Methods of this group execute SQL Query and return result as single value casted to the string type.
Use these methods to execute an SQL statement against the database without the overhead of using a TPSQLQuery object. It returns single value as a value of field specified by number (aFieldNumber parameter) or by name (aFieldName parameter) in the first row of first resultset. If aFieldNumber parameter is omitted, the function returns the value of the first field.
If query doesn't return at least one row, or specified field is not found, IsOk param is set to False (SelectString() methods), or aDefaultValue param value is returned (SelectStringDef() methods).
A String value containing the statement to be executed.
(SelectString() methods) Variable filled with True after successful execution or False if requested value can't be fetched.
(SelectStringDef() methods) Value to return by method if requested value can't be fetched.
Field number to return its value by method. Fields are numbered from zero. If this parameter is omitted it is assumed to be 0. This means that first field's value will be returned.
Field name to return its value by method.
This example will show PostgreSQL server version (like TPSQLDatabase.ServerVersion property):