query

Execute an SQL SELECT command or prepared statement.

This returns an input range of mysql.result.Row, so if you need random access to the mysql.result.Row elements, simply call std.array.array() on the result.

If the SQL command does not produce a result set (such as INSERT/CREATE/etc), then mysql.exceptions.MYXNoResultRecieved will be thrown. Use exec instead for such commands.

Only use the string sql overload 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 overload that takes a 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.

More...

Parameters

conn Connection

An open mysql.connection.Connection to the database.

prepared Prepared

The prepared statement to be run.

Return Value

A (possibly empty) mysql.result.ResultRange.

Detailed Description

Type Mappings

$(TYPE_MAPPINGS)

Examples

ResultRange oneAtATime = myConnection.query("SELECT * from myTable");
Row[]       allAtOnce  = myConnection.query("SELECT * from myTable").array;

Meta