*
* @access public
*/
- function isError($data, $code = null)
+ static function isError($data, $code = null)
{
if (is_a($data, 'MDB2_Error')) {
if (is_null($code)) {
*
* @access public
*/
- function isConnection($value)
+ static function isConnection($value)
{
return is_a($value, 'MDB2_Driver_Common');
}
*
* @access public
*/
- function isResult($value)
+ static function isResult($value)
{
return is_a($value, 'MDB2_Result');
}
*
* @access public
*/
- function isStatement($value)
+ static function isStatement($value)
{
return is_a($value, 'MDB2_Statement_Common');
}
if (!is_null($native_msg) && $native_msg !== '') {
$userinfo.= "[Native message: ". strip_tags($native_msg) ."]\n";
}
+ echo $userinfo;
if (!is_null($method)) {
$userinfo = $method.': '.$userinfo;
}
*/
function getFieldDeclarationList($fields)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _fixSequenceName($sqn, $check = false)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _fixIndexName($idx)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createDatabase($database, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function alterDatabase($database, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropDatabase($database)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _getCreateTableQuery($name, $fields, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
if (PEAR::isError($query)) {
return $query;
}
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropTable($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function truncateTable($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function vacuum($table = null, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function alterTable($name, $changes, $check)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listDatabases()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listUsers()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listViews($database = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableViews($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableTriggers($table = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listFunctions()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTables($database = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableFields($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createIndex($table, $name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropIndex($table, $name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableIndexes($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createConstraint($table, $name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropConstraint($table, $name, $primary = false)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableConstraints($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createSequence($seq_name, $start = 1)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropSequence($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listSequences($database = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createDatabase($name, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function alterDatabase($name, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropDatabase($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createTable($name, $fields, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropTable($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function truncateTable($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function vacuum($table = null, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function alterTable($name, $changes, $check)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listDatabases()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listUsers()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listFunctions()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableTriggers($table = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTables($database = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listViews($database = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableFields($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createIndex($table, $name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropIndex($table, $name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableIndexes($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createConstraint($table, $name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropConstraint($table, $name, $primary = false)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _createFKTriggers($table, $foreign_keys)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableConstraints($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createSequence($seq_name, $start = 1, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropSequence($seq_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listSequences($database = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createDatabase($name, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropDatabase($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _getCreateTableQuery($name, $fields, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
}
// create triggers to enforce FOREIGN KEY constraints
if (!empty($options['foreign_keys'])) {
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropTable($name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function vacuum($table = null, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function alterTable($name, $changes, $check, $options = array())
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
$query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true);
$query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')';
$query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')';
- $stmt =& $db->prepare($query, null, MDB2_PREPARE_MANIP);
+ $stmt =$db->prepare($query, null, MDB2_PREPARE_MANIP);
if (PEAR::isError($stmt)) {
return $stmt;
}
*/
function listDatabases()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listUsers()
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
* @return mixed array of view names on success, a MDB2 error on failure
* @access public
*/
- function listViews()
+ function listViews($dummy=null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableViews($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
* @return mixed array of table names on success, a MDB2 error on failure
* @access public
*/
- function listTables()
+ function listTables($dummy=null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableFields($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableTriggers($table = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createIndex($table, $name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropIndex($table, $name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableIndexes($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createConstraint($table, $name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
return $this->alterTable($table, array(), false, array('primary' => null));
}
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function listTableConstraints($table)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function createSequence($seq_name, $start = 1)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function dropSequence($seq_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
* @return mixed array of sequence names on success, a MDB2 error on failure
* @access public
*/
- function listSequences()
+ function listSequences($dummy=null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableFieldDefinition($table, $field)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableIndexDefinition($table, $index)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableConstraintDefinition($table, $index)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getSequenceDefinition($sequence)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTriggerDefinition($trigger)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function tableInfo($result, $mode = null)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableFieldDefinition($table_name, $field_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableIndexDefinition($table_name, $index_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function _getTableFKConstraintDefinition($table, $constraint_name, $definition)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTriggerDefinition($trigger)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
return parent::tableInfo($result, $mode);
}
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
* @access private
*/
function _removeComments($sql) {
- $lines = split("\n", $sql);
+ $lines = explode("\n", $sql);
foreach ($lines as $k => $line) {
$pieces = explode('--', $line);
if (count($pieces) > 1 && (substr_count($pieces[0], '\'') % 2) == 0) {
*/
function _getTableColumns($sql)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
// replace the decimal length-places-separator with a colon
$column_def = preg_replace('/(\d),(\d)/', '\1:\2', $column_def);
$column_def = $this->_removeComments($column_def);
- $column_sql = split(',', $column_def);
+ $column_sql = explode(',', $column_def);
$columns = array();
$count = count($column_sql);
if ($count == 0) {
*/
function getTableFieldDefinition($table_name, $field_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
*/
function getTableIndexDefinition($table_name, $index_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
$start_pos = strpos($sql, '(');
$end_pos = strrpos($sql, ')');
$column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
- $column_names = split(',', $column_names);
+ $column_names = explode(',', $column_names);
if (preg_match("/^create unique/", $sql)) {
return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
if (preg_match("/\bPRIMARY\s+KEY\b\s*\(([^)]+)/i", $sql, $tmp)) {
$definition['primary'] = true;
$definition['fields'] = array();
- $column_names = split(',', $tmp[1]);
+ $column_names = explode(',', $tmp[1]);
$colpos = 1;
foreach ($column_names as $column_name) {
$definition['fields'][trim($column_name)] = array(
if (preg_match("/\"([^\"]+)\"[^\,\"]+\bPRIMARY\s+KEY\b[^\,\)]*/i", $sql, $tmp)) {
$definition['primary'] = true;
$definition['fields'] = array();
- $column_names = split(',', $tmp[1]);
+ $column_names = explode(',', $tmp[1]);
$colpos = 1;
foreach ($column_names as $column_name) {
$definition['fields'][trim($column_name)] = array(
$definition['onupdate'] = 'NO ACTION';
$definition['ondelete'] = 'NO ACTION';
$definition['references']['table'] = $tmp[2];
- $column_names = split(',', $tmp[1]);
+ $column_names = explode(',', $tmp[1]);
$colpos = 1;
foreach ($column_names as $column_name) {
$definition['fields'][trim($column_name)] = array(
'position' => $colpos++
);
}
- $referenced_cols = split(',', $tmp[3]);
+ $referenced_cols = explode(',', $tmp[3]);
$colpos = 1;
foreach ($referenced_cols as $column_name) {
$definition['references']['fields'][trim($column_name)] = array(
$start_pos = strpos($sql, '(');
$end_pos = strrpos($sql, ')');
$column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
- $column_names = split(',', $column_names);
+ $column_names = explode(',', $column_names);
if (!preg_match("/^create unique/", $sql)) {
return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
*/
function getTriggerDefinition($trigger)
{
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
return parent::tableInfo($result, $mode);
}
- $db =& $this->getDBInstance();
+ $db =$this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
* @access public
* @see MDB2::parseDSN
*/
- function &factory(&$db, $options = array())
+ static function factory(&$db, $options = array())
{
$obj =new MDB2_Schema();
$result = $obj->connect($db, $options);
}
$this->disconnect();
if (!MDB2::isConnection($db)) {
- $db =& MDB2::factory($db, $db_options);
+ $db =MDB2::factory($db, $db_options);
}
if (PEAR::isError($db)) {
* @access public
* @see PEAR_Error
*/
- function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
+ function raiseError($code = null, $mode = null, $options = null, $userinfo = null,$a=null,$b=null,$c=null)
{
- $err =& PEAR::raiseError(null, $code, $mode, $options,
+ $err =PEAR::raiseError(null, $code, $mode, $options,
$userinfo, 'MDB2_Schema_Error', true);
return $err;
}
* @return bool true if parameter is an error
* @access public
*/
- function isError($data, $code = null)
+ static function isError($data, $code = null)
{
if (is_a($data, 'MDB2_Schema_Error')) {
if (is_null($code)) {