BPS C++ API  2.24.4
BpsTypeLiteral Class Reference

Dummy type representing a literal value for SQL operations. More...

#include <bpstypes.h>

Public Member Functions

 BpsTypeLiteral ()
 The default constructor.
 
 BpsTypeLiteral (const BpsTypeLiteral &aOther)
 The copy constructor. More...
 
 BpsTypeLiteral (const QByteArray &aByteArray)
 Construct from QByteArray. More...
 
 BpsTypeLiteral (const QString &aString)
 Construct from QString. More...
 
 operator QVariant () const
 Automatic conversion to QVariant. More...
 
QString toString () const
 

Static Public Member Functions

static int metaType ()
 

Detailed Description

Dummy type representing a literal value for SQL operations.

Used by several methods in BpsDatastore and BpsSqlValues.

// Example
vals[bStr("c_key")] = BpsTypeLiteral(bStr("f_nextkey('testtable')"));
vals[bStr("c_text")] = bStr("some text");
q.prepare(
bStr("insert into t_testtable (%1) values (%2)")
.arg(vals.columns())
.arg(vals.tags())
// insert into t_table (c_key, c_text) values (f_nextkey('testtable'), ?)
);
q.execute(vals.values()); // "some text"
#define bStr(aStr)
Encapsulation for string literals.
Definition: bpsglobals.h:125
Convenience class to help composing select, insert and update statements.
Definition: bpssqlvalues.h:54
QString tags() const
QVariantList values() const
QString columns(const QString &aPrefix=QString()) const
BpsTypeLiteral()
The default constructor.

Constructor & Destructor Documentation

◆ BpsTypeLiteral() [1/3]

BpsTypeLiteral::BpsTypeLiteral ( const QString aString)

Construct from QString.

Parameters
aStringThe string to use.

◆ BpsTypeLiteral() [2/3]

BpsTypeLiteral::BpsTypeLiteral ( const QByteArray aByteArray)

Construct from QByteArray.

Parameters
aByteArrayThe bytearray to use.

◆ BpsTypeLiteral() [3/3]

BpsTypeLiteral::BpsTypeLiteral ( const BpsTypeLiteral aOther)

The copy constructor.

Parameters
aOtherThe other number value to copy from.

Member Function Documentation

◆ metaType()

static int BpsTypeLiteral::metaType ( )
static
Returns
Get the Qt META type registered for BpsTypeLiteral.

◆ operator QVariant()

BpsTypeLiteral::operator QVariant ( ) const

Automatic conversion to QVariant.

Returns
QVariant with the BpsTypeLiteral value.

◆ toString()

QString BpsTypeLiteral::toString ( ) const
Returns
String value.

The documentation for this class was generated from the following file: