Function
|
Return type
|
Description
|
__construct($source:string)
|
|
Create instance of a data source.
|
Select()
|
SMKeyValueCollection[]
|
Select all records with all fields/columns from data source.
|
| Select($select:string) |
SMKeyValueCollection[] |
Select all records with the specified list of fields/columns (ie "*" or "field1, field2, field3").
|
| Select($select:string, $where:string) |
SMKeyValueCollection[] |
See description for Select($select:string). Specify condition(s) that must be met for records to be included (ie "field1 = 12 AND field2 = 'Casper' OR field2 = 'Michael'). Valid operators: = | != | < | > | <= | >= | IS NULL | IS NOT NULL | LIKE | NOT LIKE
|
| Select($select:string, $where:string, $orderby:string) |
SMKeyValueCollection[] |
See description for Select($select:string, $where:string). Specify field(s) by which records are ordered (ie "field1, field2").
|
| Select($select:string, $where:string, $orderby:string, $limit:integer) |
SMKeyValueCollection[] |
See description for Select($select:string, $where:string, $orderby:string). Specify a maximum number of records included.
|
| Select($select:string, $where:string, $orderby:string, $limit:integer, $offset:integer) |
SMKeyValueCollection[] |
See description for Select($select:string, $where:string, $orderby:string, $limit:integer). Specify an offset from where records are included.
|
Count()
|
Integer
|
Count all records in data source
|
Count($where:string)
|
Integer
|
Count all records matching specified WHERE statement. See description for Select($select:string, $where:string) for valid operators.
|
| Count($where:string, $limit:integer) |
Integer |
See description for Count($where:string). Specify a maximum of records included in count.
|
| Count($where:string, $limit:integer, $offset:integer) |
Integer |
See description for Count($where:string, $limit:integer). Specify an offset from where records are included.
|
| Insert($data:SMKeyValueCollection) |
|
Insert new record into data source. |
| Update($data:SMKeyValueCollection) |
Integer |
Update fields in SMKeyValueCollection for all records in data source. The number of updated records is returned. |
| Update($data:SMKeyValueCollection, $where:string) |
Integer |
See description for Update($data:SMKeyValueCollection). Only update records matching the specified WHERE condition. See description for Select($select:string, $where:string) for valid operators. |
| Update($data:SMKeyValueCollection, $where:string, $orderby:string) |
Integer |
See description for Update($data:SMKeyValueCollection, $where:string). Update records in the specified order. This is usually used in conjunction with a limit - see Update($data:SMKeyValueCollection, $where:string $orderby:string, $limit:integer). |
| Update($data:SMKeyValueCollection, $where:string, $orderby:string, $limit:integer) |
Integer |
See description for Update($data:SMKeyValueCollection, $where:string $orderby:string). Specify a limit for number of records to be updated.
|
| Update($data:SMKeyValueCollection, $where:string, $orderby:string, $limit:integer, $offset:integer) |
Integer
|
See description for Update($data:SMKeyValueCollection, $where:string $orderby:string, $limit:integer). Specify an offset from where records are updated.
|
Delete()
|
Integer
|
Delete all records from data source. The number of deleted records is returned.
|
| Delete($where:string) |
Integer
|
See description for Delete(). Delete records matching the specified WHERE statement. See description for Select($select:string, $where:string) for valid operators. |
| Delete($where:string, $orderby:string) |
Integer
|
See description for Delete($where:string). Delete records in the specified order. This is usually used in conjunction with a limit - see Delete($where:string $orderby:string, $limit:integer). |
| Delete($where:string, $orderby:string, $limit:integer) |
Integer |
See description for Delete($where:string, $orderby:string). Specify a limit for number of records to be deleted. |
| Delete($where:string, $orderby:string, $limit:integer, $offset:integer) |
Integer |
See description for Delete($where:string, $orderby:string, $limit:integer). Specify an offset from where records are removed. |
| Verify() |
|
Returns True if data can safely be committed. This function was introduced to work around a bug in PHP allowing invalid characters to be written to the XML based Data Source, which corrupted the data. |
| Commit() |
|
Commit data to data source - all changes are made permanenet. If Commit() is not invoked manually, the data source will be automatically committed between Unload and Finalize in the life cycle. It is recommended to let auto commit handle this, unless it is absolutely vital that the given data is not lost. |
| RollBack() |
|
Cancel all changes made to the given data source. Have in mind that multiple extension may have made changes to the data source. These changes will be lost too. |
| Reload() |
|
Discard all changes and reload data |
| Lock() |
|
Lock entire data source so that only one session can change it. The locking is advisory, meaning that all accessing code must call this function to respect the lock. If the data source is already locked, the given session will wait for the lock to be released. This function should not be used lightly - it will have a negative impact on performance if not used correctly. Release the lock as soon as possible by invoking Commit() or Unlock(). Also notice that locking a data source will cause data to be re-loaded to ensure most recent changes.
|
SetUseCache($value:boolean)
|
|
Deprecated - see Reload() Enable (default) or disable caching. Caching improves performance significantly, especially when using the XML based data source. Disabling the caching is primarily used when one wants to ensure the most recent data, for instance modifications from another session. Notice that changes made to the data source will be lost, when caching is disabled. To avoid this, invoke Commit() before SetUseCache(false).
|
GetUseCache()
|
Boolean
|
Deprecated Get a value indicating whether caching is enabled or not.
|
SetEscapeData($value)
|
|
Set value True to have data automatically escaped if required by data source. Automatic escaping is enabled by default. The escaping is only applied to data, not WHERE statements!
|
GetEscapeData()
|
Boolean
|
Get value indicating whether escaping is enabled or not.
|
Escape($value:string)
|
String
|
Returns escaped string. This is useful for escaping data, if automatic escaping of data has not been enabled - see SetEscapeData($value). Should be used for WHERE statements containing user input)
|
GetDataSourceType()
|
SMDataSourceType
|
Get data source type. Will return SMDataSourceType::$Xml if the XML based data source is being used, SMDataSourceType::$MySql if the MySQL based data source is being used.
|