Skip to content

Commit 93f11d7

Browse files
author
Gabriel Tadra Mainginski
committed
Fix #13 for insert, remove and update
1 parent c140b75 commit 93f11d7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Database/SybaseConnection.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ private function compileBindings($query, $bindings)
215215
if(!array_key_exists($table, $new_format)){
216216
$explicitDB = explode('..', $table);
217217
if(isset($explicitDB[1])){
218-
$queryRes = $this->getPdo()->query("select a.name, b.name AS type FROM ".$explicitDB[0]."..syscolumns a noholdlock JOIN ".$explicitDB[0]."..systypes b noholdlock ON a.usertype = b.usertype and object_name(a.id, db_id('".$explicitDB[0]."')) = '".$explicitDB[1]."'");
219-
}else{
220-
$queryRes = $this->getPdo()->query("select a.name, b.name AS type FROM syscolumns a noholdlock JOIN systypes b noholdlock ON a.usertype = b.usertype and object_name(a.id) = '".$table."'");
221-
}
218+
$queryRes = $this->getPdo()->query("SELECT s0.name,(SELECT name FROM ".$explicitDB[0]."..systypes s2 noholdlock WHERE s2.usertype=(SELECT min( s3.usertype) FROM ".$explicitDB[0]."..systypes s3 noholdlock WHERE s3.hierarchy=s1.hierarchy)) AS type FROM ".$explicitDB[0]."..systypes s1 noholdlock, ".$explicitDB[0]."..syscolumns s0 noholdlock WHERE s0.usertype = s1.usertype AND object_name(s0.id, db_id('".$explicitDB[0]."')) = '".$explicitDB[1]."'");
219+
}else{
220+
$queryRes = $this->getPdo()->query("SELECT s0.name,(SELECT name FROM systypes s2 noholdlock WHERE s2.usertype=(SELECT min( s3.usertype) FROM systypes s3 noholdlock WHERE s3.hierarchy=s1.hierarchy)) AS type FROM systypes s1 noholdlock, syscolumns s0 noholdlock WHERE s0.usertype = s1.usertype AND object_name(s0.id) = '".$table."'");
221+
}
222222
$types[$table] = $queryRes->fetchAll(\PDO::FETCH_ASSOC);
223223
for($k = 0; $k < count($types[$table]); $k++){
224224
$types[$table][$types[$table][$k]['name']] = $types[$table][$k];
@@ -280,6 +280,7 @@ private function compileNewQuery($query, $bindings)
280280
}
281281
}
282282
$newQuery = str_replace( "[]", '' ,$newQuery);
283+
var_dump($newQuery);
283284
return $newQuery;
284285
}
285286

0 commit comments

Comments
 (0)