Package DE_EPAGES::Database::API::DBImysql
Functions
- atIsolationLevel
- columnDefinition
- createDatabase
- createEpagesDatabase
- currentDateTime
- databaseName
- dropAllTables
- dropForeignKey
- dropIndex
- escapeChar
- existsDatabase
- existsForeignKey
- existsIndex
- existsTable
- existsTableColumn
- getAllTableReferences
- getSearchCollation
- lockTables
- modifyTableColumnDropDefault
- modifyTableColumnReplaceDefault
- new
- processID
- renameTable
- renameTableColumn
atIsolationLevel
executes the function sub at specified transaction isolation level.
Syntax |
$dbi->atIsolationLevel($IsolationLevel, $Sub); |
Input |
|
columnDefinition
Returns the column definition of a table column.
Syntax |
$dbi->columnDefinition( $Table, $ColumnName ); |
Example |
$dbi->columnDefinition( 'person', 'firstname' ); |
Input |
|
createDatabase
Creates a new database; sets the charset to utf-8
Syntax |
$dbi->createDatabase($DBName); |
Example |
$dbi->createDatabase('storedb'); |
Input |
|
createEpagesDatabase
Creates a database with epages default sizes and names.
Syntax |
$dbi->createEpagesDatabase($DBName, $DBLogin, $hOptions); |
Example |
$dbi->createEpagesDatabase('sitedb', 'usr_sitedb'); $dbi->createEpagesDatabase('storedb'); |
Input |
|
currentDateTime
Returns the current time of the database server.
Syntax |
$DatabaseTime = $dbi->currentDateTime(); |
Return |
|
databaseName
Returns the name of the currently used database.
Syntax |
$databaseName = $dbi->databaseName |
Return |
|
dropAllTables
Removes all user tables from the database (deleting all data, of cause).
Syntax |
$dbi->dropAllTables(); |
dropForeignKey
Drops constaint (foreign key) $constraint from a table $tablename.
Syntax |
$dbi->dropForeignKey($table, $constraint); |
Example |
$table = 'tablename'; $constraint = 'fk_tablename_reftablename'; |
Input |
|
dropIndex
Drops index $indexname from table $tablename.
Syntax |
$dbi->dropIndex($table, $indexname); |
Example |
$table = 'tablename'; $indexname = 'indexname'; |
Input |
|
escapeChar
Returns the escape character '\' to escape like parameter.
Syntax |
$escapeChar = $dbi->escapeChar; |
Return |
|
existsDatabase
Returns true if the database exists.
Syntax |
$Exists = $dbi->existsDatabase($DBName); |
Input |
|
Return |
|
existsForeignKey
Returns true if the foreign key exists.
Syntax |
$Exists = $dbi->existsForeignKey( $Name ); |
Example |
if( $dbi->existsForeignKey( 'sp_InsertAttribute' ) ) { ... }; |
Input |
|
Return |
|
existsIndex
Returns true if the index exists.
Syntax |
$exists = $dbi->existsIndex($Table, $IndexName); |
Example |
if( $dbi->existsIndex('product', 'i_product_super') ) { ... } |
Input |
|
existsTable
Returns true if the database table exists.
Syntax |
$Exists = $DBI->existsTable( $Table ); |
Example |
if( $DBI->existsTable( 'sysobjects' ) ) { ... }; |
Input |
|
Return |
|
existsTableColumn
Returns true if the database table column exists.
Syntax |
$Exists = $dbi->existsTableColumn( $Table, $Column ); |
Example |
if( $dbi->existsTableColumn( 'sysobjects', 'name' ) ) { ... }; |
Input |
|
Return |
|
getAllTableReferences
Determines all table references
Syntax |
$aaReferences = $dbi->getAllTableReferences(); |
Return |
|
getSearchCollation
Returns additional SQL syntax for specification of collations for searches. This is ususally used for mysql to return 'COLLATE utf8_general_ci'
Syntax |
$SearchCollation = $dbi->getSearchCollation; |
Return |
|
lockTables
Locks the specified tables during execution of a code block.
Syntax |
$dbi->lockTables( $ahTables, $cCode ); |
Example |
$dbi->lockTables( [ { 'table' => 'test', 'mode' => 'WRITE'}, { 'table' => 'test2', 'mode' => 'WRITE'}, ], sub { $dbi->do('DELETE FROM test2 WHERE id = ?', $id); $dbi->do('DELETE FROM test WHERE id = ?', $id); }); |
Input |
|
modifyTableColumnDropDefault
Deletes a Default of an existing column of an existing table $tablename.
Syntax |
$dbi->modifyTableColumnDropDefault($table, $column ); |
Example |
$table = 'tablename'; $column = 'columnname'; |
Input |
|
modifyTableColumnReplaceDefault
Modifies a default of an existing column $column of an existing table $tablename.
Syntax |
$dbi->modifyTableColumnReplaceDefault($table, $column ,$defaultvalue); |
Example |
$table = 'tablename'; $column = 'columnname'; $defaultvalue = 0 use functions quote* to quote the value before |
Input |
|
new
Creates a database connection using the supplied connection parameters.
Syntax |
DE_EPAGES::Database::API::DBImysql->new( $DataSource, $User, $Password, $CacheKey ); |
Example |
DE_EPAGES::Database::API::DBImysql->new( 'dbi:mysql:storedb', 'root', 'geheim', 'DAL' ); |
Input |
|
processID
Returns the ID of the current database process.
Syntax |
my $ProcessID = $dbi->processID; |
Input |
|
renameTable
Renames a table.
Syntax |
$dbi->renameTable( $OldName, $NewName ); |
Example |
$dbi->renameTable( 'land', 'country' ); |
Input |
|
renameTableColumn
Renames a table column.
Syntax |
$dbi->renameTableColumn( $Table, $OldColumnName, $NewColumnName ); |
Example |
$dbi->renameTableColumn( 'person', 'prename', 'firstname' ); |
Input |
|