As a student at a very pro-academia institution, I don’t have a lot of experience with using databases in real programs (or real programs at all, ha ha) and whenever I read posts like this I think “cool”, shortly followed by “how do I actually use this without it being a total shitfest?”
I’m used to writing all my queries inline. Sometimes they get long enough that I break them over a few lines and I wish my editor would highlight them properly. Sometimes I make typos in my queries and I wish my compiler would catch them. I’ve experimented with keeping separate numbered schema files, but I didn’t like it and in my head that doesn’t extend well to normal queries.
Including 20+ line queries inline with other code seems totally unmaintable, especially considering that the specific example in this article is likely to be called from more than one place, with slightly different paremeters, etc. Can anyone share techniques for using such queries (and query fragments for things that are reusable) in a maintainable manner?
As a student at a very pro-academia institution, I don’t have a lot of experience with using databases in real programs (or real programs at all, ha ha) and whenever I read posts like this I think “cool”, shortly followed by “how do I actually use this without it being a total shitfest?”
I’m used to writing all my queries inline. Sometimes they get long enough that I break them over a few lines and I wish my editor would highlight them properly. Sometimes I make typos in my queries and I wish my compiler would catch them. I’ve experimented with keeping separate numbered schema files, but I didn’t like it and in my head that doesn’t extend well to normal queries.
Including 20+ line queries inline with other code seems totally unmaintable, especially considering that the specific example in this article is likely to be called from more than one place, with slightly different paremeters, etc. Can anyone share techniques for using such queries (and query fragments for things that are reusable) in a maintainable manner?