webCOMAND

database Configuration

The database configuration options define the underlying database engine and connection information to use for the default COMAND repository.

  • adapter - The database adapter to use to connect to the database.  'PDO' is the default (and currently the only valid option), which will use PHP Data Objects database abstraction layer to connect to the underlying database engine.
  • type - The name of the PDO driver to use to connect to the database.  This is generally the driver name for the type of database.  'mysql' is the default, which is used for a MySQL or MariaDB database.  The following drivers currently implement the PDO interface:
    • cubrid - Cubrid
    • dblib - FreeTDS / Microsoft SQL Server / Sybase
    • firebird - Firebird
    • ibm - IBM DB2
    • informix - IBM Informix Dynamic Server
    • mysql - MySQL 3.x/4.x/5.x and MariaDB 5.x
    • oci - Oracle Call Interface
    • odbc - ODBC v3 (IBM DB2, unixODBC and win32 ODBC)
    • pgsql - PostreSQL
    • sqlite - SQLite 3 and SQLite 2
    • sqlsrv - Microsoft SQL Server / SQL Azure
    • 4d - 4D
  • host - 'localhost' (default) to connect to the local database server or the hostname of a remote database server, such as 'db1.example.com'.
  • name - The database name.  'webcomand' is the default.
  • username - The database user name.  The user should have the appropriate permissions.  The default is 'comandadmin'.
  • password - The database user password.
  • persistent - TRUE (default) to use persistent database connections, otherwise FALSE.
  • table_prefix - The table prefix that appears before all table names.  This is useful to avoid database table name collisions when multiple repositories or other databases share the same database.
  • transactions - TRUE (default) to enable database-level transactions, otherwise FALSE.
  • query_log - FALSE (default) to disable query logging.  Set to one of the following to write a log of all SQL queries.
    • '<filename>' - write to log file with no timestamps/timings/traces
    • [ 'filename' => <filename> ] - write to log file with no timestamps/timings/traces
    • [ 'enabled' => <bool>, 'filename' => <filename>, 'timestamps' => <bool>, 'timings' => <bool>, 'traces' => <bool> ] - write to log file with optional timestamps/timings/traces
  • mysql - Associative array of MySQL-specific configuration options.
    • optimizer_search_depth - The MySQL default is 62.  We have found that 5 is a good value to improve performance of content queries when complex authorizations are applied.  For more information, see MySQL optimizer_search_depth documentation.

To override defaults, add the following section to the COMAND Configuration.

<?php
/**
 * COMAND Configuration.
 */
$config = [
    'io_comand_repo' => [
        'database' => [
            'mysql' => [ 'optimizer_search_depth' => 5 ],
            'host' => 'db1.example.com',
            'name' => 'comand_repo',
            'username' => 'comand',
            'password' => '<password>'
        ]
    ]
];