qsqldriver.sip 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // qsqldriver.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtSql Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QSqlDriver : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qsqldriver.h>
  25. %End
  26. %ConvertToSubClassCode
  27. static struct class_graph {
  28. const char *name;
  29. sipTypeDef **type;
  30. int yes, no;
  31. } graph[] = {
  32. {sipName_QSqlQueryModel, &sipType_QSqlQueryModel, 3, 1},
  33. {sipName_QSqlRelationalDelegate, &sipType_QSqlRelationalDelegate, -1, 2},
  34. {sipName_QSqlDriver, &sipType_QSqlDriver, -1, -1},
  35. {sipName_QSqlTableModel, &sipType_QSqlTableModel, 4, -1},
  36. {sipName_QSqlRelationalTableModel, &sipType_QSqlRelationalTableModel, -1, -1},
  37. };
  38. int i = 0;
  39. sipType = NULL;
  40. do
  41. {
  42. struct class_graph *cg = &graph[i];
  43. if (cg->name != NULL && sipCpp->inherits(cg->name))
  44. {
  45. sipType = *cg->type;
  46. i = cg->yes;
  47. }
  48. else
  49. i = cg->no;
  50. }
  51. while (i >= 0);
  52. %End
  53. public:
  54. enum DriverFeature
  55. {
  56. Transactions,
  57. QuerySize,
  58. BLOB,
  59. Unicode,
  60. PreparedQueries,
  61. NamedPlaceholders,
  62. PositionalPlaceholders,
  63. LastInsertId,
  64. BatchOperations,
  65. SimpleLocking,
  66. LowPrecisionNumbers,
  67. EventNotifications,
  68. FinishQuery,
  69. MultipleResultSets,
  70. };
  71. enum StatementType
  72. {
  73. WhereStatement,
  74. SelectStatement,
  75. UpdateStatement,
  76. InsertStatement,
  77. DeleteStatement,
  78. };
  79. enum IdentifierType
  80. {
  81. FieldName,
  82. TableName,
  83. };
  84. explicit QSqlDriver(QObject *parent /TransferThis/ = 0);
  85. virtual ~QSqlDriver();
  86. virtual bool isOpen() const;
  87. bool isOpenError() const;
  88. virtual bool beginTransaction() /ReleaseGIL/;
  89. virtual bool commitTransaction() /ReleaseGIL/;
  90. virtual bool rollbackTransaction() /ReleaseGIL/;
  91. virtual QStringList tables(QSql::TableType tableType) const;
  92. virtual QSqlIndex primaryIndex(const QString &tableName) const;
  93. virtual QSqlRecord record(const QString &tableName) const;
  94. virtual QString formatValue(const QSqlField &field, bool trimStrings = false) const;
  95. virtual QString escapeIdentifier(const QString &identifier, QSqlDriver::IdentifierType type) const;
  96. virtual QString sqlStatement(QSqlDriver::StatementType type, const QString &tableName, const QSqlRecord &rec, bool preparedStatement) const;
  97. QSqlError lastError() const;
  98. virtual QVariant handle() const;
  99. virtual bool hasFeature(QSqlDriver::DriverFeature f) const = 0;
  100. virtual void close() = 0;
  101. virtual QSqlResult *createResult() const = 0 /Factory/;
  102. virtual bool open(const QString &db, const QString &user = QString(), const QString &password = QString(), const QString &host = QString(), int port = -1, const QString &options = QString()) = 0 /ReleaseGIL/;
  103. protected:
  104. virtual void setOpen(bool o);
  105. virtual void setOpenError(bool e);
  106. virtual void setLastError(const QSqlError &e);
  107. public:
  108. virtual bool subscribeToNotification(const QString &name);
  109. virtual bool unsubscribeFromNotification(const QString &name);
  110. virtual QStringList subscribedToNotifications() const;
  111. enum NotificationSource
  112. {
  113. UnknownSource,
  114. SelfSource,
  115. OtherSource,
  116. };
  117. signals:
  118. void notification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload);
  119. public:
  120. virtual bool isIdentifierEscaped(const QString &identifier, QSqlDriver::IdentifierType type) const;
  121. virtual QString stripDelimiters(const QString &identifier, QSqlDriver::IdentifierType type) const;
  122. void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy);
  123. QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
  124. enum DbmsType
  125. {
  126. UnknownDbms,
  127. MSSqlServer,
  128. MySqlServer,
  129. PostgreSQL,
  130. Oracle,
  131. Sybase,
  132. SQLite,
  133. Interbase,
  134. DB2,
  135. %If (Qt_6_6_0 -)
  136. MimerSQL,
  137. %End
  138. };
  139. QSqlDriver::DbmsType dbmsType() const;
  140. virtual int maximumIdentifierLength(QSqlDriver::IdentifierType type) const;
  141. %If (Qt_6_9_0 -)
  142. QString connectionName() const;
  143. %End
  144. };