PyANGKernel.GKDataBaseInfo

class GKDataBaseInfo

This class holds information about a database using in Aimsun Next.

Details

Some components of Aimsun can store data in external (to Aimsun database) databases. For example OD matrices ( GKODMatrix using GKModel::setDatabase) or Aimsun Next Simulator statistical data. This class hold the information about the database to use.

To ask Aimsun Model to use a ODBC database you will:

GKDataBaseInfo          info;
GKModel                         *model;

info.setDatabaseName( "MY DATASOURCE NAME" );
info.setDriverName( "QODBC3" );

model->setDatabase( info );

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.

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__([urlStr=""])
Parameters:

urlStr – str

clear()

Reset this object.

static driverIsFileBased(driver)
Parameters:

driver – str

Return type:

bool

Helper function: returns true if the given driver is file-based (currently Access and SQLite ))

static driverNeedsLogin(driver)
Parameters:

driver – str

Return type:

bool

Helper function: returns true if the given driver needs server and login data (currently anything not being Access & SQLite )

fromString(urlStr)
Parameters:

urlStr – str

Parses the string and constructs the GKDataBaseInfo object. The string must be compliant with the format used by toString() function.

getDatabaseName()
Return type:

str

getDriverName()
Return type:

str

Type of database. Possible values are: - QODBC3 - QSQLITE - ACCESS - Any other supported by the installed Qt sqldrivers

getHostName()
Return type:

str

Host name where the database is. Some databases do not require a host name (Access, SQLite , ODBC connections to Access or SQLite ).

getPassword()
Return type:

str

Password. Some databases do not require a password (Access for example). <b>Note:</b> password data is not encripted

getPort()
Return type:

int

TCP/IP port where the database listener is. Some databases do not require a port (Access, SQLite , ODBC connections to Access or SQLite ).

getUserName()
Return type:

str

Username. Some databases do not require a username (Access for example).

isAutomatic()
Return type:

bool

Automatic database? If so the name will be set from the model and will be created automatically

isAutomaticallyCreated()
Return type:

bool

Create the database automatically using the current name (if isAutomatic the name will be set too)

isComplete([checkDBName=true])
Parameters:

checkDBName – bool

Return type:

bool

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.

isFileBased()
Return type:

bool

isPostgresSQL()
Return type:

bool

isSQLite()
Return type:

bool

__ne__(src)
Parameters:

srcGKDataBaseInfo

Return type:

bool

__eq__(src)
Parameters:

srcGKDataBaseInfo

Return type:

bool

requiresAutomaticDBCreation(model)
Parameters:

modelGKModel

Return type:

bool

For file based databases, checks whether a DB needs to be created automatically or not

setAutomatic(value)
Parameters:

value – bool

Automatic database?

See also

isAutomatic()

setAutomaticallyCreated(value)
Parameters:

value – bool

Create the database automatically using the current name (if isAutomatic the name will be set too)

setDatabaseName(name)
Parameters:

name – str

Database name. If using QODBC3, the datasource name. If Access or SQLite the file.

setHostName(host)
Parameters:

host – str

Host name where the database is. Some databases do not require a host name (Access, SQLite , ODBC connections for Access or SQLite ).

setPassword(password)
Parameters:

password – str

Password. Some databases do not require a password (Access for example). <b>Note:</b> password data is not encripted

setPort(p)
Parameters:

p – int

TCP/IP port where the database listener is. Some databases do not require a port (Access, SQLite , ODBC connections to Access or SQLite ).

setUseProjectDB(value)
Parameters:

value – bool

If true, use the project DB instead of this DB

See also

useProjectDB()

setUserName(name)
Parameters:

name – str

User name. Some databases do not require a user name (Access for example).

toString([withPasswd=false])
Parameters:

withPasswd – bool

Return type:

str

Returns a string representation of this object as a URL. The format is the following: - For server-based DBs: “driver://user[:pass]@server:port/schema” - for file-based DB’s: “driver://user[:pass]@filepath”

UnknownCommandwithPasswd: if true, the password will also be included in the string

useProjectDB()
Return type:

bool

If true, use the project DB instead of this DB