mysql.query
mysql.query
Function
Sets the SQL text of the current MySQL object.
Syntax
mysql(dsn).query(sql)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| sql | Any | No | '' | SQL text, which will be converted to a string first when called. |
Return value
| Type | Description |
|---|---|
| Mysql | Returns the new MySQL query builder. |
Example
db = mysql('mysql://user:pass@127.0.0.1/test') result = db.query('select * from user where id=?').sql(false) // Output: select * from user where id=? print result
Notes
- query does not connect to the database, only saves SQL.