diff --git a/classes/db_pdo.php b/classes/db_pdo.php
index 2e048ce..78c22d9 100644
--- a/classes/db_pdo.php
+++ b/classes/db_pdo.php
@@ -211,15 +211,35 @@ abstract class DB_PDO extends PDO {
return array_map(array($this, 'quote_ident'), $ident);
}
- // Remove existing escape characters
- $ident = str_replace($this->escape_char, '', $ident);
+ // If the string is already quoted, return the string
+ if (($pos = strpos($ident, $this->escape_char)) !== FALSE && $pos === 0)
+ {
+ return $ident;
+ }
// Split each identifier by the period
$hiers = explode('.', $ident);
- return $this->escape_char .
- implode("{$this->escape_char}.{$this->escape_char}", $hiers) .
- $this->escape_char;
+ // Return the re-compiled string
+ return implode('.', array_map(array($this, '_quote'), $hiers));
+ }
+
+ // --------------------------------------------------------------------------
+
+ /**
+ * Helper method for quote_ident
+ *
+ * @param mixed $str
+ * @return mixed
+ */
+ protected function _quote($str)
+ {
+ if ( ! is_string($str) && is_numeric($str))
+ {
+ return $str;
+ }
+
+ return "{$this->escape_char}{$str}{$this->escape_char}";
}
// -------------------------------------------------------------------------
diff --git a/classes/query_builder.php b/classes/query_builder.php
index 776dc31..abd745a 100644
--- a/classes/query_builder.php
+++ b/classes/query_builder.php
@@ -428,7 +428,7 @@ class Query_Builder {
$this->query_map[] = array(
'type' => 'like',
- 'conjunction' => (empty($this->query_map)) ? 'WHERE ' : " {$conj} ",
+ 'conjunction' => (empty($this->query_map)) ? ' WHERE ' : " {$conj} ",
'string' => $l
);
@@ -1204,6 +1204,8 @@ class Query_Builder {
/**
* Clear out the class variables, so the next query can be run
+ *
+ * @return void
*/
private function _reset()
{
@@ -1336,7 +1338,7 @@ class Query_Builder {
break;
}
- //echo $sql . '
';
+ echo $sql . '
';
return $sql;
}
diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html
index 3d6bb90..9a13f0e 100644
--- a/docs/classes/DB_PDO.html
+++ b/docs/classes/DB_PDO.html
@@ -113,6 +113,7 @@ the connection/database
get_system_tables()
switch_db()
truncate()
_quote()
driver_query()
_quote(mixed $str) : mixed+ +
mixed
+mixed
driver_query(string $sql, bool $filtered_index) : mixed@@ -662,7 +678,7 @@ the connection/database + generated on 2012-05-01T14:03:16-04:00.