![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
hi this is from docs: --- To share a single connection 1. Ensure that your application is sharing a single SQLCA, as described in the previous procedure. 2. Manage the connection using the UltraLite C++ Component. Use the DatabaseManager::OpenConnection and Connection::Release methods to open and close connections. Do not use the static interface connection mechanisms. Once OpenConnection returns, the connection is current for the SQLCA and is used for any subsequent embedded SQL or static C++ API statements. --- i did this but i have problem - all generated classes in uldatabase.cpp require ULConnection as first parameter of Open (or Execute) methods. when i create connection using ultralite c++ component what should i send there? NULL doesn't work... so question is, how can i get ULConnection pointer when i manage connections with DatabaseManager object? thanks in advance... |
#4
| |||
| |||
|
|
If you don't need your static and dynamic UL code to be part of the same transaction then you can create a separate connection to the database for each API. This is the easiest route. UL runs at isolation level zero, so uncommitted rows on one connection _will_ be visable on the other connection. The only thing you can't do is insert/update a row on one connection (without committing it) and then try and update/delete it on another connection. If that doesn't work for you and you need to share the connection then that isn't officially supported in UL. The docs appear to be misleading here. For sharing a connection mixing dynamic C++ API with ESQL is ok, but not dynamic C++ and static C++. Unofficially you can get the functionality you need by altering %asany9%\src\ulapi.cpp and %asany9%\h\ulapi.h Add the following method to ulapi.cpp. This will allow you to initialize a ULConnection object from an existing connection. bool ULConnection::Attach( ULData *db, ul_char *name ) { if( db == UL_NULL ) return false; if( !db->IsOpen() ) return false; if( IsOpen() ) return false; _db = db; _conn = ulpp_setconnect( db->GetCA(), name ); // This line is the difference between Attach and Open _open = LastCodeOK(); return _open; } Then add the corresponding prototype in ulapi.h in the public section of the ULConnection class (about line 240 in my copy of the file) In order to make this work.... 1. Share your sqlca as described in the docs 2. Connect using dynamic C++. Name your connection eg add "CON=myconnection" to the connection parameters 3. Call the new Attach method using the connection name Note: Don't call ULConnection::Close on the shared connection, use the dynamic C++ API to close the connection. Make sure to you make copies of the new ulapi files. They could be overwritten by an EBF. Hope that helps, Mike "Michal Seliga" <michal.seliga (AT) visicom (DOT) sk> wrote in message news:43fdddd2$1 (AT) forums-2-dub (DOT) .. hi this is from docs: --- To share a single connection 1. Ensure that your application is sharing a single SQLCA, as described in the previous procedure. 2. Manage the connection using the UltraLite C++ Component. Use the DatabaseManager::OpenConnection and Connection::Release methods to open and close connections. Do not use the static interface connection mechanisms. Once OpenConnection returns, the connection is current for the SQLCA and is used for any subsequent embedded SQL or static C++ API statements. --- i did this but i have problem - all generated classes in uldatabase.cpp require ULConnection as first parameter of Open (or Execute) methods. when i create connection using ultralite c++ component what should i send there? NULL doesn't work... so question is, how can i get ULConnection pointer when i manage connections with DatabaseManager object? thanks in advance... |
![]() |
| Thread Tools | |
| Display Modes | |
| |