mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 09:14:48 +09:00
table.column 형식의 쿼리문에 더블쿼터 처리 해 주는 부분을 정규식으로 수정함
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6707 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
8375388099
commit
ea7ab79403
1 changed files with 19 additions and 31 deletions
|
|
@ -190,18 +190,11 @@
|
||||||
$string = trim(substr($string, $no1+1, $no2-$no1-1));
|
$string = trim(substr($string, $no1+1, $no2-$no1-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 테이블.필드
|
// (테이블.컬럼) 구조 일때 처리
|
||||||
if(($no1 = strpos($string,'.'))!==false) {
|
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $string, $matches);
|
||||||
$tmpString1 = substr($string, 0, $no1); // table
|
|
||||||
$tmpString2 = substr($string, $no1+1, strlen($string)-$no1+1); // field
|
|
||||||
|
|
||||||
$tmpString1 = trim($tmpString1);
|
if($matches) {
|
||||||
$tmpString2 = trim($tmpString2);
|
$string = $this->addDoubleQuotes($matches[1]).".".$this->addDoubleQuotes($matches[2]);
|
||||||
|
|
||||||
$tmpString1 = $this->addDoubleQuotes($tmpString1);
|
|
||||||
if($tmpString2 != "*") $tmpString2 = $this->addDoubleQuotes($tmpString2);
|
|
||||||
|
|
||||||
$string = $tmpString1.".".$tmpString2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$string = $this->addDoubleQuotes($string);
|
$string = $this->addDoubleQuotes($string);
|
||||||
|
|
@ -221,37 +214,32 @@
|
||||||
$tok = strtok(",");
|
$tok = strtok(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($values as $val) {
|
foreach($values as $val1) {
|
||||||
if(($no1 = strpos($val,'.'))!==false) {
|
// (테이블.컬럼) 구조 일때 처리
|
||||||
$tmpString1 = substr($val, 0, $no1); // table
|
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $val1, $matches);
|
||||||
$tmpString2 = substr($val, $no1+1, strlen($val)-$no1+1); // field
|
if($matches) {
|
||||||
|
|
||||||
$tmpString1 = trim($tmpString1);
|
|
||||||
$tmpString2 = trim($tmpString2);
|
|
||||||
|
|
||||||
$isTable = false;
|
$isTable = false;
|
||||||
foreach($tables as $key => $val) {
|
|
||||||
if($key == $tmpString1) $isTable = true;
|
foreach($tables as $key2 => $val2) {
|
||||||
if($val == $tmpString1) $isTable = true;
|
if($key2 == $matches[1]) $isTable = true;
|
||||||
|
if($val2 == $matches[1]) $isTable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($isTable) {
|
if($isTable) {
|
||||||
$tmpString1 = $this->addDoubleQuotes($tmpString1);
|
$return[] = $this->addDoubleQuotes($matches[1]).".".$this->addDoubleQuotes($matches[2]);
|
||||||
if($tmpString2 != "*") $tmpString2 = $this->addDoubleQuotes($tmpString2);
|
|
||||||
$return[] = $tmpString1.".".$tmpString2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return[] = $tmpString1.".".$tmpString2;
|
$return[] = $val1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!is_numeric($val)) {
|
else if(!is_numeric($val1)) {
|
||||||
if(strpos($val, "'") !== 0)
|
if(strpos($val1, "'") !== 0)
|
||||||
$return[] = "'".$val."'";
|
$return[] = "'".$val1."'";
|
||||||
else
|
else
|
||||||
$return[] = $val;
|
$return[] = $val1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return[] = $val;
|
$return[] = $val1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue