58 #define SQL_BIGINT_TYPE qint64 59 #define SQL_BIGUINT_TYPE quint64 71 static const SQLSMALLINT
qParamType[4] = { SQL_PARAM_INPUT, SQL_PARAM_INPUT, SQL_PARAM_OUTPUT, SQL_PARAM_INPUT_OUTPUT };
93 for (
int i = 0; i < valueCache.count(); ++i) {
119 return (SQLTCHAR*)str.
utf16();
124 SQLINTEGER nativeCode;
126 SQLRETURN r = SQL_ERROR;
127 SQLTCHAR state[SQL_SQLSTATE_SIZE + 1];
128 SQLTCHAR description[SQL_MAX_MESSAGE_LENGTH];
129 r = SQLGetDiagRec(handleType,
134 (SQLTCHAR*) description,
135 SQL_MAX_MESSAGE_LENGTH - 1,
137 if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
202 case SQL_LONGVARBINARY:
216 case SQL_TYPE_TIMESTAMP:
221 case SQL_WLONGVARCHAR:
224 case SQL_LONGVARCHAR:
236 SQLSMALLINT colNameLen;
239 SQLSMALLINT colScale;
240 SQLSMALLINT nullable;
241 SQLRETURN r = SQL_ERROR;
243 r = SQLDescribeCol(d->
hStmt,
253 if (r != SQL_SUCCESS) {
259 if (nullable == SQL_NO_NULLS)
261 else if (nullable == SQL_NULLABLE)
264 f.
setLength(colSize == 0 ? -1 :
int(colSize));
274 SQLINTEGER lengthIndicator = 0;
275 SQLRETURN r = SQLGetData(hStmt,
278 (SQLPOINTER) &intbuf,
281 if ((r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) || lengthIndicator == SQL_NULL_DATA) {
292 SQLINTEGER lengthIndicator = 0;
293 SQLRETURN r = SQLGetData(hStmt,
296 (SQLPOINTER) &dblbuf,
299 if ((r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) || lengthIndicator == SQL_NULL_DATA) {
304 return (
double) dblbuf;
311 SQLINTEGER lengthIndicator = 0;
312 SQLRETURN r = SQLGetData(hStmt,
315 (SQLPOINTER) &lngbuf,
318 if ((r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) || lengthIndicator == SQL_NULL_DATA)
327 SQLRETURN r = SQL_ERROR;
328 SQLINTEGER lengthIndicator = 0;
332 else if (colSize > 65536)
336 SQLTCHAR* buf =
new SQLTCHAR[colSize];
339 r = SQLGetData(hStmt,
343 colSize *
sizeof(SQLTCHAR),
345 if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
346 if (lengthIndicator == SQL_NULL_DATA || lengthIndicator == SQL_NO_TOTAL) {
352 }
else if (r == SQL_NO_DATA) {
355 qWarning(
"qGetStringData: Error while fetching data (%d)", r);
367 SQLSMALLINT colNameLen;
370 SQLSMALLINT colScale;
371 SQLSMALLINT nullable;
372 SQLRETURN r = SQL_ERROR;
375 r = SQLDescribeCol(hStmt,
384 if (r != SQL_SUCCESS)
385 qWarning(
"qGetBinaryData: Unable to describe column %d", column);
389 else if (colSize > 65536)
391 char * buf =
new char[colSize];
393 r = SQLGetData(hStmt,
395 colType == SQL_DBCLOB ? SQL_C_CHAR : SQL_C_BINARY,
399 if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
400 if (lengthIndicator == SQL_NULL_DATA) {
405 r == SQL_SUCCESS ? rSize = lengthIndicator : rSize = colSize;
406 if (lengthIndicator == SQL_NO_TOTAL)
409 if (r == SQL_SUCCESS)
423 if (!catalog || !schema || !table)
428 int i = 0, n = l.
count();
460 if (required == SQL_NO_NULLS)
462 else if (required == SQL_NULLABLE)
475 r = SQLAllocHandle(SQL_HANDLE_STMT,
478 if (r != SQL_SUCCESS) {
483 r = SQLFreeStmt(d->
hStmt, SQL_CLOSE);
484 if (r != SQL_SUCCESS) {
494 r = SQLSetStmtAttr(d->
hStmt,
495 SQL_ATTR_CURSOR_TYPE,
496 (SQLPOINTER) SQL_CURSOR_FORWARD_ONLY,
499 r = SQLSetStmtAttr(d->
hStmt,
500 SQL_ATTR_CURSOR_TYPE,
501 (SQLPOINTER) SQL_CURSOR_STATIC,
504 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
515 return QVariant(qRegisterMetaType<SQLHANDLE>(
"SQLHANDLE"), &
d->hStmt);
529 SQLRETURN r = SQLFreeHandle(SQL_HANDLE_STMT,
d->
hStmt);
530 if (r != SQL_SUCCESS)
549 r = SQLExecDirect(
d->
hStmt,
551 (SQLINTEGER) query.
length());
552 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
558 r = SQLNumResultCols(
d->
hStmt, &count);
561 for (
int i = 0; i < count; ++i) {
587 (SQLINTEGER) query.
length());
589 if (r != SQL_SUCCESS) {
602 memset(indicators.
data(), 0, indicators.
size() *
sizeof(SQLINTEGER));
616 for (i = 0; i < values.
count(); ++i) {
618 SQLINTEGER *ind = &indicators[i];
620 *ind = SQL_NULL_DATA;
624 switch (values.
at(i).
type()) {
627 ba.
resize(
sizeof(DATE_STRUCT));
628 DATE_STRUCT *dt = (DATE_STRUCT *)ba.
constData();
631 dt->month = qdt.
month();
633 r = SQLBindParameter(
d->
hStmt,
642 *ind == SQL_NULL_DATA ? ind : NULL);
647 ba.
resize(
sizeof(TIME_STRUCT));
648 TIME_STRUCT *dt = (TIME_STRUCT *)ba.
constData();
651 dt->minute = qdt.
minute();
652 dt->second = qdt.
second();
653 r = SQLBindParameter(
d->
hStmt,
662 *ind == SQL_NULL_DATA ? ind : NULL);
667 ba.
resize(
sizeof(TIMESTAMP_STRUCT));
668 TIMESTAMP_STRUCT * dt = (TIMESTAMP_STRUCT *)ba.
constData();
676 dt->fraction = qdt.
time().
msec() * 1000000;
677 r = SQLBindParameter(
d->
hStmt,
686 *ind == SQL_NULL_DATA ? ind : NULL);
690 r = SQLBindParameter(
d->
hStmt,
699 *ind == SQL_NULL_DATA ? ind : NULL);
702 r = SQLBindParameter(
d->
hStmt,
711 *ind == SQL_NULL_DATA ? ind : NULL);
715 if (*ind != SQL_NULL_DATA)
717 r = SQLBindParameter(
d->
hStmt,
731 if (*ind != SQL_NULL_DATA)
735 r = SQLBindParameter(
d->
hStmt,
747 void *
data = (
void*)str.utf16();
748 int len = str.length();
749 r = SQLBindParameter(
d->
hStmt,
764 int len = ba.
length() + 1;
765 if (*ind != SQL_NULL_DATA)
767 r = SQLBindParameter(
d->
hStmt,
780 if (r != SQL_SUCCESS) {
781 qWarning(
"QDB2Result::exec: unable to bind variable: %s",
790 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
791 qWarning(
"QDB2Result::exec: Unable to execute statement: %s",
798 r = SQLNumResultCols(
d->
hStmt, &count);
801 for (
int i = 0; i < count; ++i) {
815 for (i = 0; i < values.
count(); ++i) {
816 switch (values[i].
type()) {
828 QTime(dt.hour, dt.minute, dt.second, dt.fraction / 1000000)));
842 if (indicators[i] == SQL_NULL_DATA)
855 int actualIdx = i + 1;
856 if (actualIdx <= 0) {
863 while (ok && i >
at())
867 r = SQLFetchScroll(
d->
hStmt,
871 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r != SQL_NO_DATA) {
876 else if (r == SQL_NO_DATA)
886 r = SQLFetchScroll(
d->
hStmt,
889 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
890 if (r != SQL_NO_DATA)
907 r = SQLFetchScroll(
d->
hStmt,
910 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
954 qWarning(
"QDB2Result::data: column %d out of range", field);
958 SQLINTEGER lengthIndicator = 0;
970 switch (info.
type()) {
985 if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (lengthIndicator != SQL_NULL_DATA)) {
1000 if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (lengthIndicator != SQL_NULL_DATA)) {
1001 v =
new QVariant(
QTime(tbuf.hour, tbuf.minute, tbuf.second));
1008 TIMESTAMP_STRUCT dtbuf;
1012 (SQLPOINTER) &dtbuf,
1015 if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && (lengthIndicator != SQL_NULL_DATA)) {
1017 QTime(dtbuf.hour, dtbuf.minute, dtbuf.second, dtbuf.fraction / 1000000)));
1069 SQLINTEGER affectedRowCount = 0;
1070 SQLRETURN r = SQLRowCount(
d->
hStmt, &affectedRowCount);
1071 if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
1072 return affectedRowCount;
1098 SQLRETURN r = SQLMoreResults(
d->
hStmt);
1099 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
1100 if (r != SQL_NO_DATA) {
1107 SQLSMALLINT fieldCount;
1108 r = SQLNumResultCols(
d->
hStmt, &fieldCount);
1110 for (
int i = 0; i < fieldCount; ++i)
1129 SQLCloseCursor(
d->
hStmt);
1148 d->
hEnv = (SQLHANDLE)env;
1149 d->
hDbc = (SQLHANDLE)con;
1168 r = SQLAllocHandle(SQL_HANDLE_ENV,
1171 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
1177 r = SQLAllocHandle(SQL_HANDLE_DBC,
1180 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
1189 for (
int i = 0; i < opts.count(); ++i) {
1190 const QString tmp(opts.at(i));
1192 if ((idx = tmp.indexOf(
QLatin1Char(
'='))) == -1) {
1193 qWarning(
"QDB2Driver::open: Illegal connect option value '%s'",
1194 tmp.toLocal8Bit().constData());
1198 const QString opt(tmp.left(idx));
1199 const QString val(tmp.mid(idx + 1).simplified());
1205 v = SQL_MODE_READ_ONLY;
1207 v = SQL_MODE_READ_WRITE;
1209 qWarning(
"QDB2Driver::open: Unknown option value '%s'",
1210 tmp.toLocal8Bit().constData());
1213 r = SQLSetConnectAttr(
d->
hDbc, SQL_ATTR_ACCESS_MODE, (SQLPOINTER) v, 0);
1214 }
else if (opt ==
QLatin1String(
"SQL_ATTR_LOGIN_TIMEOUT")) {
1216 r = SQLSetConnectAttr(
d->
hDbc, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER) v, 0);
1221 qWarning(
"QDB2Driver::open: Unknown connection attribute '%s'",
1222 tmp.toLocal8Bit().constData());
1224 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO)
1226 "Unable to set connection attribute '%1'").arg(opt),
d);
1241 SQLTCHAR connOut[SQL_MAX_OPTION_STRING_LENGTH];
1244 r = SQLDriverConnect(
d->
hDbc,
1247 (SQLSMALLINT) connQStr.
length(),
1249 SQL_MAX_OPTION_STRING_LENGTH,
1251 SQL_DRIVER_NOPROMPT);
1252 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
1271 r = SQLDisconnect(
d->
hDbc);
1272 if (r != SQL_SUCCESS)
1275 r = SQLFreeHandle(SQL_HANDLE_DBC,
d->
hDbc);
1276 if (r != SQL_SUCCESS)
1282 r = SQLFreeHandle(SQL_HANDLE_ENV,
d->
hEnv);
1283 if (r != SQL_SUCCESS)
1303 QString catalog, schema, table;
1323 SQLRETURN r = SQLAllocHandle(SQL_HANDLE_STMT,
1326 if (r != SQL_SUCCESS) {
1331 r = SQLSetStmtAttr(hStmt,
1332 SQL_ATTR_CURSOR_TYPE,
1333 (SQLPOINTER) SQL_CURSOR_FORWARD_ONLY,
1339 r = SQLColumns(hStmt,
1349 if (r != SQL_SUCCESS)
1351 r = SQLFetchScroll(hStmt,
1354 while (r == SQL_SUCCESS) {
1356 r = SQLFetchScroll(hStmt,
1361 r = SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
1362 if (r != SQL_SUCCESS)
1377 SQLRETURN r = SQLAllocHandle(SQL_HANDLE_STMT,
1380 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
1384 r = SQLSetStmtAttr(hStmt,
1385 SQL_ATTR_CURSOR_TYPE,
1386 (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY,
1400 r = SQLTables(hStmt,
1410 if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO)
1412 r = SQLFetchScroll(hStmt,
1415 while (r == SQL_SUCCESS) {
1425 if (userVal != user)
1428 r = SQLFetchScroll(hStmt,
1433 r = SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
1434 if (r != SQL_SUCCESS)
1448 SQLRETURN r = SQLAllocHandle(SQL_HANDLE_STMT,
1451 if (r != SQL_SUCCESS) {
1455 QString catalog, schema, table;
1473 r = SQLSetStmtAttr(hStmt,
1474 SQL_ATTR_CURSOR_TYPE,
1475 (SQLPOINTER)SQL_CURSOR_FORWARD_ONLY,
1478 r = SQLPrimaryKeys(hStmt,
1485 r = SQLFetchScroll(hStmt,
1492 while (r == SQL_SUCCESS) {
1497 r = SQLFetchScroll(hStmt,
1501 r = SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
1502 if (r!= SQL_SUCCESS)
1535 qWarning(
"QDB2Driver::beginTransaction: Database not open");
1544 qWarning(
"QDB2Driver::commitTransaction: Database not open");
1547 SQLRETURN r = SQLEndTran(SQL_HANDLE_DBC,
1550 if (r != SQL_SUCCESS) {
1561 qWarning(
"QDB2Driver::rollbackTransaction: Database not open");
1564 SQLRETURN r = SQLEndTran(SQL_HANDLE_DBC,
1567 if (r != SQL_SUCCESS) {
1577 SQLUINTEGER ac = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
1578 SQLRETURN r = SQLSetConnectAttr(
d->
hDbc,
1579 SQL_ATTR_AUTOCOMMIT,
1582 if (r != SQL_SUCCESS) {
1595 switch (field.
type()) {
1619 static const char hexchars[] =
"0123456789abcdef";
1620 for (
int i = 0; i < ba.
size(); ++i) {
1635 return QVariant(qRegisterMetaType<SQLHANDLE>(
"SQLHANDLE"), &
d->
hDbc);
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
The QSqlError class provides SQL database error information.
The QSqlIndex class provides functions to manipulate and describe database indexes.
bool reset(const QString &query)
Sets the result to use the SQL statement query for subsequent data retrieval.
bool isValid() const
Returns true if the field's variant type is valid; otherwise returns false.
bool isActive() const
Returns true if the result has records to be retrieved; otherwise returns false.
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
virtual void setOpen(bool o)
This function sets the open state of the database to open.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
bool isForwardOnly() const
Returns true if you can only scroll forward through the result set; otherwise returns false...
DriverFeature
This enum contains a list of features a driver might support.
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
QVector< T > & fill(const T &t, int size=-1)
Assigns value to all items in the vector.
#define it(className, varName)
The QFlag class is a helper data type for QFlags.
virtual void setOpenError(bool e)
This function sets the open error state of the database to error.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
QByteArray & append(char c)
Appends the character ch to this byte array.
void append(const QSqlField &field)
Appends the field field to the list of indexed fields.
QVariant value() const
Returns the value of the field as a QVariant.
QString & replace(int i, int len, QChar after)
bool beginTransaction()
This function is called to begin a transaction.
The QByteArray class provides an array of bytes.
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
QString & prepend(QChar c)
QString toUpper() const Q_REQUIRED_RESULT
Returns an uppercase copy of the string.
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
static bool qMakeStatement(QDB2ResultPrivate *d, bool forwardOnly, bool setForwardOnly=true)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
QDB2Result(const QDB2Driver *dr, const QDB2DriverPrivate *dp)
void setPrecision(int precision)
Sets the field's precision.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
int day() const
Returns the day of the month (1 to 31) of this date.
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
The QDate class provides date functions.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool rollbackTransaction()
This function is called to rollback a transaction.
int msec() const
Returns the millisecond part (0 to 999) of the time.
bool fetchLast()
Positions the result to the last record (last row) in the result.
int numRowsAffected()
Returns the number of rows affected by the last query executed, or -1 if it cannot be determined or i...
int count(const T &t) const
Returns the number of occurrences of value in the list.
int size()
Returns the size of the SELECT result, or -1 if it cannot be determined or if the query is not a SELE...
virtual bool isOpen() const
Returns true if the database connection is open; otherwise returns false.
The QSqlRecord class encapsulates a database record.
bool isNull(int i)
Returns true if the field at position index in the current row is null; otherwise returns false...
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const
static QByteArray qGetBinaryData(SQLHANDLE hStmt, int column, SQLINTEGER &lengthIndicator, bool &isNull)
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
The QString class provides a Unicode character string.
int at() const
Returns the current (zero-based) row position of the result.
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
static QString qWarnDB2Handle(int handleType, SQLHANDLE handle)
static SQLBIGINT qGetBigIntData(SQLHANDLE hStmt, int column, bool &isNull)
QSqlRecord record() const
Returns the current record if the query is active; otherwise returns an empty QSqlRecord.
The QChar class provides a 16-bit Unicode character.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
static SQLTCHAR * qToTChar(const QString &str)
iterator Iterator
Qt-style synonym for QList::iterator.
const QDB2DriverPrivate * dp
virtual void setAt(int at)
This function is provided for derived classes to set the internal (zero-based) row position to index...
void resize(int size)
Sets the size of the vector to size.
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
virtual void setLastError(const QSqlError &e)
This function is provided for derived classes to set the last error to error.
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const
Returns whether identifier is escaped according to the database rules.
bool setAutoCommit(bool autoCommit)
ErrorType
This enum type describes the context in which the error occurred, e.
void append(const T &t)
Inserts value at the end of the list.
The QTime class provides clock time functions.
#define QT_BEGIN_NAMESPACE
This macro expands to.
virtual void setSelect(bool s)
This function is provided for derived classes to indicate whether or not the current statement is a S...
QVariant data(int field)
Returns the data for field index in the current row as a QVariant.
T takeFirst()
Removes the first item in the list and returns it.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
QSqlIndex primaryIndex(const QString &tablename) const
Returns the primary index for table tableName.
The QStringList class provides a list of strings.
bool hasOutValues() const
Returns true if at least one of the query's bound values is a QSql::Out or a QSql::InOut; otherwise r...
void setLength(int fieldLength)
Sets the field's length to fieldLength.
QSql::ParamType bindValueType(const QString &placeholder) const
Returns the parameter type for the value bound with the given placeholder name.
bool prepare(const QString &query)
Prepares the given query for execution; the query will normally use placeholders so that it can be ex...
static void qSqlWarning(const QString &message, const QDB2DriverPrivate *d)
Q_CORE_EXPORT void qWarning(const char *,...)
int second() const
Returns the second part (0 to 59) of the time.
void setName(const QString &name)
Sets the name of the index to name.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
bool exec()
Executes the query, returning true if successful; otherwise returns false.
Type
This enum type defines the types of variable that a QVariant can contain.
int minute() const
Returns the minute part (0 to 59) of the time.
QVariant::Type type() const
Returns the field's type as stored in the database.
bool fetch(int i)
Positions the result to an arbitrary (zero-based) row index.
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
QSqlField field(int i) const
Returns the field at position index.
virtual void virtual_hook(int id, void *data)
static QString qDB2Warn(const QDB2DriverPrivate *d)
const T & at(int i) const
Returns the item at index position i in the vector.
static QVariant::Type qDecodeDB2Type(SQLSMALLINT sqltype)
static const SQLSMALLINT qParamType[4]
int length() const
Same as size().
QSqlResult * createResult() const
Creates an empty SQL result on the database.
const char * constData() const
Returns a pointer to the data stored in the byte array.
QDate date() const
Returns the date part of the datetime.
int length() const
Returns the field's length.
QDate toDate() const
Returns the variant as a QDate if the variant has type() Date , DateTime , or String ; otherwise retu...
int count() const
Returns the number of fields in the record.
void setRequired(bool required)
Sets the required status of this field to Required if required is true; otherwise sets it to Optional...
QString & append(QChar c)
static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool &isNull)
The QDateTime class provides date and time functions.
QStringList tables(QSql::TableType type) const
Returns a list of the names of the tables in the database.
void clear()
Clears the contents of the string and makes it empty.
static QSqlError qMakeError(const QString &err, QSqlError::ErrorType type, const QDB2DriverPrivate *p)
static QSqlField qMakeFieldInfo(const QDB2ResultPrivate *d, int i)
QDB2Driver(QObject *parent=0)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
QVector< QVariant * > valueCache
Type type() const
Returns the storage type of the value stored in the variant.
bool fetchNext()
Positions the result to the next available record (row) in the result.
QObject * parent() const
Returns a pointer to the parent object.
bool open(const QString &db, const QString &user, const QString &password, const QString &host, int port, const QString &connOpts)
Derived classes must reimplement this pure virtual function to open a database connection on database...
bool fetchFirst()
Positions the result to the first record (row 0) in the result.
bool isNull() const
Returns true if the field's value is NULL; otherwise returns false.
const void * constData() const
virtual QString formatValue(const QSqlField &field, bool trimStrings=false) const
Returns a string representation of the field value for the database.
QString formatValue(const QSqlField &field, bool trimStrings) const
Returns a string representation of the field value for the database.
void resize(int size)
Sets the size of the byte array to size bytes.
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
QVariant handle() const
Returns the low-level database handle wrapped in a QVariant or an invalid variant if there is no hand...
if(void) toggleToolbarShown
void append(const QSqlField &field)
Append a copy of field field to the end of the record.
void virtual_hook(int id, void *data)
int size() const
Returns the number of bytes in this byte array.
virtual void setActive(bool a)
This function is provided for derived classes to set the internal active state to active...
void clear()
Removes all the record's fields.
QString escapeIdentifier(const QString &identifier, IdentifierType type) const
Returns the identifier escaped according to the database rules.
bool commitTransaction()
This function is called to commit a transaction.
void close()
Derived classes must reimplement this pure virtual function in order to close the database connection...
int year() const
Returns the year of this date.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
QTime time() const
Returns the time part of the datetime.
QTime toTime() const
Returns the variant as a QTime if the variant has type() Time , DateTime , or String ; otherwise retu...
bool hasFeature(DriverFeature) const
Returns true if the driver supports feature feature; otherwise returns false.
The QSqlField class manipulates the fields in SQL database tables and views.
static double qGetDoubleData(SQLHANDLE hStmt, int column, bool &isNull)
virtual void setLastError(const QSqlError &e)
This function is used to set the value of the last error, error, that occurred on the database...
QString stripDelimiters(const QString &identifier, IdentifierType type) const
Returns the identifier with the leading and trailing delimiters removed, identifier can either be a t...
QVector< QVariant > & boundValues() const
Returns a vector of the result's bound values for the current record (row).
static const int COLNAMESIZE
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
QDB2ResultPrivate(const QDB2DriverPrivate *d)
QVariant handle() const
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVarian...
QSqlRecord record(const QString &tableName) const
Returns a QSqlRecord populated with the names of the fields in table tableName.
static QString qFromTChar(SQLTCHAR *str)
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases...
int size() const
Returns the number of items in the vector.
static int qGetIntData(SQLHANDLE hStmt, int column, bool &isNull)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
IdentifierType
This enum contains a list of SQL identifier types.
static bool isNull(const QVariant::Private *d)
static void qSplitTableQualifier(const QString &qualifier, QString *catalog, QString *schema, QString *table)
int hour() const
Returns the hour part (0 to 23) of the time.
void setSqlType(int type)
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.