|
|
| version 1.57, 2004/05/19 09:32:50 | version 1.58, 2004/05/25 07:00:09 |
|---|---|
| Line 83 static int pa_setenv(const char *name, c | Line 83 static int pa_setenv(const char *name, c |
| strcat(buf, value); | strcat(buf, value); |
| value=buf; | value=buf; |
| } | } |
| return setenv(name, value, 1/*overwrite*/); | return setenv(name, value, 1/*overwrite*/); |
| } else { | } else { |
| unsetenv(name); | unsetenv(name); |
| Line 246 public: | Line 245 public: |
| } | } |
| /** connect | /** connect |
| @param used_only_in_connect_url | @param url |
| format: @b user:pass@service? | format: @b user:pass@service? |
| ORACLE_HOME=/u01/app/oracle/product/8.1.5& | ORACLE_HOME=/u01/app/oracle/product/8.1.5& |
| ORA_NLS33=/u01/app/oracle/product/8.1.5/ocommon/nls/admin/data& | ORA_NLS33=/u01/app/oracle/product/8.1.5/ocommon/nls/admin/data& |
| Line 254 public: | Line 253 public: |
| ORA_ENCRYPT_LOGIN=TRUE | ORA_ENCRYPT_LOGIN=TRUE |
| @todo environment manupulation doesnt look thread safe | @todo environment manupulation doesnt look thread safe |
| @todo allocate 'aused_only_in_connect_url' on gc heap, so it can be manipulated directly | |
| */ | */ |
| void connect( | void connect( |
| char *used_only_in_connect_url, | char *url, |
| SQL_Driver_services& services, | SQL_Driver_services& services, |
| void **connection_ref ///< output: Connection * | void **connection_ref ///< output: Connection * |
| ) | ) |
| { | { |
| // connections are cross-request, do not use services._alloc [linked with request] | // connections are cross-request, do not use services._alloc [linked with request] |
| Connection& connection=*(Connection *)::calloc(1, sizeof(Connection)); | Connection& connection=*(Connection *)services.malloc(sizeof(Connection)); |
| connection.services=&services; | connection.services=&services; |
| connection.options.bLowerCaseColumnNames = true; | connection.options.bLowerCaseColumnNames = true; |
| *connection_ref=&connection; | *connection_ref=&connection; |
| char *user=used_only_in_connect_url; | char *user=url; |
| char *service=lsplit(user, '@'); | char *service=lsplit(user, '@'); |
| char *pwd=lsplit(user, ':'); | char *pwd=lsplit(user, ':'); |
| char *options=lsplit(service, '?'); | char *options=lsplit(service, '?'); |
| Line 344 public: | Line 344 public: |
| void disconnect(void *aconnection) { | void disconnect(void *aconnection) { |
| Connection& connection=*static_cast<Connection *>(aconnection); | Connection& connection=*static_cast<Connection *>(aconnection); |
| // free fetch buffers | // free fetch buffers. leave that to GC [no such services func. yet?] |
| /* | |
| for(int i=0; i<MAX_COLS; i++) { | for(int i=0; i<MAX_COLS; i++) { |
| if(void* fetch_buffer=connection.fetch_buffers[i]) | if(void* fetch_buffer=connection.fetch_buffers[i]) |
| ::free(fetch_buffer); | connection.services->free(fetch_buffer); |
| else | else |
| break; | break; |
| } | } |
| */ | |
| // Terminate a user session | // Terminate a user session |
| OCISessionEnd( | OCISessionEnd( |
| Line 371 public: | Line 373 public: |
| OCIHandleFree( | OCIHandleFree( |
| (dvoid *)connection.envhp, (ub4)OCI_HTYPE_ENV); | (dvoid *)connection.envhp, (ub4)OCI_HTYPE_ENV); |
| // connections are cross-request, do not use services._alloc [linked with request] | // free connection. leave that to GC [no such services func. yet?] |
| ::free(&connection); | // connection.services->free(&connection); |
| } | } |
| void commit(void *aconnection) { | void commit(void *aconnection) { |
| Connection& connection=*static_cast<Connection *>(aconnection); | Connection& connection=*static_cast<Connection *>(aconnection); |
| Line 747 private: // private funcs | Line 749 private: // private funcs |
| char*& buf=connection.fetch_buffers[column_count-1]; | char*& buf=connection.fetch_buffers[column_count-1]; |
| ptr=buf; // get cached buffer | ptr=buf; // get cached buffer |
| if(!ptr) // allocate if needed, caching it | if(!ptr) // allocate if needed, caching it |
| ptr=buf=(char *)::/*see disconnect*/malloc(MAX_OUT_STRING_LENGTH+1/*terminator*/); | ptr=buf=(char *)services.malloc_atomic(MAX_OUT_STRING_LENGTH+1/*terminator*/); |
| col.str=(char*)ptr; | col.str=(char*)ptr; |
| size=MAX_OUT_STRING_LENGTH; | size=MAX_OUT_STRING_LENGTH; |
| break; | break; |