diff options
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/it_dbi.class b/it_dbi.class index d3dbc11..6f976d5 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -58,7 +58,7 @@ class it_dbi * @param $p optional array(key => value) of configuration data * @param $query Optional initial query to run */ -function it_dbi($p = array(), $query = null) +function __construct($p = array(), $query = null) { # Shortcut: String config means use this table with default values if (!is_array($p)) @@ -100,6 +100,12 @@ function it_dbi($p = array(), $query = null) $GLOBALS['it_dbi'] =& $this; } +# Migration helper function +function it_dbi($p = array(), $query = null) +{ + return self::__construct($p, $query); +} + /** * function Tablename($query) * Constructor. Returns record object from table Tablename. @@ -180,7 +186,7 @@ static function createclass($p) $interface = function_exists("interface_exists") && interface_exists("Iterator", false) ? "implements Iterator" : ""; $code = "class $classname extends it_dbi $interface { - function $classname(/* \$query ... */) + function __construct(/* \$query ... */) { \$args = func_get_args(); \$query = array_shift(\$args); # Preserve type (scalar/array) in single parameter case @@ -188,7 +194,7 @@ static function createclass($p) foreach (\$args as \$arg) \$query = array_merge((array)\$query, (array)\$arg); - \$this->it_dbi(" . var_export($p, true) . ", \$query); + parent::__construct(" . var_export($p, true) . ", \$query); } }"; |