Discussion:
[soci-users] Clarification
Medhavi Mahansaria
2014-11-27 12:14:13 UTC
Permalink
I would like to know how to configure savepoint and commit work release option using SOCI.

Request your urgent reply.

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Mateusz Loskot
2014-11-27 15:12:25 UTC
Permalink
On 27 November 2014 at 13:14, Medhavi Mahansaria
Post by Medhavi Mahansaria
I would like to know how to configure savepoint and commit work release option using SOCI.
Do you mean savepoint as SAVEPOINT syntax in SQL?
There is no built-in support for that in SOCI, but you should be able
to execute such statements

sql.once << "SAVEPOINT myname";
...
sql.once << "ROLLBACK TO SAVEPOINT myname";


It should be easy to create a RAII wrapper for this,
similar to soci::transaction
http://soci.sourceforge.net/doc/3.1/statements.html#transactions

I'd be interested to know if SAVEPOINT statements worked for you,
so please let me know.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Medhavi Mahansaria
2014-11-27 18:36:00 UTC
Permalink
Yes.. I was talking about the SAVEPOINT syntax in SQL / oracle.
Thank you. Will surely let you know..

Also, can you tell me how to configure
EXEC SQL COMMIT WORK RELEASE; used in embedded sql in SOCI.

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Mateusz Loskot
On 27 November 2014 at 13:14, Medhavi Mahansaria
Post by Medhavi Mahansaria
I would like to know how to configure savepoint and commit work release option using SOCI.
Do you mean savepoint as SAVEPOINT syntax in SQL?
There is no built-in support for that in SOCI, but you should be able
to execute such statements
sql.once << "SAVEPOINT myname";
...
sql.once << "ROLLBACK TO SAVEPOINT myname";
It should be easy to create a RAII wrapper for this,
similar to soci::transaction
http://soci.sourceforge.net/doc/3.1/statements.html#transactions
I'd be interested to know if SAVEPOINT statements worked for you,
so please let me know.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Mateusz Loskot
2014-11-27 19:19:46 UTC
Permalink
On 27 November 2014 at 19:36, Medhavi Mahansaria
Post by Medhavi Mahansaria
Also, can you tell me how to configure
EXEC SQL COMMIT WORK RELEASE; used in embedded sql in SOCI.
You may try to execute it as a Simple SQL Statement, see
http://soci.sourceforge.net/doc/3.2/queries.html

I've never used embedded SQL with SOCI myself.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Medhavi Mahansaria
2014-11-28 02:29:54 UTC
Permalink
Ok.. Simple SQL statement does not work for it. :(
Any way in which we can release all the resources and locks using SOCI?

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Mateusz Loskot
On 27 November 2014 at 19:36, Medhavi Mahansaria
Post by Medhavi Mahansaria
Also, can you tell me how to configure
EXEC SQL COMMIT WORK RELEASE; used in embedded sql in SOCI.
You may try to execute it as a Simple SQL Statement, see
http://soci.sourceforge.net/doc/3.2/queries.html
I've never used embedded SQL with SOCI myself.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Mateusz Loskot
2014-11-28 08:33:27 UTC
Permalink
On 28 November 2014 at 03:29, Medhavi Mahansaria
Post by Medhavi Mahansaria
Ok.. Simple SQL statement does not work for it. :(
Yes, it does not surprise me.
SOCI forwards statements to OCIStmtExecute which apparently can't
execute embedded SQL statements.
Post by Medhavi Mahansaria
Any way in which we can release all the resources and locks using SOCI?
I think plain COMMIT should do.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Medhavi Mahansaria
2014-11-28 06:04:25 UTC
Permalink
Hi,

The SAVEPOINT concept worked for me. Thanks a tonn!!

It would be of great help if you can help me out on how to release locks on tables and resources in SOCI..

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Mateusz Loskot
On 27 November 2014 at 13:14, Medhavi Mahansaria
Post by Medhavi Mahansaria
I would like to know how to configure savepoint and commit work release option using SOCI.
Do you mean savepoint as SAVEPOINT syntax in SQL?
There is no built-in support for that in SOCI, but you should be able
to execute such statements
sql.once << "SAVEPOINT myname";
...
sql.once << "ROLLBACK TO SAVEPOINT myname";
It should be easy to create a RAII wrapper for this,
similar to soci::transaction
http://soci.sourceforge.net/doc/3.1/statements.html#transactions
I'd be interested to know if SAVEPOINT statements worked for you,
so please let me know.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Mateusz Loskot
2014-11-28 08:40:11 UTC
Permalink
On 28 November 2014 at 07:04, Medhavi Mahansaria
Post by Medhavi Mahansaria
The SAVEPOINT concept worked for me. Thanks a tonn!!
Good to know.
Post by Medhavi Mahansaria
It would be of great help if you can help me out on how to release locks on tables and resources in SOCI..
You need to use SAVEPOINT counterparts, that is COMMIT or ROLLBACK.
AFAIR, in SQL (not embedded SQL) COMMIT releases all locks and erases
related savepoint.
Check Oracle docs for details.

Simply, you need to translate your embedded SQL statements to plain SQL.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Medhavi Mahansaria
2014-11-28 13:19:13 UTC
Permalink
Ohk.. Thank you.

Another 2 more clarifications

1) can i call a specific function which is specific to a database from any SOCI function.
Can you also shed a little more details on the getbackend() function apart from the explanation in the documentation of SOCI. Probably a program for the same would be helpful.

2) can i throw user defined exceptions in the try block so that one of the catch blocks can handle it.
For example if a query does not return any rows. I need to throw an exception and perform further action on it. Will this be possible?

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Mateusz Loskot
On 28 November 2014 at 07:04, Medhavi Mahansaria
Post by Medhavi Mahansaria
The SAVEPOINT concept worked for me. Thanks a tonn!!
Good to know.
Post by Medhavi Mahansaria
It would be of great help if you can help me out on how to release locks on tables and resources in SOCI..
You need to use SAVEPOINT counterparts, that is COMMIT or ROLLBACK.
AFAIR, in SQL (not embedded SQL) COMMIT releases all locks and erases
related savepoint.
Check Oracle docs for details.
Simply, you need to translate your embedded SQL statements to plain SQL.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Mateusz Loskot
2014-11-28 13:31:55 UTC
Permalink
On 28 November 2014 at 14:19, Medhavi Mahansaria
Post by Medhavi Mahansaria
1) can i call a specific function which is specific to a database from any SOCI function.
You need to be more specific on what kind of function you mean:
You should be able to call any backend-specific SQL function as part
of SQL statement.
SOCI is just a wrapper on top of a client C/C++ library accessing
particular backend,
so obviously you can't tell SOCI to call any extra C/C++ functions.
Post by Medhavi Mahansaria
Can you also shed a little more details on the getbackend() function apart from the explanation in the documentation of SOCI. Probably a program for the same would be helpful.
There is not much to say more than in here, really
http://soci.sourceforge.net/doc/3.2/reference.html
http://soci.sourceforge.net/doc/3.2/backends/oracle.html
and here, see "Beyond SOCI API"
http://soci.sourceforge.net/doc/3.2/beyond.html
Post by Medhavi Mahansaria
2) can i throw user defined exceptions in the try block so that one of the catch blocks can handle it.
For example if a query does not return any rows. I need to throw an exception and perform further action on it. Will this be possible?
{session|statement}::got_data() might help

if (!sql.got_data()) throw ...

or I don't understand the problem.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Medhavi Mahansaria
2014-12-01 12:36:42 UTC
Permalink
Thank you. Your approach helped me in coming up with an approach.

Is the use of statement costlier that just a session object? Does using statement over a session object have an impact on performance?

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Mateusz Loskot
On 28 November 2014 at 14:19, Medhavi Mahansaria
Post by Medhavi Mahansaria
1) can i call a specific function which is specific to a database from any SOCI function.
You should be able to call any backend-specific SQL function as part
of SQL statement.
SOCI is just a wrapper on top of a client C/C++ library accessing
particular backend,
so obviously you can't tell SOCI to call any extra C/C++ functions.
Post by Medhavi Mahansaria
Can you also shed a little more details on the getbackend() function apart from the explanation in the documentation of SOCI. Probably a program for the same would be helpful.
There is not much to say more than in here, really
http://soci.sourceforge.net/doc/3.2/reference.html
http://soci.sourceforge.net/doc/3.2/backends/oracle.html
and here, see "Beyond SOCI API"
http://soci.sourceforge.net/doc/3.2/beyond.html
Post by Medhavi Mahansaria
2) can i throw user defined exceptions in the try block so that one of the catch blocks can handle it.
For example if a query does not return any rows. I need to throw an exception and perform further action on it. Will this be possible?
{session|statement}::got_data() might help
if (!sql.got_data()) throw ...
or I don't understand the problem.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Mateusz Loskot
2014-12-01 13:17:41 UTC
Permalink
Post by Medhavi Mahansaria
Thank you. Your approach helped me in coming up with an approach.
Good to know.
Post by Medhavi Mahansaria
Is the use of statement costlier that just a session object? Does using statement over a session object have an impact on performance?
I'd expect no difference.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Medhavi Mahansaria
2014-12-11 10:01:16 UTC
Permalink
Hi,

Is CLOB supported in SOCI?

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Mateusz Loskot
Post by Medhavi Mahansaria
Thank you. Your approach helped me in coming up with an approach.
Good to know.
Post by Medhavi Mahansaria
Is the use of statement costlier that just a session object? Does using statement over a session object have an impact on performance?
I'd expect no difference.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Andrew Grafham
2014-12-11 11:00:26 UTC
Permalink
On 11 December 2014 at 11:01, Medhavi Mahansaria
Post by Medhavi Mahansaria
Hi,
Is CLOB supported in SOCI?
AFAIK, not yet. See also
http://sourceforge.net/p/soci/mailman/message/32119240/
On a similar note, it's also worth mentioning that decimals are not
fully supported either - they are mapped to "double" in c++ (with the loss
of precision that implies). Although that may not be important to you
depending on what kind of system you're developing. Those are the only 2
limitations I've come across though - other than that, soci is really great
to work with.

Cheers

Andy
Medhavi Mahansaria
2014-12-15 05:14:44 UTC
Permalink
Oh ok!! Thank you.. Will keep that in mind :)

How can retrieve data for a blob?

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
On 11 December 2014 at 11:01, Medhavi Mahansaria
Post by Medhavi Mahansaria
Hi,
Is CLOB supported in SOCI?
AFAIK, not yet. See also
http://sourceforge.net/p/soci/mailman/message/32119240/
On a similar note, it's also worth mentioning that decimals are not fully supported either - they are mapped to "double" in c++ (with the loss of precision that implies). Although that may not be important to you depending on what kind of system you're developing. Those are the only 2 limitations I've come across though - other than that, soci is really great to work with.
Cheers
Andy
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Medhavi Mahansaria
2014-12-15 05:25:21 UTC
Permalink
What I am asking actually is how do I display the contents of a BLOB? I am able to print its length but not its contents.

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Medhavi Mahansaria
Oh ok!! Thank you.. Will keep that in mind :)
How can retrieve data for a blob?
Sent from my iPhone.
Brevity may be excused.
Thank You.
Regards,
Medhavi Mahansaria.
On 11 December 2014 at 11:01, Medhavi Mahansaria
Post by Medhavi Mahansaria
Hi,
Is CLOB supported in SOCI?
AFAIK, not yet. See also
http://sourceforge.net/p/soci/mailman/message/32119240/
On a similar note, it's also worth mentioning that decimals are not fully supported either - they are mapped to "double" in c++ (with the loss of precision that implies). Although that may not be important to you depending on what kind of system you're developing. Those are the only 2 limitations I've come across though - other than that, soci is really great to work with.
Cheers
Andy
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Lalit Bhasin
2014-12-15 06:33:24 UTC
Permalink
On Monday, December 15, 2014 2:27 PM, Medhavi Mahansaria <***@yahoo.co.in> wrote:


What I am asking actually is how do I display the contents of a BLOB? I am able to print its length but not its contents.



As documented (http://soci.sourceforge.net/doc/3.2/exchange.html#blob), soci provides blob interface on top of soci session object to preform read and write operations on blob data type. So to read the blob type, you use:


- std::size_t read(std::size_t offset, char *buf, std::size_t toRead);

Ensure to allocate memory to buf before reading. Also, although not tested, it should be possible to read the blob type directly into C++ std::string.




 
Medhavi Mahansaria
2014-12-19 12:44:50 UTC
Permalink
Hi.. Is there any alternate for "rownum" in soci? Something that is generic for all databases..??

Sent from my iPhone.
Brevity may be excused.
Thank You.

Regards,
Medhavi Mahansaria.
Post by Medhavi Mahansaria
What I am asking actually is how do I display the contents of a BLOB? I am able to print its length but not its contents.
Sent from my iPhone.
Brevity may be excused.
Thank You.
Regards,
Medhavi Mahansaria.
Post by Medhavi Mahansaria
Oh ok!! Thank you.. Will keep that in mind :)
How can retrieve data for a blob?
Sent from my iPhone.
Brevity may be excused.
Thank You.
Regards,
Medhavi Mahansaria.
On 11 December 2014 at 11:01, Medhavi Mahansaria
Post by Medhavi Mahansaria
Hi,
Is CLOB supported in SOCI?
AFAIK, not yet. See also
http://sourceforge.net/p/soci/mailman/message/32119240/
On a similar note, it's also worth mentioning that decimals are not fully supported either - they are mapped to "double" in c++ (with the loss of precision that implies). Although that may not be important to you depending on what kind of system you're developing. Those are the only 2 limitations I've come across though - other than that, soci is really great to work with.
Cheers
Andy
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Loading...