diff --git a/classes/db_pdo.php b/classes/db_pdo.php index c724670..f8a1aaa 100644 --- a/classes/db_pdo.php +++ b/classes/db_pdo.php @@ -61,6 +61,7 @@ abstract class DB_PDO extends PDO { $class = get_class($this)."_util"; $this->util = new $class($this); + // Set PDO to display errors as exceptions $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Set additional driver options, if they exist @@ -92,7 +93,7 @@ abstract class DB_PDO extends PDO { if( ! (is_object($query) || is_resource($query))) { $this->get_last_error(); - return FALSE; + return NULL; } // Set the statement in the class variable for easy later access @@ -102,7 +103,7 @@ abstract class DB_PDO extends PDO { if( ! (is_array($data) || is_object($data))) { trigger_error("Invalid data argument"); - return FALSE; + return NULL; } // Bind the parameters @@ -118,7 +119,7 @@ abstract class DB_PDO extends PDO { if( ! $res) { trigger_error("Parameter not successfully bound"); - return FALSE; + return NULL; } } @@ -348,7 +349,7 @@ abstract class DB_PDO extends PDO { */ public function get_schemas() { - return FALSE; + return NULL; } // ------------------------------------------------------------------------- @@ -485,9 +486,9 @@ abstract class DB_PDO extends PDO { public function driver_query($sql, $filtered_index=TRUE) { // Return if the query doesn't apply to the driver - if ($sql === FALSE) + if ($sql === NULL) { - return FALSE; + return NULL; } // Return predefined data @@ -523,7 +524,7 @@ abstract class DB_PDO extends PDO { return $stmt->fetchColumn(); } - return FALSE; + return NULL; } // ------------------------------------------------------------------------- diff --git a/classes/idb_sql.php b/classes/idb_sql.php index dde779e..9fd1d04 100644 --- a/classes/idb_sql.php +++ b/classes/idb_sql.php @@ -78,7 +78,7 @@ interface iDB_SQL { /** * Return sql to list functions * - * @return FALSE + * @return NULL */ public function function_list(); @@ -111,5 +111,6 @@ interface iDB_SQL { * @return string */ public function column_list($table); + } // End of db_sql.php \ No newline at end of file diff --git a/classes/iquery_builder.php b/classes/iquery_builder.php index 077f924..cd5f2f8 100644 --- a/classes/iquery_builder.php +++ b/classes/iquery_builder.php @@ -32,7 +32,7 @@ interface iQuery_Builder { * @return $this */ public function select($fields); - + // -------------------------------------------------------------------------- /** @@ -252,7 +252,7 @@ interface iQuery_Builder { * @return $this */ public function set($key, $val = NULL); - + // -------------------------------------------------------------------------- /** @@ -385,7 +385,7 @@ interface iQuery_Builder { * @return int */ public function count_all_results($table=''); - + // -------------------------------------------------------------------------- /** @@ -399,6 +399,17 @@ interface iQuery_Builder { // -------------------------------------------------------------------------- + /** + * Creates a batch insert clause, and executes it + * + * @param string $table + * @param mixed $data + * @return mixed + */ + public function insert_batch($table, $data=array()); + + // -------------------------------------------------------------------------- + /** * Creates an update clause, and executes it * diff --git a/classes/query_builder.php b/classes/query_builder.php index 4c28c0d..55b9997 100644 --- a/classes/query_builder.php +++ b/classes/query_builder.php @@ -1019,6 +1019,41 @@ class Query_Builder implements iQuery_Builder { // -------------------------------------------------------------------------- + /** + * Creates a batch insert clause and executes it + * + * @param string $table + * @param mixed $data + * @return mixed + */ + public function insert_batch($table, $data=array()) + { + // Bail out on Firebird and ODBC + $driver = str_replace('_sql', '', mb_strtolower(get_class($this->sql))); + + if ($driver == 'firebird' || $driver == 'odbc') + { + return NULL; + } + + // Can't use normal set, because it doesn't handle multidimensional arrays + foreach($data as $key => $arr) + { + foreach($arr as $k => $v) + { + $this->set_array_keys[$key][] = $k; + $this->values[] = $v; + } + + // Escape the field names + $this->set_array_keys[$key] = $this->db->quote_ident($this->set_array_keys[$key]); + } + + return $this->_run("insert_batch", $table); + } + + // -------------------------------------------------------------------------- + /** * Creates an update clause, and executes it * @@ -1192,6 +1227,15 @@ class Query_Builder implements iQuery_Builder { $sql = $this->_compile($type, $table); $vals = array_merge($this->values, (array) $this->where_values); + // Add quotes to 'string' values + foreach($vals as &$v) + { + if ( ! is_numeric($v)) + { + $v = "'{$v}'"; + } + } + $start_time = microtime(TRUE); $res = ($simple) @@ -1217,6 +1261,7 @@ class Query_Builder implements iQuery_Builder { // Set the last query to get rowcounts properly $this->db->last_query = $sql; + // Reset class state for next query $this->reset_query(); return $res; @@ -1277,6 +1322,25 @@ class Query_Builder implements iQuery_Builder { . implode(',', $this->set_array_keys) . ') VALUES ('.implode(',', $params).')'; break; + + case "insert_batch": + $param_count = count($this->set_array_keys[0]); + $params = array_fill(0, $param_count, '?'); + $sql = "INSERT INTO {$table} (" + . implode(',', $this->set_array_keys[0]) + . ') VALUES ( ' + . implode(',', $params) . ')'; + + // Remove the first set from the array + array_shift($this->set_array_keys); + + // Add another set of placeholders for each batch group + foreach($this->set_array_keys as $group) + { + $sql .= ',('.implode(',', $params).')'; + } + + break; case "update": $sql = "UPDATE {$table} SET {$this->set_string}"; diff --git a/docs/classes/BadConnectionException.html b/docs/classes/BadConnectionException.html index 8e86e5e..fc4f633 100644 --- a/docs/classes/BadConnectionException.html +++ b/docs/classes/BadConnectionException.html @@ -219,7 +219,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/BadDBDriverException.html b/docs/classes/BadDBDriverException.html index 89c7267..6b5352e 100644 --- a/docs/classes/BadDBDriverException.html +++ b/docs/classes/BadDBDriverException.html @@ -219,7 +219,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index 4b0cb8a..dc01b1c 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -743,7 +743,7 @@ the connection/database
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index 6d9264b..3c5b58e 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -210,7 +210,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index afc1326..8be6a18 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -658,7 +658,7 @@ the connection/database

Bind a prepared query with arguments for executing

-
prepare_query(string $sql, array $params) : FALSE
+
prepare_query(string $sql, array $params) : NULL

@@ -672,7 +672,7 @@ the connection/database array

Returns

-
FALSE
+
NULL
@@ -925,7 +925,7 @@ the last query executed
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index 1a49b47..928bc85 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -160,7 +160,7 @@ the query

Invalidate method for data consistency

-
bindColumn(mixed $column, mixed $param, int $type, mixed $maxlen, array $driverdata) : FALSE
+
bindColumn(mixed $column, mixed $param, int $type, mixed $maxlen, array $driverdata) : NULL

@@ -186,12 +186,12 @@ the query array

Returns

-
FALSE
+
NULL

Invalidate method for data consistency

-
bindParam(mixed $parameter, mixed $variable, int $data_type, mixed $maxlen, array $driverdata) : FALSE
+
bindParam(mixed $parameter, mixed $variable, int $data_type, mixed $maxlen, array $driverdata) : NULL

@@ -217,12 +217,12 @@ the query array

Returns

-
FALSE
+
NULL

Invalidate method for data consistency

-
bindValue(mixed $parameter, mixed $variable, int $data_type) : FALSE
+
bindValue(mixed $parameter, mixed $variable, int $data_type) : NULL

@@ -240,7 +240,7 @@ the query int

Returns

-
FALSE
+
NULL
@@ -505,7 +505,7 @@ the query
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index 4b7822b..0c5dc03 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -106,12 +106,12 @@

Returns sql to list other databases

-
db_list() : FALSE
+
db_list() : NULL

Returns

-
FALSE
+
NULL
@@ -234,7 +234,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index 9e7b629..02458dc 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -213,7 +213,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index 5027ea7..337b089 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -963,7 +963,7 @@ the connection/database
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index 7e06fe4..3359add 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -169,12 +169,12 @@

Return sql to list sequences

-
sequence_list() : FALSE
+
sequence_list() : NULL

Returns

-
FALSE
+
NULL
@@ -239,7 +239,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index 70ae1e5..92cd38c 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index ce7948a..f0e4812 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -963,7 +963,7 @@ the connection/database
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index a1b72ae..ba7f925 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -91,7 +91,7 @@  Methods

SQL to show infromation about columns in a table

-
column_list(string $table) : FALSE
+
column_list(string $table) : NULL

@@ -101,27 +101,27 @@ string

Returns

-
FALSE
+
NULL

Returns sql to list other databases

-
db_list() : FALSE
+
db_list() : NULL

Returns

-
FALSE
+
NULL

Return sql to list functions

-
function_list() : FALSE
+
function_list() : NULL

Returns

-
FALSE
+
NULL
@@ -149,12 +149,12 @@

Return sql to list stored procedures

-
procedure_list() : FALSE
+
procedure_list() : NULL

Returns

-
FALSE
+
NULL
@@ -169,62 +169,62 @@

Return sql to list sequences

-
sequence_list() : FALSE
+
sequence_list() : NULL

Returns

-
FALSE
+
NULL

Returns sql to list system tables

-
system_table_list() : FALSE
+
system_table_list() : NULL

Returns

-
FALSE
+
NULL

Returns sql to list tables

-
table_list() : FALSE
+
table_list() : NULL

Returns

-
FALSE
+
NULL

Returns sql to list triggers

-
trigger_list() : FALSE
+
trigger_list() : NULL

Returns

-
FALSE
+
NULL

SQL to show list of field types

-
type_list() : FALSE
+
type_list() : NULL

Returns

-
FALSE
+
NULL

Returns sql to list views

-
view_list() : FALSE
+
view_list() : NULL

Returns

-
FALSE
+
NULL
@@ -234,7 +234,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index 114395e..bf37b6b 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -204,7 +204,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index 397de51..0f355b9 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -965,7 +965,7 @@ the connection/database
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index 3e0d49d..0bf628d 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -116,12 +116,12 @@

Return sql to list functions

-
function_list() : FALSE
+
function_list() : NULL

Returns

-
FALSE
+
NULL
@@ -234,7 +234,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index e6ff280..ba90759 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-05-01T15:58:51-04:00.
diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index 048f655..bedfecb 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -80,6 +80,7 @@ execute current compiled query
get()
  • Adds a paren to the current query for query grouping
    group_start()
  • Generates a 'Having' clause
    having()
  • Creates an insert clause, and executes it
    insert()
  • +
  • Creates a batch insert clause and executes it
    insert_batch()
  • Creates a join phrase in a compiled query
    join()
  • Creates a Like clause in the sql statement
    like()
  • Set a limit on the current sql statement
    limit()
  • @@ -499,6 +500,25 @@ execute current compiled query
    mixed
    +
    +

    Creates a batch insert clause and executes it

    +
    insert_batch(string $table, mixed $data) : mixed
    +
    +
    +

    +

    Parameters

    +
    +

    $table

    +string +
    +
    +

    $data

    +mixed +
    +

    Returns

    +
    mixed
    +
    +

    Creates a join phrase in a compiled query

    join(string $table, string $condition, string $type) : \Query_Builder
    @@ -1361,7 +1381,7 @@ passed array with key / value pairs
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/classes/Query_Parser.html b/docs/classes/Query_Parser.html index 92e5854..4320347 100644 --- a/docs/classes/Query_Parser.html +++ b/docs/classes/Query_Parser.html @@ -145,7 +145,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index 9ab42db..2d707df 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -980,7 +980,7 @@ method if the database does not support 'TRUNCATE';
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index 026bbcd..a5a33b6 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -106,22 +106,22 @@

    Returns sql to list other databases

    -
    db_list() : FALSE
    +
    db_list() : NULL

    Returns

    -
    FALSE
    +
    NULL

    Return sql to list functions

    -
    function_list() : FALSE
    +
    function_list() : NULL

    Returns

    -
    FALSE
    +
    NULL
    @@ -149,12 +149,12 @@

    Return sql to list stored procedures

    -
    procedure_list() : FALSE
    +
    procedure_list() : NULL

    Returns

    -
    FALSE
    +
    NULL
    @@ -169,12 +169,12 @@

    Return sql to list sequences

    -
    sequence_list() : FALSE
    +
    sequence_list() : NULL

    Returns

    -
    FALSE
    +
    NULL
    @@ -199,12 +199,12 @@

    Returns sql to list triggers

    -
    trigger_list() : FALSE
    +
    trigger_list() : NULL

    Returns

    -
    FALSE
    +
    NULL
    @@ -234,7 +234,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index df4f60f..d2fa0c4 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -209,7 +209,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/classes/iDB_SQL.html b/docs/classes/iDB_SQL.html index 471c415..0a34525 100644 --- a/docs/classes/iDB_SQL.html +++ b/docs/classes/iDB_SQL.html @@ -118,12 +118,12 @@ specified table

    Return sql to list functions

    -
    function_list() : FALSE
    +
    function_list() : NULL

    Returns

    -
    FALSE
    +
    NULL
    @@ -244,7 +244,7 @@ specified table
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/classes/iQuery_Builder.html b/docs/classes/iQuery_Builder.html index fea7a90..abe1215 100644 --- a/docs/classes/iQuery_Builder.html +++ b/docs/classes/iQuery_Builder.html @@ -78,6 +78,7 @@ execute current compiled query
    get()
  • Adds a paren to the current query for query grouping
    group_start()
  • Generates a 'Having' clause
    having()
  • Creates an insert clause, and executes it
    insert()
  • +
  • Creates a batch insert clause, and executes it
    insert_batch()
  • Creates a join phrase in a compiled query
    join()
  • Creates a Like clause in the sql statement
    like()
  • Set a limit on the current sql statement
    limit()
  • @@ -428,6 +429,25 @@ execute current compiled query
    mixed
    +
    +

    Creates a batch insert clause, and executes it

    +
    insert_batch(string $table, mixed $data) : mixed
    +
    +
    +

    +

    Parameters

    +
    +

    $table

    +string +
    +
    +

    $data

    +mixed +
    +

    Returns

    +
    mixed
    +
    +

    Creates a join phrase in a compiled query

    join(string $table, string $condition, string $type) : \iQuery_Builder
    @@ -964,7 +984,7 @@ passed array with key / value pairs
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/deprecated.html b/docs/deprecated.html index 497e9fd..3482422 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -68,7 +68,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/errors.html b/docs/errors.html index 9977fb8..1178440 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -237,7 +237,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/graph_class.html b/docs/graph_class.html index 02ab063..6eb2ed8 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -65,7 +65,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/markers.html b/docs/markers.html index 1e0358a..c8f37fa 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -110,7 +110,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index 61302cc..1e8acf7 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -340,7 +340,7 @@ instantiates the specific db driver

    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/packages/.html b/docs/packages/.html index c3705ec..8935945 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -68,7 +68,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/packages/Default.html b/docs/packages/Default.html index 34d992d..7f750df 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -95,7 +95,7 @@
    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index 93aebbc..6cf43eb 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -212,7 +212,7 @@ data-fetching methods

    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index c945f0f..4ac3948 100644 --- a/docs/packages/Query.Query.html +++ b/docs/packages/Query.Query.html @@ -150,7 +150,7 @@ instantiates the specific db driver

    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/packages/Query.html b/docs/packages/Query.html index ee51ce2..33fe0a1 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -362,7 +362,7 @@ instantiates the specific db driver

    + generated on 2013-05-01T15:58:51-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index f8d336f..babc019 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -98,7 +98,7 @@ - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -190,388 +190,388 @@ - + prepare_query function - + - + string - + array - + mixed - + $sql - + $data - + prepare_execute function - + - + string - + array - + \PDOStatement - + $sql - + $params - + get_query_data function - + - + \PDOStatement - + array - + $statement - + affected_rows function - + - + \PDOStatement - + int - + $statement - + get_last_error function - + - + string - + quote_table function - + - + string - + string - + $table - + _prefix function - + - + string - + string - + $str - + quote_ident function - + - + mixed - + string - + $ident - + _quote function - + - + mixed - + mixed - + $str - + empty_table function - + - + string - + mixed - + $table - + get_schemas function - + - + array - + get_tables function - + - + array - + get_dbs function - + - + array - + get_views function - + - + array - + get_sequences function - + - + array - + get_functions function - + - + array - + get_procedures function - + - + array - + get_triggers function - + - + array - + get_system_tables function - + - + array - + get_columns function - + - + string - + array - + $table - + get_types function - + - + array - + driver_query function - + - + string - + bool - + mixed - + $sql - + $filtered_index - + num_rows function - + - - + + int - + truncate function - + - + string - + void - + $table @@ -579,7 +579,7 @@ the connection/database]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -1766,10 +1766,10 @@ in place of the get() method]]> - update + insert_batch function - + string @@ -1792,267 +1792,294 @@ in place of the get() method]]> - - delete + + update function - - + + - + string - + mixed - + mixed - + $table - + + $data + + + + + + delete + function + + + + + string + + + mixed + + + mixed + + + + $table + + + + $where - + get_compiled_select function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_insert function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_update function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_delete function - + - + string - + bool - + string - + $table - + $reset - + _get_compile function - + - + string - + string - - + + - + $type - + $table - + $reset - + reset_query function - + - + void - + _run function - + - + string - + string - + bool - + mixed - + $type - + $table - + $simple - + __call function - + - + string - + array - + mixed - + $name - + $params - + _compile function - + - + string - + string - + \$string - + $type - + $table @@ -2060,7 +2087,7 @@ in place of the get() method]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -2189,8 +2216,8 @@ in place of the get() method]]> - - FALSE + + NULL @@ -2247,7 +2274,7 @@ specified table]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3107,10 +3134,10 @@ in place of the get() method]]> - update + insert_batch function - + string @@ -3134,15 +3161,15 @@ in place of the get() method]]> - delete + update function - + string - + mixed @@ -3155,43 +3182,43 @@ in place of the get() method]]> + $data + + + + + + delete + function + + + + + string + + + mixed + + + mixed + + + + $table + + + + $where - + get_compiled_select function - - - - - string - - - bool - - - string - - - - $table - - - - - $reset - - - - - - get_compiled_insert - function - + string @@ -3205,7 +3232,7 @@ in place of the get() method]]> $table - + @@ -3215,10 +3242,10 @@ in place of the get() method]]> - get_compiled_update + get_compiled_insert function - + string @@ -3232,7 +3259,7 @@ in place of the get() method]]> $table - + @@ -3242,10 +3269,10 @@ in place of the get() method]]> - get_compiled_delete + get_compiled_update function - + string @@ -3259,7 +3286,7 @@ in place of the get() method]]> $table - + @@ -3269,12 +3296,39 @@ in place of the get() method]]> + get_compiled_delete + function + + + + + string + + + bool + + + string + + + + $table + + + + + $reset + + + + + reset_query function - + - + void @@ -3601,7 +3655,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3728,8 +3782,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4012,7 +4066,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -4137,7 +4191,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -4210,8 +4264,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4221,8 +4275,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4232,8 +4286,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4243,8 +4297,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4254,8 +4308,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4265,8 +4319,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4276,8 +4330,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4287,8 +4341,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4298,8 +4352,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -4312,8 +4366,8 @@ with array_map and glob]]> string - - FALSE + + NULL
    @@ -4635,7 +4689,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -4793,8 +4847,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5106,7 +5160,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -5179,8 +5233,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5223,8 +5277,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5234,8 +5288,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5245,8 +5299,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5256,8 +5310,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5293,7 +5347,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -5366,8 +5420,8 @@ with array_map and glob]]> - - FALSE + + NULL @@ -5480,7 +5534,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -5570,8 +5624,8 @@ the query]]> array - - FALSE + + NULL
    @@ -5621,8 +5675,8 @@ the query]]> array - - FALSE + + NULL @@ -5666,8 +5720,8 @@ the query]]> int - - FALSE + + NULL @@ -5856,7 +5910,7 @@ the query]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -6136,8 +6190,8 @@ the last query executed]]> array - - FALSE + + NULL
    diff --git a/drivers/firebird/firebird_driver.php b/drivers/firebird/firebird_driver.php index 4f4f5f7..42c13f3 100644 --- a/drivers/firebird/firebird_driver.php +++ b/drivers/firebird/firebird_driver.php @@ -161,7 +161,7 @@ class Firebird extends DB_PDO { return TRUE; } - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -260,13 +260,13 @@ class Firebird extends DB_PDO { * * @param string $sql * @param array $params - * @return FALSE + * @return NULL */ public function prepare_query($sql, $params) { // You can't bind query statements before execution with // the firebird database - return FALSE; + return NULL; } } // End of firebird_driver.php \ No newline at end of file diff --git a/drivers/firebird/firebird_result.php b/drivers/firebird/firebird_result.php index 2b5b047..d5fbe77 100644 --- a/drivers/firebird/firebird_result.php +++ b/drivers/firebird/firebird_result.php @@ -78,11 +78,11 @@ class Firebird_Result extends PDOStatement { * @param int $type * @param mixed $maxlen * @param array $driverdata - * @return FALSE + * @return NULL */ public function bindColumn($column, &$param, $type=NULL, $maxlen=NULL, $driverdata=NULL) { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -95,11 +95,11 @@ class Firebird_Result extends PDOStatement { * @param int $data_type * @param mixed $maxlen * @param array $driverdata - * @return FALSE + * @return NULL */ public function bindParam($parameter, &$variable, $data_type=NULL, $maxlen=NULL, $driverdata=NULL) { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -110,11 +110,11 @@ class Firebird_Result extends PDOStatement { * @param mixed $parameter * @param mixed &$variable * @param int $data_type - * @return FALSE + * @return NULL */ public function bindValue($parameter, $variable, $data_type=NULL) { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -158,16 +158,16 @@ class Firebird_Result extends PDOStatement { // If there is no result, continue if (empty($this->result)) { - return FALSE; + return NULL; } // Keep track of the current row being fetched ++$this->row; - // Return false if the next row doesn't exist + // return NULL if the next row doesn't exist if ( ! isset($this->result[$this->row])) { - return FALSE; + return NULL; } switch($fetch_style) diff --git a/drivers/firebird/firebird_sql.php b/drivers/firebird/firebird_sql.php index 55129dc..dd89957 100644 --- a/drivers/firebird/firebird_sql.php +++ b/drivers/firebird/firebird_sql.php @@ -55,7 +55,7 @@ class Firebird_SQL implements iDB_SQL { */ public function random() { - return FALSE; + return NULL; } @@ -64,11 +64,11 @@ class Firebird_SQL implements iDB_SQL { /** * Returns sql to list other databases * - * @return FALSE + * @return NULL */ public function db_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- diff --git a/drivers/mysql/mysql_sql.php b/drivers/mysql/mysql_sql.php index 166716b..ea61f6a 100644 --- a/drivers/mysql/mysql_sql.php +++ b/drivers/mysql/mysql_sql.php @@ -146,11 +146,11 @@ class MySQL_SQL implements iDB_SQL { /** * Return sql to list sequences * - * @return FALSE + * @return NULL */ public function sequence_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- diff --git a/drivers/odbc/odbc_sql.php b/drivers/odbc/odbc_sql.php index b063b5e..295840f 100644 --- a/drivers/odbc/odbc_sql.php +++ b/drivers/odbc/odbc_sql.php @@ -43,7 +43,7 @@ class ODBC_SQL implements iDB_SQL { */ public function random() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -51,11 +51,11 @@ class ODBC_SQL implements iDB_SQL { /** * Returns sql to list other databases * - * @return FALSE + * @return NULL */ public function db_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -63,11 +63,11 @@ class ODBC_SQL implements iDB_SQL { /** * Returns sql to list tables * - * @return FALSE + * @return NULL */ public function table_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -75,11 +75,11 @@ class ODBC_SQL implements iDB_SQL { /** * Returns sql to list system tables * - * @return FALSE + * @return NULL */ public function system_table_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -87,11 +87,11 @@ class ODBC_SQL implements iDB_SQL { /** * Returns sql to list views * - * @return FALSE + * @return NULL */ public function view_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -99,11 +99,11 @@ class ODBC_SQL implements iDB_SQL { /** * Returns sql to list triggers * - * @return FALSE + * @return NULL */ public function trigger_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -111,11 +111,11 @@ class ODBC_SQL implements iDB_SQL { /** * Return sql to list functions * - * @return FALSE + * @return NULL */ public function function_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -123,11 +123,11 @@ class ODBC_SQL implements iDB_SQL { /** * Return sql to list stored procedures * - * @return FALSE + * @return NULL */ public function procedure_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -135,11 +135,11 @@ class ODBC_SQL implements iDB_SQL { /** * Return sql to list sequences * - * @return FALSE + * @return NULL */ public function sequence_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -147,11 +147,11 @@ class ODBC_SQL implements iDB_SQL { /** * SQL to show list of field types * - * @return FALSE + * @return NULL */ public function type_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -160,11 +160,11 @@ class ODBC_SQL implements iDB_SQL { * SQL to show infromation about columns in a table * * @param string $table - * @return FALSE + * @return NULL */ public function column_list($table) { - return FALSE; + return NULL; } } diff --git a/drivers/odbc/odbc_util.php b/drivers/odbc/odbc_util.php index 6104c51..a18c1b8 100644 --- a/drivers/odbc/odbc_util.php +++ b/drivers/odbc/odbc_util.php @@ -46,7 +46,7 @@ class ODBC_Util extends DB_Util { public function create_table($name, $columns, array $constraints=array(), array $indexes=array()) { //ODBC can't know how to create a table - return FALSE; + return NULL; } // -------------------------------------------------------------------------- diff --git a/drivers/pgsql/pgsql_sql.php b/drivers/pgsql/pgsql_sql.php index 72ba5fd..701ddbc 100644 --- a/drivers/pgsql/pgsql_sql.php +++ b/drivers/pgsql/pgsql_sql.php @@ -144,11 +144,11 @@ SQL; /** * Return sql to list functions * - * @return FALSE + * @return NULL */ public function function_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- diff --git a/drivers/sqlite/sqlite_sql.php b/drivers/sqlite/sqlite_sql.php index dedf560..68c82fe 100644 --- a/drivers/sqlite/sqlite_sql.php +++ b/drivers/sqlite/sqlite_sql.php @@ -56,11 +56,11 @@ class SQLite_SQL implements iDB_SQL { /** * Returns sql to list other databases * - * @return FALSE + * @return NULL */ public function db_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -89,7 +89,7 @@ SQL; */ public function system_table_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -111,11 +111,11 @@ SQL; /** * Returns sql to list triggers * - * @return FALSE + * @return NULL */ public function trigger_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -123,11 +123,11 @@ SQL; /** * Return sql to list functions * - * @return FALSE + * @return NULL */ public function function_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -135,11 +135,11 @@ SQL; /** * Return sql to list stored procedures * - * @return FALSE + * @return NULL */ public function procedure_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- @@ -147,11 +147,11 @@ SQL; /** * Return sql to list sequences * - * @return FALSE + * @return NULL */ public function sequence_list() { - return FALSE; + return NULL; } // -------------------------------------------------------------------------- diff --git a/tests/core/db_qb_test.php b/tests/core/db_qb_test.php index 50a05b8..fc0d683 100644 --- a/tests/core/db_qb_test.php +++ b/tests/core/db_qb_test.php @@ -20,7 +20,7 @@ abstract class QBTest extends UnitTestCase { public function __destruct() { - // echo '
    ' . print_r($this->db->queries, TRUE) . '
    '; + //echo '
    ' . print_r($this->db->queries, TRUE) . '
    '; } // -------------------------------------------------------------------------- @@ -415,6 +415,32 @@ abstract class QBTest extends UnitTestCase { $this->assertIsA($query, 'PDOStatement'); } + // -------------------------------------------------------------------------- + + public function TestLeftJoin() + { + if (empty($this->db)) return; + + $query = $this->db->from('create_test ct') + ->join('join cj', 'cj.id = ct.id', 'left') + ->get(); + + $this->assertIsA($query, 'PDOStatement'); + } + + // -------------------------------------------------------------------------- + + public function TestInnerJoin() + { + if (empty($this->db)) return; + + $query = $this->db->from('create_test ct') + ->join('join cj', 'cj.id = ct.id', 'inner') + ->get(); + + $this->assertIsA($query, 'PDOStatement'); + } + // -------------------------------------------------------------------------- // ! DB update tests // -------------------------------------------------------------------------- @@ -430,6 +456,35 @@ abstract class QBTest extends UnitTestCase { $this->assertIsA($query, 'PDOStatement'); } + + // -------------------------------------------------------------------------- + + public function TestInsertBatch() + { + if (empty($this->db)) return; + + $insert_array = array( + array( + 'id' => 6, + 'key' => 2, + 'val' => 3 + ), + array( + 'id' => 5, + 'key' => 6, + 'val' => 7 + ), + array( + 'id' => 8, + 'key' => 1, + 'val' => 2 + ) + ); + + $query = $this->db->insert_batch('test', $insert_array); + + $this->assertIsA($query, 'PDOStatement'); + } // -------------------------------------------------------------------------- diff --git a/tests/databases/firebird/firebird-qb.php b/tests/databases/firebird/firebird-qb.php index 7e3ccd5..5497d9c 100644 --- a/tests/databases/firebird/firebird-qb.php +++ b/tests/databases/firebird/firebird-qb.php @@ -36,6 +36,35 @@ class FirebirdQBTest extends QBTest { // echo '
    Firebird Queries
    '; } + + // -------------------------------------------------------------------------- + + public function TestInsertBatch() + { + if (empty($this->db)) return; + + $insert_array = array( + array( + 'id' => 6, + 'key' => 2, + 'val' => 3 + ), + array( + 'id' => 5, + 'key' => 6, + 'val' => 7 + ), + array( + 'id' => 8, + 'key' => 1, + 'val' => 2 + ) + ); + + $query = $this->db->insert_batch('test', $insert_array); + + $this->assertNull($query); + } public function TestTypeList() { diff --git a/tests/db_files/FB_TEST_DB.FDB b/tests/db_files/FB_TEST_DB.FDB index 144d10b..8de1c33 100755 Binary files a/tests/db_files/FB_TEST_DB.FDB and b/tests/db_files/FB_TEST_DB.FDB differ