SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDBInserter Class Reference

Encapsulates an SQL INSERT statement. More...

#include <rw/db/inserter.h>

Public Member Functions

 RWDBInserter ()
 
 RWDBInserter (const RWDBInserter &ins)
 
void acquire (void) const
 
RWDBInserteraddValue (const RWDBBoundExpr &value)
 
RWDBInserteraddValue (const RWDBExpr &value)
 
RWCString asString () const
 
RWCString asString (bool verbose) const
 
RWCString asString (const RWDBConnection &conn) const
 
RWCString asString (const RWDBConnection &conn, bool verbose) const
 
RWDBStatus clear ()
 
RWDBStatus::ErrorHandler errorHandler () const
 
RWDBResult execute ()
 
RWDBResult execute (const RWDBConnection &connection)
 
RWDBResult flush ()
 
bool isReady () const
 
bool isValid () const
 
RWDBInserteroperator<< (char value)
 
RWDBInserteroperator<< (const char *value)
 
RWDBInserteroperator<< (const RWBasicUString &value)
 
RWDBInserteroperator<< (const RWCString &value)
 
RWDBInserteroperator<< (const RWDate &value)
 
RWDBInserteroperator<< (const RWDateTime &value)
 
RWDBInserteroperator<< (const RWDBBlob &value)
 
RWDBInserteroperator<< (const RWDBBoundExpr &value)
 
RWDBInserteroperator<< (const RWDBDateTime &value)
 
RWDBInserteroperator<< (const RWDBDuration &value)
 
RWDBInserteroperator<< (const RWDBExpr &value)
 
RWDBInserteroperator<< (const RWDBMBString &value)
 
RWDBInserteroperator<< (const RWDBValue &value)
 
RWDBInserteroperator<< (const RWDecimalPortable &value)
 
RWDBInserteroperator<< (const RWWString &value)
 
RWDBInserteroperator<< (double value)
 
RWDBInserteroperator<< (float value)
 
RWDBInserteroperator<< (int value)
 
RWDBInserteroperator<< (long double value)
 
RWDBInserteroperator<< (long long value)
 
RWDBInserteroperator<< (long value)
 
RWDBInserteroperator<< (RWDBReader &reader)
 
RWDBInserteroperator<< (RWDBValueManip manip)
 
RWDBInserteroperator<< (short value)
 
RWDBInserteroperator<< (unsigned char value)
 
RWDBInserteroperator<< (unsigned int value)
 
RWDBInserteroperator<< (unsigned long long value)
 
RWDBInserteroperator<< (unsigned long value)
 
RWDBInserteroperator<< (unsigned short value)
 
RWDBInserteroperator= (const RWDBInserter &ins)
 
RWDBInserteroperator[] (const RWCString &colName)
 
RWDBInserteroperator[] (const RWDBColumn &column)
 
size_t position () const
 
void release (void) const
 
void setErrorHandler (RWDBStatus::ErrorHandler handler)
 
RWDBStatus status () const
 
RWDBTable table () const
 

Detailed Description

RWDBInserter is an encapsulation of the SQL INSERT statement. In SQL, the INSERT statement may be based either on a VALUES clause or on a SELECT statement. RWDBInserter supports either variant. Use the insertion operator operator<<() to add items to an RWDBInserter encapsulated VALUES clause, or supply an RWDBSelector when the RWDBInserter is produced. It is an error to use the insertion operator operator<<() with an RWDBInserter that was produced with an RWDBSelector.

An RWDBInserter can be produced with an optional RWDBSchema, which is used to generate a list of column names. If the list of column names is given, the values are inserted one for one into the specified columns. Otherwise the values are inserted into the table columns in the order they were created.

RWDBInserter instances that use the indexing operator, operator[], with colName derive a list of column names if all columns are provided. This allows values to be shifted into the inserter in any order without requiring a schema and an additional database access.

RWDBInserter has a notion of the current position in itself. This position is set to zero when the RWDBInserter is produced, and reset to zero whenever execute() is called. Each insertion operation adds a value at the current position and increments the position by one. If the RWDBInserter was created with an optional RWDBSchema, then the indexing operators operator[]() can set the position to a specified column or column name, and return a reference to self. The DB Interface Module does not check whether the inserted values match the table's schema in type or in number; such errors are reported by the database when execute() is invoked.

An INSERT statement does not normally produce results. However, the DB Interface Module recognizes that some database vendors provide triggers, which can cause results to be generated by an INSERT statement. Consequently, the RWDBInserter execute() method returns an RWDBResult, which is a sequence of zero or more RWDBTable instances. Applications are not obliged to request any tables from the returned object.

RWDBInserter is designed around the Interface/Implementation paradigm. An RWDBInserter instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. An RWDBInserter implementation is a base class from which a family of database-specific inserter implementations is derived.

Synopsis
#include <rw/db/inserter.h>
RWDBInserter inserter = myTable.inserter();
RWDBInserter inserter = myTable.inserter(mySelector);
Encapsulates an SQL INSERT statement.
Definition inserter.h:177
Example

Example 1

For this example, assume an AutoParts table in the database, with text column name and integer column id. Here is a way to populate it with data selected from another table, AllParts, which is also assumed to have a name and an id column.

RWDBTable allParts = myDbase.table("AllParts");
RWDBConnection connection = myDbase.connection();
RWDBSelector select = myDbase.selector();
select << allParts["name"] << allParts["id"];
select.where(allParts["type"] == "Auto");
RWDBTable autoParts = myDbase.table("AutoParts");
RWDBInserter inserter = autoParts.inserter(select);
inserter.execute(connection);
Represents an explicit database connection object that can be used in place of the implicit database ...
Definition connect.h:81
RWDBResult execute()
Encapsulates the SQL SELECT statement.
Definition select.h:369
Base class for a family of classes that represent the abstract notion of a database table in a number...
Definition table.h:89
RWDBInserter inserter(size_t cache=0) const

Example 2

This is how to insert a single row, using an encapsulated VALUES clause:

RWDBInserter inserter = autoParts.inserter();
inserter << "steering wheel" << 1001;
inserter.execute(connection);

Example 3

This is how to insert a single row, using a column list and an encapsulated VALUES clause. The correct order of insertions depends on the supplied RWDBSchema, not on the order of columns in the autoParts table:

RWDBSchema schema;
schema.appendColumn("id");
schema.appendColumn("name");
RWDBInserter inserter = autoParts.inserter(schema);
// associate with schema's 0 with column "id"
inserter << 1001;
// associate with schema's 0 with column "name"
inserter << "steering wheel";
inserter.execute(connection);
An ordered collection of RWDBColumn instances, encapsulating the database notion of a schema.
Definition schema.h:62
RWDBColumn appendColumn(const RWCString &name, RWDBValue::ValueType type=RWDBValue::NoType, long storageLength=RWDB_NO_TRAIT, int nativeType=RWDB_NO_TRAIT, int precision=RWDB_NO_TRAIT, int scale=RWDB_NO_TRAIT, bool nullAllowed=true, RWDBColumn::ParamType paramType=RWDBColumn::notAParameter)

Example 4

This is how to insert a single row, using a column list, but supplying bindings to application variables. The advantage here is that the same insertion can be made several times without reshifting variables:

RWDBSchema schema;
schema.appendColumn("id");
schema.appendColumn("name");
RWDBInserter inserter = autoParts.inserter(schema);
int id = 1001;
RWCString name = "steering wheel";
inserter << RWDBBoundExpr(&id);
inserter << RWDBBoundExpr(&name);
inserter.execute();
id = 2001;
name = "gear shift";
inserter.execute(connection);
Offers powerful and convenient facilities for manipulating strings.
Definition stdcstring.h:826
Acts as a placeholder in a dynamic SQL statement, providing a type-safe interface for binding a local...
Definition expr.h:935
See also

RWDBValueManip rwdbNull;

rwdbNull is used to represent a literal NULL value. A NULL value can be inserted through an RWDBInserter by inserting rwdbNull into the inserter like this:

inserter << rwdbNull;

The result of RWDBInserter::execute() is an RWDBResult, which represents a sequence of zero or more RWDBTable instances. For details, see RWDBResult and RWDBTable.

Constructor & Destructor Documentation

◆ RWDBInserter() [1/2]

RWDBInserter::RWDBInserter ( )

The default constructor creates an RWDBInserter whose status is RWDBStatus::notInitialized. This constructor is provided as a convenience, for example, to declare an array of RWDBInserter instances. A usable RWDBInserter is obtained from an RWDBDatabase and RWDBTable.

◆ RWDBInserter() [2/2]

RWDBInserter::RWDBInserter ( const RWDBInserter & ins)

Copy constructor. Self shares an implementation with ins.

Member Function Documentation

◆ acquire()

void RWDBInserter::acquire ( void ) const

Attempts to acquire the internal mutex lock. If the mutex is already locked by another thread, the function blocks until the mutex is released. This function can be called from a const object.

Note
In single-threaded builds, this function evaluates to a no-op.

◆ addValue() [1/2]

RWDBInserter & RWDBInserter::addValue ( const RWDBBoundExpr & value)

Adds value to self's encapsulated VALUES clause. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Equivalent to inserting value into self. Returns reference to self.

◆ addValue() [2/2]

RWDBInserter & RWDBInserter::addValue ( const RWDBExpr & value)

Adds value to self's encapsulated VALUES clause. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Equivalent to inserting value into self. Returns reference to self.

◆ asString() [1/4]

RWCString RWDBInserter::asString ( ) const
inline

Returns the SQL equivalent of:

INSERT INTO table ... VALUES ( ... )

or:

INSERT INTO table ... SELECT ...

This method returns an SQL statement that would be produced by executing self with an implicit RWDBConnection object. An implicit RWDBConnection object inherits the time zone setting from the producer RWDBDatabase instance. Hence, the time zone setting of the producer RWDBDatabase object will be used for creating the string representations of any RWDateTime instances in self.

The behavior of this method depends upon the RWDBDatabase::verboseAsString() setting in the producer RWDBDatabase instance.

  • If verboseAsString() is false, the SQL returned is the same as that passed to the database for execution. This is the default.
  • If verboseAsString() is true, any placeholders in the returned SQL are replaced with their bound values.
Note
When the RWDBDatabase::verboseAsString() option is set to true, the SQL returned by this method may not be a valid SQL statement. However, this method's return value is not necessarily the same SQL that is sent to the database for execution. For example, if an RWDBBlob object is bound, calling this method with RWDBDatabase::verboseAsString() set to true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBDatabase::timeZone(const RWZone*) for time zone setting on RWDBDatabase.

◆ asString() [2/4]

RWCString RWDBInserter::asString ( bool verbose) const
inline

Returns the SQL equivalent of:

INSERT INTO table ... VALUES ( ... )

or:

INSERT INTO table ... SELECT ...

This method returns an SQL statement that would be produced by executing self with an implicit RWDBConnection object. An implicit RWDBConnection object inherits the time zone setting from the producer RWDBDatabase instance. Hence, the time zone setting of the producer RWDBDatabase object will be used for creating the string representations of any RWDateTime instances in self.

The behavior of this method depends on the value of verbose, and is independent of the RWDBDatabase::verboseAsString() setting.

  • If verbose is false, the SQL returned is the same as that passed to the database for execution.
  • If verbose is true, any placeholders in the returned SQL are replaced with their bound values although the SQL passed to the database for execution will not be affected.
Note
The SQL returned by this method when verbose is true may not be a valid SQL statement. However, this method's return value is not necessarily the same SQL that is sent to the database for execution. For example, if an RWDBBlob object is bound, calling this method with verbose as true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBDatabase::timeZone(const RWZone*) for time zone setting on RWDBDatabase.

◆ asString() [3/4]

RWCString RWDBInserter::asString ( const RWDBConnection & conn) const
inline

Returns the SQL equivalent of:

INSERT INTO table ... VALUES ( ... )

or:

INSERT INTO table ... SELECT ...

This method returns an SQL statement that would be produced by executing self with conn. The time zone setting of conn will be used for creating string representations of any RWDateTime instances in self.

The behavior of this method depends upon the RWDBDatabase::verboseAsString() setting in the producer RWDBDatabase instance.

  • If verboseAsString() is false, the SQL returned is the same as that passed to the database for execution. This is the default.
  • If verboseAsString() is true, any placeholders in the returned SQL are replaced with their bound values.
Note
When the RWDBDatabase::verboseAsString() option is set to true, the SQL returned by this method may not be a valid SQL statement. However, this method's return value is not necessarily the same SQL that is sent to the database for execution. For example, if an RWDBBlob object is bound, calling this method with RWDBDatabase::verboseAsString() set to true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBConnection::timeZone(const RWZone*) for time zone setting on RWDBConnection.

◆ asString() [4/4]

RWCString RWDBInserter::asString ( const RWDBConnection & conn,
bool verbose ) const
inline

Returns the SQL equivalent of:

INSERT INTO table ... VALUES ( ... )

or:

INSERT INTO table ... SELECT ...

This method returns an SQL statement that would be produced by executing self with conn. The time zone setting of conn will be used for creating string representations of any RWDateTime instances in self.

The behavior of this method depends on the value of verbose, and is independent of the RWDBDatabase::verboseAsString() setting.

  • If verbose is false, the SQL returned is the same as that passed to the database for execution.
  • If verbose is true, any placeholders in the returned SQL are replaced with their bound values although the SQL passed to the database for execution will not be affected.
Note
The SQL returned by this method when verbose is true may not be a valid SQL statement. However, this method's return value is not necessarily the same SQL that is sent to the database for execution. For example, if an RWDBBlob object is bound, calling this method with verbose as true will result in a string with blob data returned as hex numbers, such as 0x0A32F5.
See also
RWDBConnection::timeZone(const RWZone*) for time zone setting on RWDBConnection.

◆ clear()

RWDBStatus RWDBInserter::clear ( )

Clears self's list of scalar values and all internal controls.

◆ errorHandler()

RWDBStatus::ErrorHandler RWDBInserter::errorHandler ( ) const

Returns the error handler attached to self.

◆ execute() [1/2]

RWDBResult RWDBInserter::execute ( )

Uses a default database connection to cause the SQL statement encapsulated by self to be executed.

◆ execute() [2/2]

RWDBResult RWDBInserter::execute ( const RWDBConnection & connection)

Uses the supplied connection to cause the SQL statement encapsulated by self to be executed. This function can behave asynchronously if executed using an asynchronous connection.

◆ flush()

RWDBResult RWDBInserter::flush ( )

Sends all cached data, if any, to the server. Depending on the size of the cache parameter used to create the inserter, can work one of two ways:

  • When the cache parameter is less than or equal to 1, sends cached data to the server immediately on invocation of execute(). Ignores any direct invocations of flush(), like a no-op.
  • When the cache parameter is greater than 1, sends cached data to the server, and is called automatically when the cache is full.

When the connection between executions changes, flush() is called before executing on the new connection. However, new data since the last execute on the old connection is saved for the new execute on the new connection.

◆ isReady()

bool RWDBInserter::isReady ( ) const

This function returns true if the object is in ready state, indicating that accessing the object will not block. Accessing a nonready object may potentially block.

◆ isValid()

bool RWDBInserter::isValid ( ) const

Returns true if self's status is RWDBStatus::ok, otherwise returns false. Does not return false if the previous executed statement failed. You must check the status of the RWDBResult returned from execute() instead of the status of the RWDBInserter object.

◆ operator<<() [1/29]

RWDBInserter & RWDBInserter::operator<< ( char value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [2/29]

RWDBInserter & RWDBInserter::operator<< ( const char * value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [3/29]

RWDBInserter & RWDBInserter::operator<< ( const RWBasicUString & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [4/29]

RWDBInserter & RWDBInserter::operator<< ( const RWCString & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [5/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDate & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [6/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDateTime & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [7/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBBlob & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [8/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBBoundExpr & value)

Adds a variable expression to the encapsulated VALUES clause in self where supported, thus allowing values or scalar expressions to be inserted into a table. The position that value holds is associated with the current position within self. The current position is incremented after adding the expression. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [9/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBDateTime & value)
Deprecated
As of SourcePro 12.5, use RWDBInserter::operator<<(const RWDateTime&) instead.

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [10/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBDuration & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [11/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBExpr & value)

Adds a scalar expression to the encapsulated VALUES clause in self, allowing values or scalar expressions to be inserted into a table. The position that value holds is associated with the current position within self. The current position is incremented after adding the expression. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [12/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBMBString & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [13/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDBValue & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [14/29]

RWDBInserter & RWDBInserter::operator<< ( const RWDecimalPortable & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [15/29]

RWDBInserter & RWDBInserter::operator<< ( const RWWString & value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [16/29]

RWDBInserter & RWDBInserter::operator<< ( double value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [17/29]

RWDBInserter & RWDBInserter::operator<< ( float value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [18/29]

RWDBInserter & RWDBInserter::operator<< ( int value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [19/29]

RWDBInserter & RWDBInserter::operator<< ( long double value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [20/29]

RWDBInserter & RWDBInserter::operator<< ( long long value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [21/29]

RWDBInserter & RWDBInserter::operator<< ( long value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [22/29]

RWDBInserter & RWDBInserter::operator<< ( RWDBReader & reader)

A row of data can be inserted directly from an RWDBReader into an RWDBInserter. This method is equivalent to using a loop to extract each value out of reader into inserter. Returns a reference to self.

◆ operator<<() [23/29]

RWDBInserter & RWDBInserter::operator<< ( RWDBValueManip manip)

Adds an RWDBValueManip to the encapsulated VALUES clause in self. RWDBValueManip is a typedef and is typically used to insert a literal NULL into the inserter. The position that manip holds is associated with the current position within self. The current position is incremented after adding the expression.

Use rwdbNull to insert a literal NULL into an inserter.

◆ operator<<() [24/29]

RWDBInserter & RWDBInserter::operator<< ( short value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [25/29]

RWDBInserter & RWDBInserter::operator<< ( unsigned char value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [26/29]

RWDBInserter & RWDBInserter::operator<< ( unsigned int value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [27/29]

RWDBInserter & RWDBInserter::operator<< ( unsigned long long value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [28/29]

RWDBInserter & RWDBInserter::operator<< ( unsigned long value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator<<() [29/29]

RWDBInserter & RWDBInserter::operator<< ( unsigned short value)

Adds the provided value as a literal in the encapsulated VALUES clause in self. The position that value holds is associated with the current position within self. The current position is incremented after adding the value. If self was produced with an RWDBSelector, sets self's status to RWDBStatus::invalidUsage. Returns a reference to self.

◆ operator=()

RWDBInserter & RWDBInserter::operator= ( const RWDBInserter & ins)

Assignment operator. Self shares an implementation with ins.

◆ operator[]() [1/2]

RWDBInserter & RWDBInserter::operator[] ( const RWCString & colName)

Sets self's current position to the index associated with the column in the column list whose name matches colName. If there is no such column, colName is appended to the column list and the current position is set to the index of that new entry. The next insertion into self will associate the inserted value with the current position. Returns a reference to self.

◆ operator[]() [2/2]

RWDBInserter & RWDBInserter::operator[] ( const RWDBColumn & column)

Sets self's current position to the index associated with the column in the column list whose name matches column.name(). If there is no such column, column.name() is appended to the column list and the current position is set to the index of that new entry. The next insertion into self will associate the inserted value with the current position. Returns a reference to self.

◆ position()

size_t RWDBInserter::position ( ) const

Returns the current position, at which the next value will be shifted in using the insertion operator. Returns RW_NPOS if isValid() returns false.

◆ release()

void RWDBInserter::release ( void ) const

Releases a previously acquired mutex. This function can be called from a const object.

Note
In single-threaded builds, this function evaluates to a no-op.

◆ setErrorHandler()

void RWDBInserter::setErrorHandler ( RWDBStatus::ErrorHandler handler)

Installs handler as self's error handler. The supplied handler is inherited by all objects produced by self. By default, an RWDBStatus::ErrorHandler is inherited from the object that produced self; this method overrides the default.

◆ status()

RWDBStatus RWDBInserter::status ( ) const

Returns the current status of self.

◆ table()

RWDBTable RWDBInserter::table ( ) const

Returns the RWDBTable that produced self. Returns an RWDBTable whose status is RWDBStatus::notInitialized if self was created with the default constructor.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.