Data base creator sql9/10/2023 If you call this function more than once without specifying connectionName, the default connection will be the one replaced.īefore using the connection, it must be initialized. Warning: If you add a connection with the same name as an existing connection, the new connection replaces the old one. The following snippet shows how to create and open a default connection to a PostgreSQL database: Subsequently, the default connection will be assumed if you call any static member function without specifying the connection name. To create the default connection, don't pass the connection name argument when you call addDatabase(). QSqlDatabase also supports the concept of a default connection, which is the unnamed connection. You can have multiple connections to one database. A connection is known by its own name, not by the name of the database it connects to. See How to Write Your Own Database Driver for more information.Ĭreate a connection (i.e., an instance of QSqlDatabase) by calling one of the static addDatabase() functions, where you specify the driver or type of driver to use (depending on the type of database) and a connection name. Alternatively, you can subclass your own database driver from QSqlDriver. The connection provides access to the database via one of the supported database drivers, which are derived from QSqlDriver. An instance of QSqlDatabase represents the connection. The QSqlDatabase class provides an interface for accessing a database through a connection. Tables(QSql::TableType type = QSql::Tables) const SetNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy) SetConnectOptions(const QString & options = QString()) PrimaryIndex(const QString & tablename) const Open(const QString & user, const QString & password) Exec(const QString & query = QString()) const
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |