<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>databinding broken on mssql -- Horde_SQL class</title> 
  <pubDate>Fri, 10 Apr 2026 19:46:43 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/1816</link> 
  <atom:link rel="self" type="application/rss+xml" title="databinding broken on mssql -- Horde_SQL class" href="https://bugs.horde.org/ticket/1816/rss" /> 
  <description>databinding broken on mssql -- Horde_SQL class</description> 
 
   
   
  <item> 
   <title>The buildClause function in Horde_SQL does not correctly han</title> 
   <description>The buildClause function in Horde_SQL does not correctly handle bitwise operators with mssql. The same code as is implemented for ODBC should be used against mssql.



Furthermore, there is a bug in the ODBC code ... when $bind = true, it tries to feed a &#039;?&#039; string through a %d field in sprintf. This forces the generated SQL to &quot;0&quot; rather than &quot;?&quot;, thereby breaking databinding. It appears the same bug will eventually appear against oci8 too, as the code is very similar. I&#039;ve patched this for mssql by changing:



case &#039;odbc&#039;:

    // ODBC must have a valid boolean expression

    $query = &#039;(%s &amp; %d) = %d&#039;;

    if ($bind) {

        return array(sprintf(Horde_SQL::escapePrepare($query),

                             Horde_SQL::escapePrepare($lhs), &#039;?&#039;, &#039;?&#039;),

                     array((int)$rhs, (int)$rhs));

    } else {

        return sprintf($query, $lhs, (int)$rhs, (int)$rhs);

    }



to:



case &#039;odbc&#039;:

case &#039;mssql&#039;:

    // ODBC must have a valid boolean expression

    if ($bind) {

        $query = &#039;(%s &amp; %s) = %s&#039;;

        return array(sprintf(Horde_SQL::escapePrepare($query),

                             Horde_SQL::escapePrepare($lhs), &#039;?&#039;, &#039;?&#039;),

                     array((int)$rhs, (int)$rhs));

    } else {

        $query = &#039;(%s &amp; %d) = %d&#039;;

        return sprintf($query, $lhs, (int)$rhs, (int)$rhs);

    }



Without this fix, no datatree functionality exists.</description> 
   <pubDate>Mon, 18 Apr 2005 23:52:56 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1816#t7417</link> 
  </item> 
   
  <item> 
   <title>Fixed in CVS and Horde 3.0.5. The wrong placeholder had been</title> 
   <description>Fixed in CVS and Horde 3.0.5. The wrong placeholder had been fixed already.</description> 
   <pubDate>Tue, 19 Apr 2005 07:47:42 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1816#t7419</link> 
  </item> 
   
  <item> 
   <title>Thanks. Sorry, I&#039;m not yet familiar enough with Horde to get</title> 
   <description>Thanks. Sorry, I&#039;m not yet familiar enough with Horde to get into the CVS side of it and I couldn&#039;t see a similar bug here.</description> 
   <pubDate>Tue, 19 Apr 2005 21:49:45 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/1816#t7447</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
