PrevUpHomeNext

Creating the Database Object

Either:

const quince_postgresql::database db("localhost", "postgres", "postgres", "quincetest", "test");

or:

const quince_sqlite::database db("quincetest");

Remarks

Either of the above definitions creates an object to represent the SQL database we are about to populate and query.

Creating the database object doesn't create the SQL database. That is something you have to do outside of quince, e.g. by using the PgAdminIII GUI tool (for PostgreSQL) or the sqlite3.exe commandline tool (for sqlite). It may require special privileges.

Creating the database object doesn't connect to the SQL database either. All it does is remember the parameters for later, when quince makes connections. (This happens automatically as needed.)

We'll go through all the constructor arguments (including those not used here) in detail later, but here are some things you might need to change straight away to suit your environment:

For the quince_postgresql::database constructor:

For the quince_sqlite::database constructor:

All the string arguments to either database constructor are interpreted as UTF-8.

Now that we have a database object, the rest of our program will not mention PostgreSQL or sqlite. All our API calls will be to quince itself, not to the backend libraries.


PrevUpHomeNext