qx::dao::count

Open discussion on QxOrm library

Re: qx::dao::count

Postby andigor » Fri May 04, 2012 4:31 pm

Thank you again. But I still want to clarify something. Why do you advice to write SQL code directly? As for me ORM implies working with databases in transparent and portable mode. Mixing SQL with C++ theoretically eliminates this advantage. From another side direct generating SQL queries look a little bit ugly. So it must separated from C++ code. But why anybody, who uses ORM need to to this? He can to this without any ORMs at all. From another side style of qx_query looks similar to LINQ from C#. Google says that LINQ for C++ is already in developing (boolinq or linq++). But it is for STL containers. For SQL seems we have nothing at all. What do you think about it?
andigor
 
Posts: 14
Joined: Wed May 02, 2012 11:53 am

Re: qx::dao::count

Postby QxOrm admin » Sat May 05, 2012 4:19 pm

Please, next time, create a new topic for each new subject or question : you start speaking about qx::dao::count function, then about stored procedure, and now about qx_query class.
It will be more easier for users of this forum to find an information if you create a new topic for each new subject...

Why do you advice to write SQL code directly?

I don't recommend one option or another option : with qx_query class, you just have the choice, you can write your SQL query directly, or you can build it using C++ style.
As you said, the C++ style provides some advantages : auto parameters binding, and portable database (this is the case for example with the limit() method which is different for each databases).
But sometimes, for easy and short query, I prefer to write directly the SQL.
It depends on your project and how do you prefer to write your queries.
The only limitation is : with the same instance of qx_query class, when you start to write your query with a style (C++ style or SQL query), you can't mix them (you will have an assert in debug mode in this case).

Google says that LINQ for C++ is already in developing (boolinq or linq++). But it is for STL containers.
For SQL seems we have nothing at all.

Wrong, you have qx_query class ;)
And thank you, I didn't know linq++ project !

PS: please, let me know when you will have tested it, if the last BETA (QxOrm 1.2.4 BETA 16) is working fine for you with the new function qx::dao::execute_query.
QxOrm admin
 

Re: qx::dao::count

Postby andigor » Mon May 07, 2012 9:59 am

Ok. Now I only compiled it and run. I'll tell you when I start to use stored routines.

About qx_query I asked you only because I thought you will extend its syntax for calling stored routines.
andigor
 
Posts: 14
Joined: Wed May 02, 2012 11:53 am

Previous

Return to QxOrm - Open discussion

Who is online

Users browsing this forum: No registered users and 9 guests