Source for file Sqlfileloaderstrategy.php
Documentation is available at Sqlfileloaderstrategy.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
* Strategy pattern for loading a RuleContext from a file in the format
* <pre>Rule_Element_Type|Rule_Element_Name|SQL_Statement|Expected_Return_Data_Type_from_SQL_Query</pre>
* @author Greg Swindle <greg@swindle.net>
* Load a RuleContext based on the elements listed in {@link $fileName}
* @param string $fileName The path to a *.sql.con file.
// $statements = $this->getStatements( $fileName );
foreach( $statements as $statement ) {
// Every statement in the RuleContext file should have
// four (4) tokens. If not, ignore it.
if( count( $tokens ) ==
$STATEMENT ) {
$ruleElementType =
$tokens[ 0 ];
$ruleElementName =
$tokens[ 1 ];
$ruleElementValueType =
trim( $tokens[ 3 ] );
$ruleElementValue =
null;
require_once BASEPATH.
'database/DB'.
EXT;
$query =
$db->query( $sql, $args );
$result =
$query->result_array();
settype( $ruleElementValue, $ruleElementValueType );
return $ruleElementValue;
$ruleElementName =
$tokens[ 1 ];
$ruleElementValue =
null;
Documentation generated on Thu, 24 Mar 2011 21:27:43 -0500 by phpDocumentor 1.4.1