KLayout 0.29.8 (2024-10-28 63dd591e5) [master]

API reference - Class QSqlDatabase

Notation used in Ruby API documentation

Module: QtSql

Description: Binding of QSqlDatabase

Public constructors

new QSqlDatabasenewConstructor QSqlDatabase::QSqlDatabase()
new QSqlDatabasenew(const QSqlDatabase other)Constructor QSqlDatabase::QSqlDatabase(const QSqlDatabase &other)

Public methods

void_assign(const QSqlDatabase other)Assigns another object to self
[const]QSqlDatabase ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
QSqlDatabaseassign(const QSqlDatabase other)Method QSqlDatabase &QSqlDatabase::operator=(const QSqlDatabase &other)
voidcloseMethod void QSqlDatabase::close()
boolcommitMethod bool QSqlDatabase::commit()
[const]stringconnectOptionsMethod QString QSqlDatabase::connectOptions()
voidconnectOptions=(string options = QString())Method void QSqlDatabase::setConnectOptions(const QString &options)
[const]stringconnectionNameMethod QString QSqlDatabase::connectionName()
[const]stringdatabaseNameMethod QString QSqlDatabase::databaseName()
voiddatabaseName=(string name)Method void QSqlDatabase::setDatabaseName(const QString &name)
[const]QSqlDriver ptrdriverMethod QSqlDriver *QSqlDatabase::driver()
[const]stringdriverNameMethod QString QSqlDatabase::driverName()
[const]new QSqlDatabase ptrdupCreates a copy of self
[const]QSqlQueryexec(string query = QString())Method QSqlQuery QSqlDatabase::exec(const QString &query)
[const]stringhostNameMethod QString QSqlDatabase::hostName()
voidhostName=(string host)Method void QSqlDatabase::setHostName(const QString &host)
[const]boolisOpen?Method bool QSqlDatabase::isOpen()
[const]boolisOpenError?Method bool QSqlDatabase::isOpenError()
[const]boolisValid?Method bool QSqlDatabase::isValid()
[const]QSqlErrorlastErrorMethod QSqlError QSqlDatabase::lastError()
[const]QSql_NumericalPrecisionPolicynumericalPrecisionPolicyMethod QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy()
voidnumericalPrecisionPolicy=(const QSql_NumericalPrecisionPolicy precisionPolicy)Method void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
boolopenMethod bool QSqlDatabase::open()
boolopen(string user,
string password)
Method bool QSqlDatabase::open(const QString &user, const QString &password)
[const]stringpasswordMethod QString QSqlDatabase::password()
voidpassword=(string password)Method void QSqlDatabase::setPassword(const QString &password)
[const]intportMethod int QSqlDatabase::port()
voidport=(int p)Method void QSqlDatabase::setPort(int p)
[const]QSqlIndexprimaryIndex(string tablename)Method QSqlIndex QSqlDatabase::primaryIndex(const QString &tablename)
[const]QSqlRecordrecord(string tablename)Method QSqlRecord QSqlDatabase::record(const QString &tablename)
boolrollbackMethod bool QSqlDatabase::rollback()
voidsetConnectOptions(string options = QString())Method void QSqlDatabase::setConnectOptions(const QString &options)
voidsetDatabaseName(string name)Method void QSqlDatabase::setDatabaseName(const QString &name)
voidsetHostName(string host)Method void QSqlDatabase::setHostName(const QString &host)
voidsetNumericalPrecisionPolicy(const QSql_NumericalPrecisionPolicy precisionPolicy)Method void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
voidsetPassword(string password)Method void QSqlDatabase::setPassword(const QString &password)
voidsetPort(int p)Method void QSqlDatabase::setPort(int p)
voidsetUserName(string name)Method void QSqlDatabase::setUserName(const QString &name)
[const]string[]tables(const QSql_TableType type = QSql::Tables)Method QStringList QSqlDatabase::tables(QSql::TableType type)
booltransactionMethod bool QSqlDatabase::transaction()
[const]stringuserNameMethod QString QSqlDatabase::userName()
voiduserName=(string name)Method void QSqlDatabase::setUserName(const QString &name)

Public static methods and constants

QSqlDatabaseaddDatabase(string type,
string connectionName = QLatin1String(QSqlDatabase::defaultConnection))
Static method QSqlDatabase QSqlDatabase::addDatabase(const QString &type, const QString &connectionName)
QSqlDatabaseaddDatabase(QSqlDriver ptr driver,
string connectionName = QLatin1String(QSqlDatabase::defaultConnection))
Static method QSqlDatabase QSqlDatabase::addDatabase(QSqlDriver *driver, const QString &connectionName)
QSqlDatabasecloneDatabase(const QSqlDatabase other,
string connectionName)
Static method QSqlDatabase QSqlDatabase::cloneDatabase(const QSqlDatabase &other, const QString &connectionName)
string[]connectionNamesStatic method QStringList QSqlDatabase::connectionNames()
boolcontains(string connectionName = QLatin1String(QSqlDatabase::defaultConnection))Static method bool QSqlDatabase::contains(const QString &connectionName)
QSqlDatabasedatabase(string connectionName = QLatin1String(QSqlDatabase::defaultConnection),
bool open = true)
Static method QSqlDatabase QSqlDatabase::database(const QString &connectionName, bool open)
string[]driversStatic method QStringList QSqlDatabase::drivers()
boolisDriverAvailable?(string name)Static method bool QSqlDatabase::isDriverAvailable(const QString &name)
voidregisterSqlDriver(string name,
QSqlDriverCreatorBase ptr creator)
Static method void QSqlDatabase::registerSqlDriver(const QString &name, QSqlDriverCreatorBase *creator)
voidremoveDatabase(string connectionName)Static method void QSqlDatabase::removeDatabase(const QString &connectionName)

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

_assign

Signature: void _assign (const QSqlDatabase other)

Description: Assigns another object to self

_const_cast

Signature: [const] QSqlDatabase ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

addDatabase

(1) Signature: [static] QSqlDatabase addDatabase (string type, string connectionName = QLatin1String(QSqlDatabase::defaultConnection))

Description: Static method QSqlDatabase QSqlDatabase::addDatabase(const QString &type, const QString &connectionName)

This method is static and can be called without an instance.

(2) Signature: [static] QSqlDatabase addDatabase (QSqlDriver ptr driver, string connectionName = QLatin1String(QSqlDatabase::defaultConnection))

Description: Static method QSqlDatabase QSqlDatabase::addDatabase(QSqlDriver *driver, const QString &connectionName)

This method is static and can be called without an instance.

assign

Signature: QSqlDatabase assign (const QSqlDatabase other)

Description: Method QSqlDatabase &QSqlDatabase::operator=(const QSqlDatabase &other)

cloneDatabase

Signature: [static] QSqlDatabase cloneDatabase (const QSqlDatabase other, string connectionName)

Description: Static method QSqlDatabase QSqlDatabase::cloneDatabase(const QSqlDatabase &other, const QString &connectionName)

This method is static and can be called without an instance.

close

Signature: void close

Description: Method void QSqlDatabase::close()

commit

Signature: bool commit

Description: Method bool QSqlDatabase::commit()

connectOptions

Signature: [const] string connectOptions

Description: Method QString QSqlDatabase::connectOptions()

Python specific notes:
The object exposes a readable attribute 'connectOptions'. This is the getter.

connectOptions=

Signature: void connectOptions= (string options = QString())

Description: Method void QSqlDatabase::setConnectOptions(const QString &options)

Python specific notes:
The object exposes a writable attribute 'connectOptions'. This is the setter.

connectionName

Signature: [const] string connectionName

Description: Method QString QSqlDatabase::connectionName()

connectionNames

Signature: [static] string[] connectionNames

Description: Static method QStringList QSqlDatabase::connectionNames()

This method is static and can be called without an instance.

contains

Signature: [static] bool contains (string connectionName = QLatin1String(QSqlDatabase::defaultConnection))

Description: Static method bool QSqlDatabase::contains(const QString &connectionName)

This method is static and can be called without an instance.

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

database

Signature: [static] QSqlDatabase database (string connectionName = QLatin1String(QSqlDatabase::defaultConnection), bool open = true)

Description: Static method QSqlDatabase QSqlDatabase::database(const QString &connectionName, bool open)

This method is static and can be called without an instance.

databaseName

Signature: [const] string databaseName

Description: Method QString QSqlDatabase::databaseName()

Python specific notes:
The object exposes a readable attribute 'databaseName'. This is the getter.

databaseName=

Signature: void databaseName= (string name)

Description: Method void QSqlDatabase::setDatabaseName(const QString &name)

Python specific notes:
The object exposes a writable attribute 'databaseName'. This is the setter.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

driver

Signature: [const] QSqlDriver ptr driver

Description: Method QSqlDriver *QSqlDatabase::driver()

driverName

Signature: [const] string driverName

Description: Method QString QSqlDatabase::driverName()

drivers

Signature: [static] string[] drivers

Description: Static method QStringList QSqlDatabase::drivers()

This method is static and can be called without an instance.

dup

Signature: [const] new QSqlDatabase ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

exec

Signature: [const] QSqlQuery exec (string query = QString())

Description: Method QSqlQuery QSqlDatabase::exec(const QString &query)

Python specific notes:
This attribute is available as 'exec_' in Python.

hostName

Signature: [const] string hostName

Description: Method QString QSqlDatabase::hostName()

Python specific notes:
The object exposes a readable attribute 'hostName'. This is the getter.

hostName=

Signature: void hostName= (string host)

Description: Method void QSqlDatabase::setHostName(const QString &host)

Python specific notes:
The object exposes a writable attribute 'hostName'. This is the setter.

isDriverAvailable?

Signature: [static] bool isDriverAvailable? (string name)

Description: Static method bool QSqlDatabase::isDriverAvailable(const QString &name)

This method is static and can be called without an instance.

isOpen?

Signature: [const] bool isOpen?

Description: Method bool QSqlDatabase::isOpen()

isOpenError?

Signature: [const] bool isOpenError?

Description: Method bool QSqlDatabase::isOpenError()

isValid?

Signature: [const] bool isValid?

Description: Method bool QSqlDatabase::isValid()

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

lastError

Signature: [const] QSqlError lastError

Description: Method QSqlError QSqlDatabase::lastError()

new

(1) Signature: [static] new QSqlDatabase new

Description: Constructor QSqlDatabase::QSqlDatabase()

This method creates an object of class QSqlDatabase.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new QSqlDatabase new (const QSqlDatabase other)

Description: Constructor QSqlDatabase::QSqlDatabase(const QSqlDatabase &other)

This method creates an object of class QSqlDatabase.

Python specific notes:
This method is the default initializer of the object.

numericalPrecisionPolicy

Signature: [const] QSql_NumericalPrecisionPolicy numericalPrecisionPolicy

Description: Method QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy()

Python specific notes:
The object exposes a readable attribute 'numericalPrecisionPolicy'. This is the getter.

numericalPrecisionPolicy=

Signature: void numericalPrecisionPolicy= (const QSql_NumericalPrecisionPolicy precisionPolicy)

Description: Method void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)

Python specific notes:
The object exposes a writable attribute 'numericalPrecisionPolicy'. This is the setter.

open

(1) Signature: bool open

Description: Method bool QSqlDatabase::open()

(2) Signature: bool open (string user, string password)

Description: Method bool QSqlDatabase::open(const QString &user, const QString &password)

password

Signature: [const] string password

Description: Method QString QSqlDatabase::password()

Python specific notes:
The object exposes a readable attribute 'password'. This is the getter.

password=

Signature: void password= (string password)

Description: Method void QSqlDatabase::setPassword(const QString &password)

Python specific notes:
The object exposes a writable attribute 'password'. This is the setter.

port

Signature: [const] int port

Description: Method int QSqlDatabase::port()

Python specific notes:
The object exposes a readable attribute 'port'. This is the getter.

port=

Signature: void port= (int p)

Description: Method void QSqlDatabase::setPort(int p)

Python specific notes:
The object exposes a writable attribute 'port'. This is the setter.

primaryIndex

Signature: [const] QSqlIndex primaryIndex (string tablename)

Description: Method QSqlIndex QSqlDatabase::primaryIndex(const QString &tablename)

record

Signature: [const] QSqlRecord record (string tablename)

Description: Method QSqlRecord QSqlDatabase::record(const QString &tablename)

registerSqlDriver

Signature: [static] void registerSqlDriver (string name, QSqlDriverCreatorBase ptr creator)

Description: Static method void QSqlDatabase::registerSqlDriver(const QString &name, QSqlDriverCreatorBase *creator)

This method is static and can be called without an instance.

removeDatabase

Signature: [static] void removeDatabase (string connectionName)

Description: Static method void QSqlDatabase::removeDatabase(const QString &connectionName)

This method is static and can be called without an instance.

rollback

Signature: bool rollback

Description: Method bool QSqlDatabase::rollback()

setConnectOptions

Signature: void setConnectOptions (string options = QString())

Description: Method void QSqlDatabase::setConnectOptions(const QString &options)

Python specific notes:
The object exposes a writable attribute 'connectOptions'. This is the setter.

setDatabaseName

Signature: void setDatabaseName (string name)

Description: Method void QSqlDatabase::setDatabaseName(const QString &name)

Python specific notes:
The object exposes a writable attribute 'databaseName'. This is the setter.

setHostName

Signature: void setHostName (string host)

Description: Method void QSqlDatabase::setHostName(const QString &host)

Python specific notes:
The object exposes a writable attribute 'hostName'. This is the setter.

setNumericalPrecisionPolicy

Signature: void setNumericalPrecisionPolicy (const QSql_NumericalPrecisionPolicy precisionPolicy)

Description: Method void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)

Python specific notes:
The object exposes a writable attribute 'numericalPrecisionPolicy'. This is the setter.

setPassword

Signature: void setPassword (string password)

Description: Method void QSqlDatabase::setPassword(const QString &password)

Python specific notes:
The object exposes a writable attribute 'password'. This is the setter.

setPort

Signature: void setPort (int p)

Description: Method void QSqlDatabase::setPort(int p)

Python specific notes:
The object exposes a writable attribute 'port'. This is the setter.

setUserName

Signature: void setUserName (string name)

Description: Method void QSqlDatabase::setUserName(const QString &name)

Python specific notes:
The object exposes a writable attribute 'userName'. This is the setter.

tables

Signature: [const] string[] tables (const QSql_TableType type = QSql::Tables)

Description: Method QStringList QSqlDatabase::tables(QSql::TableType type)

transaction

Signature: bool transaction

Description: Method bool QSqlDatabase::transaction()

userName

Signature: [const] string userName

Description: Method QString QSqlDatabase::userName()

Python specific notes:
The object exposes a readable attribute 'userName'. This is the getter.

userName=

Signature: void userName= (string name)

Description: Method void QSqlDatabase::setUserName(const QString &name)

Python specific notes:
The object exposes a writable attribute 'userName'. This is the setter.