Aimsun Next Scripting
22
|
Public Member Functions | |
GKDataBaseInfo () | |
bool | useProjectDB () const |
void | setUseProjectDB (bool value) |
bool | isAutomatic () const |
void | setAutomatic (bool value) |
bool | isAutomaticallyCreated () const |
void | setAutomaticallyCreated (bool value) |
void | setDatabaseName (const QString &) |
void | setUserName (const QString &) |
void | setPassword (const QString &) |
void | setHostName (const QString &) |
void | setDriverName (const QString &) |
void | setPort (int) |
QString | getDatabaseName (GKModel *model) const |
const QString & | getUserName () const |
const QString & | getPassword () const |
const QString & | getHostName () const |
const QString & | getDriverName () const |
int | getPort () const |
QString | toString (bool withPasswd=false) const |
void | fromString (const QString &urlStr) |
bool | isEmpty () const |
void | clear () |
bool | checkConnection (QString &errorString) const |
bool | checkWritetable (GKModel *model, QString &errorString) const |
bool | isComplete () const |
bool | isFileBased () const |
Static Public Member Functions | |
static bool | driverIsFileBased (const QString &driver) |
static bool | driverNeedsLogin (const QString &driver) |
Some components of Aimsun can store data in external (to Aimsun database) databases. For example OD matrices (GKODMatrix using GKModel::setDatabase) or Aimsun Next Simulators statistical data. This class hold the information about the database to use.
To ask Aimsun Model to use a ODBC database you will:
The database can be automatic (false by default). In this case Aimsun Next will create and manage the database for the user without asking for a file. The supported automatic ones are SQLite (MAC OS X, Linux, Windows) and Access (Windows). In Windows, the user can select the driver to use.
GKDataBaseInfo::GKDataBaseInfo | ( | ) |
bool GKDataBaseInfo::checkConnection | ( | QString & | errorString | ) | const |
Checks that the database can be opened. It will open and then close the db. errorStr will report any error.
bool GKDataBaseInfo::checkWritetable | ( | GKModel * | model, |
QString & | errorString | ||
) | const |
Checks that the database is writable. It will open, create a table, do an insert and then close the db. errorStr will report any error.
void GKDataBaseInfo::clear | ( | ) |
Reset this object.
|
static |
Helper function: returns true if the given driver is file-based (currently Access and SQLite))
|
static |
Helper function: returns true if the given driver needs server and login data (currently anything not being Access & SQLite)
void GKDataBaseInfo::fromString | ( | const QString & | urlStr | ) |
Parses the string and constructs the GKDataBaseInfo object. The string must be compliant with the format used by toString() function.
QString GKDataBaseInfo::getDatabaseName | ( | GKModel * | model | ) | const |
Database name. If using QODBC3, the datasource name. If Access or SQLite the file. A model is required when using the automatic mode.
const QString & GKDataBaseInfo::getDriverName | ( | ) | const |
Type of database. Possible values are:
const QString & GKDataBaseInfo::getHostName | ( | ) | const |
Host name where the database is. Some databases doesn't require a host name (Access, SQLite, ODBC connections to Access or SQLite).
const QString & GKDataBaseInfo::getPassword | ( | ) | const |
Password. Some databases doesn't require a password (Access for example). Note: password data is not encripted
int GKDataBaseInfo::getPort | ( | ) | const |
TCP/IP port where the database listener is. Some databases doesn't require a port (Access, SQLite, ODBC connections to Access or SQLite).
const QString & GKDataBaseInfo::getUserName | ( | ) | const |
Password. Some databases doesn't require a password (Access for example). Note: password data is not encripted
bool GKDataBaseInfo::isAutomatic | ( | ) | const |
Automatic database?
bool GKDataBaseInfo::isAutomaticallyCreated | ( | ) | const |
Create the database automatically using the current name (is isAutomatic the name will be set too)
bool GKDataBaseInfo::isComplete | ( | ) | const |
Checks if the object has all the required data to connect to the database. For file-based drivers, this means checking if the file is defined. For server-based driver, the server and login data are also mandatory.
bool GKDataBaseInfo::isEmpty | ( | ) | const |
Returns true if is empty (no db name)
bool GKDataBaseInfo::isFileBased | ( | ) | const |
void GKDataBaseInfo::setAutomatic | ( | bool | value | ) |
Automatic database?
void GKDataBaseInfo::setAutomaticallyCreated | ( | bool | value | ) |
Create the database automatically using the current name (is isAutomatic the name will be set too)
void GKDataBaseInfo::setDatabaseName | ( | const QString & | ) |
Database name. If using QODBC3, the datasource name. If Access or SQLite the file.
void GKDataBaseInfo::setDriverName | ( | const QString & | ) |
Type of database. Possible values are:
void GKDataBaseInfo::setHostName | ( | const QString & | ) |
Host name where the database is. Some databases doesn't require a host name (Access, SQLite, ODBC connections for Access or SQLite).
void GKDataBaseInfo::setPassword | ( | const QString & | ) |
Password. Some databases doesn't require a password (Access for example). Note: password data is not encripted
void GKDataBaseInfo::setPort | ( | int | ) |
TCP/IP port where the database listener is. Some databases doesn't require a port (Access, SQLite, ODBC connections to Access or SQLite).
void GKDataBaseInfo::setUseProjectDB | ( | bool | value | ) |
If true, use the project DB instead of this DB
void GKDataBaseInfo::setUserName | ( | const QString & | ) |
User name. Some databases doesn't require a user name (Access for example).
QString GKDataBaseInfo::toString | ( | bool | withPasswd = false | ) | const |
Returns a string representation of this object as a URL. The format is the following:
withPasswd | if true, the password will also be included in the string |
bool GKDataBaseInfo::useProjectDB | ( | ) | const |
If true, use the project DB instead of this DB