diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-12-06 17:33:43 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-12-07 11:57:25 +0900 |
| commit | 5a863a8932d14b99c5f838c4efa1618070d71b29 (patch) | |
| tree | 000bd50b5c488635f9663b16b7fbfe5380435a04 /src/sql/drivers/odbc/tqsql_odbc.cpp | |
| parent | 771af909e74927126fba90ec6e0298dc68d5bf4f (diff) | |
| download | tqt-5a863a8932d14b99c5f838c4efa1618070d71b29.tar.gz tqt-5a863a8932d14b99c5f838c4efa1618070d71b29.zip | |
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/sql/drivers/odbc/tqsql_odbc.cpp')
| -rw-r--r-- | src/sql/drivers/odbc/tqsql_odbc.cpp | 246 |
1 files changed, 123 insertions, 123 deletions
diff --git a/src/sql/drivers/odbc/tqsql_odbc.cpp b/src/sql/drivers/odbc/tqsql_odbc.cpp index 3da2dd50c..bc09fb28b 100644 --- a/src/sql/drivers/odbc/tqsql_odbc.cpp +++ b/src/sql/drivers/odbc/tqsql_odbc.cpp @@ -81,10 +81,10 @@ class TQODBCPrivate { public: TQODBCPrivate() - : hEnv(0), hDbc(0), hStmt(0), useSchema(FALSE) + : hEnv(0), hDbc(0), hStmt(0), useSchema(false) { sql_char_type = sql_varchar_type = sql_longvarchar_type = TQVariant::CString; - unicode = FALSE; + unicode = false; } SQLHANDLE hEnv; @@ -258,7 +258,7 @@ static TQVariant::Type qDecodeODBCType( SQLSMALLINT sqltype, const TQODBCPrivate return type; } -static TQString qGetStringData( SQLHANDLE hStmt, int column, int colSize, bool& isNull, bool unicode = FALSE ) +static TQString qGetStringData( SQLHANDLE hStmt, int column, int colSize, bool& isNull, bool unicode = false ) { TQString fieldVal; SQLRETURN r = SQL_ERROR; @@ -275,7 +275,7 @@ static TQString qGetStringData( SQLHANDLE hStmt, int column, int colSize, bool& } } char* buf = new char[ colSize ]; - while ( TRUE ) { + while ( true ) { r = SQLGetData( hStmt, column+1, unicode ? SQL_C_WCHAR : SQL_C_CHAR, @@ -285,7 +285,7 @@ static TQString qGetStringData( SQLHANDLE hStmt, int column, int colSize, bool& if ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) { if ( lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL ) { fieldVal = TQString::null; - isNull = TRUE; + isNull = true; break; } // if SQL_SUCCESS_WITH_INFO is returned, indicating that @@ -350,7 +350,7 @@ static TQByteArray qGetBinaryData( SQLHANDLE hStmt, int column, TQSQLLEN& length colSize = 65536; } char * buf = new char[ colSize ]; - while ( TRUE ) { + while ( true ) { r = SQLGetData( hStmt, column+1, SQL_C_BINARY, @@ -359,7 +359,7 @@ static TQByteArray qGetBinaryData( SQLHANDLE hStmt, int column, TQSQLLEN& length &lengthIndicator ); if ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) { if ( lengthIndicator == SQL_NULL_DATA ) { - isNull = TRUE; + isNull = true; break; } else { int rSize; @@ -391,7 +391,7 @@ static TQByteArray qGetBinaryData( SQLHANDLE hStmt, int column, TQSQLLEN& length static int qGetIntData( SQLHANDLE hStmt, int column, bool& isNull ) { TQSQLLEN intbuf = 0; - isNull = FALSE; + isNull = false; TQSQLLEN lengthIndicator = 0; SQLRETURN r = SQLGetData( hStmt, column+1, @@ -400,7 +400,7 @@ static int qGetIntData( SQLHANDLE hStmt, int column, bool& isNull ) (TQSQLLEN)0, &lengthIndicator ); if ( ( r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO ) || lengthIndicator == SQL_NULL_DATA ) { - isNull = TRUE; + isNull = true; return 0; } return (int)intbuf; @@ -410,7 +410,7 @@ static double qGetDoubleData( SQLHANDLE hStmt, int column, bool& isNull ) { SQLDOUBLE dblbuf; TQSQLLEN lengthIndicator = 0; - isNull = FALSE; + isNull = false; SQLRETURN r = SQLGetData( hStmt, column+1, SQL_C_DOUBLE, @@ -418,7 +418,7 @@ static double qGetDoubleData( SQLHANDLE hStmt, int column, bool& isNull ) (TQSQLLEN)0, &lengthIndicator ); if ( ( r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO ) || lengthIndicator == SQL_NULL_DATA ) { - isNull = TRUE; + isNull = true; return 0.0; } @@ -428,7 +428,7 @@ static double qGetDoubleData( SQLHANDLE hStmt, int column, bool& isNull ) static SQLBIGINT qGetBigIntData( SQLHANDLE hStmt, int column, bool& isNull ) { SQLBIGINT lngbuf = TQ_INT64_C( 0 ); - isNull = FALSE; + isNull = false; TQSQLLEN lengthIndicator = 0; SQLRETURN r = SQLGetData( hStmt, column+1, @@ -437,7 +437,7 @@ static SQLBIGINT qGetBigIntData( SQLHANDLE hStmt, int column, bool& isNull ) (TQSQLLEN)0, &lengthIndicator ); if ( ( r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO ) || lengthIndicator == SQL_NULL_DATA ) - isNull = TRUE; + isNull = true; return lngbuf; } @@ -600,11 +600,11 @@ bool TQODBCPrivate::setConnectionOptions( const TQString& connOpts ) #ifdef QT_CHECK_RANGE qSqlWarning( TQString("TQODBCDriver::open: Unable to set connection attribute '%1'").arg( opt ), this ); #endif - return FALSE; + return false; } } } - return TRUE; + return true; } void TQODBCPrivate::splitTableQualifier(const TQString & qualifier, TQString &catalog, @@ -614,7 +614,7 @@ void TQODBCPrivate::splitTableQualifier(const TQString & qualifier, TQString &ca table = qualifier; return; } - TQStringList l = TQStringList::split( ".", qualifier, TRUE ); + TQStringList l = TQStringList::split( ".", qualifier, true ); if ( l.count() > 3 ) return; // can't possibly be a valid table qualifier int i = 0, n = l.count(); @@ -667,7 +667,7 @@ TQODBCResult::~TQODBCResult() bool TQODBCResult::reset ( const TQString& query ) { - setActive( FALSE ); + setActive( false ); setAt( TQSql::BeforeFirst ); SQLRETURN r; @@ -680,7 +680,7 @@ bool TQODBCResult::reset ( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::reset: Unable to free statement handle", d ); #endif - return FALSE; + return false; } } r = SQLAllocHandle( SQL_HANDLE_STMT, @@ -690,7 +690,7 @@ bool TQODBCResult::reset ( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::reset: Unable to allocate statement handle", d ); #endif - return FALSE; + return false; } if ( isForwardOnly() ) { @@ -708,7 +708,7 @@ bool TQODBCResult::reset ( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration", d ); #endif - return FALSE; + return false; } #ifdef UNICODE @@ -723,38 +723,38 @@ bool TQODBCResult::reset ( const TQString& query ) #endif if ( r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO ) { setLastError( qMakeError( "Unable to execute statement", TQSqlError::Statement, d ) ); - return FALSE; + return false; } SQLSMALLINT count; r = SQLNumResultCols( d->hStmt, &count ); if ( count ) { - setSelect( TRUE ); + setSelect( true ); for ( int i = 0; i < count; ++i ) { d->rInf.append( qMakeFieldInfo( d, i ) ); } } else { - setSelect( FALSE ); + setSelect( false ); } - setActive( TRUE ); - return TRUE; + setActive( true ); + return true; } bool TQODBCResult::fetch(int i) { if ( isForwardOnly() && i < at() ) - return FALSE; + return false; if ( i == at() ) - return TRUE; + return true; fieldCache.clear(); nullCache.clear(); int actualIdx = i + 1; if ( actualIdx <= 0 ) { setAt( TQSql::BeforeFirst ); - return FALSE; + return false; } SQLRETURN r; if ( isForwardOnly() ) { - bool ok = TRUE; + bool ok = true; while ( ok && i > at() ) ok = fetchNext(); return ok; @@ -764,10 +764,10 @@ bool TQODBCResult::fetch(int i) actualIdx ); } if ( r != SQL_SUCCESS ){ - return FALSE; + return false; } setAt( i ); - return TRUE; + return true; } bool TQODBCResult::fetchNext() @@ -779,15 +779,15 @@ bool TQODBCResult::fetchNext() SQL_FETCH_NEXT, 0 ); if ( r != SQL_SUCCESS ) - return FALSE; + return false; setAt( at() + 1 ); - return TRUE; + return true; } bool TQODBCResult::fetchFirst() { if ( isForwardOnly() && at() != TQSql::BeforeFirst ) - return FALSE; + return false; SQLRETURN r; fieldCache.clear(); nullCache.clear(); @@ -798,15 +798,15 @@ bool TQODBCResult::fetchFirst() SQL_FETCH_FIRST, 0 ); if ( r != SQL_SUCCESS ) - return FALSE; + return false; setAt( 0 ); - return TRUE; + return true; } bool TQODBCResult::fetchPrior() { if ( isForwardOnly() ) - return FALSE; + return false; SQLRETURN r; fieldCache.clear(); nullCache.clear(); @@ -814,9 +814,9 @@ bool TQODBCResult::fetchPrior() SQL_FETCH_PRIOR, 0 ); if ( r != SQL_SUCCESS ) - return FALSE; + return false; setAt( at() - 1 ); - return TRUE; + return true; } bool TQODBCResult::fetchLast() @@ -829,20 +829,20 @@ bool TQODBCResult::fetchLast() // cannot seek to last row in forwardOnly mode, so we have to use brute force int i = at(); if ( i == TQSql::AfterLast ) - return FALSE; + return false; if ( i == TQSql::BeforeFirst ) i = 0; while ( fetchNext() ) ++i; setAt( i ); - return TRUE; + return true; } r = SQLFetchScroll( d->hStmt, SQL_FETCH_LAST, 0 ); if ( r != SQL_SUCCESS ) { - return FALSE; + return false; } SQLINTEGER currRow; r = SQLGetStmtAttr( d->hStmt, @@ -851,9 +851,9 @@ bool TQODBCResult::fetchLast() SQL_IS_INTEGER, 0 ); if ( r != SQL_SUCCESS ) - return FALSE; + return false; setAt( currRow-1 ); - return TRUE; + return true; } TQVariant TQODBCResult::data( int field ) @@ -866,7 +866,7 @@ TQVariant TQODBCResult::data( int field ) return fieldCache[ field ]; SQLRETURN r(0); TQSQLLEN lengthIndicator = 0; - bool isNull = FALSE; + bool isNull = false; int current = fieldCache.count(); for ( ; current < (field + 1); ++current ) { const TQSqlFieldInfo info = d->rInf[ current ]; @@ -889,10 +889,10 @@ TQVariant TQODBCResult::data( int field ) &lengthIndicator ); if ( ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) && ( lengthIndicator != SQL_NULL_DATA ) ) { fieldCache[ current ] = TQVariant( TQDate( dbuf.year, dbuf.month, dbuf.day ) ); - nullCache[ current ] = FALSE; + nullCache[ current ] = false; } else { fieldCache[ current ] = TQVariant( TQDate() ); - nullCache[ current ] = TRUE; + nullCache[ current ] = true; } break; case TQVariant::Time: @@ -905,10 +905,10 @@ TQVariant TQODBCResult::data( int field ) &lengthIndicator ); if ( ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) && ( lengthIndicator != SQL_NULL_DATA ) ) { fieldCache[ current ] = TQVariant( TQTime( tbuf.hour, tbuf.minute, tbuf.second ) ); - nullCache[ current ] = FALSE; + nullCache[ current ] = false; } else { fieldCache[ current ] = TQVariant( TQTime() ); - nullCache[ current ] = TRUE; + nullCache[ current ] = true; } break; case TQVariant::DateTime: @@ -921,38 +921,38 @@ TQVariant TQODBCResult::data( int field ) &lengthIndicator ); if ( ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) && ( lengthIndicator != SQL_NULL_DATA ) ) { fieldCache[ current ] = TQVariant( TQDateTime( TQDate( dtbuf.year, dtbuf.month, dtbuf.day ), TQTime( dtbuf.hour, dtbuf.minute, dtbuf.second, dtbuf.fraction / 1000000 ) ) ); - nullCache[ current ] = FALSE; + nullCache[ current ] = false; } else { fieldCache[ current ] = TQVariant( TQDateTime() ); - nullCache[ current ] = TRUE; + nullCache[ current ] = true; } break; case TQVariant::ByteArray: { - isNull = FALSE; + isNull = false; TQByteArray val = qGetBinaryData( d->hStmt, current, lengthIndicator, isNull ); fieldCache[ current ] = TQVariant( val ); nullCache[ current ] = isNull; break; } case TQVariant::String: - isNull = FALSE; + isNull = false; fieldCache[ current ] = TQVariant( qGetStringData( d->hStmt, current, - info.length(), isNull, TRUE ) ); + info.length(), isNull, true ) ); nullCache[ current ] = isNull; break; case TQVariant::Double: if ( info.typeID() == SQL_DECIMAL || info.typeID() == SQL_NUMERIC ) // bind Double values as string to prevent loss of precision fieldCache[ current ] = TQVariant( qGetStringData( d->hStmt, current, - info.length() + 1, isNull, FALSE ) ); // length + 1 for the comma + info.length() + 1, isNull, false ) ); // length + 1 for the comma else fieldCache[ current ] = TQVariant( qGetDoubleData( d->hStmt, current, isNull ) ); nullCache[ current ] = isNull; break; case TQVariant::CString: default: - isNull = FALSE; + isNull = false; fieldCache[ current ] = TQVariant( qGetStringData( d->hStmt, current, - info.length(), isNull, FALSE ) ); + info.length(), isNull, false ) ); nullCache[ current ] = isNull; break; } @@ -991,7 +991,7 @@ int TQODBCResult::numRowsAffected() bool TQODBCResult::prepare( const TQString& query ) { - setActive( FALSE ); + setActive( false ); setAt( TQSql::BeforeFirst ); SQLRETURN r; @@ -1002,7 +1002,7 @@ bool TQODBCResult::prepare( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::prepare: Unable to close statement", d ); #endif - return FALSE; + return false; } } r = SQLAllocHandle( SQL_HANDLE_STMT, @@ -1012,7 +1012,7 @@ bool TQODBCResult::prepare( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::prepare: Unable to allocate statement handle", d ); #endif - return FALSE; + return false; } if ( isForwardOnly() ) { @@ -1030,7 +1030,7 @@ bool TQODBCResult::prepare( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::prepare: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration", d ); #endif - return FALSE; + return false; } #ifdef UNICODE @@ -1048,18 +1048,18 @@ bool TQODBCResult::prepare( const TQString& query ) #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::prepare: Unable to prepare statement", d ); #endif - return FALSE; + return false; } - return TRUE; + return true; } bool TQODBCResult::exec() { SQLRETURN r; TQPtrList<TQVirtualDestructor> tmpStorage; // holds temporary ptrs. which will be deleted on fu exit - tmpStorage.setAutoDelete( TRUE ); + tmpStorage.setAutoDelete( true ); - setActive( FALSE ); + setActive( false ); setAt( TQSql::BeforeFirst ); d->rInf.clear(); @@ -1067,12 +1067,12 @@ bool TQODBCResult::exec() #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCResult::exec: No statement handle available", d ); #endif - return FALSE; + return false; } else { r = SQLFreeStmt( d->hStmt, SQL_CLOSE ); if ( r != SQL_SUCCESS ) { qSqlWarning( "TQODBCResult::exec: Unable to close statement handle", d ); - return FALSE; + return false; } } @@ -1232,7 +1232,7 @@ bool TQODBCResult::exec() tqWarning( "TQODBCResult::exec: unable to bind variable: %s", qODBCWarn( d ).local8Bit().data() ); #endif setLastError( qMakeError( "Unable to bind variable", TQSqlError::Statement, d ) ); - return FALSE; + return false; } } } @@ -1242,19 +1242,19 @@ bool TQODBCResult::exec() tqWarning( "TQODBCResult::exec: Unable to execute statement: %s", qODBCWarn( d ).local8Bit().data() ); #endif setLastError( qMakeError( "Unable to execute statement", TQSqlError::Statement, d ) ); - return FALSE; + return false; } SQLSMALLINT count; r = SQLNumResultCols( d->hStmt, &count ); if ( count ) { - setSelect( TRUE ); + setSelect( true ); for ( int i = 0; i < count; ++i ) { d->rInf.append( qMakeFieldInfo( d, i ) ); } } else { - setSelect( FALSE ); + setSelect( false ); } - setActive( TRUE ); + setActive( true ); //get out parameters if ( extension()->index.count() > 0 ) { @@ -1263,7 +1263,7 @@ bool TQODBCResult::exec() SQLINTEGER* indPtr = qAutoDeleterData( (TQAutoDeleter<SQLINTEGER>*)tmpStorage.getFirst() ); if ( !indPtr ) - return FALSE; + return false; bool isNull = (*indPtr == SQL_NULL_DATA); tmpStorage.removeFirst(); @@ -1318,7 +1318,7 @@ bool TQODBCResult::exec() } } - return TRUE; + return true; } //////////////////////////////////////// @@ -1337,8 +1337,8 @@ TQODBCDriver::TQODBCDriver( SQLHANDLE env, SQLHANDLE con, TQObject * parent, con d->hEnv = env; d->hDbc = con; if ( env && con ) { - setOpen( TRUE ); - setOpenError( FALSE ); + setOpen( true ); + setOpenError( false ); } } @@ -1363,7 +1363,7 @@ bool TQODBCDriver::hasFeature( DriverFeature f ) const switch ( f ) { case Transactions: { if ( !d->hDbc ) - return FALSE; + return false; SQLUSMALLINT txn; SQLSMALLINT t; int r = SQLGetInfo( d->hDbc, @@ -1372,22 +1372,22 @@ bool TQODBCDriver::hasFeature( DriverFeature f ) const sizeof(txn), &t); if ( r != SQL_SUCCESS || txn == SQL_TC_NONE ) - return FALSE; + return false; else - return TRUE; + return true; } case QuerySize: - return FALSE; + return false; case BLOB: - return TRUE; + return true; case Unicode: return d->unicode; case PreparedQueries: - return TRUE; + return true; case PositionalPlaceholders: - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -1398,7 +1398,7 @@ bool TQODBCDriver::open( const TQString&, int ) { tqWarning("TQODBCDriver::open(): This version of open() is no longer supported." ); - return FALSE; + return false; } bool TQODBCDriver::open( const TQString & db, @@ -1418,8 +1418,8 @@ bool TQODBCDriver::open( const TQString & db, #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCDriver::open: Unable to allocate environment", d ); #endif - setOpenError( TRUE ); - return FALSE; + setOpenError( true ); + return false; } r = SQLSetEnvAttr( d->hEnv, SQL_ATTR_ODBC_VERSION, @@ -1432,12 +1432,12 @@ bool TQODBCDriver::open( const TQString & db, #ifdef QT_CHECK_RANGE qSqlWarning( "TQODBCDriver::open: Unable to allocate connection", d ); #endif - setOpenError( TRUE ); - return FALSE; + setOpenError( true ); + return false; } if ( !d->setConnectionOptions( connOpts ) ) - return FALSE; + return false; // Create the connection string TQString connTQStr; @@ -1465,36 +1465,36 @@ bool TQODBCDriver::open( const TQString & db, SQL_DRIVER_NOPROMPT ); if ( r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO ) { setLastError( qMakeError( "Unable to connect", TQSqlError::Connection, d ) ); - setOpenError( TRUE ); - return FALSE; + setOpenError( true ); + return false; } if ( !d->checkDriver() ) { setLastError( qMakeError( "Unable to connect - Driver doesn't support all needed functionality", TQSqlError::Connection, d ) ); - setOpenError( TRUE ); - return FALSE; + setOpenError( true ); + return false; } d->checkUnicode(); d->checkSchemaUsage(); - setOpen( TRUE ); - setOpenError( FALSE ); - return TRUE; + setOpen( true ); + setOpenError( false ); + return true; } void TQODBCDriver::close() { cleanup(); - setOpen( FALSE ); - setOpenError( FALSE ); + setOpen( false ); + setOpenError( false ); } bool TQODBCDriver::ping() { // FIXME // Implement ping if supported - return TRUE; + return true; } void TQODBCDriver::cleanup() @@ -1537,14 +1537,14 @@ void TQODBCPrivate::checkUnicode() { #if defined(TQ_WS_WIN) if ( !qt_winunicode ) { - unicode = FALSE; + unicode = false; return; } #endif SQLRETURN r; SQLUINTEGER fFunc; - unicode = FALSE; + unicode = false; r = SQLGetInfo( hDbc, SQL_CONVERT_CHAR, (SQLPOINTER)&fFunc, @@ -1552,7 +1552,7 @@ void TQODBCPrivate::checkUnicode() NULL ); if ( ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) && ( fFunc & SQL_CVT_WCHAR ) ) { sql_char_type = TQVariant::String; - unicode = TRUE; + unicode = true; } r = SQLGetInfo( hDbc, @@ -1562,7 +1562,7 @@ void TQODBCPrivate::checkUnicode() NULL ); if ( ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) && ( fFunc & SQL_CVT_WVARCHAR ) ) { sql_varchar_type = TQVariant::String; - unicode = TRUE; + unicode = true; } r = SQLGetInfo( hDbc, @@ -1572,7 +1572,7 @@ void TQODBCPrivate::checkUnicode() NULL ); if ( ( r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO ) && ( fFunc & SQL_CVT_WLONGVARCHAR ) ) { sql_longvarchar_type = TQVariant::String; - unicode = TRUE; + unicode = true; } } @@ -1604,7 +1604,7 @@ bool TQODBCPrivate::checkDriver() const #ifdef QT_CHECK_RANGE if ( r != SQL_SUCCESS ) { qSqlWarning( "TQODBCDriver::checkDriver: Cannot get list of supported functions", this ); - return FALSE; + return false; } #endif if ( sup == SQL_FALSE ) { @@ -1612,7 +1612,7 @@ bool TQODBCPrivate::checkDriver() const tqWarning ( "TQODBCDriver::open: Warning - Driver doesn't support all needed functionality (%d). " "Please look at the TQt SQL Module Driver documentation for more information.", reqFunc[ i ] ); #endif - return FALSE; + return false; } } @@ -1624,19 +1624,19 @@ bool TQODBCPrivate::checkDriver() const #ifdef QT_CHECK_RANGE if ( r != SQL_SUCCESS ) { qSqlWarning( "TQODBCDriver::checkDriver: Cannot get list of supported functions", this ); - return FALSE; + return false; } #endif if ( sup == SQL_FALSE ) { #ifdef QT_CHECK_RANGE tqWarning( "TQODBCDriver::checkDriver: Warning - Driver doesn't support some non-critical functions (%d)", optFunc[ i ] ); #endif - return TRUE; + return true; } } #endif //ODBC_CHECK_DRIVER - return TRUE; + return true; } void TQODBCPrivate::checkSchemaUsage() @@ -1664,7 +1664,7 @@ bool TQODBCDriver::beginTransaction() #ifdef QT_CHECK_RANGE tqWarning(" TQODBCDriver::beginTransaction: Database not open" ); #endif - return FALSE; + return false; } SQLUINTEGER ac(SQL_AUTOCOMMIT_OFF); SQLRETURN r = SQLSetConnectAttr( d->hDbc, @@ -1673,9 +1673,9 @@ bool TQODBCDriver::beginTransaction() sizeof(ac) ); if ( r != SQL_SUCCESS ) { setLastError( qMakeError( "Unable to disable autocommit", TQSqlError::Transaction, d ) ); - return FALSE; + return false; } - return TRUE; + return true; } bool TQODBCDriver::commitTransaction() @@ -1684,14 +1684,14 @@ bool TQODBCDriver::commitTransaction() #ifdef QT_CHECK_RANGE tqWarning(" TQODBCDriver::commitTransaction: Database not open" ); #endif - return FALSE; + return false; } SQLRETURN r = SQLEndTran( SQL_HANDLE_DBC, d->hDbc, SQL_COMMIT ); if ( r != SQL_SUCCESS ) { setLastError( qMakeError("Unable to commit transaction", TQSqlError::Transaction, d ) ); - return FALSE; + return false; } return endTrans(); } @@ -1702,14 +1702,14 @@ bool TQODBCDriver::rollbackTransaction() #ifdef QT_CHECK_RANGE tqWarning(" TQODBCDriver::rollbackTransaction: Database not open" ); #endif - return FALSE; + return false; } SQLRETURN r = SQLEndTran( SQL_HANDLE_DBC, d->hDbc, SQL_ROLLBACK ); if ( r != SQL_SUCCESS ) { setLastError( qMakeError( "Unable to rollback transaction", TQSqlError::Transaction, d ) ); - return FALSE; + return false; } return endTrans(); } @@ -1723,9 +1723,9 @@ bool TQODBCDriver::endTrans() sizeof(ac)); if ( r != SQL_SUCCESS ) { setLastError( qMakeError( "Unable to enable autocommit", TQSqlError::Transaction, d ) ); - return FALSE; + return false; } - return TRUE; + return true; } TQStringList TQODBCDriver::tables( const TQString& typeName ) const @@ -1801,7 +1801,7 @@ TQSqlIndex TQODBCDriver::primaryIndex( const TQString& tablename ) const TQSqlIndex index( tablename ); if ( !isOpen() ) return index; - bool usingSpecialColumns = FALSE; + bool usingSpecialColumns = false; TQSqlRecord rec = record( tablename ); SQLHANDLE hStmt; @@ -1873,7 +1873,7 @@ TQSqlIndex TQODBCDriver::primaryIndex( const TQString& tablename ) const qSqlWarning( "TQODBCDriver::primaryIndex: Unable to execute primary key list", d ); #endif } else { - usingSpecialColumns = TRUE; + usingSpecialColumns = true; } } r = SQLFetchScroll( hStmt, @@ -2018,8 +2018,8 @@ TQString TQODBCDriver::formatValue( const TQSqlField* field, // Dateformat has to be "yyyy-MM-dd hh:mm:ss", with leading zeroes if month or day < 10 r = "{ ts '" + TQString::number(dt.year()) + "-" + - TQString::number(dt.month()).rightJustify( 2, '0', TRUE ) + "-" + - TQString::number(dt.day()).rightJustify( 2, '0', TRUE ) + " " + + TQString::number(dt.month()).rightJustify( 2, '0', true ) + "-" + + TQString::number(dt.day()).rightJustify( 2, '0', true ) + " " + tm.toString() + "' }"; } else |
