# sql class

A sql database interface.

Inherits
object
Description
This class permits KVIrc to have an interface with a SQL database supported by Qt library drivers.
Functions

`<boolean> $setConnection(<connection_name:string>,<database_name:string>,[<user:string>,<host_name_string>,<password:string>,<database_driver:string>])`
Connects to the DBMS using the connection <connection_name> and selecting the database <database_name>. If the optional parameter <database_driver> is passed, it will be used the corresponding driver (if present), otherwise Sqlite will be used. Returns true if the operation is successful, false otherwise.
`: <array or string> $connectionNames([<stringreturnflag>:'s'])`
Returns as array or, if the flag 's' is passed, as a comma separate string all the database active connection's names.
`<array> $tablesList(<connection_name:string>)`
Returns as array the database tables list.
`$transaction()`
Begin a transaction.
`$commit()`
Commit the transaction.
`$setCurrentQuery(<connection_name:string>)`
Sets the query for the database connection <connection_name>, which has to be already connected, as current query.
`<connection_name:string> $currentQuery()`
Returns the name of the database connection for the current query, or an empty string if there aren't any initialized queries.
`$closeConnection(<connection_name:string>)`
Closes the connection <connection_name>.
`<size:integer> $queryResultsSize()`
Returns the query size in rows or -1 if the query is empty or the database driver doesn' support the function.
`<error:string> $lastError(<more_details:boolean>)`
Returns last error occurred. Use the more_details flag for more info about the error.
`<ok:boolean> $queryExec([<query:string>])`
Execs the current query <query>. The string must follow the right syntax against the database in use. If there are no parameters, it will exec the query previously done. After the execution, the query will positioned on the first resulting record. Returns true if the operation is successful, false otherwise. See also $queryPrepare()
`<ok:boolean> $queryPrepare(<query_string>)`
Prepare the query <query> to execute. The string must follow the right syntax against the database in use. It's possible to use the placeholders. It's supported either the identifier ':' and '?' but it's not possible to use them together. Returns true if the operation is successful, false otherwise. See also $queryExecand[classfnc]$queryBindValue[/classfnc.
`$queryBindValue()`
Sets the placeholder <placeholder> to be bound to the value <val> in the prepared statement. Note that the placeholder mark (e.g :) must be included when specifing the placeholder name.
`<boolean> $queryPrevious()`
Sets the current query position to the previous resulting record. Returns true if the operation is successful, false otherwise.
`<boolean> $queryNext()`
Sets the current query position to the next resulting record. Returns true if the operation is successful, false otherwise.
`<boolean> $queryLast()`
Sets the current query position to the last resulting record. Returns true if the operation is successful, false otherwise.
`<boolean> $queryFirst()`
Sets the current query position to the first resulting record. Returns true if the operation is successful, false otherwise.
`<record:hash> $queryRecord()`
Returns a hash containing the current query's record fields.
`$queryFinish()`
Sets the current query to inactive.

Index, Object Classes

KVIrc 4.2.0.6190 Documentation
Generated by root at Mon Sep 23 06:46:00 2013