$PHPOPENTAG$ //The Query Automator /************************* - Gets the table name from the model circuit - Gets the unique Result Set identifier from the fuseaction name - Generates the table alias name - Generates the Result Set name */ //get the table name from the name of the circuit (m_table_select) $table_holder = str_replace("$MODEL_PREFIX$$CIRCUIT_SEP$", "", $query_circuit); $table_holder = str_replace("$CIRCUIT_SEP$select", "", $table_holder); //filter the table name if(! isset($short_name) || '' == $short_name) { $short_name = substr($table_holder, 0, 1); } if(! isset($table_name) || '' == $table_name) { $table_name = $table_holder; } if(! isset($rsCustom) || '' == $rsCustom) { //$rsCustom is set in the controller to change the rs name if(! isset($rsDefault) || '' == $rsDefault) { //$rsDefault is set in the prefuseaction or fuseaction to make a default rs name $resultSet_name = ucfirst($table_holder); //otherwise we use the automatic table name from the circuit name } else { $resultSet_name = $rsDefault; } } else { $resultSet_name = $rsCustom; } //Go Query /********************************************************/ //assembly $query = "SELECT $qryWhat FROM $table_name AS $short_name $qryWhere"; //name the result set $resultSet = "rsSelect{$resultSet_name}_{$query_name}"; if(!isset($run_query) || 'true' == $run_query) { if(! isset(${$resultSet})) { ${$resultSet} = $db->query($query); } else { $errors->pushError("The result set variable \$$resultSet was already in use. Could not run query.", 100); } } $PHPCLOSETAG$