mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 13:02:15 +09:00
fixed
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7826 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b46e18d706
commit
7a61a6bdb2
1 changed files with 43 additions and 55 deletions
|
|
@ -125,6 +125,17 @@
|
||||||
|
|
||||||
if (!is_numeric ($string))
|
if (!is_numeric ($string))
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
if ($this->isConnected())
|
||||||
|
{
|
||||||
|
$string = cubrid_real_escape_string($string);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$string = str_replace("'","\'",$string);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$string = str_replace("'","''",$string);
|
$string = str_replace("'","''",$string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,10 +190,14 @@
|
||||||
|
|
||||||
// 쿼리 문 실행
|
// 쿼리 문 실행
|
||||||
$result = @cubrid_execute ($this->fd, $query);
|
$result = @cubrid_execute ($this->fd, $query);
|
||||||
|
//if(!$result){ debugPrint('result null: ' .$query); }
|
||||||
// 오류 체크
|
// 오류 체크
|
||||||
if (cubrid_error_code ()) {
|
if (cubrid_error_code ()) {
|
||||||
$this->setError (cubrid_error_code (), cubrid_error_msg ());
|
$code = cubrid_error_code ();
|
||||||
|
$msg = cubrid_error_msg ();
|
||||||
|
|
||||||
|
//debugPrint('query error : '. $code.', msg:'. $msg .', ' .$query);
|
||||||
|
$this->setError ($code, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 쿼리 실행 종료를 알림
|
// 쿼리 실행 종료를 알림
|
||||||
|
|
@ -305,7 +320,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->_query ($query);
|
$result = $this->_query ($query);
|
||||||
|
//if(!$result) debugPrint($query);
|
||||||
if (cubrid_num_rows($result) > 0)
|
if (cubrid_num_rows($result) > 0)
|
||||||
{
|
{
|
||||||
$output = true;
|
$output = true;
|
||||||
|
|
@ -325,8 +340,8 @@
|
||||||
**/
|
**/
|
||||||
function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = false)
|
function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = false)
|
||||||
{
|
{
|
||||||
$type = $this->column_type[$type];
|
$type = strtoupper($this->column_type[$type]);
|
||||||
if (strtoupper ($type) == 'INTEGER') $size = '';
|
if ($type == 'INTEGER') $size = '';
|
||||||
|
|
||||||
$query = sprintf ("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name);
|
$query = sprintf ("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name);
|
||||||
|
|
||||||
|
|
@ -346,7 +361,7 @@
|
||||||
|
|
||||||
if ($default)
|
if ($default)
|
||||||
{
|
{
|
||||||
if ($type == 'number' || $type == 'bignumber')
|
if ($type == 'INTEGER' || $type == 'BIGINT' || $type=='INT')
|
||||||
{
|
{
|
||||||
$query .= sprintf ("default %d ", $default);
|
$query .= sprintf ("default %d ", $default);
|
||||||
}
|
}
|
||||||
|
|
@ -695,47 +710,37 @@
|
||||||
{
|
{
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
if ($this->getColumnType ($output->column_type, $name) != 'number')
|
//if ($this->getColumnType ($output->column_type, $name) != 'number')
|
||||||
|
if ($output->column_type[$name] != 'number')
|
||||||
{
|
{
|
||||||
$clen = strlen ($value);
|
|
||||||
if ($clen <= $this->cutlen)
|
if(!is_null($value))
|
||||||
{
|
{
|
||||||
$value = "'" . $this->addQuotes($value) ."'";
|
$value = "'" . $this->addQuotes($value) ."'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$wrk = "";
|
if($val['notnull']=='notnull') {
|
||||||
$off = 0;
|
$value = "''";
|
||||||
while ($off < $clen)
|
} else {
|
||||||
{
|
//$value = 'null';
|
||||||
$wlen = $clen - $off;
|
$value = "''";
|
||||||
if ($wlen > $this->cutlen) $wlen = $this->cutlen;
|
|
||||||
if ($off > 0) $wrk .= "+\n";
|
|
||||||
$wrk .= "'".$this->addQuotes (substr ($value, $off, $wlen))."'";
|
|
||||||
$off += $wlen;
|
|
||||||
}
|
|
||||||
$value = $wrk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$value) $value = 'null';
|
}
|
||||||
}
|
}
|
||||||
elseif (!$value || is_numeric ($value))
|
elseif (!$value || is_numeric ($value))
|
||||||
{
|
{
|
||||||
$value = (int) $value;
|
$value = (int) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos ($name, '.') === false)
|
|
||||||
{
|
|
||||||
$column_list[] = '"'.$name.'"';
|
$column_list[] = '"'.$name.'"';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$column_list[] = $name;
|
|
||||||
}
|
|
||||||
$value_list[] = $value;
|
$value_list[] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = sprintf ("insert into %s (%s) values (%s);", implode(',', $table_list), implode(',', $column_list), implode(',', $value_list));
|
$query = sprintf ("insert into %s (%s) values (%s);", implode(',', $table_list), implode(',', $column_list), implode(',', $value_list));
|
||||||
|
|
||||||
|
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
|
||||||
$result = $this->_query ($query);
|
$result = $this->_query ($query);
|
||||||
if ($result && !$this->transaction_started)
|
if ($result && !$this->transaction_started)
|
||||||
{
|
{
|
||||||
|
|
@ -786,27 +791,8 @@
|
||||||
if ($output->column_type[$name] != 'number')
|
if ($output->column_type[$name] != 'number')
|
||||||
{
|
{
|
||||||
$check_column = false;
|
$check_column = false;
|
||||||
$clen=strlen($value);
|
|
||||||
if ($clen <= $this->cutlen)
|
|
||||||
{
|
|
||||||
$value = "'".$this->addQuotes ($value)."'";
|
$value = "'".$this->addQuotes ($value)."'";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$wrk = "";
|
|
||||||
$off = 0;
|
|
||||||
while ($off < $clen)
|
|
||||||
{
|
|
||||||
$wlen=$clen-$off;
|
|
||||||
if ($wlen > $this->cutlen) $wlen=$this->cutlen;
|
|
||||||
if ($off > 0) $wrk .= "+\n";
|
|
||||||
$wrk .= "'".$this->addQuotes (substr($value, $off,
|
|
||||||
$wlen))."'";
|
|
||||||
$off += $wlen;
|
|
||||||
}
|
|
||||||
$value = $wrk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (!$value || is_numeric ($value))
|
elseif (!$value || is_numeric ($value))
|
||||||
{
|
{
|
||||||
$value = (int) $value;
|
$value = (int) $value;
|
||||||
|
|
@ -1223,6 +1209,8 @@
|
||||||
{
|
{
|
||||||
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
|
$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
|
||||||
$result = $this->_query($count_query);
|
$result = $this->_query($count_query);
|
||||||
$count_output = $this->_fetch($result);
|
$count_output = $this->_fetch($result);
|
||||||
$total_count = (int)$count_output->count;
|
$total_count = (int)$count_output->count;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue