Coding with SPIP 3.0
SPIP3.0 Technical Documentation
Home > en > SQL access > The SQL API

The SQL API

SPIP’s SQL abstraction functions constitute an API which contains the following functions:

Name Description
Common elements
System parameters and options
sql_allfetsel
Returns an array with all of the results from a selection
sql_alltable
Returns an array of the existing SQL tables
sql_alter
Modifies the structure of an SQL table
sql_count
Counts the number of rows in a selection resource
sql_countsel
Counts the number of results
sql_create
Creates a table according to the schema provided
sql_create_base
Creates a database
sql_create_view
Creates a view
sql_date_proche
Returns a date comparison expression based on a date calculation
sql_delete
Deletes database records
sql_drop_table
Deletes a table!
sql_drop_view
Deletes a view
sql_errno
Returns the number code for the last SQL error
sql_error
Returns the last SQL error
sql_explain
Explains how the SQL server will process a request
sql_fetch
Returns a row from a selection resource
sql_fetch_all
Returns a table with all the results from a query
sql_fetsel
Selects and returns the first row of results
sql_free
Releases a resource
sql_getfetsel
Retrieves the single column requested from the first row in the selection
sql_get_charset
Requests if a particular character encoding is available on the server
sql_get_select
Returns the selection query
sql_hex
Returns a numeric value for a hexadecimal character string
sql_in
Constructs a condition using the IN operator
sql_insert
Inserts content into the database
sql_insertq
Inserts content into a database (automatically filtered)
sql_insertq_multi
Used to insert several database rows in a single operation
sql_in_select
Returns an sql_in condition from the results of an sql_select
sql_listdbs
Lists the databases available for a given connection
sql_multi
Extracts multilingual content
sql_optimize
Optimises a given table
sql_query
Executes a specific query
sql_quote
Filters (or escapes) an SQL parameter
sql_repair
Repairs a damaged table
sql_replace
Inserts or modifies a record
sql_replace_multi
Inserts or replaces several records
sql_seek
Positions a selection resource at the designated row number
sql_select
Selects content
sql_selectdb
Selects the requested database
sql_serveur
The API’s principal transparent function
sql_set_charset
Requests the use of the specified character encoding
sql_showbase
Returns a resource of the list of database tables
sql_showtable
Returns a description of the table
sql_update
Updates a database record
sql_updateq
Updates database content (and filters the data against SQL injection attacks)
sql_version
Returns the version number of the database manager
  • Author :
  • Published :
  • Updated : 19/02/12
  • Translations : English, français