The OFFICIAL programming thread
-
-
Time for my favorite frownie: m(
-
Interesting article, I didn’t know that
“The SQL spec (part 2 = 1732) pages is more than twice the length of the Javascript 2021 spec (879 pages), almost matches the C++ 2020 spec (1853) pages and contains 411 occurrences of ‘implementation-defined’, occurrences which include type inference and error propagation.”
Sweet jesus, double the length of the JS specs…
One SQL problem that I couldn’t solve so far is finding a good way to use the output of a single column query (multiple rows, result count must be flexible) as headers and/or fields for a subsequent query.
-
@rote7 said in The OFFICIAL programming thread:
Interesting article, I didn’t know that
“The SQL spec (part 2 = 1732) pages is more than twice the length of the Javascript 2021 spec (879 pages), almost matches the C++ 2020 spec (1853) pages and contains 411 occurrences of ‘implementation-defined’, occurrences which include type inference and error propagation.”
Sweet jesus, double the length of the JS specs…
One SQL problem that I couldn’t solve so far is finding a good way to use the output of a single column query (multiple rows, result count must be flexible) as headers and/or fields for a subsequent query.
Dynamic DB-driven filter query? Sounds like a specific SQL client function to me.
-
@Kilemall Yes, that was my first idea too. My goal is to replace a whole lot of client logic with a set of queries/subqueries and/or joins. I am looking for a pivot mechanism to transform a set of column(s) into rows.
E.g. turn
col_1 | col_2
param_1 | value_1
param_2 | value_2
param_foo | value_fointo a dynamic DB operation that delivers a result like the client generated query “SELECT * FROM table WHERE param_1 = value_1 AND param_2 = value_2 AND param_foo = value_foo” without all the string concatenation, input scrubbing etc. pp. going on in the client.
-
@rote7 said in The OFFICIAL programming thread:
Interesting article, I didn’t know that
“The SQL spec (part 2 = 1732) pages is more than twice the length of the Javascript 2021 spec (879 pages), almost matches the C++ 2020 spec (1853) pages and contains 411 occurrences of ‘implementation-defined’, occurrences which include type inference and error propagation.”
Sweet jesus, double the length of the JS specs…
One SQL problem that I couldn’t solve so far is finding a good way to use the output of a single column query (multiple rows, result count must be flexible) as headers and/or fields for a subsequent query.
I think you need to do it as a stored procedure if I remember right and using the PIVOT function. Basically instead of defining the static columns as in the base function, you dynamically insert them in the stored procedure. If you are doing this as part of another code project, you could do the same by just assembling the text of the SQL script to sent dynamically (e.g. “SELECT “& [column name varIable]&” FROM TABLE_NAME;”
-
This thread:

-
Stored procedures are one possible solution. But, and this is a big but, they are DB dependent and I am looking for a way to achieve this with as little as possible DB specific SQL dialect.
As for the client generated SQL, that’s the current solution as a part of a homegrown ORM. I am just curious if it can be done purely in the DB as a way to replace a bunch of DB specific logic during the SQL generation in that ORM.

/* insert snappy comment here */
-
I’d snap one off in her
-
@rote7 said in The OFFICIAL programming thread:
Stored procedures are one possible solution. But, and this is a big but, they are DB dependent and I am looking for a way to achieve this with as little as possible DB specific SQL dialect.
As for the client generated SQL, that’s the current solution as a part of a homegrown ORM. I am just curious if it can be done purely in the DB as a way to replace a bunch of DB specific logic during the SQL generation in that ORM.

/* insert snappy comment here */
@rote7
Yeah, I couldn’t find a way other than a stored procedure in Oracle. The function requires you to define the columns in the SQL so it’s static. Nothing in many searches I did changed that, though the procedure thing was suggested. Seems like a stupid design since pivoting often requires dynamic results. -
@gators1 She bumped her chin on something.
-
@gustaf said in The OFFICIAL programming thread:
This thread:

This is what I was waiting for, the caterwauls of the computer illiterati! SUCCESS ROTE SUCCESS!
-
@rote7 said in The OFFICIAL programming thread:
Stored procedures are one possible solution. But, and this is a big but, they are DB dependent and I am looking for a way to achieve this with as little as possible DB specific SQL dialect.
As for the client generated SQL, that’s the current solution as a part of a homegrown ORM. I am just curious if it can be done purely in the DB as a way to replace a bunch of DB specific logic during the SQL generation in that ORM.
Suspected as much.
Do Dark Magic, pay with your soul. You know the rules.
-
SELL! SELL! SELL!
-
-
Mildly interesting article but the title is possibly the worst click bait I’ve ever seen.
-
@hog said in The OFFICIAL programming thread:
Mildly interesting article but the title is possibly the worst click bait I’ve ever seen.
Here’s a worser one…

-
@gators1 probably let out a six minute long fart
-
@rote7 said in The OFFICIAL programming thread:
Stored procedures are one possible solution. But, and this is a big but, they are DB dependent and I am looking for a way to achieve this with as little as possible DB specific SQL dialect.
As for the client generated SQL, that’s the current solution as a part of a homegrown ORM. I am just curious if it can be done purely in the DB as a way to replace a bunch of DB specific logic during the SQL generation in that ORM.

/* insert snappy comment here */
This is the kind of amazing posting that has won this website so many awards!
-
Programming with pictures
Back in the late 90’s I demonstrated a graphical workflow tool I was using to a colleague and he dubbed it “programming with pictures”. Later, similar tools started appearing in most 3D applications like Blender and Godot. Except there they call them “node editors”.
Anyway, just now I wanted to temporarily backdrop something I’m working on in Blender with a tiled floor and I thought, oh that would be a good case for using shader nodes. So I started building it and got this far before I had a problem:

The problem was that I needed a logical XOR operation on the output of the Column and Row. ie, if either the column or the row is odd (edit: but only one of them), then use the alternate color. But, surprisingly to me, I found out that Blender doesn’t have a node for boolean logic. I could have written some python code to do it but that seemed like cheating so I thought about for a bit before I realized I could add the row and column remainder and then do another modulo operation on it:

Fucking Bingo! My math skills are so rudimentary that I felt like Plato after I reasoned out that solution.



