Repository navigation
Specifiers
The specifiers of a query, which MySQL_Send, MySQL_Query, MySQL_ParallelQuery, MySQL_Run, MySQL_Format, MySQL_CreateQuery and MySQL_AppendQuery take.
| Specifier | Value | Writes |
|---|---|---|
%i, %d
|
Integer | The number, as -42. |
%u |
Integer | The number read as unsigned, as 4294967254 for -42. |
%x |
Integer | The number in hexadecimal, as 2a. |
%f |
Float | As many digits as the float needs, as 1.5. |
%.4f |
Float | Four decimals, as 1.5000. Any count works. |
%s |
String | The text as it is. Only for text the script controls, such as the name of a table. |
%e |
String | The text escaped for a string literal, without quotes. |
%q |
String | The text escaped and between single quotes, as 'O\'Neil'. |
%j |
String | The text as a JSON string, between double quotes, as "say \"hi\"". |
%Q |
Query | The text of a query being built, as it is. |
%% |
none | A percent sign. |
A float takes the Float tag, and a query being built the Query tag. The tags listed in CUSTOM_TAG_TYPES are taken too, as by the natives of open.mp.
Escaping follows the connection: its character set, and the NO_BACKSLASH_ESCAPES mode of the server when it is on.
MySQL_Prepare takes the same specifiers, each one a value the server fills, never written into the text.
| Specifier | Bound as |
|---|---|
%i, %d, %x
|
A signed integer. |
%u |
An unsigned integer. |
%f, %.4f
|
A float. |
%s, %e, %q, %j
|
A string, as it is. |
%Q |
The text of a query being built, as a string. |
%% |
A percent sign in the text. |
Since the server never parses a value, %s, %e, %q and %j bind the same string, with no quotes and no escapes. A value cannot be the name of a table or a column. A ? written in the text is a placeholder of its own, which makes the statement fail.
MySQL 0.2.0 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Queries
- Results
- JSON cells
- Prepared statements
- Passwords
- Errors
- TLS
- Coming from R41
- Performance
Reference
Functions