Creating Drivers

Driver Directory and File Structure Sample driver directory and file structure layout: /application/libraries/Driver_nameDriver_name.php driversDriver_name_subclass_1.php Driver_name_subclass_2.php Driver_name_subclass_3.php Note In order to maintain compatibility on case-sensitive file systems, the Driver_name directory must be named in the format returned by ucfirst(). Note The Driver library’s architecture is such that the subclasses don’t extend and therefore don’t inherit properties

CI_Table::set_empty()

set_empty($value) Parameters: $value (mixed) – Value to put in empty cells Returns: CI_Table instance (method chaining) Return type: CI_Table Lets you set a default value for use in any table cells that are empty. You might, for example, set a non-breaking space: $this->table->set_empty(" ");

CI_DB_query_builder

class CI_DB_query_builder reset_query() Returns: CI_DB_query_builder instance (method chaining) Return type: CI_DB_query_builder Resets the current Query Builder state. Useful when you want to build a query that can be cancelled under certain conditions. start_cache() Returns: CI_DB_query_builder instance (method chaining) Return type: CI_DB_query_builder Starts the Query Builder cache. stop_cache() Returns: CI_DB_query_builder instance (method chaining) Return type: CI_DB_que

config_item()

config_item($key) Parameters: $key (string) – Config item key Returns: Configuration key value or NULL if not found Return type: mixed The Config Library is the preferred way of accessing configuration information, however config_item() can be used to retrieve single keys. See Config Library documentation for more information.

CI_DB_driver::cache_delete_all()

cache_delete_all() Returns: TRUE on success, FALSE on failure Return type: bool Delete all cache files.

form_close()

form_close([$extra = '']) Parameters: $extra (string) – Anything to append after the closing tag, as is Returns: An HTML form closing tag Return type: string Produces a closing </form> tag. The only advantage to using this function is it permits you to pass data to it which will be added below the tag. For example: $string = '</div></div>'; echo form_close($string); // Would produce: </form> </div></div>

CI_DB_result::first_row()

first_row([$type = 'object']) Parameters: $type (string) – Type of the requested result - array, object, or class name Returns: First row of result set, or NULL if it doesn’t exist Return type: mixed Returns the first row from the result set.

CI_DB_driver::simple_query()

simple_query($sql) Parameters: $sql (string) – The SQL statement to execute Returns: Whatever the underlying driver’s “query” function returns Return type: mixed A simplified version of the query() method, appropriate for use when you don’t need to get a result object or to just send a query to the database and not care for the result.

form_hidden()

form_hidden($name[, $value = '']) Parameters: $name (string) – Field name $value (string) – Field value Returns: An HTML hidden input field tag Return type: string Lets you generate hidden input fields. You can either submit a name/value string to create one field: form_hidden('username', 'johndoe'); // Would produce: <input type="hidden" name="username" value="johndoe" /> ... or you can submit an associative array to create multiple fields: $data = array( 'name' =&

ol()

ol($list, $attributes = '') Parameters: $list (array) – List entries $attributes (array) – HTML attributes Returns: HTML-formatted ordered list Return type: string Identical to ul(), only it produces the <ol> tag for ordered lists instead of <ul>.