From 19913a2481f6b7ef534f314f836da73a410aff37 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 3 Aug 2007 18:02:31 +0000 Subject: [PATCH] Updating create_schema.php to work with the new ISSO3 stuff --- tools/create_schema.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/tools/create_schema.php b/tools/create_schema.php index 0802c00..224b02e 100644 --- a/tools/create_schema.php +++ b/tools/create_schema.php @@ -3,14 +3,11 @@ // creates schema file output // $Id$ -require_once('../isso-21x/kernel.php'); -$isso = new ISSO; +ini_set('include_path', ini_get('include_path') . ':' . dirname(dirname(getcwd()))); +require_once('ISSO/Register.php'); -$isso->setApplication('Schema Creator'); -$isso->setAppPath(getcwd()); - -define('ISSO_DB_LAYER', 'db_mysql'); -$isso->load('db_mysql', 'db', true); +$db = BSRegister::LoadModule('DbMySQL'); +$input = BSRegister::LoadModule('Input'); if (empty($_REQUEST['submit'])) { @@ -38,13 +35,13 @@ if (empty($_REQUEST['submit'])) } else { - $db->connect($isso->in['server'], $isso->in['username'], $isso->in['password'], $isso->in['database'], false); + $db->connect($input->in['server'], $input->in['username'], $input->in['password'], $input->in['database'], false); - $t = ($isso->in['encase'] ? '`' : ''); - $prefix = ($isso->in['prefix'] ? '" . TABLE_PREFIX . "' : ''); + $t = ($input->in['encase'] ? '`' : ''); + $prefix = ($input->in['prefix'] ? '" . TABLE_PREFIX . "' : ''); $tables = $db->query("SHOW TABLES"); - while ($table = $db->fetch_array($tables, false)) + while ($table = $db->fetchArray($tables, false)) { $table = $table[0]; $list = array(); @@ -53,11 +50,11 @@ else $build = "CREATE TABLE $t$prefix$table$t\n(\n"; $indexes = $db->query("SHOW INDEX FROM $table"); - while ($index = $db->fetch_array($indexes)) + while ($index = $db->fetchArray($indexes)) { array_walk($index, 'trim'); - if ($index['Sub_part'] AND $isso->in['engine'] == 'postgresql') + if ($index['Sub_part'] AND $input->in['engine'] == 'postgresql') { $subpart = " ($index[Sub_part])"; } @@ -87,7 +84,7 @@ else } $fields = $db->query("DESCRIBE $table"); - while ($field = $db->fetch_array($fields)) + while ($field = $db->fetchArray($fields)) { array_walk($field, 'trim'); @@ -110,11 +107,11 @@ else $field['Type'] = 'int'; } - if ($isso->in['engine'] == 'mysql' AND $field['Type'] != 'bool') + if ($input->in['engine'] == 'mysql' AND $field['Type'] != 'bool') { $field['Type'] .= $matches[3]; } - else if ($isso->in['engine'] == 'postgresql') + else if ($input->in['engine'] == 'postgresql') { if (preg_match('#AUTO_INCREMENT#i', $field['Extra'])) { @@ -130,7 +127,7 @@ else else if (preg_match('#.+?blob$#i', $field['Type'])) { $field['Type'] = 'blob'; - if ($isso->in['engine'] == 'postgresql') + if ($input->in['engine'] == 'postgresql') { $field['Type'] = 'bytea'; } @@ -172,11 +169,11 @@ else $queries["$table"] = $build; } - if ($isso->in['variable'] != '') + if ($input->in['variable'] != '') { foreach ($queries AS $table => $query) { - $output[] = "\${$isso->in['variable']}['$table'] = \"\n$query\";"; + $output[] = "\${$input->in['variable']}['$table'] = \"\n$query\";"; } } else -- 2.22.5