Give it a try on SQLBuilder tool
SQLBuilder is a flexible and powerful SQL query string builder for InterSystems IRIS,
With SQLBuilder you have nice and clean object oriented methods, instead of having to use concatenation and substituition to generate dynamic queries.
A Dynamic SQL without SQLBuilder
A Dynamic SQL with SQLBuilder
If you like it, don't forget to vote in the IRIS Programming Contest
Hello @Henry Pereira !
I think you created a fantastic tool with a great potential and roadmap.
I think your product is very wished by developers. Thank you to bring and share modern approaches to work with SQL.
Thank you very much @Maks Atygaev
Hi @Henry.Pereira
Excellent tool, thanks for sharing with the community
👍
My preferred approach is using a Query class element.
Here's how it can look like:
Short and concise.
Hi @Eduard Lebedyuk
Yes, you are totally right. Using query class element will be concise and faster.
The point to use dynamic query are when the user choose the parameters to you do the query.
Using my simple example, when the method receive a name param or a age param to build the where clause. I really don't know how to solve it using query class.
In my $0.02 maybe will create an ByName and a ByAge methods, and another to combine both.
Like I said, it's a simple example that can solved by an OR, but in a complex report with the user need to choose by parameters use dynamic query could be an alternative
cool, thank @Vitaliy.Serdtsev for the enlightenment
But will it use a name or age index? Age index bad example but hey. Sqlquery is a class so you can extend/replace it. We came up with a syntax where the sql would generate based on the parameters. So you could do
SELECT TOP 5 ID, Name, Age, SSN FROM Sample.Person WHERE 1=1 --If Name'="" And Name %STARTSWITH :Name --endif --if Age'="" AND Age >= :Age --endif
Method chains look nice. Very interesting project, Henry. Well done!
Thank you very much @Evgeny Shvarov
Hello @Henry Pereira
How can I learn more about this?
You can take a look on Henry's demonstration here: https://www.youtube.com/watch?v=d83vF7B7Tm4&t=215s&ab_channel=InterSyste...
Hi, yes you can see a demonstration on video that @Henrique.Dias
shared ( BTW thanks a lot). Or you can read the documentation here , with a lot of examples.
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue