git-svn-id: http://xe-core.googlecode.com/svn/trunk@1099 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-11 06:17:36 +00:00
parent 7e93e910c7
commit 5a2d1a4018
3 changed files with 35 additions and 31 deletions

View file

@ -285,7 +285,7 @@
break;
}
if($default && !is_int($default)) $default = "'".$default."'";
if($default && !is_numeric($default)) $default = "'".$default."'";
$column_schema[] = sprintf('"%s" %s%s %s %s',
$name,
@ -359,8 +359,10 @@
foreach($column as $key => $val) {
$key_list[] = $key;
if(is_int($val) || in_array($key, $pass_quotes)) $val_list[] = $this->addQuotes($val);
else $val_list[] = '\''.$this->addQuotes($val).'\'';
if($val) {
if(is_numeric($val) || in_array($key, $pass_quotes)) $val_list[] = $this->addQuotes($val);
else $val_list[] = "'".$this->addQuotes($val)."'";
} else $val_list[] = "null";
}
$query = sprintf("insert into %s%s (%s) values (%s);", $this->prefix, $table, '"'.implode('","',$key_list).'"', implode(',', $val_list));
@ -374,10 +376,12 @@
$table = array_pop($tables);
foreach($column as $key => $val) {
// args에 아예 해당 key가 없으면 패스
if(!isset($args->{$key})) continue;
if(is_int($val) || in_array($key, $pass_quotes)) $update_list[] = sprintf('"%s" = %s', $key, $this->addQuotes($val));
if($vla) {
if(is_numeric($val) || in_array($key, $pass_quotes)) $update_list[] = sprintf('"%s" = %s', $key, $this->addQuotes($val));
else $update_list[] = sprintf('"%s" = \'%s\'', $key, $this->addQuotes($val));
} else $update_list[] = "null";
}
if(!count($update_list)) return;
$update_query = implode(',',$update_list);

View file

@ -3,8 +3,8 @@
<table name="modules" />
</tables>
<columns>
<column name="module_srl" default="module_srl" notnull="notnull" />
<column name="module_category_srl" default="module_category_srl" />
<column name="module_srl" var="module_srl" notnull="notnull" />
<column name="module_category_srl" var="module_category_srl" default="0" />
<column name="mid" var="mid" notnull="notnull" minlength="1" maxlength="40" />
<column name="skin" var="skin" minlength="1" maxlength="250" />
<column name="browser_title" var="browser_title" notnull="notnull" minlength="1" maxlength="250" />