An open mysql.impl.connection.Connection to the database.
The SQL command to be run.
Nullable!MySQLVal: This will be null (check via Nullable.isNull) if the query resulted in an empty result set.
$(TYPE_MAPPINGS)
auto myInt = 7; Nullable!MySQLVal value = myConnection.queryRow("SELECT * FROM `myTable` WHERE `a` = ?", myInt);
Execute an SQL SELECT command or prepared statement and return a single value: the first column of the first row received.
If the query did not produce any rows, or the rows it produced have zero columns, this will return Nullable!MySQLVal(), ie, null. Test for this with result.isNull.
If the query DID produce a result, but the value actually received is NULL, then result.isNull will be FALSE, and result.get will produce a MySQLVal which CONTAINS null. Check for this with result.get.kind == MySQLVal.Kind.Null or result.get == null.
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.
If args is supplied, the sql string will automatically be used as a prepared statement. Prepared statements are automatically cached by mysql-native, so there's no performance penalty for using this multiple times for the same statement instead of manually preparing a statement.
If args and prepared are both provided, args will be used, and any arguments that are already set in the prepared statement will automatically be replaced with args (note, just like calling mysql.impl.prepared.SafePrepared.setArgs, this will also remove all mysql.impl.prepared.SafeParameterSpecialization that may have been applied).
Only use the const(char[]) sql overload that doesn't take args 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 you need to use any mysql.impl.prepared.SafeParameterSpecialization, use mysql.safe.connection.prepare to manually create a mysql.impl.prepared.SafePrepared, and set your parameter specializations using mysql.impl.prepared.SafePrepared.setArg or mysql.impl.prepared.SafePrepared.setArgs.