Package DE_EPAGES::Database::API::DBISybase
Functions
- atIsolationLevel
- createDatabase
- createDevice
- createEpagesDatabase
- createTempTable
- defaultDevicePath
- disconnect
- doEscapeChars
- dropAllTables
- encodeSpaces
- escapeChar
- escapeFromExtension
- existsDatabase
- existsDevice
- existsForeignKey
- existsIndex
- existsLogin
- existsProcedure
- getAllTableReferences
- getDatabaseUsages
- getIndex
- getTableLockingScheme
- killConnections
- lockTables
- modifyTableColumnDropDefault
- modifyTableColumnReplaceDefault
- modifyTableLockingScheme
- operatingSystem
- ping
- processID
- setDatabaseOption
- setPriority
- tempTableName
- transaction
- truncateTransactionLog
atIsolationLevel
executes the function sub at specified transaction isolation level.
Syntax |
$dbi->atIsolationLevel($IsolationLevel, $Sub); |
Input |
|
createDatabase
Creates database in devices.
Syntax |
$dbi->createDatabase($DBName, $DataDeviceName, $DataSize, $LogDevice, $LogSize); |
Example |
$dbi->createDatabase('storedb', 'storedbdatdev', '2000', 'storedblogdev', 1000 ); |
Input |
|
createDevice
Creates data or log device.
Syntax |
$dbi->createDevice($DeviceName, $FileName, $Size); $dbi->createDevice($DeviceName, $FileName, $Size, $hOptions); |
Example |
$dbi->createDevice('storedbdat2dev', '/opt/eproot/Sybase/data/sitedbdatdev.dat', '2000' ); $dbi->createDevice('storedbdat2dev', '/opt/eproot/Sybase/data/sitedbdatdev.dat', '2000', { 'dsync' => 'false', 'directio' => 'true' }); |
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 |
|
createTempTable
Creates a temporary table with the given name and parameters.
Syntax |
$dbi->createTempTable($Table); $dbi->createTempTable('temptable(objectid int not null primary key)')); |
Input |
|
defaultDevicePath
Look at sysdevices table to find a device (saved in /data/ directory).
Syntax |
$DefaultPath = $dbi->defaultDevicePath; |
Return |
|
disconnect
Disconnects the underlying database handle and finish cached statements.
Syntax |
$dbi->disconnect; |
doEscapeChars
Returns which character should be escaped.
Syntax |
$doEscapeChars = $dbi->doEscapeChars; |
Return |
|
dropAllTables
Removes all user tables and all stored procedures from the database (deleting all data, of course).
Syntax |
$dbi->dropAllTables(); |
encodeSpaces
Encodes spaces to simulate Sybase-like string encoding. Currently two operations are executed on the given string:
- Trailing spaces are removed
- Multiple spaces are substituted by one single space
Syntax |
$string = encodeSpaces( $string ); |
Input |
|
Return |
|
escapeChar
Returns the escape character ~ to escape like parameter.
Syntax |
$escapeChar = $dbi->escapeChar; |
Return |
|
escapeFromExtension
Returns string should be added after each like. escapeChar is used to get the escape char.
Syntax |
$EscapeFromExtension = $dbi->escapeFromExtension; |
Return |
|
existsDatabase
Exists the database ?
Syntax |
$Exists = $dbi->existsDatabase($DBName); |
Input |
|
Return |
|
existsDevice
Exists the device ?
Syntax |
$Exists = $dbi->existsDevice($DeviceName); |
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 |
|
existsLogin
Returns true if the login name exists.
Syntax |
$Exists = $dbi->existsLogin($Login); |
Input |
|
Return |
|
existsProcedure
Returns true if the stored procedure exists.
Syntax |
$Exists = $dbi->existsProcedure( $Procedure ); |
Example |
if( $dbi->existsProcedure( 'sp_InsertAttribute' ) ) { ... }; |
Input |
|
Return |
|
getAllTableReferences
Determines all table references
Syntax |
$aaReferences = $dbi->getAllTableReferences(); |
Return |
|
getDatabaseUsages
Gets the total size and usage of all databases
Syntax |
$ahDatabases = $dbi->getDatabaseUsages(); |
Return |
|
getIndex
Returns index information.
Syntax |
$exists = $dbi->getIndex($Table, $IndexName); |
Example |
$dbi->getIndex('product', 'i_product_super') |
Input |
|
getTableLockingScheme
Gets the locking scheme of a table.
Syntax |
$lockingscheme = $dbi->getTableLockingScheme($table ); |
Example |
$lockingscheme = $dbi->getTableLockingScheme('tablename' ); |
Input |
|
Return |
|
killConnections
Terminates all connections to the given database.
Syntax |
$dbi->killConnections( $DBName ); |
Input |
|
lockTables
Locks the specified tables during execution of a code block. Notes: For the Sybase implementation, the locks will be held until the end of the transaction. If lockTables() is run within a transaction, the locks may still hold after lockTables() returns. If lockTables() is run in AutoCommit mode, a transaction is implicitely created for $cCode.
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 |
|
modifyTableLockingScheme
Changes the locking scheme of a table.
Syntax |
$dbi->modifyTableLockingScheme($table, $lockingscheme ); |
Example |
$dbi->modifyTableLockingScheme('tablename', 'datarows'); |
Input |
|
operatingSystem
Returns the operating system name. Usable for file name concatenation.
Syntax |
$OperatingSystem = $dbi->operatingSystem; |
Return |
|
ping
test if dbi connection is alive. Implementation is copy of DBD::Sybase::ping with correct/extended sybase get results.
Syntax |
$isAlive = $dbi->ping; |
Return |
|
processID
Returns the ID of the current database process.
Syntax |
my $ProcessID = $dbi->processID; |
Input |
|
setDatabaseOption
Set a database option.
Syntax |
$Exists = $dbi->setDatabaseOption($DatabaseName, $Option, $Value); |
Input |
|
setPriority
Sets the priority of the current database process.
Syntax |
$dbi->setPriority( $Priority ) |
Example |
$dbi->setPriority( 'LOW' ) |
Input |
|
tempTableName
Returns the name of the temporary table in the correct database style.
Syntax |
$dbi->tempTableName($TableName); $dbi->tempTableName('temptable'); |
Input |
|
Return |
|
transaction
Executes a code block in a transaction.
Syntax |
$dbi->transaction( $cCode, $cRollback ); |
Example |
$dbi->transaction( sub { $dbi->do( "DELETE FROM objects WHERE classid = 25" ); $dbi->do( "DELETE FROM classes WHERE classid = 25" ); } ); |
Input |
|
truncateTransactionLog
Clears the transaction log of the current database.
Syntax |
$dbi->truncateTransactionLog(); |