diff --git a/cake/libs/cache/hashfile.php b/cake/libs/cache/hashfile.php new file mode 100644 index 00000000000..b94fabd1723 --- /dev/null +++ b/cake/libs/cache/hashfile.php @@ -0,0 +1,36 @@ +_File->name), 0, self::HASH_DIGITS_NUMBER); + + $this->_File->Folder->create( + $this->_File->Folder->addPathElement( + $this->_File->Folder->pwd(), + $intermediate_key + ) + ); + $this->_File->Folder->cd($intermediate_key); + $this->_File->path = null; + $this->_File->pwd(); + + } + +} \ No newline at end of file diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php index 5de46be8a84..c71c8eae488 100644 --- a/cake/libs/model/datasources/datasource.php +++ b/cake/libs/model/datasources/datasource.php @@ -223,7 +223,7 @@ function __construct($config = array()) { * @return array Array of sources available in this datasource. * @access public */ - function listSources($data = null) { + function cachedListSources($data = null) { if ($this->cacheSources === false) { return null; } diff --git a/cake/libs/model/datasources/dbo/dbo_mssql.php b/cake/libs/model/datasources/dbo/dbo_mssql.php index b7b17f7c8a9..cff9dca0894 100644 --- a/cake/libs/model/datasources/dbo/dbo_mssql.php +++ b/cake/libs/model/datasources/dbo/dbo_mssql.php @@ -201,7 +201,7 @@ function _execute($sql) { * @return array Array of tablenames in the database */ function listSources() { - $cache = parent::listSources(); + $cache = $this->cachedListSources(); if ($cache != null) { return $cache; @@ -217,7 +217,7 @@ function listSources() { $tables[] = $table[0]['TABLE_NAME']; } - parent::listSources($tables); + $this->cachedListSources($tables); return $tables; } } diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 7bd0fd64ff5..68f240fcbe2 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -513,6 +513,9 @@ function column($real) { if (strpos($col, 'enum') !== false) { return "enum($vals)"; } + if (strpos($col, 'bit') !== false) { + return 'bit'; + } return 'text'; } } @@ -615,7 +618,7 @@ function _execute($sql) { * @return array Array of tablenames in the database */ function listSources() { - $cache = parent::listSources(); + $cache = $this->cachedListSources(); if ($cache != null) { return $cache; } @@ -629,7 +632,7 @@ function listSources() { while ($line = mysql_fetch_row($result)) { $tables[] = $line[0]; } - parent::listSources($tables); + $this->cachedListSources($tables); return $tables; } } @@ -662,6 +665,13 @@ function value($data, $column = null, $safe = false) { case 'boolean': return $this->boolean((bool)$data); break; + case 'bit': + if(is_int($data)) { + return "b'" . decbin($data) . "'"; + } else { + return "b'" . $data . "'"; + } + break; case 'integer': case 'float': if ($data === '') { diff --git a/cake/libs/model/datasources/dbo/dbo_mysqli.php b/cake/libs/model/datasources/dbo/dbo_mysqli.php index 844554cdd7c..e7661a71fb2 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysqli.php +++ b/cake/libs/model/datasources/dbo/dbo_mysqli.php @@ -133,7 +133,7 @@ function _executeProcedure($sql) { * @return array Array of tablenames in the database */ function listSources() { - $cache = parent::listSources(); + $cache = $this->cachedListSources(); if ($cache !== null) { return $cache; } @@ -148,7 +148,7 @@ function listSources() { while ($line = mysqli_fetch_row($result)) { $tables[] = $line[0]; } - parent::listSources($tables); + $this->cachedListSources($tables); return $tables; } diff --git a/cake/libs/model/datasources/dbo/dbo_oracle.php b/cake/libs/model/datasources/dbo/dbo_oracle.php index 38fb0338278..503bf658f2e 100644 --- a/cake/libs/model/datasources/dbo/dbo_oracle.php +++ b/cake/libs/model/datasources/dbo/dbo_oracle.php @@ -463,7 +463,7 @@ function createTrigger($table) { * @access public */ function listSources() { - $cache = parent::listSources(); + $cache = $this->cachedListSources(); if ($cache != null) { return $cache; } @@ -477,7 +477,7 @@ function listSources() { while($r = $this->fetchRow()) { $sources[] = strtolower($r[0]['name']); } - parent::listSources($sources); + $this->cachedListSources($sources); return $sources; } diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index 9d1558e3371..d6e8c09394f 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -173,7 +173,7 @@ function _execute($sql) { * @return array Array of tablenames in the database */ function listSources() { - $cache = parent::listSources(); + $cache = $this->cachedListSources(); if ($cache != null) { return $cache; @@ -192,7 +192,7 @@ function listSources() { $tables[] = $item[0]['name']; } - parent::listSources($tables); + $this->cachedListSources($tables); return $tables; } } diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php index efc660f33b8..2dbc74fcb16 100644 --- a/cake/libs/model/datasources/dbo/dbo_sqlite.php +++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php @@ -192,7 +192,7 @@ function execute($sql) { * @return array Array of tablenames in the database */ function listSources() { - $cache = parent::listSources(); + $cache = $this->cachedListSources(); if ($cache != null) { return $cache; @@ -206,7 +206,7 @@ function listSources() { foreach ($result as $table) { $tables[] = $table[0]['name']; } - parent::listSources($tables); + $this->cachedListSources($tables); return $tables; } return array(); diff --git a/cake/libs/view/helpers/js.php b/cake/libs/view/helpers/js.php index 8ecb5c5bc1f..afbf1f36a68 100644 --- a/cake/libs/view/helpers/js.php +++ b/cake/libs/view/helpers/js.php @@ -445,6 +445,19 @@ function _getHtmlOptions($options, $additional = array()) { } return array($options, $htmlOptions); } + + function beforeRender() { + if(!isset($this->params['requested'])) { + ClassRegistry::addObject('main_js_helper', $this); + } + } + + function afterRender() { + if(isset($this->params['requested']) && ClassRegistry::isKeySet('main_js_helper')) { + ClassRegistry::getObject('main_js_helper')->buffer(implode("\n", $this->getBuffer())); + } + } + } /** diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php index c90d585ca77..157d2c7b33d 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php @@ -227,6 +227,14 @@ function testQuoting() { $expected = "'00010010001'"; $result = $this->db->value('00010010001'); $this->assertEqual($expected, $result); + + $expected = "b'00010010001'"; + $result = $this->db->value('00010010001', 'bit'); + $this->assertEqual($expected, $result); + + $expected = "b'1101'"; + $result = $this->db->value(13, 'bit'); + $this->assertEqual($expected, $result); } /** @@ -525,6 +533,10 @@ function testColumn() { $result = $this->db->column('decimal(14,7) unsigned'); $expected = 'float'; $this->assertEqual($result, $expected); + + $result = $this->db->column('bit(3)'); + $expected = 'bit'; + $this->assertEqual($result, $expected); } /**