mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 13:17:22 +01:00
Added docs for the QueryBuilder.
This commit is contained in:
parent
db534a3da6
commit
3ae8a852a7
@ -1,8 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<class name="QueryBuilder" inherits="Reference" version="3.10">
|
<class name="QueryBuilder" inherits="Reference" version="3.10">
|
||||||
<brief_description>
|
<brief_description>
|
||||||
|
A class that helps you with building and running database backend specific sql safely.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
|
A class that helps you with building and running database backend specific sql safely.
|
||||||
|
Methods by default use escape on their parameters that can normally contain user input. For performance reasons other variants that don't do this also exist. These are prefixed with 'n'. For example [method select] vs [method nselect]. Don't use these with raw user input, as it will make your application vulnerable to sql injection attacks.
|
||||||
|
It contains helper methods that lets you run the finished query directly See [method run] and [method run_query].
|
||||||
|
You should not allocate this directly, instead get it from you active database connection, like:
|
||||||
|
[codeblock]
|
||||||
|
var conn : DatabaseConnection = DatabaseManager.ddb.get_connection()
|
||||||
|
var qb : QueryBuilder = conn.get_query_builder()
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
@ -11,71 +20,116 @@
|
|||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="col" type="String" default="""" />
|
<argument index="0" name="col" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (col.empty()):
|
||||||
|
result += "ASC, "
|
||||||
|
else:
|
||||||
|
result += col + " ASC, "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="begin_transaction">
|
<method name="begin_transaction">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "BEGIN TRANSACTION;"
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="commit">
|
<method name="commit">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "COMMIT;"
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="corder_by">
|
<method name="corder_by">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Closes the current [code]ORDER BY[/code] statement. (Usually by removing the last [code],[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="cset">
|
<method name="cset">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Closes the current [code]SET[/code] statement. (Usually by removing the last [code],[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="cstr">
|
<method name="cstr">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Closes the current string. (Usually by adding a [code]'[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="cvalues">
|
<method name="cvalues">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Closes the current [code]VALUES[/code] statement. (Usually by replacing the last [code],[/code] with a [code])[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="del">
|
<method name="del">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" default="""" />
|
<argument index="0" name="params" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "DELETE FROM " + escape(params) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="desc">
|
<method name="desc">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="col" type="String" default="""" />
|
<argument index="0" name="col" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (col.empty()):
|
||||||
|
result += "DESC, "
|
||||||
|
else:
|
||||||
|
result += col + " DESC, "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="end_command">
|
<method name="end_command">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Closes the current sql command. (Usually by adding a [code];[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="escape">
|
<method name="escape">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<argument index="0" name="param" type="String" />
|
<argument index="0" name="param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Escapes the given string and returns it. (Using the database connector's escape method.)
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="ew">
|
<method name="ew">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="str" type="String" />
|
<argument index="0" name="str" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
(ew = escape write)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += escape(str)
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="from">
|
<method name="from">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" default="""" />
|
<argument index="0" name="params" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "FROM "
|
||||||
|
|
||||||
|
if (!params.empty()):
|
||||||
|
result += escape(params)
|
||||||
|
result += " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="insert">
|
<method name="insert">
|
||||||
@ -83,62 +137,117 @@
|
|||||||
<argument index="0" name="table_name" type="String" default="""" />
|
<argument index="0" name="table_name" type="String" default="""" />
|
||||||
<argument index="1" name="columns" type="String" default="""" />
|
<argument index="1" name="columns" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "INSERT INTO ";
|
||||||
|
|
||||||
|
if (!table_name.empty()):
|
||||||
|
result += table_name
|
||||||
|
result += " "
|
||||||
|
|
||||||
|
if (!columns.empty()):
|
||||||
|
result += "("
|
||||||
|
result += columns
|
||||||
|
result += ") "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="land">
|
<method name="land">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
(land = logical and)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "AND "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="like">
|
<method name="like">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="str" type="String" default="""" />
|
<argument index="0" name="str" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (str.empty()):
|
||||||
|
result += "LIKE "
|
||||||
|
else:
|
||||||
|
result += "LIKE '" + escape(str) + "' "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="limit">
|
<method name="limit">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="num" type="int" />
|
<argument index="0" name="num" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "LIMIT " + itos(num) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="lor">
|
<method name="lor">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
(lor = logical or)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "OR "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="ndel">
|
<method name="ndel">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" />
|
<argument index="0" name="params" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "DELETE FROM " + params + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="next_value">
|
<method name="next_value">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Closes the current [code]VALUES[/code] statement, and then open an another one. (Usually by replacing the last [code],[/code] with [code]"), ("[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nfrom">
|
<method name="nfrom">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" />
|
<argument index="0" name="params" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "FROM "
|
||||||
|
|
||||||
|
if (!params.empty()):
|
||||||
|
result += params + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nl">
|
<method name="nl">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds a newline. This can help when debugging sql statements. (Usually [code]\n[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nlike">
|
<method name="nlike">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="str" type="String" />
|
<argument index="0" name="str" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "LIKE '" + str + "' "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nselect">
|
<method name="nselect">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" />
|
<argument index="0" name="params" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "SELECT " + params + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nsetp">
|
<method name="nsetp">
|
||||||
@ -146,30 +255,61 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="escape_param" type="String" />
|
<argument index="1" name="escape_param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Add parameters to [code]UPDATE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "='" + params + "', "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nupdate">
|
<method name="nupdate">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" />
|
<argument index="0" name="params" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Start an [code]UPDATE[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "UPDATE " + params + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nval">
|
<method name="nval">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="param" type="String" />
|
<argument index="0" name="param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Add parameters to [code]INSERT INTO[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "'" + param + "', "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nvalues">
|
<method name="nvalues">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params_str" type="String" />
|
<argument index="0" name="params_str" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an unescaped [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "VALUES("
|
||||||
|
|
||||||
|
if (!params_str.empty()):
|
||||||
|
result += params_str + ") "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nwhere">
|
<method name="nwhere">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" />
|
<argument index="0" name="params" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an unescaped [code]WHERE[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "WHERE "
|
||||||
|
|
||||||
|
if (!params.empty()):
|
||||||
|
result += params + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="nwp">
|
<method name="nwp">
|
||||||
@ -177,67 +317,112 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="escape_param" type="String" />
|
<argument index="1" name="escape_param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an unescaped parameter to [code]WHERE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "='" + params + "' "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="offset">
|
<method name="offset">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="num" type="int" />
|
<argument index="0" name="num" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an [code]OFFSET[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "OFFSET " + str(num) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="order_by">
|
<method name="order_by">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an [code]ORDER BY[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (col.empty()):
|
||||||
|
result += "ORDER BY "
|
||||||
|
else:
|
||||||
|
result += "ORDER BY " + col + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="order_by_add_col">
|
<method name="order_by_add_col">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds a column to an [code]ORDER BY[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="order_by_asc">
|
<method name="order_by_asc">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an [code]ORDER BY ASC[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "ORDER BY " + col + " ASC, ";
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="order_by_desc">
|
<method name="order_by_desc">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an [code]ORDER BY DESC[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "ORDER BY " + col + " DESC, ";
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="prepare">
|
<method name="prepare">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Part of the unfinished prepared statement api.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="reset">
|
<method name="reset">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Resets the QueryBuilder.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="run">
|
<method name="run">
|
||||||
<return type="QueryResult" />
|
<return type="QueryResult" />
|
||||||
<description>
|
<description>
|
||||||
|
Run the query currently stored in the result property.
|
||||||
|
Use this if your query returns values from the database (an you want to read them).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="run_query">
|
<method name="run_query">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<description>
|
<description>
|
||||||
|
Run the query currently stored in the result property.
|
||||||
|
Use this if your query doesn't return values from the database (or you don't want to read them if it does).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="select">
|
<method name="select">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" default="""" />
|
<argument index="0" name="params" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds a [code]SELECT[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += SELECT " + escape(params) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="select_last_insert_id">
|
<method name="select_last_insert_id">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds a statement to select and return the last inserted row's id.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_paramf">
|
<method name="set_paramf">
|
||||||
@ -245,6 +430,7 @@
|
|||||||
<argument index="0" name="index" type="int" />
|
<argument index="0" name="index" type="int" />
|
||||||
<argument index="1" name="value" type="float" />
|
<argument index="1" name="value" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Part of the unfinished prepared statement api.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_parami">
|
<method name="set_parami">
|
||||||
@ -252,6 +438,7 @@
|
|||||||
<argument index="0" name="index" type="int" />
|
<argument index="0" name="index" type="int" />
|
||||||
<argument index="1" name="value" type="int" />
|
<argument index="1" name="value" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Part of the unfinished prepared statement api.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_params">
|
<method name="set_params">
|
||||||
@ -259,6 +446,7 @@
|
|||||||
<argument index="0" name="index" type="int" />
|
<argument index="0" name="index" type="int" />
|
||||||
<argument index="1" name="value" type="String" />
|
<argument index="1" name="value" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Part of the unfinished prepared statement api.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="setpb">
|
<method name="setpb">
|
||||||
@ -266,6 +454,14 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="bool" />
|
<argument index="1" name="param" type="bool" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a bool parameter to [code]UPDATE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (param):
|
||||||
|
result += col + "=1, "
|
||||||
|
else:
|
||||||
|
result += col + "=0, "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="setpd">
|
<method name="setpd">
|
||||||
@ -273,6 +469,11 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="float" />
|
<argument index="1" name="param" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a double parameter to [code]UPDATE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "=" + str(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="setpf">
|
<method name="setpf">
|
||||||
@ -280,6 +481,11 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="float" />
|
<argument index="1" name="param" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a float parameter to [code]UPDATE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "=" + str(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="setpi">
|
<method name="setpi">
|
||||||
@ -287,6 +493,11 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="int" />
|
<argument index="1" name="param" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an int parameter to [code]UPDATE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "=" + str(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="setps">
|
<method name="setps">
|
||||||
@ -294,80 +505,151 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="String" />
|
<argument index="1" name="param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an escaped string parameter to [code]UPDATE[/code] statements.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "=" + escape(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="sets">
|
<method name="sets">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Starts a [code]SET[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "SET "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="str">
|
<method name="str">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Starts a string. (Usually by adding a [code]'[/code]).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="update">
|
<method name="update">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" default="""" />
|
<argument index="0" name="params" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Starts an [code]UPDATE[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "UPDATE " + escape(params) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="val">
|
<method name="val">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds [code]DEFAULT[/code] to a [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "DEFAULT, "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="valb">
|
<method name="valb">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="param" type="bool" />
|
<argument index="0" name="param" type="bool" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a bool parameter to a [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (param):
|
||||||
|
result += "1, "
|
||||||
|
else:
|
||||||
|
result += "0, "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="vald">
|
<method name="vald">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="param" type="float" />
|
<argument index="0" name="param" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a double parameter to a [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += str(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="valf">
|
<method name="valf">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="param" type="float" />
|
<argument index="0" name="param" type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a float parameter to a [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += str(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="vali">
|
<method name="vali">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="param" type="int" />
|
<argument index="0" name="param" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an int parameter to a [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += str(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="vals">
|
<method name="vals">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="param" type="String" />
|
<argument index="0" name="param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an escaped string parameter to a [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += escape(param) + ", "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="values">
|
<method name="values">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params_str" type="String" default="""" />
|
<argument index="0" name="params_str" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an escaped [code]VALUES[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "VALUES("
|
||||||
|
|
||||||
|
if (!params_str.empty()):
|
||||||
|
result += escape(params_str) + ") "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="w">
|
<method name="w">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="str" type="String" />
|
<argument index="0" name="str" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
(w = write)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += str
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="where">
|
<method name="where">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<argument index="0" name="params" type="String" default="""" />
|
<argument index="0" name="params" type="String" default="""" />
|
||||||
<description>
|
<description>
|
||||||
|
Adds an escaped [code]WHERE[/code] statement.
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += "WHERE "
|
||||||
|
|
||||||
|
if (!params.empty()):
|
||||||
|
result += escape(params) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="wildcard">
|
<method name="wildcard">
|
||||||
<return type="QueryBuilder" />
|
<return type="QueryBuilder" />
|
||||||
<description>
|
<description>
|
||||||
|
Gets the wildcard character for the given database backend. (Usually [code]%[/code].)
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="wpb">
|
<method name="wpb">
|
||||||
@ -375,6 +657,14 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="bool" />
|
<argument index="1" name="param" type="bool" />
|
||||||
<description>
|
<description>
|
||||||
|
Add a bool parameter to a [code]WHERE[/code] statement. (wpb = where param bool)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
if (param):
|
||||||
|
result += col + "=1 "
|
||||||
|
else:
|
||||||
|
result += col + "=0 "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="wpi">
|
<method name="wpi">
|
||||||
@ -382,6 +672,11 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="int" />
|
<argument index="1" name="param" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an int parameter to a [code]WHERE[/code] statement. (wpi = where param int)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "=" + str(param) + " "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="wps">
|
<method name="wps">
|
||||||
@ -389,11 +684,17 @@
|
|||||||
<argument index="0" name="col" type="String" />
|
<argument index="0" name="col" type="String" />
|
||||||
<argument index="1" name="param" type="String" />
|
<argument index="1" name="param" type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
Add an escaped string parameter to a [code]WHERE[/code] statement. (wps = where param string)
|
||||||
|
Equivalent to:
|
||||||
|
[codeblock]
|
||||||
|
result += col + "='" + escape(param) + "' "
|
||||||
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
<members>
|
<members>
|
||||||
<member name="result" type="String" setter="set_result" getter="get_result" default="""">
|
<member name="result" type="String" setter="set_result" getter="get_result" default="""">
|
||||||
|
The current (resulting) sql statement.
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
<constants>
|
<constants>
|
||||||
|
Loading…
Reference in New Issue
Block a user