Ejemplo n.º 1
0
 private static function sqlWhere(&$params = null)
 {
     $sql = "";
     $sep = "WHERE";
     setIfNull($params, $_REQUEST);
     //TODO: list of reserved keywords. check if params are valid columm names
     unset($params["debug"]);
     unset($params["table"]);
     unset($params["group_by"]);
     unset($params["order_by"]);
     unset($params["limit"]);
     $where = arrayExtract($params, "where");
     foreach ($params as $key => $param) {
         $sql .= " {$sep} " . SqlManager::sqlCondition($params, $key, true);
         $sep = "AND";
     }
     if ($where) {
         $sql .= " {$sep} {$where}";
     }
     return $sql;
 }