DatabaseCompatibilityUtil Class Reference

Public Member Functions

 getCharLimits ()

Static Public Member Functions

static charLength ($columnName)
static concat (array $strings)
static escape ($value)
static getAllTableNames ()
static getDateFormat ()
static getDateTimeFormat ()
static getMaxVarCharLength ()
static lower ($columnName)
static getQuote ()
static getTrue ()
static length ($columnName)
static quoteString ($string)
static getDatabaseMaxColumnNameLength ()
static getDatabaseReserverWords ()
static getOperatorAndValueWherePart ($operatorType, $value)
static resolveToLowerForStringComparison ($operatorType, $value)
static bulkInsert ($tableName, &$rowsOfColumnValues, &$columnNames, $bulkQuantity, $shouldTrim=false)
static getDatabaseVersion ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseMaxAllowedPacketsSizeRb ()
static getDatabaseMaxAllowedPacketsSize ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseMaxSpRecursionDepth ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseThreadStackValue ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseOptimizerSearchDepthValue ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseLogBinValue ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseLogBinTrustFunctionCreatorsValue ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static getDatabaseDefaultCollation ($databaseType, $databaseHostname, $databaseName, $databaseUsername, $databasePassword, $databasePort)
static isDatabaseStrictMode ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static checkDatabaseConnection ($databaseType, $host, $rootUsername, $rootPassword, $port)
static checkDatabaseExists ($databaseType, $host, $rootUsername, $rootPassword, $port, $databaseName)
static checkDatabaseUserExists ($databaseType, $host, $rootUsername, $rootPassword, $port, $username)
static getDatabaseSupportsLoadLocalInFile ($databaseType, $databaseHostname, $databaseUsername, $databasePassword, $databasePort)
static createDatabase ($databaseType, $host, $rootUsername, $rootPassword, $port, $databaseName)
static createDatabaseUser ($databaseType, $host, $rootUsername, $rootPassword, $port, $databaseName, $username, $password)
static getTableRowsCountTotal ()
static getDatabaseDefaultPort ($databaseType= 'mysql')
static backupDatabase ($databaseType= 'mysql', $host, $username, $password, $port, $databaseName, $backupFilePath)
static restoreDatabase ($databaseType= 'mysql', $host, $username, $password, $port, $databaseName, $restoreFilePath)
static mapHintTypeIntoDatabaseColumnType ($hintType, $length=null)
static makeTimeZoneAdjustmentContent ()
static resolveIntegerMaxAllowedValuesByType ($signed=false)
static resolveCollationByHintType ($hint)
static resolveUnsignedByHintType ($hint, $assumeSigned=false, $hintName=null)

Detailed Description

Helper functionality for use in RedBeanModels and derived models. These functions cater for specific databases other than MySQL, then by default return results for for MySQL.

Definition at line 42 of file DatabaseCompatibilityUtil.php.


Member Function Documentation

static charLength ( columnName  )  [static]

Returns the database character length equivalent string function by a column name.

Parameters:
string $columnName

Definition at line 48 of file DatabaseCompatibilityUtil.php.

static concat ( array $  strings  )  [static]

Returns sql to concatentate the given strings for the current database.

Definition at line 58 of file DatabaseCompatibilityUtil.php.

static getAllTableNames (  )  [static]

Returns an array of table names from the database.

Definition at line 79 of file DatabaseCompatibilityUtil.php.

static getDateFormat (  )  [static]

Get the date format for the database in Unicode format. http://www.unicode.org/reports/tr35/#Date_Format_Patterns

Returns:
string

Definition at line 90 of file DatabaseCompatibilityUtil.php.

static getDateTimeFormat (  )  [static]

Get the datetime format for the database in Unicode format. http://www.unicode.org/reports/tr35/#Date_Format_Patterns

Returns:
string

Definition at line 100 of file DatabaseCompatibilityUtil.php.

static getMaxVarCharLength (  )  [static]

Returns the maximum varchar column type value.

Definition at line 108 of file DatabaseCompatibilityUtil.php.

static lower ( columnName  )  [static]

Returns the database string to lower equivalent string function by a column name and adds quotes to it.

Parameters:
string $columnName

Definition at line 118 of file DatabaseCompatibilityUtil.php.

static getQuote (  )  [static]

Get the quote used for quoting table and column names. for the current database. Note: ' is always used for strings.

Definition at line 129 of file DatabaseCompatibilityUtil.php.

static getTrue (  )  [static]

Returns the value that represents true in sql for the current database.

Definition at line 146 of file DatabaseCompatibilityUtil.php.

static length ( columnName  )  [static]

Returns the database length equivalent string function by a column name.

Parameters:
string $columnName

Definition at line 163 of file DatabaseCompatibilityUtil.php.

static quoteString ( string  )  [static]

Returns the given string quoted for the current database. Note: ' is always used for strings. Do not use this function to quote strings in sql.

Definition at line 175 of file DatabaseCompatibilityUtil.php.

static getDatabaseMaxColumnNameLength (  )  [static]

Get max length for column name

Returns:
int

Definition at line 186 of file DatabaseCompatibilityUtil.php.

static getDatabaseReserverWords (  )  [static]

Get array of database reserved words

Exceptions:
NotSupportedException 
Returns:
multitype:string

Definition at line 197 of file DatabaseCompatibilityUtil.php.

static getOperatorAndValueWherePart ( operatorType,
value 
) [static]

Given an operator type and value, SQL is constructed. Example return would be '>= 5'.

Returns:
string

Definition at line 240 of file DatabaseCompatibilityUtil.php.

static bulkInsert ( tableName,
&$  rowsOfColumnValues,
&$  columnNames,
bulkQuantity,
shouldTrim = false 
) [static]

Insert multiple columns into database. Currently it supports only mysql database. Limit write to 500 rows at once

Parameters:
string $tableName
array $rowsOfColumnValues
array $columnNames
$bulkQuantity 
bool $shouldTrim Should trim data before insert
Exceptions:
BulkInsertFailedException 
NotSupportedException 

Definition at line 292 of file DatabaseCompatibilityUtil.php.

static getDatabaseVersion ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get version number of database

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $port
Exceptions:
NotSupportedException 

Definition at line 359 of file DatabaseCompatibilityUtil.php.

static getDatabaseMaxAllowedPacketsSizeRb (  )  [static]

Get database max alowed packet size.

Exceptions:
NotSupportedException 

Definition at line 395 of file DatabaseCompatibilityUtil.php.

static getDatabaseMaxAllowedPacketsSize ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database max alowed packet size.

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 
Returns:
int|string error

Definition at line 424 of file DatabaseCompatibilityUtil.php.

static getDatabaseMaxSpRecursionDepth ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database max_sp_recursion_depth

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 

Definition at line 462 of file DatabaseCompatibilityUtil.php.

static getDatabaseThreadStackValue ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database thread_stack

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 

Definition at line 499 of file DatabaseCompatibilityUtil.php.

static getDatabaseOptimizerSearchDepthValue ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database optimizer_search_depth

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 

Definition at line 536 of file DatabaseCompatibilityUtil.php.

static getDatabaseLogBinValue ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database log_bin

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 

Definition at line 573 of file DatabaseCompatibilityUtil.php.

static getDatabaseLogBinTrustFunctionCreatorsValue ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database log_bin_trust_function_creators

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 

Definition at line 610 of file DatabaseCompatibilityUtil.php.

static getDatabaseDefaultCollation ( databaseType,
databaseHostname,
databaseName,
databaseUsername,
databasePassword,
databasePort 
) [static]

Get database default collation

Parameters:
string $databaseType
string $databaseHostname
string $databaseName
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 
Returns:
string|boolean

Definition at line 649 of file DatabaseCompatibilityUtil.php.

static isDatabaseStrictMode ( databaseType,
databaseHostname,
databaseUsername,
databasePassword,
databasePort 
) [static]

Check if database is in strict mode

Parameters:
string $databaseType
string $databaseHostname
string $databaseUsername
string $databasePassword
string $databasePort
Exceptions:
NotSupportedException 
Returns:
boolean

Definition at line 690 of file DatabaseCompatibilityUtil.php.

static checkDatabaseConnection ( databaseType,
host,
rootUsername,
rootPassword,
port 
) [static]

Check if can connect to database

Parameters:
string $databaseType
string $host
string $rootUsername
string $rootPassword
string $port
Exceptions:
NotSupportedException 
Returns:
true|string $error

Definition at line 735 of file DatabaseCompatibilityUtil.php.

static checkDatabaseExists ( databaseType,
host,
rootUsername,
rootPassword,
port,
databaseName 
) [static]

Check if database exist

Parameters:
string $databaseType
string $host
string $rootUsername
string $rootPassword
string $port
string $databaseName
Exceptions:
NotSupportedException 
Returns:
true/false for if the named database exists.

Definition at line 773 of file DatabaseCompatibilityUtil.php.

static checkDatabaseUserExists ( databaseType,
host,
rootUsername,
rootPassword,
port,
username 
) [static]

Check if database user exist

Parameters:
string $databaseType
string $host
string $rootUsername
string $rootPassword
string $port
string $username
Exceptions:
NotSupportedException 
Returns:
true/false for if the named database user exists.

Definition at line 813 of file DatabaseCompatibilityUtil.php.

static createDatabase ( databaseType,
host,
rootUsername,
rootPassword,
port,
databaseName 
) [static]

Creates the named database, dropping it first if it already exists.

Parameters:
string $databaseType
string $host
string $rootUsername
string $rootPassword
string $port
string $databaseName
Exceptions:
NotSupportedException 
Returns:
boolean|string error

Definition at line 909 of file DatabaseCompatibilityUtil.php.

static createDatabaseUser ( databaseType,
host,
rootUsername,
rootPassword,
port,
databaseName,
username,
password 
) [static]

Creates the named database user, dropping it first if it already exists. Grants the user full access on the given database.

Parameters:
string $databaseType
string $host
string $rootUsername
string $rootPassword
string $port
string $databaseName
string $username
string $password
Exceptions:
NotSupportedException 
Returns:
boolean|string error

Definition at line 952 of file DatabaseCompatibilityUtil.php.

static getDatabaseDefaultPort ( databaseType = 'mysql'  )  [static]

Get port on which database is running by default, depending on database type

Parameters:
string $databaseType

Definition at line 1003 of file DatabaseCompatibilityUtil.php.

static backupDatabase ( databaseType = 'mysql',
host,
username,
password,
port,
databaseName,
backupFilePath 
) [static]

Baackup database schema and stored procedures.

Parameters:
string $databaseType
string $host
string $username
string $password
int $port
string $databaseName
string $backupFilePath
Exceptions:
NotSupportedException 
Returns:
boolean

Definition at line 1027 of file DatabaseCompatibilityUtil.php.

static mapHintTypeIntoDatabaseColumnType ( hintType,
length = null 
) [static]

Map hint type into database valid type

Parameters:
string $hintType
Exceptions:
NotSupportedException 
Returns:
string

Definition at line 1099 of file DatabaseCompatibilityUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Mon Oct 16 07:10:24 2017