public static
array
|
#
currentSchema( string $dbConfig = 'default' )
Returns an array with current database schema information (tables, columns,
indexes, constraints)
Using $dbConfig database connection ('default' as default)
Returns an array with current database schema information (tables, columns,
indexes, constraints)
Using $dbConfig database connection ('default' as default)
Parameters
- $dbConfig
- Input database configuration ('default' as default)
Returns
array containing complete schema information, table names as keys
and details on columns, indexes and constraints for every table
|
public static
array
|
#
schemaCompare( array $expected, array $current )
Compare schema arrays between $expected and $current schema metadata
Returns an array with difference details
Compare schema arrays between $expected and $current schema metadata
Returns an array with difference details
Parameters
- $expected
- Expected db schema
- $current
- Current db schema from DbUtils::currentSchema()
Returns
array containing information on differences found
|
protected static
|
#
compareSchemaItems( string $table, string $itemType, array $expItems, array $currItems, array & $diff )
Compare schema related arrays relative to some $itemType ('columns', 'constraints', 'indexes')
Populate $diff array with differences on 3 keys:
- 'missing' items expected but not found
- 'changed' items with different metadata
- 'exceeding' items not present in expected data
Compare schema related arrays relative to some $itemType ('columns', 'constraints', 'indexes')
Populate $diff array with differences on 3 keys:
- 'missing' items expected but not found
- 'changed' items with different metadata
- 'exceeding' items not present in expected data
Parameters
- $table
- Current table
- $itemType
- Item type ('columns', 'constraints', 'indexes'()
- $expItems
- Expected items data
- $currItems
- Current items data
- $diff
- Difference array
|
public static
array
|
#
basicInfo( string $dbConfig = 'default', boolean $version = true )
Get basic database connection info
Get basic database connection info
Parameters
- $dbConfig
- Input database configuration ('default' as default)
- $version
- Retrieve or not version info
Returns
array containing requested configuration
+ 'vendor' key (mysql, sqlite, postgres,...)
|
public static
boolean
|
#
supportedVersion( array $options )
See if a DB vendor and min version matches current connection info on 'default'
See if a DB vendor and min version matches current connection info on 'default'
Deprecated
Will be dropped in a future release, not to be used anymore
Parameters
- $options
- Array containing 'vendor' (lower case - 'mysql', 'postgres', 'sqlite') and optionally 'version'
Returns
boolean True on match success, false otherwise
|
public static
array
|
#
connectionTest( string $dbConfig = 'default' )
See if Database connection is available and working correctly
See if Database connection is available and working correctly
Parameters
- $dbConfig
- input database configuration ('default' as default)
Returns
array containing keys: 'success' (boolean), 'error' (string with error message)
|
protected static
array
|
#
splitSqlQueries( string $sql )
Split a multi-statement SQL query into chunks.
Split a multi-statement SQL query into chunks.
Parameters
Returns
array
|
public static
array
|
#
executeTransaction( string|string[] $sql, string $dbConfig = 'default' )
Executes SQL query using transactions.
Returns an array providing information on SQL query results
Executes SQL query using transactions.
Returns an array providing information on SQL query results
Parameters
- $sql
- SQL query to execute.
- $dbConfig
- Database config to use ('default' as default)
Returns
array containing keys: 'success' (boolean), 'error' (string with error message),
'rowCount' (number of affected rows), 'queryCount' (number of queries executed)
Throws
Cake\Datasource\Exception\MissingDatasourceConfigException Throws an exception
if the requested $dbConfig does not exist.
|