mysql-native v1.2.0
API Reference Home: [This Version] [Latest Version] [Other Versions]
Function query
Execute a one-off SQL SELECT command where you want to deal with the result set one row at a time.
If you need random access to the resulting Row elements,
simply call std
on the result.
If the SQL command does not produce a result set (such as INSERT/CREATE/etc),
then MYXNoResultRecieved
will be thrown. Use
exec
instead for such commands.
Use this method when you are not going to be using the same command
repeatedly and you are CERTAIN all the data you're sending is properly
escaped. Otherwise consider using Prepared
.
If there are long data items among the expected result columns you can use the csa param to specify that they are to be subject to chunked transfer via a delegate.
Type Mappings
See the MySQL/D Type Mappings tables
Parameters
Name | Description |
---|---|
conn | An open Connection to the database. |
sql | The SQL command to be run. |
csa | An optional array of ColumnSpecialization structs. |
Returns
A (possibly empty) ResultRange.
Example
ResultRange oneAtATime = myConnection .query("SELECT * from myTable");
Row[] allAtOnce = myConnection .query("SELECT * from myTable") .array;