Changeset 6342


Ignore:
Timestamp:
May 24, 2010, 10:44:55 PM (15 years ago)
Author:
nikrou
Message:

Fix bug 1695 : incorrect boolean to string conversion for SQLite and PostgreSQL database engines merge from trunk

Location:
branches/2.1/include/dblayer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/include/dblayer/functions_pdo-sqlite.inc.php

    r6153 r6342  
    468468function boolean_to_string($var)
    469469{
    470   if (!empty($var) && ($var == 'true'))
    471   {
    472     return 'true';
     470  if (is_bool($var))
     471  {
     472    return $var ? 'true' : 'false';
    473473  }
    474474  else
    475475  {
    476     return 'false';
     476    return $var;
    477477  }
    478478}
  • branches/2.1/include/dblayer/functions_pgsql.inc.php

    r6090 r6342  
    511511function boolean_to_string($var)
    512512{
    513   if (!empty($var) && ($var == 't'))
    514   {
    515     return 'true';
     513  if (is_bool($var))
     514  {
     515    return $var ? 'true' : 'false';
    516516  }
    517517  else
    518518  {
    519     return 'false';
     519    return $var;
    520520  }
    521521}
  • branches/2.1/include/dblayer/functions_sqlite.inc.php

    r6153 r6342  
    480480function boolean_to_string($var)
    481481{
    482   if (!empty($var) && ($var == 'true'))
    483   {
    484     return 'true';
     482  if (is_bool($var))
     483  {
     484    return $var ? 'true' : 'false';
    485485  }
    486486  else
    487487  {
    488     return 'false';
     488    return $var;
    489489  }
    490490}
Note: See TracChangeset for help on using the changeset viewer.