From: Carlos G.A. <car...@ho...> - 2002-05-30 08:42:30
|
Hello: More things: 1.- The function DLLRegisterServer ( setup.cpp ) don´t register the IscDbc.dll ( almost to me, i test it in 2 computers and all give the same problem ) 2.- The method OdbcConnection::sqlSetConnectAttr ( OdbcConnection.cpp ) don´t have code for the SQL_ATTR_TXN_ISOLATION attribute: .... case SQL_ATTR_TXN_ISOLATION: if( connection ) connection->setTransactionIsolation( (int) value ); .... I check the connection because this atrribute can be set before connect, this make that the OdbcConnection::connect( OdbcConnection.cpp ) needs to set this attribute after connect ( the SQL_ATTR_AUTOCOMMIT also can be set before connect ) : ...... connection->setAutoCommit( autoCommit ); connection->setTransactionIsolation( SQL_TXN_READ_COMMITTED ); } catch (SQLException& exception) ..... With the set of the SQL_ATTR_TXN_ISOLATION i made a new implementation of the IscConnection::startTransaction ( IscConnection.cpp ) method ( the implementation is based on the XTG driver implementation and the Interbase documentation ), i think this can be interesting: void* IscConnection::startTransaction() { if (transactionHandle) return transactionHandle; ISC_STATUS statusVector [20]; static char iscTpb[5]; /* Número de version de la transaccion */ iscTpb[0] = isc_tpb_version3; /* Modo de acceso */ iscTpb[1] = isc_tpb_write; /* Resolución de conflictos en los bloqueos */ iscTpb[2] = isc_tpb_wait; /* Isolation level */ switch( transactionIsolation ) { case 0x00000008L: // SQL_TXN_SERIALIZABLE: iscTpb[3] = isc_tpb_consistency; break; case 0x00000004L: // SQL_TXN_REPEATABLE_READ: iscTpb[3] = isc_tpb_concurrency; break; case 0x00000001L: // SQL_TXN_READ_UNCOMMITTED: iscTpb[3] = isc_tpb_read_committed; iscTpb[4] = isc_tpb_rec_version; break; case 0x00000002L: default: // SQL_TXN_READ_COMMITTED: iscTpb[3] = isc_tpb_read_committed; iscTpb[4] = isc_tpb_no_rec_version; break; } isc_start_transaction( statusVector, &transactionHandle, 1, &attachment->databaseHandle, sizeof( iscTpb ), &iscTpb); if (statusVector [1]) throw SQLEXCEPTION (statusVector [1], getIscStatusText (statusVector)); return transactionHandle; } 3.- The driver don´t have implementation for : OdbcStatement::sqlParamData OdbcStatement::sqlPutData I´m working on it for make work the data at exec parameters when i fisnish it ( if i have time......... :)) ) i will post it in the list. 4.- I want to know if this fix posted by Bernhard Schulte is correct because the expandPattern is used in other files in the same way ( and i want to know if i have to change the other files too... :)) ) : The fix: c) some minor bug: IscTablesResultSet IscTablesResultSet::getTables(...) // change line 68 to this: ( replace the first %s with = ) sql += expandPattern (" where rdb$relation_name = '%s'\n", tableNamePattern); For example: a) IscIndexInfoResultSet::getIndexInfo ( IscIndexInfoResultSet.cpp ) if (tableNamePattern) sql += expandPattern (" and idx.rdb$relation_name %s '%s'\n", tableNamePattern); b) IscPrimaryKeysResultSet::getPrimaryKeys ( IscPrimaryKeysResultSet.cpp ) if (tableNamePattern) sql += expandPattern(" and rel.rdb$relation_name %s '%s'", tableNamePattern); c) IscProcedureColumnsResultSet::getProcedureColumns ( IscProcedureColumnsResultSet.cpp ) if (procedureNamePattern) sql += expandPattern (" and pp.rdb$procedure_name %s '%s'", procedureNamePattern); if (columnNamePattern) sql += expandPattern (" and pp.rdb$parameter_name %s '%s'", columnNamePattern); d) IscProceduresResultSet::getProcedures ( IscProceduresResultSet.cpp ) if (procedureNamePattern) sql += expandPattern (" where rdb$procedure_name %s '%s'", procedureNamePattern); e) IscSpecialColumnsResultSet::specialColumns ( IscSpecialColumnsResultSet.cpp ) sql += expandPattern ("\tand rfr.rdb$relation_name %s '%s'\n", table); f) IscCrossReferenceResultSet::getCrossReference ( IscCrossReferenceResultSet.cpp ) if (primaryTable) sql += expandPattern (" and pidx.rdb$relation_name %s '%s'", primaryTable); 5.- The supportedFunctions array ( OdbcConnection.cpp ) don´t have the SQL_API_SQLSETCONNECTOPTION in the list. 6.- The CHAR and VARCHAR datatype and my fix: Bernhard Schulte is right ( Thanks very much ) my fix don´t work properly when you have fields with both datatypes in the tables or when you have only CHAR fields, i´m testing it and the second part of the fix is incorrect the line ( in the fix ): data [var->sqllen] = 0; would be like the original code of the driver: data [var->sqllen-1] = 0; The first part of the fix seems to be correct ( but if any can test it i´m very pleased ). I test it with CHARS only in the table ( and other datatypes like int, date, ... ), with VARCHARS only ( witha a database with 108 tables in wich string fields are all VARCHAR ), and with CHARS and VARCHARS and it seems to work good. If this don´t work too please tell me ... i will send the code to the thrash......... :)) Best Regards Carlos Guzmán Álvarez PD: Sorry about my bad english but i´m spanish. _________________________________________________________________ Únase con MSN Hotmail al servicio de correo electrónico más grande del mundo. http://www.hotmail.com |