rename prepareSQL to replaceDecorator (ioguix)
authorxzilla <xzilla>
Sat, 24 Mar 2007 02:33:59 +0000 (02:33 +0000)
committerxzilla <xzilla>
Sat, 24 Mar 2007 02:33:59 +0000 (02:33 +0000)
libraries/decorator.inc.php
tblproperties.php
viewproperties.php

index a93e66caf76d16f059ff737c1d22d295526a8bbb..8207b230388a2e4bd75a2e82f268372084cc78bb 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: decorator.inc.php,v 1.6 2006/08/03 19:03:33 xzilla Exp $
+// $Id: decorator.inc.php,v 1.7 2007/03/24 02:33:59 xzilla Exp $
 
 // This group of functions and classes provides support for
 // resolving values in a lazy manner (ie, as and when required)
@@ -56,8 +56,8 @@ function noEscape($value) {
        return new Decorator($value, false);
 }
 
-function prepareSQL($sql, $params) {
-       return new PrepareSQL($sql, $params);
+function replace($str, $params) {
+       return new replaceDecorator($str, $params);
 }
 
 // Resolving functions:
@@ -215,19 +215,19 @@ class UrlDecorator extends Decorator
        }
 }
 
-class PrepareSQL extends Decorator
+class replaceDecorator extends Decorator
 {
-       function PrepareSQL($sql, $params) {
-               $this->q = $sql;
+       function replaceDecorator($str, $params) {
+               $this->s = $str;
                $this->p = $params;
        }
 
        function value($fields) {
-               $req = $this->q;
+               $str = $this->s;
                foreach ($this->p as $k => $v) {
-                       $req = str_replace($k, value($v, $fields), $req);
+                       $str = str_replace($k, value($v, $fields), $str);
                }
-               return $req;
+               return $str;
        }
 }
 ?>
index 2dc67a4efa2e05294641c99b9d7432888a02e4a4..bf61385f48d8c4e21c53213d9b6e0253a1c60efd 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tblproperties.php,v 1.74 2007/01/22 16:33:01 soranzo Exp $
+        * $Id: tblproperties.php,v 1.75 2007/03/24 02:33:59 xzilla Exp $
         */
 
        // Include application functions
                                                                array(
                                                                        'table'         => $_REQUEST['table'],
                                                                        'column'        => field('attname'),
-                                                                       'query'         => prepareSQL(
+                                                                       'query'         => replace(
                                                                                                                "SELECT %column%, count(*) AS \"count\" FROM %table% GROUP BY %column% ORDER BY %column%", 
                                                                                                                array (
                                                                                                                        '%column%' => field('attname'),
index 9c496f4e8261fc136130b7e187c8da3dca36140c..1497775fa0c121059dadc6f15d2f28a6dc298a72 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * List views in a database
         *
-        * $Id: viewproperties.php,v 1.23 2007/01/23 14:12:29 soranzo Exp $
+        * $Id: viewproperties.php,v 1.24 2007/03/24 02:33:59 xzilla Exp $
         */
 
        // Include application functions
                                                        array(
                                                                'view'     => $_REQUEST['view'],
                                                                'column'    => field('attname'),
-                                                               'query'     => prepareSQL(
+                                                               'query'     => replace(
                                                                        "SELECT %column%, count(*) AS \"count\" FROM %view% GROUP BY %column% ORDER BY %column%",
                                                                        array (
                                                                                '%column%' => field('attname'),