Loading db/jig.php +12 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ class Jig { //@} protected //! UUID $uuid, //! Storage location $dir, //! Current storage format Loading Loading @@ -73,12 +75,20 @@ class Jig { return $out; } /** * Return directory * @return string **/ function dir() { return $this->dir; } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dir); return $this->uuid; } /** Loading Loading @@ -117,7 +127,7 @@ class Jig { function __construct($dir,$format=self::FORMAT_JSON) { if (!is_dir($dir)) mkdir($dir,\Base::MODE,TRUE); $this->dir=$dir; $this->uuid=\Base::instance()->hash($this->dir=$dir); $this->format=$format; } Loading db/jig/mapper.php +1 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ class Mapper extends \DB\Cursor { $db=$this->db; $now=microtime(TRUE); if (!$fw->get('CACHE') || !$ttl || !($cached=$cache->exists( $hash=$fw->hash($this->db->dir. $hash=$fw->hash($this->db->dir(). $fw->stringify(array($filter,$options))).'.jig',$data)) || $cached[0]+$ttl<microtime(TRUE)) { $data=$db->read($this->file); Loading db/mongo.php +12 −2 Original line number Diff line number Diff line Loading @@ -24,17 +24,27 @@ class Mongo extends \MongoDB { //@} private //! UUID $uuid, //! Data source name $dsn, //! MongoDB log $log; /** * Return data source name * @return string **/ function dsn() { return $this->dsn; } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); return $this->uuid; } /** Loading Loading @@ -73,7 +83,7 @@ class Mongo extends \MongoDB { * @param $options array **/ function __construct($dsn,$dbname,array $options=NULL) { $this->dsn=$dsn; $this->uuid=\Base::instance()->hash($this->dsn=$dsn); $class=class_exists('\MongoClient')?'\MongoClient':'\Mongo'; parent::__construct(new $class($dsn,$options?:array()),$dbname); $this->setprofilinglevel(2); Loading db/mongo/mapper.php +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class Mapper extends \DB\Cursor { ); $fw=\Base::instance(); $cache=\Cache::instance(); if (!($cached=$cache->exists($hash=$fw->hash($this->db->dsn. if (!($cached=$cache->exists($hash=$fw->hash($this->db->dsn(). $fw->stringify(array($fields,$filter,$options))).'.mongo', $result)) || !$ttl || $cached[0]+$ttl<microtime(TRUE)) { if ($options['group']) { Loading db/sql.php +6 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ namespace DB; class SQL extends \PDO { private //! UUID $uuid, //! Data source name $dsn, //! Database engine Loading Loading @@ -284,7 +286,7 @@ class SQL extends \PDO { * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); return $this->uuid; } /** Loading Loading @@ -338,7 +340,8 @@ class SQL extends \PDO { * @param $options array **/ function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) { $this->dsn=$dsn; $fw=\Base::instance(); $this->uuid=$fw->hash($this->dsn=$dsn); if (preg_match('/^.+?(?:dbname|database)=(.+?)(?=;|$)/i',$dsn,$parts)) $this->dbname=$parts[1]; if (!$options) Loading @@ -346,8 +349,7 @@ class SQL extends \PDO { $options+=array(\PDO::ATTR_EMULATE_PREPARES=>FALSE); if (isset($parts[0]) && strstr($parts[0],':',TRUE)=='mysql') $options+=array(\PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES '. strtolower(str_replace('-','', \Base::instance()->get('ENCODING'))).';'); strtolower(str_replace('-','',$fw->get('ENCODING'))).';'); parent::__construct($dsn,$user,$pw,$options); $this->engine=parent::getattribute(parent::ATTR_DRIVER_NAME); } Loading Loading
db/jig.php +12 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ class Jig { //@} protected //! UUID $uuid, //! Storage location $dir, //! Current storage format Loading Loading @@ -73,12 +75,20 @@ class Jig { return $out; } /** * Return directory * @return string **/ function dir() { return $this->dir; } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dir); return $this->uuid; } /** Loading Loading @@ -117,7 +127,7 @@ class Jig { function __construct($dir,$format=self::FORMAT_JSON) { if (!is_dir($dir)) mkdir($dir,\Base::MODE,TRUE); $this->dir=$dir; $this->uuid=\Base::instance()->hash($this->dir=$dir); $this->format=$format; } Loading
db/jig/mapper.php +1 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ class Mapper extends \DB\Cursor { $db=$this->db; $now=microtime(TRUE); if (!$fw->get('CACHE') || !$ttl || !($cached=$cache->exists( $hash=$fw->hash($this->db->dir. $hash=$fw->hash($this->db->dir(). $fw->stringify(array($filter,$options))).'.jig',$data)) || $cached[0]+$ttl<microtime(TRUE)) { $data=$db->read($this->file); Loading
db/mongo.php +12 −2 Original line number Diff line number Diff line Loading @@ -24,17 +24,27 @@ class Mongo extends \MongoDB { //@} private //! UUID $uuid, //! Data source name $dsn, //! MongoDB log $log; /** * Return data source name * @return string **/ function dsn() { return $this->dsn; } /** * Return UUID * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); return $this->uuid; } /** Loading Loading @@ -73,7 +83,7 @@ class Mongo extends \MongoDB { * @param $options array **/ function __construct($dsn,$dbname,array $options=NULL) { $this->dsn=$dsn; $this->uuid=\Base::instance()->hash($this->dsn=$dsn); $class=class_exists('\MongoClient')?'\MongoClient':'\Mongo'; parent::__construct(new $class($dsn,$options?:array()),$dbname); $this->setprofilinglevel(2); Loading
db/mongo/mapper.php +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class Mapper extends \DB\Cursor { ); $fw=\Base::instance(); $cache=\Cache::instance(); if (!($cached=$cache->exists($hash=$fw->hash($this->db->dsn. if (!($cached=$cache->exists($hash=$fw->hash($this->db->dsn(). $fw->stringify(array($fields,$filter,$options))).'.mongo', $result)) || !$ttl || $cached[0]+$ttl<microtime(TRUE)) { if ($options['group']) { Loading
db/sql.php +6 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ namespace DB; class SQL extends \PDO { private //! UUID $uuid, //! Data source name $dsn, //! Database engine Loading Loading @@ -284,7 +286,7 @@ class SQL extends \PDO { * @return string **/ function uuid() { return \Base::instance()->hash($this->dsn); return $this->uuid; } /** Loading Loading @@ -338,7 +340,8 @@ class SQL extends \PDO { * @param $options array **/ function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) { $this->dsn=$dsn; $fw=\Base::instance(); $this->uuid=$fw->hash($this->dsn=$dsn); if (preg_match('/^.+?(?:dbname|database)=(.+?)(?=;|$)/i',$dsn,$parts)) $this->dbname=$parts[1]; if (!$options) Loading @@ -346,8 +349,7 @@ class SQL extends \PDO { $options+=array(\PDO::ATTR_EMULATE_PREPARES=>FALSE); if (isset($parts[0]) && strstr($parts[0],':',TRUE)=='mysql') $options+=array(\PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES '. strtolower(str_replace('-','', \Base::instance()->get('ENCODING'))).';'); strtolower(str_replace('-','',$fw->get('ENCODING'))).';'); parent::__construct($dsn,$user,$pw,$options); $this->engine=parent::getattribute(parent::ATTR_DRIVER_NAME); } Loading