mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
static public -> public static
This commit is contained in:
@@ -94,49 +94,49 @@ class dibi
|
|||||||
* Connection registry storage for DibiDriver objects
|
* Connection registry storage for DibiDriver objects
|
||||||
* @var DibiDriver[]
|
* @var DibiDriver[]
|
||||||
*/
|
*/
|
||||||
static private $registry = array();
|
private static $registry = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current connection
|
* Current connection
|
||||||
* @var DibiDriver
|
* @var DibiDriver
|
||||||
*/
|
*/
|
||||||
static private $connection;
|
private static $connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last SQL command @see dibi::query()
|
* Last SQL command @see dibi::query()
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
static public $sql;
|
public static $sql;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File for logging SQL queries
|
* File for logging SQL queries
|
||||||
* @var string|NULL
|
* @var string|NULL
|
||||||
*/
|
*/
|
||||||
static public $logFile;
|
public static $logFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mode parameter used by fopen()
|
* Mode parameter used by fopen()
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
static public $logMode = 'a';
|
public static $logMode = 'a';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To log all queries or error queries (debug mode)
|
* To log all queries or error queries (debug mode)
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
static public $logAll = FALSE;
|
public static $logAll = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dibi::query() error mode
|
* dibi::query() error mode
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
static public $throwExceptions = FALSE;
|
public static $throwExceptions = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Substitutions for identifiers
|
* Substitutions for identifiers
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
static private $substs = array();
|
private static $substs = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class dibi
|
|||||||
* @return DibiDriver
|
* @return DibiDriver
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
static public function connect($config, $name=0)
|
public static function connect($config, $name=0)
|
||||||
{
|
{
|
||||||
// DSN string
|
// DSN string
|
||||||
if (is_string($config))
|
if (is_string($config))
|
||||||
@@ -190,7 +190,7 @@ class dibi
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static public function isConnected()
|
public static function isConnected()
|
||||||
{
|
{
|
||||||
return (bool) self::$connection;
|
return (bool) self::$connection;
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ class dibi
|
|||||||
* @return object DibiDriver object.
|
* @return object DibiDriver object.
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
static public function getConnection($name=NULL)
|
public static function getConnection($name=NULL)
|
||||||
{
|
{
|
||||||
if ($name === NULL) {
|
if ($name === NULL) {
|
||||||
if (!self::$connection)
|
if (!self::$connection)
|
||||||
@@ -227,7 +227,7 @@ class dibi
|
|||||||
* @return void
|
* @return void
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
static public function activate($name)
|
public static function activate($name)
|
||||||
{
|
{
|
||||||
self::$connection = self::getConnection($name);
|
self::$connection = self::getConnection($name);
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ class dibi
|
|||||||
* @return int|DibiResult
|
* @return int|DibiResult
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
static public function query($args)
|
public static function query($args)
|
||||||
{
|
{
|
||||||
// receive arguments
|
// receive arguments
|
||||||
if (!is_array($args))
|
if (!is_array($args))
|
||||||
@@ -258,7 +258,7 @@ class dibi
|
|||||||
* @param array|mixed one or more arguments
|
* @param array|mixed one or more arguments
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static public function test($args)
|
public static function test($args)
|
||||||
{
|
{
|
||||||
// receive arguments
|
// receive arguments
|
||||||
if (!is_array($args))
|
if (!is_array($args))
|
||||||
@@ -287,7 +287,7 @@ class dibi
|
|||||||
*
|
*
|
||||||
* @return int|bool int on success or FALSE on failure
|
* @return int|bool int on success or FALSE on failure
|
||||||
*/
|
*/
|
||||||
static public function insertId()
|
public static function insertId()
|
||||||
{
|
{
|
||||||
return self::getConnection()->insertId();
|
return self::getConnection()->insertId();
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ class dibi
|
|||||||
*
|
*
|
||||||
* @return int number of rows or FALSE on error
|
* @return int number of rows or FALSE on error
|
||||||
*/
|
*/
|
||||||
static public function affectedRows()
|
public static function affectedRows()
|
||||||
{
|
{
|
||||||
return self::getConnection()->affectedRows();
|
return self::getConnection()->affectedRows();
|
||||||
}
|
}
|
||||||
@@ -313,14 +313,14 @@ class dibi
|
|||||||
* @param string SQL statement.
|
* @param string SQL statement.
|
||||||
* @return object|bool Result set object or TRUE on success, FALSE on failure
|
* @return object|bool Result set object or TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
static public function nativeQuery($sql)
|
public static function nativeQuery($sql)
|
||||||
{
|
{
|
||||||
return self::getConnection()->nativeQuery($sql);
|
return self::getConnection()->nativeQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static private function dumpHighlight($matches)
|
private static function dumpHighlight($matches)
|
||||||
{
|
{
|
||||||
if (!empty($matches[1])) // comment
|
if (!empty($matches[1])) // comment
|
||||||
return '<em style="color:gray">'.$matches[1].'</em>';
|
return '<em style="color:gray">'.$matches[1].'</em>';
|
||||||
@@ -344,7 +344,7 @@ class dibi
|
|||||||
* @param bool return or print?
|
* @param bool return or print?
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static public function dump($sql, $return=FALSE) {
|
public static function dump($sql, $return=FALSE) {
|
||||||
static $keywords2 = 'ALL|DISTINCT|AS|ON|INTO|AND|OR|AS';
|
static $keywords2 = 'ALL|DISTINCT|AS|ON|INTO|AND|OR|AS';
|
||||||
static $keywords1 = 'SELECT|UPDATE|INSERT|DELETE|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|LIMIT|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN';
|
static $keywords1 = 'SELECT|UPDATE|INSERT|DELETE|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|LIMIT|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN';
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ class dibi
|
|||||||
* @param object DibiResult
|
* @param object DibiResult
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static public function dumpResult(DibiResult $res)
|
public static function dumpResult(DibiResult $res)
|
||||||
{
|
{
|
||||||
echo '<table class="dump"><tr>';
|
echo '<table class="dump"><tr>';
|
||||||
echo '<th>#row</th>';
|
echo '<th>#row</th>';
|
||||||
@@ -403,7 +403,7 @@ class dibi
|
|||||||
* @param string to
|
* @param string to
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static public function addSubst($expr, $subst)
|
public static function addSubst($expr, $subst)
|
||||||
{
|
{
|
||||||
self::$substs[':'.$expr.':'] = $subst;
|
self::$substs[':'.$expr.':'] = $subst;
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,7 @@ class dibi
|
|||||||
* @param string from
|
* @param string from
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static public function removeSubst($expr)
|
public static function removeSubst($expr)
|
||||||
{
|
{
|
||||||
unset(self::$substs[':'.$expr.':']);
|
unset(self::$substs[':'.$expr.':']);
|
||||||
}
|
}
|
||||||
@@ -425,7 +425,7 @@ class dibi
|
|||||||
* @param string
|
* @param string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static public function substitute($s)
|
public static function substitute($s)
|
||||||
{
|
{
|
||||||
if (strpos($s, ':') === FALSE) return $s;
|
if (strpos($s, ':') === FALSE) return $s;
|
||||||
return strtr($s, self::$substs);
|
return strtr($s, self::$substs);
|
||||||
@@ -436,7 +436,7 @@ class dibi
|
|||||||
* Error logging
|
* Error logging
|
||||||
* EXPERIMENTAL
|
* EXPERIMENTAL
|
||||||
*/
|
*/
|
||||||
static public function log($message)
|
public static function log($message)
|
||||||
{
|
{
|
||||||
if (self::$logFile == NULL || self::$logMode == NULL) return;
|
if (self::$logFile == NULL || self::$logMode == NULL) return;
|
||||||
|
|
||||||
|
@@ -252,12 +252,14 @@ abstract class DibiDriver
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**#@+
|
||||||
* Access to undeclared property
|
* Access to undeclared property
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
|
|
||||||
} // class DibiDriver
|
} // class DibiDriver
|
||||||
|
@@ -54,7 +54,7 @@ abstract class DibiResult implements IteratorAggregate, Countable
|
|||||||
protected $meta;
|
protected $meta;
|
||||||
|
|
||||||
|
|
||||||
static private $types = array(
|
private static $types = array(
|
||||||
dibi::FIELD_TEXT => 'string',
|
dibi::FIELD_TEXT => 'string',
|
||||||
dibi::FIELD_BINARY => 'string',
|
dibi::FIELD_BINARY => 'string',
|
||||||
dibi::FIELD_BOOL => 'bool',
|
dibi::FIELD_BOOL => 'bool',
|
||||||
@@ -400,12 +400,14 @@ abstract class DibiResult implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**#@+
|
||||||
* Access to undeclared property
|
* Access to undeclared property
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
} // class DibiResult
|
} // class DibiResult
|
||||||
|
|
||||||
|
@@ -377,11 +377,13 @@ class DibiTranslator
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**#@+
|
||||||
* Access to undeclared property
|
* Access to undeclared property
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __get($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __set($name, $value) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
function __unset($name) { throw new Exception("Access to undeclared property: " . get_class($this) . "::$$name"); }
|
||||||
|
/**#@-*/
|
||||||
|
|
||||||
} // class DibiParser
|
} // class DibiParser
|
||||||
|
Reference in New Issue
Block a user