function SetupDatabase(&$arguments) { if (isset($arguments["Debug"])) { $this->debug = $arguments["Debug"]; } if (strcmp($error = MetabaseSetupDatabase($arguments, $this->database), "")) { return $error; } if (!isset($arguments["Debug"])) { MetabaseCaptureDebugOutput($this->database, 1); } return ""; }
function SetupDatabase(&$arguments) { if (isset($arguments["Connection"]) && strlen($error = MetabaseParseConnectionArguments($arguments["Connection"], $arguments))) { return $error; } if (isset($arguments["Debug"])) { $this->debug = $arguments["Debug"]; } if (strlen($error = MetabaseSetupDatabase($arguments, $this->database))) { return $error; } if (!isset($arguments["Debug"])) { MetabaseCaptureDebugOutput($this->database, 1); } return ""; }
function connect($host, $db, $user, $password, $persistent = false) { parent::connect($host, $db, $user, $password, $persistent); $args = array(); $args['Type'] = $this->_dbType; $args['User'] = $user; $args['Password'] = $password; $args['Host'] = $host; $args['Persistent'] = $persistent ? 1 : 0; $error = MetabaseSetupDatabase($args, $this->db); if ($error != null) { $this->error = $error; return false; } else { MetabaseSetDatabase($this->db, $db); return true; } }
} } set_time_limit(0); $input_file = "driver_test.schema"; $manager = new metabase_manager_class(); $success = $manager->UpdateDatabase($input_file, $input_file . ".before", $driver_arguments, $database_variables); $debug_output = ""; if (count($manager->warnings) > 0) { $debug_output .= "WARNING:{$eol}" . implode($manager->warnings, "!{$eol}") . $eol; } if ($manager->database && isset($driver_arguments["CaptureDebug"])) { $debug_output .= MetabaseDebugOutput($manager->database); } $passed = $failed = 0; if ($success) { if (!strcmp($error = MetabaseSetupDatabase($driver_arguments, $database), "")) { if (isset($driver_arguments["CaptureDebug"])) { MetabaseCaptureDebugOutput($database, 1); } MetabaseSetDatabase($database, $database_variables["name"]); if (isset($tests["storage"]) && $success) { $test = "storage"; echo "Testing typed field storage and retrieval ... "; flush(); $pass = 1; if (!MetabaseQuery($database, "DELETE FROM users")) { $success = 0; } else { $row = 1234; $data = array(); $data["user_name"] = "user_{$row}";
function setHotelDB() { global $errorhandler, $gDatasource, $gDatabase, $request; global $tbl_timetracker; $hoteltable = $request->GetVar('schema', 'session'); $error = MetabaseSetupDatabase($gDatasource, &$gDatabase); if ($error != '') { $errorhandler->display('SQL', 'default.inc.php', $error); die; } else { // select database MetabaseSetDatabase($gDatabase, $hoteltable); } // global variables for DB fields $tbl_timetracker = $hoteltable . '.zvs_timetracker'; }
/* * test_metabase_auto_complete.php * * @(#) $Header: /home/mlemos/cvsroot/forms/test_metabase_auto_complete.php,v 1.2 2006/12/20 06:21:17 mlemos Exp $ * */ define("METABASE_PATH", "./ajax/metabase"); require METABASE_PATH . "/metabase_database.php"; require METABASE_PATH . "/metabase_interface.php"; require './ajax/forms.php'; require './ajax/form_ajax_submit.php'; require './ajax/form_auto_complete.php'; require './ajax/form_metabase_auto_complete.php'; $arguments = array("Type" => "mysql", "User" => "root", "Password" => "mysql1", "Database" => "medicus", "IncludePath" => METABASE_PATH, "Debug" => "error_log"); MetabaseSetupDatabase($arguments, $database); $form = new form_class(); $form->NAME = 'auto_complete_form'; $form->METHOD = 'POST'; $form->ACTION = ''; $form->debug = 'error_log'; $form->AddInput(array('TYPE' => 'text', 'ID' => 'location', 'NAME' => 'location', 'SIZE' => 60, 'LABEL' => 'Nazwa <u>L</u>eku', 'ACCESSKEY' => 'L', 'VALUE' => '', 'ExtraAttributes' => array('autocomplete' => 'off', 'title' => 'Leki.'))); $form->AddInput(array('TYPE' => 'button', 'NAME' => 'show_locations', 'ID' => 'show_locations', 'VALUE' => '...', 'ExtraAttributes' => array('title' => 'Click to show all locations.'))); $form->AddInput(array('TYPE' => 'custom', 'ID' => 'complete_location', 'NAME' => 'complete_location', 'CustomClass' => 'form_metabase_auto_complete_class', 'CompleteInput' => 'location', 'CompleteMinimumLength' => 1, 'Dynamic' => 1, 'ShowButton' => 'show_locations', "Connection" => $database, "CompleteValuesQuery" => "SELECT nazwa FROM sl_bloz WHERE nazwa {BEGINSWITH} ORDER BY nazwa", "CompleteValuesLimit" => 10, 'FeedbackElement' => 'complete_location_feedback', 'SubmitFeedback' => ' <img src="indicator.gif" width="16" height="16" alt="Looking up for locations" title="Looking up for locations" /> ', 'CompleteFeedback' => ' <img src="indicator.gif" width="16" height="16" style="visibility: hidden;" /> ', 'MenuClass' => 'groovymenu', 'MenuStyle' => '', 'ItemClass' => 'groovyitem', 'ItemStyle' => '', 'SelectedItemClass' => 'groovyselecteditem', 'SelectedItemStyle' => '')); /* * This code is necessary to handle the requests for fetching * auto-complete values. */ $form->HandleEvent($processed); if ($processed) { exit;
} $input_file = "lob_test.schema"; if (!($success = $manager->UpdateDatabase($input_file, $input_file . ".before", $driver_arguments, $database_variables))) { $error = $manager->error; } if (count($manager->warnings) > 0) { $debug_output .= "WARNING:{$eol}" . implode($manager->warnings, "!{$eol}") . $eol; } if ($manager->database && isset($driver_arguments["CaptureDebug"])) { $debug_output .= MetabaseDebugOutput($manager->database); } $manager->CloseSetup(); if ($success) { MetabaseCloseSetup($database); $database = 0; if ($success = strlen($error = MetabaseSetupDatabase($driver_arguments, $database)) == 0) { MetabaseSetDatabase($database, $database_variables["name"]); if (isset($driver_arguments["CaptureDebug"])) { MetabaseCaptureDebugOutput($database, 1); } } } } else { echo "LOBs are not supported.{$eol}"; } } if ($support_lobs && isset($tests["lobstorage"]) && $success) { $test = "lobstorage"; echo "Testing lob storage... "; flush(); $pass = 1;
function setHotelDB() { global $errorhandler, $gDatasource, $gDatabase, $request; global $tbl_guest, $tbl_address, $tbl_guest_address, $tbl_gast_begleit, $tbl_begleit, $tbl_guestcat, $tbl_guest_guestcat, $tbl_room, $tbl_roomcat, $tbl_bookingcat, $tbl_booking, $tbl_booking_detail, $tbl_booking_detail_guest, $tbl_season, $tbl_price, $tbl_receipt, $tbl_receipt_item, $tbl_article, $tbl_roomcat_article, $tbl_account, $tbl_paycat, $tbl_price2, $tbl_receiptnumber, $tbl_receipt_booking, $tbl_draftreceipt_booking, $tbl_draftreceipt, $tbl_draftreceipt_item, $tbl_timetracker; $hoteltable = $request->GetVar('schema', 'session'); $error = MetabaseSetupDatabase($gDatasource, &$gDatabase); if ($error != '') { $errorhandler->display('SQL', 'default.inc.php', $error); die; } else { // select database MetabaseSetDatabase($gDatabase, $hoteltable); } // global variables for DB fields $tbl_guest = $hoteltable . '.zvs_guest'; $tbl_address = $hoteltable . '.zvs_address'; $tbl_guest_address = $hoteltable . '.zvs_guest_address'; $tbl_gast_begleit = $hoteltable . '.zvs_guest_escort'; $tbl_begleit = $hoteltable . '.zvs_escort'; $tbl_guestcat = $hoteltable . '.zvs_guestcat'; $tbl_guest_guestcat = $hoteltable . '.zvs_guest_guestcat'; $tbl_room = $hoteltable . '.zvs_room'; $tbl_roomcat = $hoteltable . '.zvs_roomcat'; $tbl_bookingcat = $hoteltable . '.zvs_bookingcat'; $tbl_booking = $hoteltable . '.zvs_booking'; $tbl_booking_detail = $hoteltable . '.zvs_booking_detail'; $tbl_booking_detail_guest = $hoteltable . '.zvs_booking_detail_guest'; $tbl_season = $hoteltable . '.zvs_season'; $tbl_price = $hoteltable . '.zvs_price'; $tbl_receipt = $hoteltable . '.zvs_receipt'; $tbl_receipt_item = $hoteltable . '.zvs_receipt_item'; $tbl_article = $hoteltable . '.zvs_article'; $tbl_roomcat_article = $hoteltable . '.zvs_roomcat_article'; $tbl_account = $hoteltable . '.zvs_account'; $tbl_paycat = $hoteltable . '.zvs_paycat'; $tbl_price2 = $hoteltable . '.zvs_price2'; $tbl_receiptnumber = $hoteltable . '.zvs_receiptnumber'; $tbl_receipt_booking = $hoteltable . '.zvs_receipt_booking'; $tbl_draftreceipt_booking = $hoteltable . '.zvs_draftreceipt_booking'; $tbl_draftreceipt = $hoteltable . '.zvs_draftreceipt'; $tbl_draftreceipt_item = $hoteltable . '.zvs_draftreceipt_item'; $tbl_timetracker = $hoteltable . '.zvs_timetracker'; }
function setZVSHotelDB() { global $errorhandler, $gZVSDatabase, $request; global $tbl_zvs_bookingcat, $tbl_zvs_guest, $tbl_zvs_booking, $tbl_zvs_booking_detail; global $zvsmysqlhost, $zvsmysqlpassword, $zvsmysqluser, $metabasepath; $hoteltable = $request->GetVar('schema', 'session'); $gZVSDatasource = array('Type' => 'mysql', 'Host' => $zvsmysqlhost, 'User' => $zvsmysqluser, 'Password' => $zvsmysqlpassword, 'IncludePath' => $metabasepath, 'Persistent' => true, 'Options' => array('UseTransactions' => 1, 'DefaultTableType' => "INNODB")); $error = MetabaseSetupDatabase($gZVSDatasource, &$gZVSDatabase); if ($error != '') { $errorhandler->display('SQL', 'default.inc.php', $error); die; } else { // select database MetabaseSetDatabase($gZVSDatabase, $hoteltable); } // global variables for DB fields $tbl_zvs_bookingcat = $hoteltable . '.zvs_bookingcat'; $tbl_zvs_guest = $hoteltable . '.zvs_guest'; $tbl_zvs_booking = $hoteltable . '.zvs_booking'; $tbl_zvs_booking_detail = $hoteltable . '.zvs_booking_detail'; }