4 require_once(
'DBMysql.class.php');
62 $error = mysqli_connect_errno();
65 $this->
setError($error, mysqli_connect_error());
68 mysqli_set_charset(
$result,
'utf8');
88 function _begin($transactionLevel = 0)
92 if(!$transactionLevel)
112 $point = $transactionLevel - 1;
148 if(version_compare(PHP_VERSION,
"5.4.0",
"<") && get_magic_quotes_gpc())
150 $string = stripslashes(str_replace(
"\\",
"\\\\", $string));
152 if(!is_numeric($string))
155 $string = mysqli_escape_string(
$connection, $string);
169 if($this->use_prepared_statements ==
'Y')
185 foreach($params as $key => $param)
187 $copy[$key] = $param;
188 $args[$i++] = &$copy[$key];
192 $status = call_user_func_array(
'mysqli_stmt_bind_param',
$args);
200 $status = mysqli_stmt_execute($stmt);
240 foreach($this->param as $k => $o)
242 $value = $o->getUnescapedValue();
243 $type = $o->getType();
246 if($o->isColumnName())
265 foreach($value as $v)
287 if($this->use_prepared_statements !=
'Y')
289 return parent::_fetch(
$result, $arrayIndexEndValue);
299 $meta = mysqli_stmt_result_metadata($stmt);
300 $fields = mysqli_fetch_fields($meta);
307 $longtext_exists =
false;
308 foreach($fields as $field)
310 if(isset($resultArray[$field->name]))
312 $field->name =
'repeat_' . $field->name;
316 $row[$field->name] =
"";
317 $resultArray[$field->name] = &$row[$field->name];
319 if($field->type == 252)
321 $longtext_exists =
true;
324 $resultArray = array_merge(array($stmt), $resultArray);
328 mysqli_stmt_store_result($stmt);
331 call_user_func_array(
'mysqli_stmt_bind_result', $resultArray);
334 while(mysqli_stmt_fetch($stmt))
336 $resultObject =
new stdClass();
338 foreach($resultArray as $key => $value)
344 if(strpos($key,
'repeat_'))
346 $key = substr($key, 6);
348 $resultObject->$key = $value;
351 $rows[] = $resultObject;
354 mysqli_stmt_close($stmt);
356 if($arrayIndexEndValue)
358 foreach($rows as $row)
360 $output[$arrayIndexEndValue--] = $row;
370 if(isset($arrayIndexEndValue))
391 if($this->use_prepared_statements !=
'Y')
393 return parent::_executeInsertAct($queryObject);
395 $this->param = $queryObject->getArguments();
396 $result = parent::_executeInsertAct($queryObject, $with_values);
409 if($this->use_prepared_statements !=
'Y')
411 return parent::_executeUpdateAct($queryObject);
413 $this->param = $queryObject->getArguments();
414 $result = parent::_executeUpdateAct($queryObject, $with_values);
427 if($this->use_prepared_statements !=
'Y')
429 return parent::_executeDeleteAct($queryObject);
431 $this->param = $queryObject->getArguments();
432 $result = parent::_executeDeleteAct($queryObject, $with_values);
448 if($this->use_prepared_statements !=
'Y')
450 return parent::_executeSelectAct($queryObject,
$connection);
452 $this->param = $queryObject->getArguments();
477 return mysqli_fetch_object(
$result);
487 return mysqli_free_result(
$result);
503 $xml_obj = $oXml->parse($xml_doc);
505 $table_name = $xml_obj->table->attrs->name;
510 $table_name = $this->prefix . $table_name;
512 if(!is_array($xml_obj->table->column))
514 $columns[] = $xml_obj->table->column;
518 $columns = $xml_obj->table->column;
521 foreach($columns as $column)
523 $name = $column->attrs->name;
524 $type = $column->attrs->type;
525 $size = $column->attrs->size;
526 $notnull = $column->attrs->notnull;
527 $primary_key = $column->attrs->primary_key;
528 $index = $column->attrs->index;
529 $unique = $column->attrs->unique;
530 $default = $column->attrs->default;
531 $auto_increment = $column->attrs->auto_increment;
533 $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' :
'');
537 $primary_list[] = $name;
541 $unique_list[$unique][] = $name;
545 $index_list[$index][] = $name;
549 if(count($primary_list))
551 $column_schema[] = sprintf(
"primary key (%s)",
'`' . implode($primary_list,
'`,`') .
'`');
554 if(count($unique_list))
556 foreach($unique_list as $key => $val)
558 $column_schema[] = sprintf(
"unique %s (%s)", $key,
'`' . implode($val,
'`,`') .
'`');
562 if(count($index_list))
564 foreach($index_list as $key => $val)
566 $column_schema[] = sprintf(
"index %s (%s)", $key,
'`' . implode($val,
'`,`') .
'`');
570 $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')
_executeSelectAct($queryObject, $connection=null, $with_values=false)
__construct($auto_connect=TRUE)
_begin($transactionLevel=0)
isConnected($type= 'master', $indx=0)
_executeInsertAct($queryObject, $with_values=false)
_prepareQueryParameters(&$types, &$params)
_rollback($transactionLevel=0)
db_fetch_object(&$result)
_executeUpdateAct($queryObject, $with_values=false)
_connect($type= 'master', $indx=0)
_getConnection($type= 'master', $indx=NULL)
_query($query, $connection=NULL)
_executeDeleteAct($queryObject, $with_values=false)
isTableExists($target_name)
_fetch($result, $arrayIndexEndValue=NULL)
__query($query, $connection)