Loading db/jig.php +8 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,14 @@ class Jig { return $out; } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dir); } /** * Return SQL profiler results * @return string Loading db/mongo.php +11 −0 Original line number Diff line number Diff line Loading @@ -24,9 +24,19 @@ class Mongo extends \MongoDB { //@} private //! Data source name $dsn, //! MongoDB log $log; /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); } /** * Return MongoDB profiler results * @return string Loading Loading @@ -63,6 +73,7 @@ class Mongo extends \MongoDB { * @param $options array **/ function __construct($dsn,$dbname,array $options=NULL) { $this->dsn=$dsn; $class=class_exists('\MongoClient')?'\MongoClient':'\Mongo'; parent::__construct(new $class($dsn,$options?:array()),$dbname); $this->setprofilinglevel(2); Loading db/sql.php +14 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ namespace DB; class SQL extends \PDO { private //! Data source name $dsn, //! Database engine $engine, //! Database name Loading Loading @@ -112,8 +114,9 @@ class SQL extends \PDO { $now=microtime(TRUE); $keys=$vals=array(); if ($fw->get('CACHE') && $ttl && ($cached=$cache->exists( $hash=$fw->hash($cmd.$fw->stringify($arg)).'.sql', $result)) && $cached[0]+$ttl>microtime(TRUE)) { $hash=$fw->hash($this->dsn.$cmd. $fw->stringify($arg)).'.sql',$result)) && $cached[0]+$ttl>microtime(TRUE)) { foreach ($arg as $key=>$val) { $vals[]=$fw->stringify(is_array($val)?$val[0]:$val); $keys[]='/'.(is_numeric($key)?'\?':preg_quote($key)).'/'; Loading Loading @@ -276,6 +279,14 @@ class SQL extends \PDO { parent::quote($val,$type); } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); } /** * Return database engine * @return string Loading Loading @@ -327,6 +338,7 @@ class SQL extends \PDO { * @param $options array **/ function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) { $this->dsn=$dsn; if (preg_match('/^.+?(?:dbname|database)=(.+?)(?=;|$)/i',$dsn,$parts)) $this->dbname=$parts[1]; if (!$options) Loading Loading
db/jig.php +8 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,14 @@ class Jig { return $out; } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dir); } /** * Return SQL profiler results * @return string Loading
db/mongo.php +11 −0 Original line number Diff line number Diff line Loading @@ -24,9 +24,19 @@ class Mongo extends \MongoDB { //@} private //! Data source name $dsn, //! MongoDB log $log; /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); } /** * Return MongoDB profiler results * @return string Loading Loading @@ -63,6 +73,7 @@ class Mongo extends \MongoDB { * @param $options array **/ function __construct($dsn,$dbname,array $options=NULL) { $this->dsn=$dsn; $class=class_exists('\MongoClient')?'\MongoClient':'\Mongo'; parent::__construct(new $class($dsn,$options?:array()),$dbname); $this->setprofilinglevel(2); Loading
db/sql.php +14 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ namespace DB; class SQL extends \PDO { private //! Data source name $dsn, //! Database engine $engine, //! Database name Loading Loading @@ -112,8 +114,9 @@ class SQL extends \PDO { $now=microtime(TRUE); $keys=$vals=array(); if ($fw->get('CACHE') && $ttl && ($cached=$cache->exists( $hash=$fw->hash($cmd.$fw->stringify($arg)).'.sql', $result)) && $cached[0]+$ttl>microtime(TRUE)) { $hash=$fw->hash($this->dsn.$cmd. $fw->stringify($arg)).'.sql',$result)) && $cached[0]+$ttl>microtime(TRUE)) { foreach ($arg as $key=>$val) { $vals[]=$fw->stringify(is_array($val)?$val[0]:$val); $keys[]='/'.(is_numeric($key)?'\?':preg_quote($key)).'/'; Loading Loading @@ -276,6 +279,14 @@ class SQL extends \PDO { parent::quote($val,$type); } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); } /** * Return database engine * @return string Loading Loading @@ -327,6 +338,7 @@ class SQL extends \PDO { * @param $options array **/ function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) { $this->dsn=$dsn; if (preg_match('/^.+?(?:dbname|database)=(.+?)(?=;|$)/i',$dsn,$parts)) $this->dbname=$parts[1]; if (!$options) Loading