KDb

KDbConnectionProxy.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2016 Jarosław Staniek <staniek@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KDbConnectionProxy.h"
21#include "KDbConnectionData.h"
22#include "KDbProperties.h"
23#include "KDbVersionInfo.h"
24
25class Q_DECL_HIDDEN KDbConnectionProxy::Private
26{
27public:
28 Private()
29 : connectionIsOwned(true)
30 {
31 }
32 ~Private() {
33 if (connectionIsOwned) {
34 connection->disconnect();
35 delete connection;
36 }
37 }
38 bool connectionIsOwned;
39 KDbConnection *connection;
40private:
41 Q_DISABLE_COPY(Private)
42};
43
45 : KDbConnection(parentConnection->driver(), parentConnection->data(), *parentConnection->options())
46 , d(new Private)
47{
48 Q_ASSERT(parentConnection);
49 d->connection = parentConnection;
50}
51
56
58{
59 return d->connection;
60}
61
63{
64 return d->connection;
65}
66
68{
69 d->connectionIsOwned = set;
70}
71
72KDbConnectionData KDbConnectionProxy::data() const
73{
74 return d->connection->data();
75}
76
77KDbDriver* KDbConnectionProxy::driver() const
78{
79 return d->connection->driver();
80}
81
82bool KDbConnectionProxy::connect()
83{
84 return d->connection->connect();
85}
86
87bool KDbConnectionProxy::isConnected() const
88{
89 return d->connection->isConnected();
90}
91
92bool KDbConnectionProxy::isDatabaseUsed() const
93{
94 return d->connection->isDatabaseUsed();
95}
96
97KDbConnectionOptions* KDbConnectionProxy::options()
98{
99 return d->connection->options();
100}
101
102void KDbConnectionProxy::clearResult()
103{
104 d->connection->clearResult();
105}
106
107KDbResult KDbConnectionProxy::result() const
108{
109 return d->connection->result();
110}
111
112KDbResultable KDbConnectionProxy::resultable() const
113{
114 return *d->connection;
115}
116
117bool KDbConnectionProxy::disconnect()
118{
119 return d->connection->disconnect();
120}
121
122QStringList KDbConnectionProxy::databaseNames(bool also_system_db)
123{
124 return d->connection->databaseNames(also_system_db);
125}
126
127bool KDbConnectionProxy::databaseExists(const QString &dbName, bool ignoreErrors)
128{
129 return d->connection->databaseExists(dbName, ignoreErrors);
130}
131
132bool KDbConnectionProxy::createDatabase(const QString &dbName)
133{
134 return d->connection->createDatabase(dbName);
135}
136
137bool KDbConnectionProxy::useDatabase(const QString &dbName, bool kexiCompatible, bool *cancelled,
138 KDbMessageHandler* msgHandler)
139{
140 return d->connection->useDatabase(dbName, kexiCompatible, cancelled, msgHandler);
141}
142
143bool KDbConnectionProxy::closeDatabase()
144{
145 return d->connection->closeDatabase();
146}
147
148QString KDbConnectionProxy::currentDatabase() const
149{
150 return d->connection->currentDatabase();
151}
152
153bool KDbConnectionProxy::dropDatabase(const QString &dbName)
154{
155 return d->connection->dropDatabase(dbName);
156}
157
158QStringList KDbConnectionProxy::objectNames(int objectType, bool* ok)
159{
160 return d->connection->objectNames(objectType, ok);
161}
162
163QStringList KDbConnectionProxy::tableNames(bool alsoSystemTables, bool* ok)
164{
165 return d->connection->tableNames(alsoSystemTables, ok);
166}
167
168tristate KDbConnectionProxy::containsTable(const QString &tableName)
169{
170 return d->connection->containsTable(tableName);
171}
172
173KDbServerVersionInfo KDbConnectionProxy::serverVersion() const
174{
175 return d->connection->serverVersion();
176}
177
178KDbVersionInfo KDbConnectionProxy::databaseVersion() const
179{
180 return d->connection->databaseVersion();
181}
182
183KDbProperties KDbConnectionProxy::databaseProperties() const
184{
185 return d->connection->databaseProperties();
186}
187
188QList<int> KDbConnectionProxy::tableIds(bool* ok)
189{
190 return d->connection->tableIds(ok);
191}
192
193QList<int> KDbConnectionProxy::queryIds(bool* ok)
194{
195 return d->connection->queryIds(ok);
196}
197
198QList<int> KDbConnectionProxy::objectIds(int objectType, bool* ok)
199{
200 return d->connection->objectIds(objectType, ok);
201}
202
203KDbTransaction KDbConnectionProxy::beginTransaction()
204{
205 return d->connection->beginTransaction();
206}
207
208bool KDbConnectionProxy::commitTransaction(KDbTransaction trans,
210{
211 return d->connection->commitTransaction(trans, options);
212}
213
214bool KDbConnectionProxy::rollbackTransaction(KDbTransaction trans,
216{
217 return d->connection->rollbackTransaction(trans, options);
218}
219
220KDbTransaction KDbConnectionProxy::defaultTransaction() const
221{
222 return d->connection->defaultTransaction();
223}
224
225void KDbConnectionProxy::setDefaultTransaction(const KDbTransaction& trans)
226{
227 d->connection->setDefaultTransaction(trans);
228}
229
230QList<KDbTransaction> KDbConnectionProxy::transactions()
231{
232 return d->connection->transactions();
233}
234
235bool KDbConnectionProxy::autoCommit() const
236{
237 return d->connection->autoCommit();
238}
239
240bool KDbConnectionProxy::setAutoCommit(bool on)
241{
242 return d->connection->setAutoCommit(on);
243}
244
246{
247 return d->connection->escapeString(str);
248}
249
251{
252 return d->connection->prepareQuery(sql, options);
253}
254
256{
257 return d->connection->prepareQuery(query, options);
258}
259
261{
262 return d->connection->prepareQuery(table, options);
263}
264
265KDbCursor* KDbConnectionProxy::executeQuery(const KDbEscapedString& sql, KDbCursor::Options options)
266{
267 return d->connection->executeQuery(sql, options);
268}
269
270KDbCursor* KDbConnectionProxy::executeQuery(KDbQuerySchema* query, const QList<QVariant>& params,
271 KDbCursor::Options options)
272{
273 return d->connection->executeQuery(query, params, options);
274}
275
276KDbCursor* KDbConnectionProxy::executeQuery(KDbQuerySchema* query, KDbCursor::Options options)
277{
278 return d->connection->executeQuery(query, options);
279}
280
281KDbCursor* KDbConnectionProxy::executeQuery(KDbTableSchema* table, KDbCursor::Options options)
282{
283 return d->connection->executeQuery(table, options);
284}
285
286bool KDbConnectionProxy::deleteCursor(KDbCursor *cursor)
287{
288 return d->connection->deleteCursor(cursor);
289}
290
291KDbTableSchema* KDbConnectionProxy::tableSchema(int tableId)
292{
293 return d->connection->tableSchema(tableId);
294}
295
296KDbTableSchema* KDbConnectionProxy::tableSchema(const QString& tableName)
297{
298 return d->connection->tableSchema(tableName);
299}
300
301KDbQuerySchema* KDbConnectionProxy::querySchema(int queryId)
302{
303 return d->connection->querySchema(queryId);
304}
305
306KDbQuerySchema* KDbConnectionProxy::querySchema(const QString& queryName)
307{
308 return d->connection->querySchema(queryName);
309}
310
311bool KDbConnectionProxy::setQuerySchemaObsolete(const QString& queryName)
312{
313 return d->connection->setQuerySchemaObsolete(queryName);
314}
315
316tristate KDbConnectionProxy::querySingleRecord(const KDbEscapedString &sql, KDbRecordData *data,
317 QueryRecordOptions options)
318{
319 return d->connection->querySingleRecord(sql, data, options);
320}
321
322tristate KDbConnectionProxy::querySingleRecord(KDbQuerySchema* query, KDbRecordData* data,
323 QueryRecordOptions options)
324{
325 return d->connection->querySingleRecord(query, data, options);
326}
327
328tristate KDbConnectionProxy::querySingleRecord(KDbQuerySchema* query, KDbRecordData* data,
329 const QList<QVariant>& params, QueryRecordOptions options)
330{
331 return d->connection->querySingleRecord(query, data, params, options);
332}
333
334tristate KDbConnectionProxy::querySingleString(const KDbEscapedString& sql, QString* value, int column,
335 QueryRecordOptions options)
336{
337 return d->connection->querySingleString(sql, value, column, options);
338}
339
340tristate KDbConnectionProxy::querySingleString(KDbQuerySchema* query, QString* value, int column,
341 QueryRecordOptions options)
342{
343 return d->connection->querySingleString(query, value, column, options);
344}
345
346tristate KDbConnectionProxy::querySingleString(KDbQuerySchema* query, QString* value,
347 const QList<QVariant>& params, int column,
348 QueryRecordOptions options)
349{
350 return d->connection->querySingleString(query, value, params, column, options);
351}
352
353tristate KDbConnectionProxy::querySingleNumber(const KDbEscapedString& sql, int* number, int column,
354 QueryRecordOptions options)
355{
356 return d->connection->querySingleNumber(sql, number, column, options);
357}
358
359 tristate KDbConnectionProxy::querySingleNumber(KDbQuerySchema* query, int* number, int column,
360 QueryRecordOptions options)
361 {
362 return d->connection->querySingleNumber(query, number, column, options);
363 }
364
365tristate KDbConnectionProxy::querySingleNumber(KDbQuerySchema* query, int* number,
366 const QList<QVariant>& params, int column,
367 QueryRecordOptions options)
368{
369 return d->connection->querySingleNumber(query, number, params, column, options);
370}
371
372bool KDbConnectionProxy::queryStringList(const KDbEscapedString& sql, QStringList* list, int column)
373{
374 return d->connection->queryStringList(sql, list, column);
375}
376
377bool KDbConnectionProxy::queryStringList(KDbQuerySchema* query, QStringList* list, int column)
378{
379 return d->connection->queryStringList(query, list, column);
380}
381
382bool KDbConnectionProxy::queryStringList(KDbQuerySchema* query, QStringList* list,
383 const QList<QVariant>& params, int column)
384{
385 return d->connection->queryStringList(query, list, params, column);
386}
387
388tristate KDbConnectionProxy::resultExists(const KDbEscapedString& sql, QueryRecordOptions options)
389{
390 return d->connection->resultExists(sql, options);
391}
392
393tristate KDbConnectionProxy::isEmpty(KDbTableSchema* table)
394{
395 return d->connection->isEmpty(table);
396}
397
399{
400 return d->connection->recentSqlString();
401}
402
403//PROTOTYPE:
404#define A , const QVariant&
405#define H_INS_REC(args, ...) bool KDbConnectionProxy::insertRecord(KDbTableSchema* tableSchema args) \
406{ \
407 return d->connection->insertRecord(tableSchema, __VA_ARGS__); \
408}
409#define H_INS_REC_ALL \
410H_INS_REC(A a1, a1) \
411H_INS_REC(A a1 A a2, a1, a2) \
412H_INS_REC(A a1 A a2 A a3, a1, a2, a3) \
413H_INS_REC(A a1 A a2 A a3 A a4, a1, a2, a3, a4) \
414H_INS_REC(A a1 A a2 A a3 A a4 A a5, a1, a2, a3, a4, a5) \
415H_INS_REC(A a1 A a2 A a3 A a4 A a5 A a6, a1, a2, a3, a4, a5, a6) \
416H_INS_REC(A a1 A a2 A a3 A a4 A a5 A a6 A a7, a1, a2, a3, a4, a5, a6, a7) \
417H_INS_REC(A a1 A a2 A a3 A a4 A a5 A a6 A a7 A a8, a1, a2, a3, a4, a5, a6, a7, a8)
418H_INS_REC_ALL
419
420#undef H_INS_REC
421#define H_INS_REC(args, ...) bool KDbConnectionProxy::insertRecord(KDbFieldList* fields args) \
422{ \
423 return d->connection->insertRecord(fields, __VA_ARGS__); \
424}
425
426H_INS_REC_ALL
427#undef H_INS_REC_ALL
428#undef H_INS_REC
429#undef A
430
431bool KDbConnectionProxy::insertRecord(KDbTableSchema* tableSchema, const QList<QVariant>& values)
432{
433 return d->connection->insertRecord(tableSchema, values);
434}
435
436bool KDbConnectionProxy::insertRecord(KDbFieldList* fields, const QList<QVariant>& values)
437{
438 return d->connection->insertRecord(fields, values);
439}
440
441bool KDbConnectionProxy::createTable(KDbTableSchema* tableSchema, CreateTableOptions options)
442{
443 return d->connection->createTable(tableSchema, options);
444}
445
446KDbTableSchema *KDbConnectionProxy::copyTable(const KDbTableSchema &tableSchema, const KDbObject &newData)
447{
448 return d->connection->copyTable(tableSchema, newData);
449}
450
451KDbTableSchema *KDbConnectionProxy::copyTable(const QString& tableName, const KDbObject &newData)
452{
453 return d->connection->copyTable(tableName, newData);
454}
455
456tristate KDbConnectionProxy::dropTable(KDbTableSchema* tableSchema)
457{
458 return d->connection->dropTable(tableSchema);
459}
460
461tristate KDbConnectionProxy::dropTable(const QString& tableName)
462{
463 return d->connection->dropTable(tableName);
464}
465
466tristate KDbConnectionProxy::alterTable(KDbTableSchema* tableSchema, KDbTableSchema* newTableSchema)
467{
468 return d->connection->alterTable(tableSchema, newTableSchema);
469}
470
471bool KDbConnectionProxy::alterTableName(KDbTableSchema* tableSchema, const QString& newName,
472 AlterTableNameOptions options)
473{
474 return d->connection->alterTableName(tableSchema, newName, options);
475}
476
477bool KDbConnectionProxy::dropQuery(KDbQuerySchema* querySchema)
478{
479 return d->connection->dropQuery(querySchema);
480}
481
482bool KDbConnectionProxy::dropQuery(const QString& queryName)
483{
484 return d->connection->dropQuery(queryName);
485}
486
487bool KDbConnectionProxy::removeObject(int objId)
488{
489 return d->connection->removeObject(objId);
490}
491
492KDbField* KDbConnectionProxy::findSystemFieldName(const KDbFieldList& fieldlist)
493{
494 return d->connection->findSystemFieldName(fieldlist);
495}
496
501
502void KDbConnectionProxy::setAvailableDatabaseName(const QString& dbName)
503{
504 d->connection->setAvailableDatabaseName(dbName);
505}
506
507bool KDbConnectionProxy::useTemporaryDatabaseIfNeeded(QString* name)
508{
509 return d->connection->useTemporaryDatabaseIfNeeded(name);
510}
511
512QSharedPointer<KDbSqlResult> KDbConnectionProxy::prepareSql(const KDbEscapedString& sql)
513{
514 return d->connection->prepareSql(sql);
515}
516
517bool KDbConnectionProxy::executeSql(const KDbEscapedString& sql)
518{
519 return d->connection->executeSql(sql);
520}
521
522bool KDbConnectionProxy::storeObjectData(KDbObject* object)
523{
524 return d->connection->storeObjectData(object);
525}
526
527bool KDbConnectionProxy::storeNewObjectData(KDbObject* object)
528{
529 return d->connection->storeNewObjectData(object);
530}
531
533{
534 return d->connection->loadObjectData(type, id, object);
535}
536
537tristate KDbConnectionProxy::loadObjectData(int type, const QString& name, KDbObject* object)
538{
539 return d->connection->loadObjectData(type, name, object);
540}
541
542tristate KDbConnectionProxy::loadDataBlock(int objectID, QString* dataString, const QString& dataID)
543{
544 return d->connection->loadDataBlock(objectID, dataString, dataID);
545}
546
547bool KDbConnectionProxy::storeDataBlock(int objectID, const QString &dataString,
548 const QString& dataID)
549{
550 return d->connection->storeDataBlock(objectID, dataString, dataID);
551}
552
553bool KDbConnectionProxy::copyDataBlock(int sourceObjectID, int destObjectID, const QString& dataID)
554{
555 return d->connection->copyDataBlock(sourceObjectID, destObjectID, dataID);
556}
557
558bool KDbConnectionProxy::removeDataBlock(int objectID, const QString& dataID)
559{
560 return d->connection->removeDataBlock(objectID, dataID);
561}
562
563KDbPreparedStatement KDbConnectionProxy::prepareStatement(KDbPreparedStatement::Type type,
564 KDbFieldList* fields, const QStringList& whereFieldNames)
565{
566 return d->connection->prepareStatement(type, fields, whereFieldNames);
567}
568
569bool KDbConnectionProxy::isInternalTableSchema(const QString& tableName)
570{
571 return d->connection->isInternalTableSchema(tableName);
572}
573
575{
576 return d->connection->escapeIdentifier(id);
577}
578
580{
581 return d->connection->drv_connect();
582}
583
585{
586 return d->connection->drv_disconnect();
587}
588
590{
591 return d->connection->drv_getServerVersion(version);
592}
593
595{
596 Q_ASSERT(ok);
597 return d->connection->drv_getTableNames(ok);
598}
599
601{
602 return d->connection->drv_containsTable(tableName);
603}
604
606{
607 return d->connection->drv_createTable(tableSchema);
608}
609
611{
612 return d->connection->drv_alterTableName(tableSchema, newName);
613}
614
616 const KDbTableSchema &destinationTableSchema)
617{
618 return d->connection->drv_copyTableData(tableSchema, destinationTableSchema);
619}
620
622{
623 return d->connection->drv_dropTable(tableName);
624}
625
626tristate KDbConnectionProxy::dropTableInternal(KDbTableSchema* tableSchema, bool alsoRemoveSchema)
627{
628 return d->connection->dropTableInternal(tableSchema, alsoRemoveSchema);
629}
630
631bool KDbConnectionProxy::setupObjectData(const KDbRecordData& data, KDbObject* object)
632{
633 return d->connection->setupObjectData(data, object);
634}
635
636KDbField* KDbConnectionProxy::setupField(const KDbRecordData& data)
637{
638 return d->connection->setupField(data);
639}
640
642{
643 return d->connection->drv_prepareSql(sql);
644}
645
647{
648 return d->connection->drv_executeSql(sql);
649}
650
652{
653 return d->connection->drv_getDatabasesList(list);
654}
655
656bool KDbConnectionProxy::drv_databaseExists(const QString &dbName, bool ignoreErrors)
657{
658 return d->connection->drv_databaseExists(dbName, ignoreErrors);
659}
660
662{
663 return d->connection->drv_createDatabase(dbName);
664}
665
666bool KDbConnectionProxy::drv_useDatabase(const QString &dbName, bool *cancelled,
667 KDbMessageHandler* msgHandler)
668{
669 return d->connection->drv_useDatabase(dbName, cancelled, msgHandler);
670}
671
673{
674 return d->connection->drv_closeDatabase();
675}
676
678{
679 return d->connection->drv_isDatabaseUsed();
680}
681
683{
684 return d->connection->drv_dropDatabase(dbName);
685}
686
688{
689 return d->connection->drv_createTable(tableName);
690}
691
696
698{
699 return d->connection->drv_commitTransaction(trans);
700}
701
703{
704 return d->connection->drv_rollbackTransaction(trans);
705}
706
708{
709 return d->connection->drv_beforeInsert(tableName, fields);
710}
711
713{
714 return d->connection->drv_afterInsert(tableName, fields);
715}
716
718{
719 return d->connection->drv_beforeUpdate(tableName, fields);
720}
721
723{
724 return d->connection->drv_afterUpdate(tableName, fields);
725}
726
728{
729 return d->connection->drv_setAutoCommit(on);
730}
731
736
737bool KDbConnectionProxy::beginAutoCommitTransaction(KDbTransactionGuard* tg)
738{
739 return d->connection->beginAutoCommitTransaction(tg);
740}
741
742bool KDbConnectionProxy::commitAutoCommitTransaction(const KDbTransaction& trans)
743{
744 return d->connection->commitAutoCommitTransaction(trans);
745}
746
747bool KDbConnectionProxy::rollbackAutoCommitTransaction(const KDbTransaction& trans)
748{
749 return d->connection->rollbackAutoCommitTransaction(trans);
750}
751
752bool KDbConnectionProxy::checkConnected()
753{
754 return d->connection->checkConnected();
755}
756
757bool KDbConnectionProxy::checkIsDatabaseUsed()
758{
759 return d->connection->checkIsDatabaseUsed();
760}
761
762bool KDbConnectionProxy::updateRecord(KDbQuerySchema* query, KDbRecordData* data, KDbRecordEditBuffer* buf, bool useRecordId)
763{
764 return d->connection->updateRecord(query, data, buf, useRecordId);
765}
766
767bool KDbConnectionProxy::insertRecord(KDbQuerySchema* query, KDbRecordData* data, KDbRecordEditBuffer* buf, bool getRecordId)
768{
769 return d->connection->insertRecord(query, data, buf, getRecordId);
770}
771
772bool KDbConnectionProxy::deleteRecord(KDbQuerySchema* query, KDbRecordData* data, bool useRecordId)
773{
774 return d->connection->deleteRecord(query, data, useRecordId);
775}
776
777bool KDbConnectionProxy::deleteAllRecords(KDbQuerySchema* query)
778{
779 return d->connection->deleteAllRecords(query);
780}
781
782bool KDbConnectionProxy::checkIfColumnExists(KDbCursor *cursor, int column)
783{
784 return d->connection->checkIfColumnExists(cursor, column);
785}
786
787tristate KDbConnectionProxy::querySingleRecordInternal(KDbRecordData* data, const KDbEscapedString* sql,
788 KDbQuerySchema* query, const QList<QVariant>* params,
789 QueryRecordOptions options)
790{
791 return d->connection->querySingleRecordInternal(data, sql, query, params, options);
792}
793
794tristate KDbConnectionProxy::querySingleStringInternal(const KDbEscapedString* sql, QString* value,
795 KDbQuerySchema* query, const QList<QVariant>* params,
796 int column, QueryRecordOptions options)
797{
798 return d->connection->querySingleStringInternal(sql, value, query, params, column, options);
799}
800
801tristate KDbConnectionProxy::querySingleNumberInternal(const KDbEscapedString* sql, int* number,
802 KDbQuerySchema* query, const QList<QVariant>* params,
803 int column, QueryRecordOptions options)
804{
805 return d->connection->querySingleNumberInternal(sql, number, query, params, column, options);
806}
807
808bool KDbConnectionProxy::queryStringListInternal(const KDbEscapedString *sql, QStringList* list,
809 KDbQuerySchema* query, const QList<QVariant>* params,
810 int column, bool (*filterFunction)(const QString&))
811{
812 return d->connection->queryStringListInternal(sql, list, query, params, column, filterFunction);
813}
814
815KDbCursor* KDbConnectionProxy::executeQueryInternal(const KDbEscapedString& sql, KDbQuerySchema* query,
816 const QList<QVariant>* params)
817{
818 return d->connection->executeQueryInternal(sql, query, params);
819}
820
821bool KDbConnectionProxy::loadExtendedTableSchemaData(KDbTableSchema* tableSchema)
822{
823 return d->connection->loadExtendedTableSchemaData(tableSchema);
824}
825
826bool KDbConnectionProxy::storeExtendedTableSchemaData(KDbTableSchema* tableSchema)
827{
828 return d->connection->storeExtendedTableSchemaData(tableSchema);
829}
830
831bool KDbConnectionProxy::storeMainFieldSchema(KDbField *field)
832{
833 return d->connection->storeMainFieldSchema(field);
834}
Database specific connection data, e.g. host, port.
Generic options for a single connection. The options are accessible using key/value pairs....
The KDbConnectionProxy class gives access to protected (low-level) API of KDbConnection.
QStringList drv_getTableNames(bool *ok) override
bool drv_beforeUpdate(const QString &tableName, KDbFieldList *fields) override
bool drv_dropDatabase(const QString &dbName=QString()) override
bool drv_executeSql(const KDbEscapedString &sql) override
Executes query for a raw SQL statement sql without returning resulting records.
bool drv_connect() override
bool drv_beforeInsert(const QString &tableName, KDbFieldList *fields) override
tristate drv_containsTable(const QString &tableName) override
bool drv_closeDatabase() override
KDbEscapedString recentSqlString() const override
Return recently used SQL string.
bool drv_getDatabasesList(QStringList *list) override
~KDbConnectionProxy() override
Deletes this proxy. Owned connection is closed and destroyed.
bool drv_afterUpdate(const QString &tableName, KDbFieldList *fields) override
KDbCursor * prepareQuery(const KDbEscapedString &sql, KDbCursor::Options options=KDbCursor::Option::None) override
QString anyAvailableDatabaseName() override
bool drv_copyTableData(const KDbTableSchema &tableSchema, const KDbTableSchema &destinationTableSchema) override
QString escapeIdentifier(const QString &id) const override
Identifier escaping function in the associated KDbDriver.
bool drv_setAutoCommit(bool on) override
bool drv_dropTable(const QString &tableName) override
bool drv_alterTableName(KDbTableSchema *tableSchema, const QString &newName) override
void setParentConnectionIsOwned(bool set)
Control owhership of parent connection that is assigned to this proxy.
KDbConnection * parentConnection()
bool drv_disconnect() override
bool drv_useDatabase(const QString &dbName=QString(), bool *cancelled=nullptr, KDbMessageHandler *msgHandler=nullptr) override
bool drv_getServerVersion(KDbServerVersionInfo *version) override
KDbSqlResult * drv_prepareSql(const KDbEscapedString &sql) override
Prepares query for a raw SQL statement sql with possibility of returning records.
KDbTransactionData * drv_beginTransaction() override
bool drv_rollbackTransaction(KDbTransactionData *trans) override
bool drv_isDatabaseUsed() const override
bool drv_createDatabase(const QString &dbName=QString()) override
bool drv_afterInsert(const QString &tableName, KDbFieldList *fields) override
bool drv_commitTransaction(KDbTransactionData *trans) override
bool drv_createTable(const KDbTableSchema &tableSchema) override
Creates table using tableSchema information.
bool drv_databaseExists(const QString &dbName, bool ignoreErrors=true) override
tristate loadObjectData(int type, int id, KDbObject *object)
KDbPreparedStatementInterface * prepareStatementInternal() override
KDbConnectionProxy(KDbConnection *connection)
Creates a proxy object for parent connection.
KDbEscapedString escapeString(const QString &str) const override
Provides database connection, allowing queries and data modification.
bool connect()
Connects to driver with given parameters.
virtual QStringList drv_getTableNames(bool *ok)
LOW LEVEL METHOD.
bool updateRecord(KDbQuerySchema *query, KDbRecordData *data, KDbRecordEditBuffer *buf, bool useRecordId=false)
virtual KDbEscapedString escapeString(const QString &str) const
bool removeObject(int objId)
tristate loadObjectData(int type, int id, KDbObject *object)
tristate loadDataBlock(int objectID, QString *dataString, const QString &dataID=QString())
KDbField * setupField(const KDbRecordData &data)
virtual bool drv_setAutoCommit(bool on)
KDbTableSchema * copyTable(const KDbTableSchema &tableSchema, const KDbObject &newData)
bool databaseExists(const QString &dbName, bool ignoreErrors=true)
bool queryStringList(const KDbEscapedString &sql, QStringList *list, int column=0)
bool removeDataBlock(int objectID, const QString &dataID=QString())
virtual bool drv_closeDatabase()=0
virtual KDbPreparedStatementInterface * prepareStatementInternal()=0
bool storeMainFieldSchema(KDbField *field)
void setAvailableDatabaseName(const QString &dbName)
bool setQuerySchemaObsolete(const QString &queryName)
QList< int > tableIds(bool *ok=nullptr)
KDbProperties databaseProperties() const
KDbPreparedStatement prepareStatement(KDbPreparedStatement::Type type, KDbFieldList *fields, const QStringList &whereFieldNames=QStringList())
bool commitAutoCommitTransaction(const KDbTransaction &trans)
tristate querySingleString(const KDbEscapedString &sql, QString *value, int column=0, QueryRecordOptions options=QueryRecordOption::Default)
virtual bool drv_getServerVersion(KDbServerVersionInfo *version)=0
KDbCursor * executeQuery(const KDbEscapedString &sql, KDbCursor::Options options=KDbCursor::Option::None)
virtual bool drv_alterTableName(KDbTableSchema *tableSchema, const QString &newName)
bool closeDatabase()
Closes currently used database for this connection.
virtual bool drv_isDatabaseUsed() const
virtual bool drv_executeSql(const KDbEscapedString &sql)=0
Executes query for a raw SQL statement sql without returning resulting records.
virtual bool drv_useDatabase(const QString &dbName=QString(), bool *cancelled=nullptr, KDbMessageHandler *msgHandler=nullptr)=0
void setDefaultTransaction(const KDbTransaction &trans)
Sets default transaction.
QStringList tableNames(bool alsoSystemTables=false, bool *ok=nullptr)
bool executeSql(const KDbEscapedString &sql)
Executes a new native (raw, backend-specific) SQL query.
bool autoCommit() const
virtual KDbSqlResult * drv_prepareSql(const KDbEscapedString &sql)=0
Prepares query for a raw SQL statement sql with possibility of returning records.
tristate querySingleStringInternal(const KDbEscapedString *sql, QString *value, KDbQuerySchema *query, const QList< QVariant > *params, int column, QueryRecordOptions options)
virtual bool drv_disconnect()=0
virtual QString escapeIdentifier(const QString &id) const
Identifier escaping function in the associated KDbDriver.
virtual bool drv_createDatabase(const QString &dbName=QString())=0
bool storeDataBlock(int objectID, const QString &dataString, const QString &dataID=QString())
KDbConnectionData data() const
tristate dropTable(KDbTableSchema *tableSchema)
virtual QString anyAvailableDatabaseName()
virtual KDbTransactionData * drv_beginTransaction()
KDbServerVersionInfo serverVersion() const
virtual bool drv_createTable(const KDbTableSchema &tableSchema)
Creates table using tableSchema information.
tristate alterTable(KDbTableSchema *tableSchema, KDbTableSchema *newTableSchema)
virtual bool drv_databaseExists(const QString &dbName, bool ignoreErrors=true)
tristate isEmpty(KDbTableSchema *table)
virtual bool drv_copyTableData(const KDbTableSchema &tableSchema, const KDbTableSchema &destinationTableSchema)
KDbField * findSystemFieldName(const KDbFieldList &fieldlist)
bool isConnected() const
bool dropDatabase(const QString &dbName=QString())
Drops database with name dbName.
QStringList databaseNames(bool also_system_db=false)
virtual KDbCursor * prepareQuery(const KDbEscapedString &sql, KDbCursor::Options options=KDbCursor::Option::None)=0
bool deleteCursor(KDbCursor *cursor)
bool checkIfColumnExists(KDbCursor *cursor, int column)
bool rollbackTransaction(KDbTransaction trans=KDbTransaction(), KDbTransaction::CommitOptions options=KDbTransaction::CommitOptions())
Rolls back specified transaction for this connection.
virtual bool drv_dropDatabase(const QString &dbName=QString())=0
bool createTable(KDbTableSchema *tableSchema, CreateTableOptions options=CreateTableOption::Default)
Creates a new table.
virtual bool drv_rollbackTransaction(KDbTransactionData *trans)
KDbTransaction beginTransaction()
Starts a new database transaction.
bool loadExtendedTableSchemaData(KDbTableSchema *tableSchema)
bool deleteAllRecords(KDbQuerySchema *query)
QStringList objectNames(int objectType=KDb::AnyObjectType, bool *ok=nullptr)
QSharedPointer< KDbSqlResult > prepareSql(const KDbEscapedString &sql)
Prepares execution of a new native (raw, backend-specific) SQL query.
virtual bool drv_dropTable(const QString &tableName)
QList< int > objectIds(int objectType, bool *ok=nullptr)
bool disconnect()
Disconnects from driver with given parameters.
bool checkIsDatabaseUsed()
tristate querySingleRecordInternal(KDbRecordData *data, const KDbEscapedString *sql, KDbQuerySchema *query, const QList< QVariant > *params, QueryRecordOptions options)
KDbDriver * driver() const
bool storeObjectData(KDbObject *object)
tristate querySingleRecord(const KDbEscapedString &sql, KDbRecordData *data, QueryRecordOptions options=QueryRecordOption::Default)
KDbTableSchema * tableSchema(int tableId)
bool storeExtendedTableSchemaData(KDbTableSchema *tableSchema)
KDbCursor * executeQueryInternal(const KDbEscapedString &sql, KDbQuerySchema *query, const QList< QVariant > *params)
bool dropQuery(KDbQuerySchema *querySchema)
bool isDatabaseUsed() const
virtual bool drv_connect()=0
bool copyDataBlock(int sourceObjectID, int destObjectID, const QString &dataID=QString())
tristate querySingleNumber(const KDbEscapedString &sql, int *number, int column=0, QueryRecordOptions options=QueryRecordOption::Default)
bool createDatabase(const QString &dbName)
Creates new database with name dbName, using this connection.
QString currentDatabase() const
Get the name of the current database.
bool useDatabase(const QString &dbName=QString(), bool kexiCompatible=true, bool *cancelled=nullptr, KDbMessageHandler *msgHandler=nullptr)
Opens an existing database specified by dbName.
virtual bool drv_beforeInsert(const QString &tableName, KDbFieldList *fields)
virtual bool drv_afterInsert(const QString &tableName, KDbFieldList *fields)
bool setupObjectData(const KDbRecordData &data, KDbObject *object)
virtual KDbEscapedString recentSqlString() const
Return recently used SQL string.
bool beginAutoCommitTransaction(KDbTransactionGuard *tg)
KDbVersionInfo databaseVersion() const
QList< int > queryIds(bool *ok=nullptr)
bool alterTableName(KDbTableSchema *tableSchema, const QString &newName, AlterTableNameOptions options=AlterTableNameOption::Default)
Alters name of table.
bool rollbackAutoCommitTransaction(const KDbTransaction &trans)
tristate resultExists(const KDbEscapedString &sql, QueryRecordOptions options=QueryRecordOption::Default)
virtual bool drv_afterUpdate(const QString &tableName, KDbFieldList *fields)
bool deleteRecord(KDbQuerySchema *query, KDbRecordData *data, bool useRecordId=false)
QList< KDbTransaction > transactions()
Returns set of handles of currently active transactions.
tristate dropTableInternal(KDbTableSchema *tableSchema, bool alsoRemoveSchema)
bool useTemporaryDatabaseIfNeeded(QString *name)
virtual bool drv_beforeUpdate(const QString &tableName, KDbFieldList *fields)
KDbQuerySchema * querySchema(int queryId)
bool storeNewObjectData(KDbObject *object)
bool setAutoCommit(bool on)
bool commitTransaction(KDbTransaction transaction=KDbTransaction(), KDbTransaction::CommitOptions options=KDbTransaction::CommitOptions())
Commits specified transaction for this connection.
virtual bool drv_commitTransaction(KDbTransactionData *trans)
KDbTransaction defaultTransaction() const
Returns handle of default transaction for this connection.
virtual tristate drv_containsTable(const QString &tableName)=0
virtual bool drv_getDatabasesList(QStringList *list)
tristate querySingleNumberInternal(const KDbEscapedString *sql, int *number, KDbQuerySchema *query, const QList< QVariant > *params, int column, QueryRecordOptions options)
tristate containsTable(const QString &tableName)
KDbConnectionOptions * options()
bool queryStringListInternal(const KDbEscapedString *sql, QStringList *list, KDbQuerySchema *query, const QList< QVariant > *params, int column, bool(*filterFunction)(const QString &))
Provides database cursor functionality.
Definition KDbCursor.h:69
Database driver's abstraction.
Definition KDbDriver.h:50
Specialized string for escaping.
Meta-data for a field.
Definition KDbField.h:72
Prepared statement interface for backend-dependent implementations.
Prepared database command for optimizing sequences of multiple database actions.
Type
Defines type of the prepared statement.
A set of storable database properties.
KDbQuerySchema provides information about database query.
Structure for storing single record with type information.
provides data for single edited database record
Interface for classes providing a result.
The KDbSqlResult class abstracts result of a raw SQL query preparation by KDbConnection::prepareSql()
Internal prototype for storing transaction handle for KDbTransaction object.
KDbTransactionGuard class is a convenience class that simplifies handling transactions.
This class encapsulates a single database transaction.
3-state logical type with three values: true, false and cancelled and convenient operators.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:11:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.