Changeset:
        bfe364ee42a8
        
https://sourceforge.net/p/mrbs/hg-code/ci/bfe364ee42a865cab2690d886b6cb89f87558e56
Author:
        Campbell Morrison <[email protected]>
Date:
        Fri Dec 04 13:24:16 2015 +0000
Log message:

Fixed bug in reports: the case sensitivity of types was not being recognised 
(see SF Support Requests #776)

diffstat:

 web/mysqli.inc |  18 +++++++++++++++++-
 web/pgsql.inc  |  18 +++++++++++++++++-
 web/report.php |  16 +++++-----------
 3 files changed, 39 insertions(+), 13 deletions(-)

diffs (84 lines):

diff -r 927e879b2e34 -r bfe364ee42a8 web/mysqli.inc
--- a/web/mysqli.inc    Tue Nov 24 17:11:59 2015 +0000
+++ b/web/mysqli.inc    Fri Dec 04 13:24:16 2015 +0000
@@ -53,7 +53,23 @@
 // Quote a table or column name
 function sql_mysqli_quote($identifier)
 {
-  return '`' . $identifier . '`';
+  // Don't quote the alias, if there is one
+  if (strpos($identifier, '.') === FALSE)
+  {
+    $column = $identifier;
+  }
+  else
+  {
+    list($alias, $column) = explode('.', $identifier, 2);
+  }
+  
+  $result = '`' . $column . '`';
+  if (isset($alias))
+  {
+    $result = $alias . '.' . $result;
+  }
+  
+  return $result;
 }
 
 
diff -r 927e879b2e34 -r bfe364ee42a8 web/pgsql.inc
--- a/web/pgsql.inc     Tue Nov 24 17:11:59 2015 +0000
+++ b/web/pgsql.inc     Fri Dec 04 13:24:16 2015 +0000
@@ -82,7 +82,23 @@
 // Quote a table or column name
 function sql_pgsql_quote($identifier)
 {
-  return '"' . $identifier . '"';
+  // Don't quote the alias, if there is one
+  if (strpos($identifier, '.') === FALSE)
+  {
+    $column = $identifier;
+  }
+  else
+  {
+    list($alias, $column) = explode('.', $identifier, 2);
+  }
+  
+  $result = '"' . $column . '"';
+  if (isset($alias))
+  {
+    $result = $alias . '.' . $result;
+  }
+  
+  return $result;
 }
 
 
diff -r 927e879b2e34 -r bfe364ee42a8 web/report.php
--- a/web/report.php    Tue Nov 24 17:11:59 2015 +0000
+++ b/web/report.php    Fri Dec 04 13:24:16 2015 +0000
@@ -1267,19 +1267,13 @@
   if (!empty($typematch))
   {
     $sql .= " AND ";
-    if ( count( $typematch ) > 1 )
+    $or_array = array();
+    foreach ( $typematch as $type )
     {
-      $or_array = array();
-      foreach ( $typematch as $type )
-      {
-        $or_array[] = "E.type = '".sql_escape($type)."'";
-      }
-      $sql .= "(". implode( " OR ", $or_array ) .")";
+      // sql_syntax_casesensitive_equals() does the SQL escaping
+      $or_array[] = sql_syntax_casesensitive_equals('E.type', $type);
     }
-    else
-    {
-      $sql .= "E.type = '".sql_escape($typematch[0])."'";
-    }
+    $sql .= "(". implode(" OR ", $or_array ) .")";
   }
   if (!empty($namematch))
   {

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to