Dataset/DatasetFrom method
Previous  Top  Next

See Also Properties Methods Events Example
Unit
MySQLServer

Applies to
TMySQLServer component

Declaration
function Dataset(const AName: string='';const Table: string='';AutoOpen: boolean=False; const Master: string=''const Condition: string=''): TDataset;
function DatasetFrom(const SQL: string=''
;const AName: string='';AutoOpen: boolean=True; const Master: string=''const Condition: string=''): TDataset;

Description
This method is very powerful and gives you the ability to create datasets on the fly using one method call.

NOTE: Don't free or destroy the dataset you get back, these datasets are managed internally by the TMySQLServer and it will destroy and free them when it is destroyed. If you must destroy a dataset, please use the FreeDataset method.

The datasets returned is TMySQLDataset objects, but for compatibility they are cast to TDataset objects. You can just use a cast again to access the TMySQLDataset properties. The datasets created this way will all have default properties set and also operate on the same database as the TMySQLServer which created them.

AName      - The name of your dataset, this does not need to be a delphi/kylix name, any name will do, ex. "MyTable"
ATable      - The table on which this dataset will work. This can be empty, but is the equivalent of the TableName property which might be needed for Macros/Params
AutoOpen   - This will open the dataset before returning you the dataset, else you can keep it closed until you have access to it
Master      - This will link this dataset's MasterSource and MasterFields property up to a master dataset which you create earlier
Condition   - Is the condition for the Master linking

Here are a few examples, for a few examples please see Flying Dataset Examples

These methods work great, because you can create a TMySQLServer in a variant Session variable of for example an ISAPI dll and have this session's data totally persist through out the session's usage completely in sync with the session's context.