summaryrefslogtreecommitdiffstats
path: root/src/sql/tqsqlcursor.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-12-06 17:33:43 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-12-07 11:57:25 +0900
commit5a863a8932d14b99c5f838c4efa1618070d71b29 (patch)
tree000bd50b5c488635f9663b16b7fbfe5380435a04 /src/sql/tqsqlcursor.cpp
parent771af909e74927126fba90ec6e0298dc68d5bf4f (diff)
downloadtqt-5a863a8932d14b99c5f838c4efa1618070d71b29.tar.gz
tqt-5a863a8932d14b99c5f838c4efa1618070d71b29.zip
Replace TRUE/FALSE with boolean values true/false - part 7HEADmaster
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/sql/tqsqlcursor.cpp')
-rw-r--r--src/sql/tqsqlcursor.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/sql/tqsqlcursor.cpp b/src/sql/tqsqlcursor.cpp
index 55f9c9a38..5950b79e9 100644
--- a/src/sql/tqsqlcursor.cpp
+++ b/src/sql/tqsqlcursor.cpp
@@ -109,7 +109,7 @@ TQString qWhereClause( TQSqlRecord* rec, const TQString& prefix, const TQString&
{
static TQString blank( " " );
TQString filter;
- bool separator = FALSE;
+ bool separator = false;
for ( uint j = 0; j < rec->count(); ++j ) {
TQSqlField* f = rec->field( j );
if ( rec->isGenerated( j ) ) {
@@ -117,7 +117,7 @@ TQString qWhereClause( TQSqlRecord* rec, const TQString& prefix, const TQString&
filter += sep + blank;
filter += qWhereClause( prefix, f, driver );
filter += blank;
- separator = TRUE;
+ separator = true;
}
}
return filter;
@@ -145,13 +145,13 @@ TQString qWhereClause( TQSqlRecord* rec, const TQString& prefix, const TQString&
For browsing data, a cursor must first select() data from the
database. After a successful select() the cursor is active
- (isActive() returns TRUE), but is initially not positioned on a
- valid record (isValid() returns FALSE). To position the cursor on
+ (isActive() returns true), but is initially not positioned on a
+ valid record (isValid() returns false). To position the cursor on
a valid record, use one of the navigation functions, next(),
prev(), first(), last(), or seek(). Once positioned on a valid
record, data can be retrieved from the browse buffer using
value(). If a navigation function is not successful, it returns
- FALSE, the cursor will no longer be positioned on a valid record
+ false, the cursor will no longer be positioned on a valid record
and the values returned by value() are undefined.
For example:
@@ -165,7 +165,7 @@ TQString qWhereClause( TQSqlRecord* rec, const TQString& prefix, const TQString&
view name in the database. Then, select() is called, which can be
optionally parameterised to filter and order the records
retrieved. Each record in the cursor is retrieved using next().
- When next() returns FALSE, there are no more records to process,
+ When next() returns false, there are no more records to process,
and the loop terminates.
For editing records (rows of data), a cursor contains a separate
@@ -209,10 +209,10 @@ TQString qWhereClause( TQSqlRecord* rec, const TQString& prefix, const TQString&
After calling insert(), update() or del(), the cursor is no longer
positioned on a valid record and can no longer be navigated
- (isValid() return FALSE). The reason for this is that any changes
+ (isValid() return false). The reason for this is that any changes
made to the database will not be visible until select() is called
to refresh the cursor. You can change this behavior by passing
- FALSE to insert(), update() or del() which will prevent the cursor
+ false to insert(), update() or del() which will prevent the cursor
from becoming invalid. The edits will still not be visible when
navigating the cursor until select() is called.
@@ -258,7 +258,7 @@ TQString qWhereClause( TQSqlRecord* rec, const TQString& prefix, const TQString&
/*!
Constructs a cursor on database \a db using table or view \a name.
- If \a autopopulate is TRUE (the default), the \a name of the
+ If \a autopopulate is true (the default), the \a name of the
cursor must correspond to an existing table or view name in the
database so that field information can be automatically created.
If the table or view does not exist, the cursor will not be
@@ -381,7 +381,7 @@ TQString TQSqlCursor::filter() const
}
/*!
- Sets the name of the cursor to \a name. If \a autopopulate is TRUE
+ Sets the name of the cursor to \a name. If \a autopopulate is true
(the default), the \a name must correspond to a valid table or
view name in the database. Also, note that all references to the
cursor edit buffer become invalidated when fields are
@@ -421,7 +421,7 @@ TQString TQSqlCursor::toString( const TQString& prefix, const TQString& sep ) co
{
TQString pflist;
TQString pfix = prefix.isEmpty() ? TQString::null : prefix + ".";
- bool comma = FALSE;
+ bool comma = false;
for ( uint i = 0; i < count(); ++i ) {
const TQString fname = fieldName( i );
@@ -429,7 +429,7 @@ TQString TQSqlCursor::toString( const TQString& prefix, const TQString& sep ) co
if( comma )
pflist += sep + " ";
pflist += pfix + fname;
- comma = TRUE;
+ comma = true;
}
}
return pflist;
@@ -503,7 +503,7 @@ void TQSqlCursor::remove( int pos )
/*!
Sets the generated flag for the field \a name to \a generated. If
the field does not exist, nothing happens. Only fields that have
- \a generated set to TRUE are included in the SQL that is
+ \a generated set to true are included in the SQL that is
generated by insert(), update() or del().
\sa isGenerated()
@@ -538,7 +538,7 @@ void TQSqlCursor::setGenerated( int i, bool generated )
/*!
Returns the primary index associated with the cursor as defined in
the database, or an empty index if there is no primary index. If
- \a setFromCursor is TRUE (the default), the index fields are
+ \a setFromCursor is true (the default), the index fields are
populated with the corresponding values in the cursor's current
record.
*/
@@ -618,8 +618,8 @@ TQSqlIndex TQSqlCursor::index( const char* fieldName ) const
/*!
Selects all fields in the cursor from the database matching the
filter criteria \a filter. The data is returned in the order
- specified by the index \a sort. Returns TRUE if the data was
- successfully selected; otherwise returns FALSE.
+ specified by the index \a sort. Returns true if the data was
+ successfully selected; otherwise returns false.
The \a filter is a string containing a SQL \c WHERE clause but
without the 'WHERE' keyword. The cursor is initially positioned at
@@ -661,7 +661,7 @@ bool TQSqlCursor::select( const TQString & filter, const TQSqlIndex & sort )
{
TQString fieldList = toString( d->nm );
if ( fieldList.isEmpty() )
- return FALSE;
+ return false;
TQString str= "select " + fieldList;
str += " from " + d->nm;
if ( !filter.isEmpty() ) {
@@ -798,12 +798,12 @@ void TQSqlCursor::setCalculated( const TQString& name, bool calculated )
return;
d->infoBuffer[ pos ].setCalculated( calculated );
if ( calculated )
- setGenerated( pos, FALSE );
+ setGenerated( pos, false );
}
/*!
- Returns TRUE if the field \a name exists and is calculated;
- otherwise returns FALSE.
+ Returns true if the field \a name exists and is calculated;
+ otherwise returns false.
\sa setCalculated()
*/
@@ -812,7 +812,7 @@ bool TQSqlCursor::isCalculated( const TQString& name ) const
{
int pos = position( name );
if ( pos < 0 )
- return FALSE;
+ return false;
return d->infoBuffer[ pos ].isCalculated();
}
@@ -835,8 +835,8 @@ void TQSqlCursor::setTrimmed( const TQString& name, bool trim )
}
/*!
- Returns TRUE if the field \a name exists and is trimmed; otherwise
- returns FALSE.
+ Returns true if the field \a name exists and is trimmed; otherwise
+ returns false.
When a trimmed field of type string or cstring is read from the
database any trailing (right-most) spaces are removed.
@@ -848,13 +848,13 @@ bool TQSqlCursor::isTrimmed( const TQString& name ) const
{
int pos = position( name );
if ( pos < 0 )
- return FALSE;
+ return false;
return d->infoBuffer[ pos ].isTrim();
}
/*!
- Returns TRUE if the cursor is read-only; otherwise returns FALSE.
- The default is FALSE. Read-only cursors cannot be edited using
+ Returns true if the cursor is read-only; otherwise returns false.
+ The default is false. Read-only cursors cannot be edited using
insert(), update() or del().
\sa setMode()
@@ -866,8 +866,8 @@ bool TQSqlCursor::isReadOnly() const
}
/*!
- Returns TRUE if the cursor will perform inserts; otherwise returns
- FALSE.
+ Returns true if the cursor will perform inserts; otherwise returns
+ false.
\sa setMode()
*/
@@ -879,8 +879,8 @@ bool TQSqlCursor::canInsert() const
/*!
- Returns TRUE if the cursor will perform updates; otherwise returns
- FALSE.
+ Returns true if the cursor will perform updates; otherwise returns
+ false.
\sa setMode()
*/
@@ -891,8 +891,8 @@ bool TQSqlCursor::canUpdate() const
}
/*!
- Returns TRUE if the cursor will perform deletes; otherwise returns
- FALSE.
+ Returns true if the cursor will perform deletes; otherwise returns
+ false.
\sa setMode()
*/
@@ -933,7 +933,7 @@ TQString TQSqlCursor::toString( const TQString& prefix, TQSqlField* field, const
".", the field name, the \a fieldSep and the field value. If the
\a prefix is empty then each field will begin with the field name.
The fields are then joined together separated by \a sep. Fields
- where isGenerated() returns FALSE are not included. This function
+ where isGenerated() returns false are not included. This function
is useful for generating SQL statements.
*/
@@ -942,7 +942,7 @@ TQString TQSqlCursor::toString( TQSqlRecord* rec, const TQString& prefix, const
{
static TQString blank( " " );
TQString filter;
- bool separator = FALSE;
+ bool separator = false;
for ( uint j = 0; j < count(); ++j ) {
TQSqlField* f = rec->field( j );
if ( rec->isGenerated( j ) ) {
@@ -950,7 +950,7 @@ TQString TQSqlCursor::toString( TQSqlRecord* rec, const TQString& prefix, const
filter += sep + blank;
filter += toString( prefix, f, fieldSep );
filter += blank;
- separator = TRUE;
+ separator = true;
}
}
return filter;
@@ -965,7 +965,7 @@ TQString TQSqlCursor::toString( TQSqlRecord* rec, const TQString& prefix, const
If the \a prefix is empty then each field will begin with the field
name. The field values are taken from \a rec. The fields are then
joined together separated by \a sep. Fields where isGenerated()
- returns FALSE are ignored. This function is useful for generating
+ returns false are ignored. This function is useful for generating
SQL statements.
*/
@@ -973,7 +973,7 @@ TQString TQSqlCursor::toString( const TQSqlIndex& i, TQSqlRecord* rec, const TQS
const TQString& fieldSep, const TQString& sep ) const
{
TQString filter;
- bool separator = FALSE;
+ bool separator = false;
for( uint j = 0; j < i.count(); ++j ){
if ( rec->isGenerated( j ) ) {
if( separator ) {
@@ -982,7 +982,7 @@ TQString TQSqlCursor::toString( const TQSqlIndex& i, TQSqlRecord* rec, const TQS
TQString fn = i.fieldName( j );
TQSqlField* f = rec->field( fn );
filter += toString( prefix, f, fieldSep );
- separator = TRUE;
+ separator = true;
}
}
return filter;
@@ -996,7 +996,7 @@ TQString TQSqlCursor::toString( const TQSqlIndex& i, TQSqlRecord* rec, const TQS
number of rows affected by the insert. For error information, use
lastError().
- If \a invalidate is TRUE (the default), the cursor will no longer
+ If \a invalidate is true (the default), the cursor will no longer
be positioned on a valid record and can no longer be navigated. A
new select() call must be made before navigating to a valid
record.
@@ -1020,14 +1020,14 @@ TQString TQSqlCursor::toString( const TQSqlIndex& i, TQSqlRecord* rec, const TQS
int TQSqlCursor::insert( bool invalidate )
{
if ( ( d->md & Insert ) != Insert || !driver() )
- return FALSE;
+ return false;
int k = d->editBuffer.count();
if ( k == 0 )
return 0;
TQString fList;
TQString vList;
- bool comma = FALSE;
+ bool comma = false;
// use a prepared query if the driver supports it
if ( driver()->hasFeature( TQSqlDriver::PreparedQueries ) ) {
int cnt = 0;
@@ -1040,9 +1040,9 @@ int TQSqlCursor::insert( bool invalidate )
vList += ",";
}
fList += f->name();
- vList += (oraStyle == TRUE) ? ":f" + TQString::number(cnt) : TQString("?");
+ vList += oraStyle ? ":f" + TQString::number(cnt) : TQString("?");
cnt++;
- comma = TRUE;
+ comma = true;
}
}
if ( !comma ) {
@@ -1061,7 +1061,7 @@ int TQSqlCursor::insert( bool invalidate )
}
fList += f->name();
vList += driver()->formatValue( f );
- comma = TRUE;
+ comma = true;
}
}
@@ -1076,8 +1076,8 @@ int TQSqlCursor::insert( bool invalidate )
}
/*!
- Returns the current internal edit buffer. If \a copy is TRUE (the
- default is FALSE), the current cursor field values are first
+ Returns the current internal edit buffer. If \a copy is true (the
+ default is false), the current cursor field values are first
copied into the edit buffer. The edit buffer is valid as long as
the cursor remains valid. The cursor retains ownership of the
returned pointer, so it must not be deleted or modified.
@@ -1104,7 +1104,7 @@ TQSqlRecord* TQSqlCursor::editBuffer( bool copy )
returns the edit buffer. The default implementation copies the
field values from the current cursor record into the edit buffer
(therefore, this function is equivalent to calling editBuffer(
- TRUE ) ). The cursor retains ownership of the returned pointer, so
+ true ) ). The cursor retains ownership of the returned pointer, so
it must not be deleted or modified.
\sa editBuffer() update()
@@ -1113,8 +1113,8 @@ TQSqlRecord* TQSqlCursor::editBuffer( bool copy )
TQSqlRecord* TQSqlCursor::primeUpdate()
{
// memorize the primary keys as they were before the user changed the values in editBuffer
- TQSqlRecord* buf = editBuffer( TRUE );
- TQSqlIndex idx = primaryIndex( FALSE );
+ TQSqlRecord* buf = editBuffer( true );
+ TQSqlIndex idx = primaryIndex( false );
if ( !idx.isEmpty() )
d->editIndex = toString( idx, buf, d->nm, "=", "and" );
else
@@ -1127,7 +1127,7 @@ TQSqlRecord* TQSqlCursor::primeUpdate()
returns the edit buffer. The default implementation copies the
field values from the current cursor record into the edit buffer
(therefore, this function is equivalent to calling editBuffer(
- TRUE ) ). The cursor retains ownership of the returned pointer, so
+ true ) ). The cursor retains ownership of the returned pointer, so
it must not be deleted or modified.
\sa editBuffer() del()
@@ -1135,7 +1135,7 @@ TQSqlRecord* TQSqlCursor::primeUpdate()
TQSqlRecord* TQSqlCursor::primeDelete()
{
- return editBuffer( TRUE );
+ return editBuffer( true );
}
/*!
@@ -1163,7 +1163,7 @@ TQSqlRecord* TQSqlCursor::primeInsert()
cursor's primary index are updated. If the cursor does not contain
a primary index, no update is performed and 0 is returned.
- If \a invalidate is TRUE (the default), the current cursor can no
+ If \a invalidate is true (the default), the current cursor can no
longer be navigated. A new select() call must be made before you
can move to a valid record. For example:
@@ -1208,7 +1208,7 @@ int TQSqlCursor::update( bool invalidate )
Only records which meet the filter criteria are updated, otherwise
all records in the table are updated.
- If \a invalidate is TRUE (the default), the cursor can no longer
+ If \a invalidate is true (the default), the cursor can no longer
be navigated. A new select() call must be made before you can move
to a valid record.
@@ -1218,7 +1218,7 @@ int TQSqlCursor::update( bool invalidate )
int TQSqlCursor::update( const TQString & filter, bool invalidate )
{
if ( ( d->md & Update ) != Update ) {
- return FALSE;
+ return false;
}
int k = count();
if ( k == 0 ) {
@@ -1228,7 +1228,7 @@ int TQSqlCursor::update( const TQString & filter, bool invalidate )
// use a prepared query if the driver supports it
if ( driver()->hasFeature( TQSqlDriver::PreparedQueries ) ) {
TQString fList;
- bool comma = FALSE;
+ bool comma = false;
int cnt = 0;
bool oraStyle = driver()->hasFeature( TQSqlDriver::NamedPlaceholders );
for( int j = 0; j < k; ++j ) {
@@ -1237,9 +1237,9 @@ int TQSqlCursor::update( const TQString & filter, bool invalidate )
if ( comma ) {
fList += ",";
}
- fList += f->name() + " = " + (oraStyle == TRUE ? ":f" + TQString::number(cnt) : TQString("?"));
+ fList += f->name() + " = " + (oraStyle ? ":f" + TQString::number(cnt) : TQString("?"));
cnt++;
- comma = TRUE;
+ comma = true;
}
}
if ( !comma ) {
@@ -1269,7 +1269,7 @@ int TQSqlCursor::update( const TQString & filter, bool invalidate )
Only records which meet the filter criteria specified by the
cursor's primary index are deleted. If the cursor does not contain
a primary index, no delete is performed and 0 is returned. If \a
- invalidate is TRUE (the default), the current cursor can no longer
+ invalidate is true (the default), the current cursor can no longer
be navigated. A new select() call must be made before you can move
to a valid record. For example:
@@ -1291,7 +1291,7 @@ int TQSqlCursor::update( const TQString & filter, bool invalidate )
int TQSqlCursor::del( bool invalidate )
{
- TQSqlIndex idx = primaryIndex( FALSE );
+ TQSqlIndex idx = primaryIndex( false );
if ( idx.isEmpty() )
return del( qWhereClause( &d->editBuffer, d->nm, "and", driver() ), invalidate );
else
@@ -1305,7 +1305,7 @@ int TQSqlCursor::del( bool invalidate )
Deletes the current cursor record from the database using the
filter \a filter. Only records which meet the filter criteria are
deleted. Returns the number of records which were deleted. If \a
- invalidate is TRUE (the default), the current cursor can no longer
+ invalidate is true (the default), the current cursor can no longer
be navigated. A new select() call must be made before you can move
to a valid record. For error information, use lastError().
@@ -1384,8 +1384,8 @@ int TQSqlCursor::applyPrepared( const TQString& q, bool invalidate )
/*! \reimp
- Executes the SQL query \a sql. Returns TRUE of the cursor is
- active, otherwise returns FALSE.
+ Executes the SQL query \a sql. Returns true of the cursor is
+ active, otherwise returns false.
*/
bool TQSqlCursor::exec( const TQString & sql )
@@ -1434,10 +1434,10 @@ void TQSqlCursor::sync()
d->lastAt = at();
uint i = 0;
uint j = 0;
- bool haveCalculatedFields = FALSE;
+ bool haveCalculatedFields = false;
for ( ; i < count(); ++i ) {
if ( !haveCalculatedFields && d->infoBuffer[i].isCalculated() ) {
- haveCalculatedFields = TRUE;
+ haveCalculatedFields = true;
}
if ( TQSqlRecord::isGenerated( i ) ) {
TQVariant v = TQSqlQuery::value( j );
@@ -1507,8 +1507,8 @@ void TQSqlCursor::insert( int pos, const TQSqlField& field )
}
/*!
- Returns TRUE if the field \a i is NULL or if there is no field at
- position \a i; otherwise returns FALSE.
+ Returns true if the field \a i is NULL or if there is no field at
+ position \a i; otherwise returns false.
This is the same as calling TQSqlRecord::isNull( \a i )
*/
@@ -1519,8 +1519,8 @@ bool TQSqlCursor::isNull( int i ) const
/*!
\overload
- Returns TRUE if the field called \a name is NULL or if there is no
- field called \a name; otherwise returns FALSE.
+ Returns true if the field called \a name is NULL or if there is no
+ field called \a name; otherwise returns false.
This is the same as calling TQSqlRecord::isNull( \a name )
*/