--- sql/oracle/parser3oracle.C 2004/03/30 08:18:24 1.55 +++ sql/oracle/parser3oracle.C 2004/06/18 11:29:55 1.59 @@ -7,7 +7,7 @@ 2001.07.30 using Oracle 8.1.6 [@test tested with Oracle 7.x.x] */ -static const char *RCSId="$Id: parser3oracle.C,v 1.55 2004/03/30 08:18:24 paf Exp $"; +static const char *RCSId="$Id: parser3oracle.C,v 1.59 2004/06/18 11:29:55 paf Exp $"; #include "config_includes.h" @@ -83,7 +83,6 @@ static int pa_setenv(const char *name, c strcat(buf, value); value=buf; } - return setenv(name, value, 1/*overwrite*/); } else { unsetenv(name); @@ -139,16 +138,13 @@ struct OracleSQL_query_lobs { } *row; int count; }; - struct cbf_context_struct { - Connection *connection; - return_rows *rows; - }; struct Item { const char *name_ptr; size_t name_size; char *data_ptr; size_t data_size; OCILobLocator *locator; OCIBind *bind; return_rows rows; + Connection *connection; } items[MAX_IN_LOBS]; int count; }; @@ -249,7 +245,7 @@ public: } /** connect - @param used_only_in_connect_url + @param url format: @b user:pass@service? ORACLE_HOME=/u01/app/oracle/product/8.1.5& ORA_NLS33=/u01/app/oracle/product/8.1.5/ocommon/nls/admin/data& @@ -257,18 +253,21 @@ public: ORA_ENCRYPT_LOGIN=TRUE @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( - char *used_only_in_connect_url, + char *url, SQL_Driver_services& services, void **connection_ref ///< output: Connection * - ) { + ) + { + // connections are cross-request, do not use services._alloc [linked with request] Connection& connection=*(Connection *)services.malloc(sizeof(Connection)); connection.services=&services; connection.options.bLowerCaseColumnNames = true; *connection_ref=&connection; - char *user=used_only_in_connect_url; + char *user=url; char *service=lsplit(user, '@'); char *pwd=lsplit(user, ':'); char *options=lsplit(service, '?'); @@ -345,13 +344,15 @@ public: void disconnect(void *aconnection) { Connection& connection=*static_cast(aconnection); - // free fetch buffers + // free fetch buffers. leave that to GC [no such services func. yet?] + /* for(int i=0; ifree(fetch_buffer); else break; - } + } + */ // Terminate a user session OCISessionEnd( @@ -372,8 +373,8 @@ public: OCIHandleFree( (dvoid *)connection.envhp, (ub4)OCI_HTYPE_ENV); - // connections are cross-request, do not use services._alloc [linked with request] - ::free(&connection); + // free connection. leave that to GC [no such services func. yet?] + // connection.services->free(&connection); } void commit(void *aconnection) { Connection& connection=*static_cast(aconnection); @@ -450,22 +451,26 @@ public: (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT)); { for(int i=0; i(ctxp); if(index==0) { static ub4 rows; @@ -1097,12 +1106,12 @@ static sb4 cbf_get_data(dvoid *ctxp, OracleSQL_driver->OCIAttrGet( (CONST dvoid *) bindp, OCI_HTYPE_BIND, (dvoid *)&rows, (ub4 *)sizeof(ub2), OCI_ATTR_ROWS_RETURNED, context.connection->errhp)) ; - context.rows->count=(ub2)rows; - context.rows->row=(OracleSQL_query_lobs::return_rows::return_row *) + context.rows.count=(ub2)rows; + context.rows.row=(OracleSQL_query_lobs::return_rows::return_row *) context.connection->services->malloc_atomic(sizeof(OracleSQL_query_lobs::return_rows::return_row)*rows); } - OracleSQL_query_lobs::return_rows::return_row &var=context.rows->row[index]; + OracleSQL_query_lobs::return_rows::return_row &var=context.rows.row[index]; check(*context.connection, "alloc output var desc dynamic", OracleSQL_driver->OCIDescriptorAlloc( (dvoid *) context.connection->envhp, (dvoid **)&var.locator,