last_error="database creation is not supported"; return(0); } Function DropDatabase($database) { $this->last_error="database dropping is not supported"; return(0); } Function GetField(&$field,$field_name,&$query) { if(!strcmp($field_name,"")) { $this->last_error="it was not specified a valid field name (\"$field_name\")"; return(0); } switch($field["type"]) { case "integer": $query=MetabaseGetIntegerFieldTypeDeclaration($this->database,$field_name,&$field); break; case "text": $query=MetabaseGetTextFieldTypeDeclaration($this->database,$field_name,&$field); break; case "boolean": $query=MetabaseGetBooleanFieldTypeDeclaration($this->database,$field_name,&$field); break; case "date": $query=MetabaseGetDateFieldTypeDeclaration($this->database,$field_name,&$field); break; case "timestamp": $query=MetabaseGetTimestampFieldTypeDeclaration($this->database,$field_name,&$field); break; case "time": $query=MetabaseGetTimeFieldTypeDeclaration($this->database,$field_name,&$field); break; case "float": $query=MetabaseGetFloatFieldTypeDeclaration($this->database,$field_name,&$field); break; case "decimal": $query=MetabaseGetDecimalFieldTypeDeclaration($this->database,$field_name,&$field); break; default: $this->last_error="type \"".$field["type"]."\" is not yet supported"; return(0); } return(1); } Function GetFieldList(&$fields,&$query_fields) { for($query_fields="",Reset($fields),$field_number=0;$field_number0) $query_fields.=","; $field_name=Key($fields); if(!$this->GetField($fields[$field_name],$field_name,$query)) return(0); $query_fields.=$query; } return(1); } Function CreateTable($name,&$fields) { if(!IsSet($name) || !strcmp($name,"")) return("it was not specified a valid table name"); if(count($fields)==0) return("it were not specified any fields for table \"$name\""); $query_fields=""; if(!$this->GetFieldList($fields,$query_fields)) return(0); return($this->Query("CREATE TABLE $name ($query_fields)")); } Function DropTable($name) { return($this->Query("DROP TABLE $name")); } Function AlterTable($name,$changes,$check) { $this->last_error="database table alterations are not supported"; return(0); } Function Query($query) { $this->last_error="database queries are not implemented"; return(0); } Function PrepareQuery1($query) { $positions=array(); for($position=-1;GetType($position=strpos($query,"?",$position+1))=="integer";) $positions[]=$position; $this->prepared_queries[]=array( "Query"=>$query, "Positions"=>$positions, "Values"=>array() ); $prepared_query=count($this->prepared_queries); if($this->selected_row_limit>0) { $this->prepared_queries[$prepared_query-1]["First"]=$this->first_selected_row; $this->prepared_queries[$prepared_query-1]["Limit"]=$this->selected_row_limit; } //echo "pre :".$query; return($prepared_query); } Function PrepareQuery($query) { //$this->Debug("PrepareQuery: $query"); $positions=array(); for($position=0;$positionSetError("Prepare query","it was specified a query with an unterminated text string")); switch($this->escape_quotes) { case "": case "'": $position=$end_quote+1; break; default: if($end_quote==$quote+1) $position=$end_quote+1; else { if($query[$end_quote-1]==$this->escape_quotes) $position=$end_quote; else $position=$end_quote+1; } break; } } else { $positions[]=$question; $position=$question+1; } } $this->prepared_queries[]=array( "Query"=>$query, "Positions"=>$positions, "Values"=>array(), "Types"=>array() ); $prepared_query=count($this->prepared_queries); if($this->selected_row_limit>0) { $this->prepared_queries[$prepared_query-1]["First"]=$this->first_selected_row; $this->prepared_queries[$prepared_query-1]["Limit"]=$this->selected_row_limit; } return($prepared_query); } Function ValidatePreparedQuery($prepared_query) { //echo "
prepared validate
"; if($prepared_query<1 || $prepared_query>count($this->prepared_queries)) { $this->last_error="invalid prepared query"; //echo "invalid prepared query No ".$prepared_query."end here"; return(0); } //echo "
prepared validate 1: pass
"; if(GetType($this->prepared_queries[$prepared_query-1])!="array") { $this->last_error="prepared query was already freed"; //echo "prepared query was already freed"; return(0); } //echo "
prepared validate 2: pass
"; return(1); } Function FreePreparedQuery($prepared_query) { if(!$this->ValidatePreparedQuery($prepared_query)) return(0); $this->prepared_queries[$prepared_query-1]=""; return(1); } Function ExecuteQuery($prepared_query) { //echo "
execute ".$this->prepared_queries[$prepared_query-1]["Query"]; if(!$this->ValidatePreparedQuery($prepared_query)) return(0); //echo "
end here validate pass "; $index=$prepared_query-1; for($query="",$last_position=$position=0;$positionprepared_queries[$index]["Positions"]);$position++) { if(!IsSet($this->prepared_queries[$index]["Values"][$position])) { $this->last_error="it was not defined query argument ".($position+1); //echo "
it was not defined query argument ".($position+1); return(0); } $current_position=$this->prepared_queries[$index]["Positions"][$position]; $query.=substr($this->prepared_queries[$index]["Query"],$last_position,$current_position-$last_position).$this->prepared_queries[$index]["Values"][$position]; $last_position=$current_position+1; } //echo "inhere 2".$this->prepared_queries[$prepared_query-1]["Query"]; $query.=substr($this->prepared_queries[$index]["Query"],$last_position); if($this->selected_row_limit>0) { $this->prepared_queries[$index]["First"]=$this->first_selected_row; $this->prepared_queries[$index]["Limit"]=$this->selected_row_limit; } if(IsSet($this->prepared_queries[$index]["Limit"]) && $this->prepared_queries[$index]["Limit"]>0) { $this->first_selected_row=$this->prepared_queries[$index]["First"]; $this->selected_row_limit=$this->prepared_queries[$index]["Limit"]; } else $this->first_selected_row=$this->selected_row_limit=0; //echo "
prepare qyery : ".$query.";
"; MetabaseDebug($this->database,"Prepared query: ".$this->prepared_queries[$index]["Query"]); return(MetabaseQuery($this->database,$query)); } Function QuerySet($prepared_query,$parameter,$type,$value) { if(!$this->ValidatePreparedQuery($prepared_query)){ //echo "Can't Set ValidatePreparedQuery type $type value $value"; return(0); } $index=$prepared_query-1; if($parameter<1 || $parameter>count($this->prepared_queries[$index]["Positions"])) { $this->last_error="it was not specified a valid argument number"; return(0); } $this->prepared_queries[$index]["Values"][$parameter-1]=$value; return(1); } Function QuerySetNull($prepared_query,$parameter,$type) { return($this->QuerySet($prepared_query,$parameter,$type,"NULL")); } Function QuerySetText($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"text",$this->GetTextFieldValue($value))); } Function QuerySetInteger($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"integer",$this->GetIntegerFieldValue($value))); } Function QuerySetBoolean($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"boolean",$this->GetBooleanFieldValue($value))); } Function QuerySetDate($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"date",$this->GetDateFieldValue($value))); } Function QuerySetTimestamp($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"timestamp",$this->GetTimestampFieldValue($value))); } Function QuerySetTime($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"time",$this->GetTimeFieldValue($value))); } Function QuerySetFloat($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"float",$this->GetFloatFieldValue($value))); } Function QuerySetDecimal($prepared_query,$parameter,$value) { return($this->QuerySet($prepared_query,$parameter,"decimal",$this->GetDecimalFieldValue($value))); } Function AffectedRows(&$affected_rows) { if($this->affected_rows==-1) { $this->last_error="there was no previous valid query to determine the number of affected rows"; return(0); } $affected_rows=$this->affected_rows; return(1); } Function EndOfResult($result) { $this->last_error="end of result method not implemented"; return(-1); } Function FetchResult($result,$row,$field) { $this->warning="method not implemented"; return(""); } Function ResultIsNull($result,$row,$field) { $value=$this->FetchResult($result,$row,$field); return(!IsSet($value)); } Function FetchDateResult($result,$row,$field) { return($this->ResultIsNull($result,$row,$field) ? "NULL" : $this->FetchResult($result,$row,$field)); } Function FetchTimestampResult($result,$row,$field) { return($this->ResultIsNull($result,$row,$field) ? "NULL" : $this->FetchResult($result,$row,$field)); } Function FetchTimeResult($result,$row,$field) { return($this->ResultIsNull($result,$row,$field) ? "NULL" : $this->FetchResult($result,$row,$field)); } Function FetchBooleanResult($result,$row,$field) { return($this->ResultIsNull($result,$row,$field) ? "NULL" : (strcmp($this->FetchResult($result,$row,$field),"Y") ? 0 : 1)); } Function FetchFloatResult($result,$row,$field) { return($this->ResultIsNull($result,$row,$field) ? "NULL" : doubleval($this->FetchResult($result,$row,$field))); } Function FetchDecimalResult($result,$row,$field) { return($this->ResultIsNull($result,$row,$field) ? "NULL" : $this->FetchResult($result,$row,$field)); } Function NumberOfRows($result) { $this->warning="method not implemented"; return(0); } Function FreeResult($result) { $this->warning="method not implemented"; return(0); } Function Error() { return($this->last_error); } Function GetIntegerFieldTypeDeclaration($name,&$field) { if(IsSet($field["unsigned"])) $this->warning="unsigned integer field \"$name\" is being declared as signed integer"; return("$name INT".(IsSet($field["default"]) ? " DEFAULT ".$field["default"] : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetTextFieldTypeDeclaration($name,&$field) { return((IsSet($field["length"]) ? "$name CHAR (".$field["length"].")" : "$name TEXT").(IsSet($field["default"]) ? " DEFAULT ".$this->GetTextFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetBooleanFieldTypeDeclaration($name,&$field) { return("$name CHAR (1)".(IsSet($field["default"]) ? " DEFAULT ".$this->GetBooleanFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetDateFieldTypeDeclaration($name,&$field) { return("$name CHAR (".strlen("YYYY-MM-DD").")".(IsSet($field["default"]) ? " DEFAULT ".$this->GetDateFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetTimestampFieldTypeDeclaration($name,&$field) { return("$name CHAR (".strlen("YYYY-MM-DD HH:MM:SS").")".(IsSet($field["default"]) ? " DEFAULT ".$this->GetTimestampFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetTimeFieldTypeDeclaration($name,&$field) { return("$name CHAR (".strlen("HH:MM:SS").")".(IsSet($field["default"]) ? " DEFAULT ".$this->GetTimeFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetFloatFieldTypeDeclaration($name,&$field) { return("$name TEXT ".(IsSet($field["default"]) ? " DEFAULT ".$this->GetFloatFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetDecimalFieldTypeDeclaration($name,&$field) { return("$name TEXT ".(IsSet($field["default"]) ? " DEFAULT ".$this->GetDecimalFieldValue($field["default"]) : "").(IsSet($field["notnull"]) ? " NOT NULL" : "")); } Function GetIntegerFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : "$value"); } Function GetTextFieldValue($value) { return("'$value'"); } Function GetBooleanFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : ($value ? "'Y'" : "'N'")); } Function GetDateFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : "'$value'"); } Function GetTimestampFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : "'$value'"); } Function GetTimeFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : "'$value'"); } Function GetFloatFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : "'$value'"); } Function GetDecimalFieldValue($value) { return(!strcmp($value,"NULL") ? "NULL" : "'$value'"); } Function GetFieldValue($type,$value) { switch($type) { case "integer": return($this->GetIntegerFieldValue($value)); case "text": return($this->GetTextFieldValue($value)); case "boolean": return($this->GetBooleanFieldValue($value)); case "date": return($this->GetDateFieldValue($value)); case "timestamp": return($this->GetTimestampFieldValue($value)); case "time": return($this->GetTimeFieldValue($value)); case "float": return($this->GetFloatFieldValue($value)); case "decimal": return($this->GetDecimalFieldValue($value)); } return(""); } Function Support($feature) { return(IsSet($this->supported[$feature])); } Function CreateSequence($name,$start) { $this->last_error="sequence creation is not supported"; return(0); } Function DropSequence($name) { $this->last_error="sequence dropping is not supported"; return(0); } Function GetSequenceNextValue($name,&$value) { $this->last_error="getting sequence next value is not supported"; return(0); } Function GetSequenceCurrentValue($name,&$value) { $this->last_error="getting sequence current value is not supported"; return(0); } Function AutoCommitTransactions() { $this->last_error="transactions are not supported"; return(0); } Function CommitTransaction() { $this->last_error="commiting transactions are not supported"; return(0); } Function RollbackTransaction() { $this->last_error="rolling back transactions are not supported"; return(0); } Function CreateIndex($table,$name,$definition) { $query="CREATE"; if(IsSet($definition["unique"])) $query.=" UNIQUE"; $query.=" INDEX $name ON $table ("; for($field=0,Reset($definition["FIELDS"]);$field0) $query.=","; $field_name=Key($definition["FIELDS"]); $query.=$field_name; if($this->Support("IndexSorting") && IsSet($definition["FIELDS"][$field_name]["sorting"])) { switch($definition["FIELDS"][$field_name]["sorting"]) { case "ascending": $query.=" ASC"; break; case "descending": $query.=" DESC"; break; } } } $query.=")"; return($this->Query($query)); } Function DropIndex($table,$name) { return($this->Query("DROP INDEX $name")); } Function Setup() { return(""); } Function SetSelectedRowRange($first,$limit) { if(!IsSet($this->supported["SelectRowRanges"])) { $this->last_error="selecting row ranges is not supported by this driver"; return(0); } if(GetType($first)!="integer" || $first<0) { $this->last_error="it was not specified a valid first selected range row"; return(0); } if(GetType($limit)!="integer" || $limit<1) { $this->last_error="it was not specified a valid selected range row limit"; return(0); } $this->first_selected_row=$first; $this->selected_row_limit=$limit; return(1); } }; ?>interface=count($metabase_interfaces)+1; $metabase_interfaces[$this->interface]=new $class_name; $metabase_interfaces[$this->interface]->database=$this->interface; if(IsSet($arguments["Host"])) $metabase_interfaces[$this->interface]->host=$arguments["Host"]; if(IsSet($arguments["User"])) $metabase_interfaces[$this->interface]->user=$arguments["User"]; if(IsSet($arguments["Password"])) $metabase_interfaces[$this->interface]->password=$arguments["Password"]; if(IsSet($arguments["Persistent"])) $metabase_interfaces[$this->interface]->persistent=$arguments["Persistent"]; if(IsSet($arguments["Debug"])) $this->debug=$arguments["Debug"]; $metabase_interfaces[$this->interface]->decimal_places=(IsSet($arguments["DecimalPlaces"]) ? $arguments["DecimalPlaces"] : 2); if(IsSet($arguments["Options"])) $metabase_interfaces[$this->interface]->options=$arguments["Options"]; return($metabase_interfaces[$this->interface]->Setup()); } Function OutputDebug($message) { if(strcmp($function=$this->debug,"")) { if($this->pass_debug_handle) $function($this->database,$message); else $function($message); } } Function Query($query) { global $metabase_interfaces; //echo "interface Q:".$query; $this->OutputDebug("Query: $query"); if(($result=$metabase_interfaces[$this->interface]->Query($query))==0) $this->OutputDebug("Query error: ".$metabase_interfaces[$this->interface]->Error()); return($result); } }; Function MetabaseSetupDatabase($arguments,&$database) { global $metabase_databases; $database=count($metabase_databases)+1; $metabase_databases[$database]=new metabase_interface_class; $metabase_databases[$database]->database=$database; if(strcmp($error=$metabase_databases[$database]->SetupInterface(&$arguments),"")) { Unset($metabase_databases[$database]); $database=0; } return($error); } Function MetabaseCloseSetup($database) { global $metabase_databases,$metabase_interfaces; if($metabase_databases[$database]->in_transaction && MetabaseRollbackTransaction($database)) MetabaseAutoCommitTransactions($database,1); $metabase_interfaces[$metabase_databases[$database]->interface]->Close(); Unset($metabase_databases[$database]); $metabase_databases[$database]=""; } Function MetabaseQuery($database,$query) { global $metabase_databases; return($metabase_databases[$database]->Query($query)); } Function MetabasePrepareQuery($database,$query) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->PrepareQuery($query)); } Function MetabaseFreePreparedQuery($database,$prepared_query) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FreePreparedQuery($prepared_query)); } Function MetabaseExecuteQuery($database,$prepared_query) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->ExecuteQuery($prepared_query)); } /* Function MetabaseQuerySet($database,$prepared_query,$parameter,$type,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySet($prepared_query,$parameter,$type,$value)); } */ Function MetabaseQuerySet($database,$prepared_query,$parameter,$type,$value) { global $metabase_databases,$metabase_interfaces; switch($type){ case "text": return MetabaseQuerySetText($database,$prepared_query,$parameter,$value); break; case "integer": return MetabaseQuerySetInteger($database,$prepared_query,$parameter,$value); break; case "boolean": return MetabaseQuerySetBoolean($database,$prepared_query,$parameter,$value); break; case "date": return MetabaseQuerySetDate($database,$prepared_query,$parameter,$value); break; case "timestamp": return MetabaseQuerySetTimestamp($database,$prepared_query,$parameter,$value); break; case "time": return MetabaseQuerySetTime($database,$prepared_query,$parameter,$value); break; case "float": return MetabaseQuerySetFloat($database,$prepared_query,$parameter,$value); break; case "decimal": return MetabaseQuerySetDecimal($database,$prepared_query,$parameter,$value); break; default: return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySet($prepared_query,$parameter,$type,$value)); } } Function MetabaseQuerySetNull($database,$prepared_query,$parameter,$type) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetNull($prepared_query,$parameter,$type)); } Function MetabaseQuerySetText($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetText($prepared_query,$parameter,$value)); } Function MetabaseQuerySetInteger($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetInteger($prepared_query,$parameter,$value)); } Function MetabaseQuerySetBoolean($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetBoolean($prepared_query,$parameter,$value)); } Function MetabaseQuerySetDate($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetDate($prepared_query,$parameter,$value)); } Function MetabaseQuerySetTimestamp($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetTimestamp($prepared_query,$parameter,$value)); } Function MetabaseQuerySetTime($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetTime($prepared_query,$parameter,$value)); } Function MetabaseQuerySetFloat($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetFloat($prepared_query,$parameter,$value)); } Function MetabaseQuerySetDecimal($database,$prepared_query,$parameter,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->QuerySetDecimal($prepared_query,$parameter,$value)); } Function MetabaseAffectedRows($database,&$affected_rows) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->AffectedRows(&$affected_rows)); } Function MetabaseFetchResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchResult($result,$row,$field)); } Function MetabaseResultIsNull($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->ResultIsNull($result,$row,$field)); } Function MetabaseFetchDateResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchDateResult($result,$row,$field)); } Function MetabaseFetchTimestampResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchTimestampResult($result,$row,$field)); } Function MetabaseFetchTimeResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchTimeResult($result,$row,$field)); } Function MetabaseFetchBooleanResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchBooleanResult($result,$row,$field)); } Function MetabaseFetchFloatResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchFloatResult($result,$row,$field)); } Function MetabaseFetchDecimalResult($database,$result,$row,$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FetchDecimalResult($result,$row,$field)); } Function MetabaseNumberOfRows($database,$result) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->NumberOfRows($result)); } Function MetabaseFreeResult($database,$result) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->FreeResult($result)); } Function MetabaseError($database) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->Error()); } Function MetabaseCreateDatabase($database,$name) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->CreateDatabase($name)); } Function MetabaseDropDatabase($database,$name) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->DropDatabase($name)); } Function MetabaseSetDatabase($database,$name) { global $metabase_databases,$metabase_interfaces; $previous_database_name=$metabase_interfaces[$metabase_databases[$database]->interface]->database_name; $metabase_interfaces[$metabase_databases[$database]->interface]->database_name=$name; return($previous_database_name); } Function MetabaseGetIntegerFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetIntegerFieldTypeDeclaration($name,&$field)); } Function MetabaseGetTextFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetTextFieldTypeDeclaration($name,&$field)); } Function MetabaseGetBooleanFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetBooleanFieldTypeDeclaration($name,&$field)); } Function MetabaseGetDateFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetDateFieldTypeDeclaration($name,&$field)); } Function MetabaseGetTimestampFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetTimestampFieldTypeDeclaration($name,&$field)); } Function MetabaseGetTimeFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetTimeFieldTypeDeclaration($name,&$field)); } Function MetabaseGetFloatFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetFloatFieldTypeDeclaration($name,&$field)); } Function MetabaseGetDecimalFieldTypeDeclaration($database,$name,&$field) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetDecimalFieldTypeDeclaration($name,&$field)); } Function MetabaseGetTextFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetTextFieldValue($value)); } Function MetabaseGetBooleanFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetBooleanFieldValue($value)); } Function MetabaseGetDateFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetDateFieldValue($value)); } Function MetabaseGetTimestampFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetTimestampFieldValue($value)); } Function MetabaseGetTimeFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetTimeFieldValue($value)); } Function MetabaseGetFloatFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetFloatFieldValue($value)); } Function MetabaseGetDecimalFieldValue($database,$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetDecimalFieldValue($value)); } Function MetabaseSupport($database,$feature) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->Support($feature)); } Function MetabaseCreateTable($database,$name,&$fields) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->CreateTable($name,$fields)); } Function MetabaseDropTable($database,$name) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->DropTable($name)); } Function MetabaseAlterTable($database,$name,$changes,$check=0) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->AlterTable($name,&$changes,$check)); } Function MetabaseCreateSequence($database,$name,$start) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->CreateSequence($name,$start)); } Function MetabaseDropSequence($database,$name) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->DropSequence($name)); } Function MetabaseGetSequenceNextValue($database,$name,&$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetSequenceNextValue($name,&$value)); } Function MetabaseGetSequenceCurrentValue($database,$name,&$value) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->GetSequenceCurrentValue($name,&$value)); } $metabase_registered_transactions_shutdown=0; Function MetabaseShutdownTransactions() { global $metabase_databases; for(Reset($metabase_databases),$database=0;$databasein_transaction && MetabaseRollbackTransaction($metabase_database)) MetabaseAutoCommitTransactions($metabase_database,1); } } Function MetabaseAutoCommitTransactions($database,$auto_commit) { global $metabase_databases,$metabase_interfaces,$metabase_registered_transactions_shutdown; MetabaseDebug($database,"AutoCommit: ".($auto_commit ? "On" : "Off")); if(($success=$metabase_interfaces[$metabase_databases[$database]->interface]->AutoCommitTransactions($auto_commit)) && ($metabase_databases[$database]->in_transaction= !$auto_commit) && !$metabase_registered_transactions_shutdown) { register_shutdown_function("MetabaseShutdownTransactions"); $metabase_registered_transactions_shutdown=1; } return($success); } Function MetabaseCommitTransaction($database) { global $metabase_databases,$metabase_interfaces; MetabaseDebug($database,"Commit Transaction"); if(($success=$metabase_interfaces[$metabase_databases[$database]->interface]->CommitTransaction())) $metabase_databases[$database]->in_transaction=0; return($success); } Function MetabaseRollbackTransaction($database) { global $metabase_databases,$metabase_interfaces; MetabaseDebug($database,"Rollback Transaction"); if(($success=$metabase_interfaces[$metabase_databases[$database]->interface]->RollbackTransaction())) $metabase_databases[$database]->in_transaction=0; return($success); } Function MetabaseCreateIndex($database,$table,$name,$definition) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->CreateIndex($table,$name,$definition)); } Function MetabaseDropIndex($database,$table,$name) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->DropIndex($table,$name)); } Function MetabaseNow() { return(strftime("%Y-%m-%d %H:%M:%S")); } Function MetabaseToday() { return(strftime("%Y-%m-%d")); } Function MetabaseTime() { return(strftime("%H:%M:%S")); } Function MetabaseSetSelectedRowRange($database,$first,$limit) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->SetSelectedRowRange($first,$limit)); } Function MetabaseEndOfResult($database,$result) { global $metabase_databases,$metabase_interfaces; return($metabase_interfaces[$metabase_databases[$database]->interface]->EndOfResult($result)); } Function MetabaseDefaultDebugOutput($database,$message) { global $metabase_databases; $metabase_databases[$database]->debug_output.="$database $message\n"; } Function MetabaseCaptureDebugOutput($database,$capture) { global $metabase_databases; $metabase_databases[$database]->pass_debug_handle=$capture; $metabase_databases[$database]->debug=($capture ? "MetabaseDefaultDebugOutput" : ""); } Function MetabaseDebugOutput($database) { global $metabase_databases; return($metabase_databases[$database]->debug_output); } Function MetabaseDebug($database,$message) { global $metabase_databases; return($metabase_databases[$database]->OutputDebug($message)); } ?>