Skip to content

Commit f486d48

Browse files
author
Gabriel Tadra Mainginski
committed
Fix #13
1 parent 6a08f78 commit f486d48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Database/SybaseConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ private function compileForSelect(Builder $builder, $bindings) {
104104

105105
$explicitDB = explode('..', $tables);
106106
if(isset($explicitDB[1])){
107-
$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]."'");
107+
$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]."'");
108108
}else{
109-
$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) = '".$tables."'");
109+
$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) = '".$tables."'");
110110
}
111111

112112
$types[$tables] = $queryRes->fetchAll(\PDO::FETCH_NAMED);

0 commit comments

Comments
 (0)