4 require_once(
'DBMysql.class.php');
54 function _begin($transactionLevel = 0)
58 if(!$transactionLevel)
78 $point = $transactionLevel - 1;
114 exit(
'XE cannot handle DB connection.');
140 $xml_obj = $oXml->parse($xml_doc);
142 $table_name = $xml_obj->table->attrs->name;
147 $table_name = $this->prefix . $table_name;
149 if(!is_array($xml_obj->table->column))
151 $columns[] = $xml_obj->table->column;
155 $columns = $xml_obj->table->column;
158 foreach($columns as $column)
160 $name = $column->attrs->name;
161 $type = $column->attrs->type;
162 $size = $column->attrs->size;
163 $notnull = $column->attrs->notnull;
164 $primary_key = $column->attrs->primary_key;
165 $index = $column->attrs->index;
166 $unique = $column->attrs->unique;
167 $default = $column->attrs->default;
168 $auto_increment = $column->attrs->auto_increment;
170 $column_schema[] = sprintf(
'`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ?
'(' . $size .
')' :
'', isset($default) ?
"default '" . $default .
"'" :
'', $notnull ?
'not null' :
'', $auto_increment ?
'auto_increment' :
'');
174 $primary_list[] = $name;
178 $unique_list[$unique][] = $name;
182 $index_list[$index][] = $name;
186 if(count($primary_list))
188 $column_schema[] = sprintf(
"primary key (%s)",
'`' . implode($primary_list,
'`,`') .
'`');
191 if(count($unique_list))
193 foreach($unique_list as $key => $val)
195 $column_schema[] = sprintf(
"unique %s (%s)", $key,
'`' . implode($val,
'`,`') .
'`');
199 if(count($index_list))
201 foreach($index_list as $key => $val)
203 $column_schema[] = sprintf(
"index %s (%s)", $key,
'`' . implode($val,
'`,`') .
'`');
207 $schema = sprintf(
'create table `%s` (%s%s) %s;', $this->
addQuotes($table_name),
"\n", implode($column_schema,
",\n"),
"ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci");
setError($errno=0, $errstr= 'success')
_begin($transactionLevel=0)
__query($query, $connection)
_connect($type= 'master', $indx=0)
_rollback($transactionLevel=0)
_getConnection($type= 'master', $indx=NULL)
_query($query, $connection=NULL)
__construct($auto_connect=TRUE)
isTableExists($target_name)