Skip to content

Commit

Permalink
Fixed issue #06207: [Microsoft][ODBC SQL Server Driver][SQL Server]Am…
Browse files Browse the repository at this point in the history
…biguous column name 'qid'

Dev now properly handles different SQL syntax between MSSQL and others
  • Loading branch information
TMSWhite committed Jun 19, 2012
1 parent 781b26b commit 165b5e7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions classes/expressions/LimeExpressionManager.php
Expand Up @@ -7008,6 +7008,8 @@ public static function usingCommaAsRadix()

private static function getConditionsForEM($surveyid=NULL, $qid=NULL)
{
global $databasetype;

if (!is_null($qid)) {
$where = " c.qid = ".$qid." and ";
}
Expand All @@ -7029,8 +7031,18 @@ private static function getConditionsForEM($surveyid=NULL, $qid=NULL)
." from ".db_table_name('conditions')." as c"
.", ".db_table_name('questions')." as q"
." where ". $where
." c.cqid = 0 and c.qid = q.qid"
." order by sid, qid, scenario, cqid, cfieldname, value";
." c.cqid = 0 and c.qid = q.qid";

if ($databasetype == 'mssql')
{
$query .= " order by sid, c.qid, scenario, cqid, cfieldname, value";

}
else
{
$query .= " order by sid, qid, scenario, cqid, cfieldname, value";

}

$data = db_execute_assoc($query);

Expand Down

0 comments on commit 165b5e7

Please sign in to comment.