[odb-users] Querying with native SQL Statements

Raj, Phani PRAJ at beckman.com
Thu Mar 25 22:22:33 EDT 2021

Hi Sir,
Thanks for your response on this.
I do have some queries on this.
>From the Documentation my team was able to analyze the following things:
*       Execute method is used to perform only INSERT, DELETE and UPDATE operations as it only returns the number of rows affected.
*       Views will work on queries that are created at design time.
But sir, I want to ask you one question, the query method has an overloaded version that takes a string as argument. But the documentation doesn't mention about it.
My App needs to generate the SQL Statement dynamically as we are using a lot of polymorphic objects in a large hierarchy. So we want to use the query by simply building the query and execute them to return the results  Can I call the query method that takes string as argument to get the required results? The Template version might not help us as per the requirement.
Awaiting your valuable inputs.

In my app, the query is auto generated. So

-----Original Message-----
From: Boris Kolpackov <boris at codesynthesis.com>
Sent: Thursday, March 25, 2021 6:09 PM
To: Raj, Phani <PRAJ at beckman.com>
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Querying with native SQL Statements

Raj, Phani <PRAJ at beckman.com<mailto:PRAJ at beckman.com>> writes:

> Is there a possibility of querying data from the SQL Server using
> ODB::ORM with native SQL statements. My App generates SQL Statements
> that has to be executed thru' the db->query method. Is it possible to
> do so.

Yes, see "Executing Native SQL Statements":


As well as "Native Views":


Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment.

More information about the odb-users mailing list