Since v2.5.5, v2.6.1 (SelectInt64 and SelectDateTime) Methods of this group execute SQL query and return result as single value casted to XXX type. Syntax: function SelectString(aSQL : string; var IsOk : boolean; aFieldNumber : integer = 0):string; Description: Use these methods to execute an SQL statement against the database without the overhead of using a TMySQLQuery object. Methods return single value as a value of the field specified by number (aFieldNumber parameter) or by name (aFieldName parameter) in the first row of the first resultset. If the aFieldNumber parameter is omitted, methods return the value of the first field. If the query doesn't return at least one row or specified field is not found, the IsOk param is set to False (SelectXxx methods) or aDefaultValue param value is returned (SelectXxxDef methods). Parameters: aSQL A String value containing the statement to be executed. IsOk (SelectXxx methods) variable is set to True after successful execution, or False if requested value couldn't be fetched. aDefaultValue (SelectXxxDef methods) value to return by method if requested value can't be fetched. aFieldNumber Field number to return its value by method. Fields are numbered from zero. If this parameter is omitted, then it is assumed to be 0. In this case the value of the first field will be returned. aFieldName Field name to return its value by method. Examples: This example will show MySQL server version (like TMySQLDatabase.GetServerInfo method): ShowMessage(mySQLDatabase1.SelectStringDef('SELECT version', 'Something wrong happend!')); This example will show current UNIX timestamp value returned by MySQL server: ShowMessage(IntToStr(mySQLDatabase1.SelectIntDef('SELECT unix_timestamp', -1))); See also: Execute method |