mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* added sql tests (linux only) * add mysql_escape_string module function its now possible to define a port for sql connection. (0 means default sql port like before) * escape string can fail, return error in this case * rebuild antlr * added docs
93 lines
3.7 KiB
XML
93 lines
3.7 KiB
XML
<?xml version='1.0' encoding="iso-8859-1"?>
|
|
<?xml-stylesheet type="text/xsl" href="escript.xslt" ?>
|
|
<!DOCTYPE ESCRIPT SYSTEM "escript.dtd">
|
|
<ESCRIPT>
|
|
<fileheader fname="sql.em">
|
|
<filedesc>Functions for interacting with a MySQL DBMS.
|
|
On Linux you must have the MySQL headers and libraries installed.</filedesc>
|
|
<datemodified>03/10/2024</datemodified>
|
|
</fileheader>
|
|
|
|
<function name="mysql_connect">
|
|
<prototype>mysql_connect(host,username,password := "", port := 0)</prototype>
|
|
<parameter name="host" value="MySQL DBMS hostname, usually 'localhost'" />
|
|
<parameter name="username" value="User Name for the connection" />
|
|
<parameter name="password" value="Password for the connection" />
|
|
<parameter name="port" value="connection port, 0 for default port" />
|
|
<explain>Connects to DMBS.</explain>
|
|
<return>Connection on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_query">
|
|
<prototype>mysql_query(connection,query,parameters := "")</prototype>
|
|
<parameter name="connection" value="Connection object" />
|
|
<parameter name="query" value="the SQL query to perform" />
|
|
<parameter name="parameters" value="Array of parameters." />
|
|
<explain>Performs a query. Every occurrence of ? in the query will be replaced
|
|
by corresponding parameter in the parameters array (if present). Parameters are
|
|
automatically escaped. All parameters are handled as string by now.</explain>
|
|
<explain>Example: mysql_query(conn, "SELECT a FROM t WHERE a = ? AND b = ?", array{1,"hel'lo")
|
|
executes "SELECT a FROM t WHERE a = '1' AND b = 'hel\'lo'"</explain>
|
|
<return>Connection on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_fetch_row">
|
|
<prototype>mysql_fetch_row(result)</prototype>
|
|
<parameter name="result" value="Result object" />
|
|
<explain>Fetches next row from Result.</explain>
|
|
<return>Array on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_affected_rows">
|
|
<prototype>mysql_affected_rows(result)</prototype>
|
|
<parameter name="result" value="Result object" />
|
|
<explain>Returns number of rows affected by last query.</explain>
|
|
<return>Integer on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_num_fields">
|
|
<prototype>mysql_num_fields(result)</prototype>
|
|
<parameter name="result" value="Result object" />
|
|
<explain>Returns number of fields in result.</explain>
|
|
<return>Integer on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_num_rows">
|
|
<prototype>mysql_num_rows(result)</prototype>
|
|
<parameter name="result" value="Result object" />
|
|
<explain>Returns number of rows in result.</explain>
|
|
<return>Integer on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_select_db">
|
|
<prototype>mysql_select_db(connection,database)</prototype>
|
|
<parameter name="connection" value="Connection object" />
|
|
<parameter name="database" value="database name" />
|
|
<explain>Select a database to perform queries on.</explain>
|
|
<return>1 on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_field_name">
|
|
<prototype>mysql_field_name(result,column_index)</prototype>
|
|
<parameter name="result" value="Result object" />
|
|
<parameter name="column_index" value="index for the field in the result" />
|
|
<explain>Returns the given field's name in result.</explain>
|
|
<return>String on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_close">
|
|
<prototype>mysql_close(connection)</prototype>
|
|
<parameter name="connection" value="Connection object" />
|
|
<explain>Closed the connection to DBMS.</explain>
|
|
<return>1 on success</return>
|
|
</function>
|
|
|
|
<function name="mysql_escape_string">
|
|
<prototype>mysql_escape_string(connection, str)</prototype>
|
|
<parameter name="connection" value="Connection object" />
|
|
<parameter name="str" value="String to escape" />
|
|
<explain>Returns escaped string on success</explain>
|
|
<return>String on success, Error otherwise</return>
|
|
</function>
|
|
|
|
</ESCRIPT>
|