git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 7d8e199a authored by mmn's avatar mmn

Update to DB_DataObject 1.11.2

Now there's definitely no PHP4 support whatsoever, if there even
was little of it before this commit.
parent f79aec36
This diff is collapsed.
......@@ -17,7 +17,7 @@
* @author Alan Knowles <alan@akbkhome.com>
* @copyright 1997-2008 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: Cast.php 287158 2009-08-12 13:58:31Z alan_k $
* @version CVS: $Id: Cast.php 326604 2012-07-12 03:02:00Z alan_k $
* @link http://pear.php.net/package/DB_DataObject
*/
......@@ -395,7 +395,16 @@ class DB_DataObject_Cast {
// this is funny - the parameter order is reversed ;)
return "'".sqlite_escape_string($this->value)."'";
case 'mssql':
if(is_numeric($this->value)) {
return $this->value;
}
$unpacked = unpack('H*hex', $this->value);
return '0x' . $unpacked['hex'];
default:
return PEAR::raiseError("DB_DataObject_Cast cant handle blobs for Database:{$db->dsn['phptype']} Yet");
}
......@@ -422,10 +431,10 @@ class DB_DataObject_Cast {
// perhaps we should support TEXT fields???
//
if (!($to & DB_DATAOBJECT_BLOB)) {
return PEAR::raiseError('Invalid Cast from a DB_DataObject_Cast::string to something other than a blob!'.
' (why not just use native features)');
}
// $to == a string field which is the default type (0)
// so we do not test it here. - we assume that number fields
// will accept a string?? - which is stretching it a bit ...
// should probaly add that test as some point.
switch ($db->dsn['phptype']) {
case 'pgsql':
......@@ -438,7 +447,15 @@ class DB_DataObject_Cast {
case 'mysqli':
return "'".mysqli_real_escape_string($db->connection, $this->value)."'";
case 'mssql':
// copied from the old DB mssql code...?? not sure how safe this is.
return "'" . str_replace(
array("'", "\\\r\n", "\\\n"),
array("''", "\\\\\r\n\r\n", "\\\\\n\n"),
$this->value
) . "'";
default:
return PEAR::raiseError("DB_DataObject_Cast cant handle blobs for Database:{$db->dsn['phptype']} Yet");
}
......@@ -544,6 +561,5 @@ class DB_DataObject_Cast {
}
File mode changed from 100644 to 100755
This diff is collapsed.
This diff is collapsed.
......@@ -16,7 +16,7 @@
// | Author: Alan Knowles <alan@akbkhome.com>
// +----------------------------------------------------------------------+
//
// $Id: createTables.php 277015 2009-03-12 05:51:03Z alan_k $
// $Id: createTables.php 315758 2011-08-30 08:11:59Z alan_k $
//
// since this version doesnt use overload,
......@@ -27,13 +27,17 @@ define('DB_DATAOBJECT_NO_OVERLOAD',1);
//require_once 'DB/DataObject/Generator.php';
require_once 'DB/DataObject/Generator.php';
if (php_sapi_name() != 'cli') {
PEAR::raiseError("\nERROR: You must turn use the cli sapi to run this", null, PEAR_ERROR_DIE);
}
if (!ini_get('register_argc_argv')) {
PEAR::raiseError("\nERROR: You must turn register_argc_argv On in you php.ini file for this to work\neg.\n\nregister_argc_argv = On\n\n", null, PEAR_ERROR_DIE);
exit;
}
if (!@$_SERVER['argv'][1]) {
PEAR::raiseError("\nERROR: createTable.php usage:\n\nC:\php\pear\DB\DataObjects\createTable.php example.ini\n\n", null, PEAR_ERROR_DIE);
PEAR::raiseError("\nERROR: createTable.php usage:\n\n" .$_SERVER['argv'][0] . " example.ini\n\n", null, PEAR_ERROR_DIE);
exit;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment