Re: [Sqlrelay-discussion] oddity with cursors in sqlrelay-0.39
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2009-02-26 17:01:27
|
Hi Guillaume,
Sorry for taking so long to respond. Hopefully you figured out the
problem already :)
I'm not sure what's going on. When I run that C++ program it works fine
for me with 0.40. It could be that there was a bug in 0.39. You might
try a more recent release. Also, what database are you using?
David Muse
dav...@fi...
On Tue, 2009-02-03 at 18:42 +0100, Guillaume Gimenez wrote:
> Hi folks,
>
> I'm working on a project that puts an abstraction layer around sqlrelay.
> And I found something like an inconsistency in the manner the cursors
> are constructed and destructed. All cursors are consumed with the error
> message
> "No server-side cursors were available to process the query."
>
>
> I'm using sqlrelay-0.39 provided by debian
>
> the interesting part of /etc/sqlrelay/sqlrelay.conf
> <instance id="cpta" port="9000" socket="/tmp/.sqlrelay.cpta"
> dbase="postgresql" connections="5" maxconnections="5" maxqueuelength="0"
> growby="1" ttl="60" endofsession="rollback" sessiontimeout="600"
> runasuser="sqlrelay" runasgroup="sqlrelay" cursors="40"
> authtier="listener" handoff="pass">
>
> the snippet of code that exhausts cursors
> ----------8<--------------------8<--------------------8<----------
> #include <iostream>
> #include <sqlrelay/sqlrclient.h>
>
> using namespace std;
>
> int main(int argc, char **argv) {
>
> sqlrconnection *con=new
> sqlrconnection("localhost",9000,"/tmp/.sqlrelay.cpta","zorro","11digitsprimenumber",1,1);
>
>
> for ( int i=0 ; i<100 ; ++i ) {
> sqlrcursor *cursor1=new sqlrcursor(con);
> sqlrcursor *cursor2=new sqlrcursor(con);
> if ( cursor1->sendQuery("SELECT 1 AS r1") == 0 ) {
> cout << cursor1->errorMessage() << endl;
> return 1;
> }
> if ( cursor2->sendQuery("SELECT 2 AS r2") == 0 ) {
> cout << cursor2->errorMessage() << endl;
> return 1;
> }
> delete cursor2;
> delete cursor1;
> }
>
> return 0;
> }
> ----------8<--------------------8<--------------------8<----------
>
> I know that in this example sqlrcursor's pointers should be declared and
> initialized outer the for loop. but it is approximatively what the
> abstraction layer does with the following code :
>
> Connection
> conn("sqlrelay://zoro:11digitsprimenumber@localhost:9000/tmp/.sqlrelay.cpta");
> for (...) {
> Begin transaction(conn);
> conn.query(...);
> }
>
> Could you tell me if I'm wrong ?
> And if I'm wrong, why this strange issue occurs ?
>
> Thanks in advance
>
>
> Best regards - Guillaume Gimenez
>
>
> PS: For information this pseudo code
> class Begin {
> Connection& conn;
> public:
> Begin(Connection& conn) {
> conn.setAutoCommitOff();
> }
> ~Begin() {
> conn.rollback();
> conn.setAutoCommitOn();
> }
> commit();
> rollback();
> ...
> };
> class Connection {
> sqlrconnection *sqlrconn;
> public:
> ...
> ResultSet query(const std::string& str);
> ...
> }
> class ResultSet {
> sqlrcursor *sqlrcur;
> public:
> ...
> next();
> std::string operator[](const std::string& str);
> ...
> }
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
> __________________________________________________
> D O T E A S Y - "Join the web hosting revolution!"
> http://www.doteasy.com
__________________________________________________
D O T E A S Y - "Join the web hosting revolution!"
http://www.doteasy.com
|