SPL Module Reference: sql_mysql
load "sql_mysql";
This module implements the MySQL database driver.
Load this module (and the "sql" module) and pass "mysql" as backend
driver name to sql_connect();
The string describing the database connection (the 2nd argument to
sql_connect()) is a coma seperated list of the following tokens:
host={hostname}
user={username}
pass={password}
sock={socket_filename}
db={database_name}
port={tcp_port_number}
compress (set MySQL CLIENT_COMPRESS flag)
ignore_space (set MySQL CLIENT_IGNORE_SPACE flag)
multi_statements (set MySQL CLIENT_MULTI_STATEMENTS flag)
Whitespaces are not allowed. E.g.:
var db = sql_connect("mysql", "host=dbserver,user=dbuser");
var r = sql(db, "show databases");
foreach i (r)
debug pop r[i];
builtin
encode_mysql(text);
builtin encode_mysql(text);
This function encodes a string to be used in an MySQL query. I.e. the string
will be put in single quotes and special characters inside the string is
quoted with backslash sequences.
Always use this function instead of encode_sql() for quoting strings
in MySQL queries unless you are running MySQL in the ANSI_QUOTES mode.
This function is designed to be used with the encoding/quoting operator (::).