You can code directly against the Data Storage engine driver for lower level access. This is not normally recommended and shouldn't be needed for most applications.

Data Storage

ActiveWAFL uses Data Storage drivers, which abstract the communication with multiple data storage engines (such as MySql).

The default ActiveWAFL Storage Engine driver is for MySql 5.2+.
Application objects expose the methods GetStorageEngine and GetStorageEngines which can be used to get the connected data storage instances for the given application.

Get Table Data

  1. $storageEngine->GetData($storageLocation, $keyFieldName, $keyValue);
The meanings of the arguments are Storage Engine specific. However, for most Storage Engine drivers, including MySql, the following applies:
The name of the table you want to get data from.
The name of the column you are searching against (usually a primary key).
The value that the $keyFieldName must match to return the row.
  1. $storageEngine->GetDataGroup($storageLocation, $filter, $orderByFieldName, $maxRecordCount, $filterJoinLocations, $startOffset);
The name of the table you want to get data from.
Sql "Where" claus.e
Sql "Order By" clause.
The max number of rows to return.
an array keyed by table names that are to be joined. The element values represent the column name that the tables will be joined on.
Which row number to start at.

Store Table Data

  1. $storageEngine->StoreData($storageLocation, $fieldNames, $fieldValues, $keyFieldName, $keyValueIsAutoGenerated);
The name of the table you want to store data on.
An array of the name of the fields to set the values for.
An array of the values to set the columns in $fieldNames to.
The name of the primary key column.
Whether or not the value of the primary key column is generated automatically.

Get Aggregate Data

Get average, count, and sum
  1. $avg = $storageEngine->GetDataGroupAvg($storageLocation, $columnName);
  2. $count = $storageEngine->GetDataGroupCount($storageLocation, $columnName);
  3. $sum = $storageEngine->GetDataGroupSum($storageLocation, $columnName);
The name of the table you want to get data from.
The name of the column to aggregate.

Direct SQL Queries

DirectExecute, DirectQuery
  1. $storageEngine->DirectExecute($sql) //execute a sql query that returns no rows
  2. $storageEngine->DirectQuery($sql) //execute a sql query that returns rows

Escaping Data

Escape data prior to inserting it to ensure data integrity and security.
Escape user input string in a Controller action
  1. $formVar = storageEngine->Escape($request->GetInputString("FormFieldName"));

Data Joins

  1. $storageEngine->GetDataGroup($storageLocation, $filter, $orderByFieldName, $maxRecordCount, $filterJoinLocations, $startOffset)
$filterJoinLocations format
$joinObjects is an array keyed by the names of the tables you wish to join. The element value is the name of the column you wish to join on.
filterJoinLocations example
  1. $filterJoinLocations=array("EmployeeDepartments"=>"EmployeeId", "EmployeeDistricts"=>"EmployeeId");