mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
add phpDoc comment
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10780 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
43999a0bb1
commit
ebc5edeec7
30 changed files with 830 additions and 161 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery
|
||||
* @version 0.1
|
||||
**/
|
||||
*/
|
||||
class DBParser {
|
||||
/**
|
||||
* Character for escape target value on the left
|
||||
|
|
@ -154,6 +154,11 @@
|
|||
return implode('', $functions);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks argument is asterisk
|
||||
* @param string $column_name
|
||||
* @return bool
|
||||
*/
|
||||
function isStar($column_name){
|
||||
if(substr($column_name,-1) == '*') return true;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* QueryParser class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery
|
||||
* @version 0.1
|
||||
*/
|
||||
class QueryParser {
|
||||
|
||||
/**
|
||||
* QueryTag object
|
||||
* @var QueryTag object
|
||||
*/
|
||||
var $queryTag;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $query
|
||||
* @param bool $isSubQuery
|
||||
* @return void
|
||||
*/
|
||||
function QueryParser($query = NULL, $isSubQuery = false) {
|
||||
if ($query)
|
||||
$this->queryTag = new QueryTag($query, $isSubQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return table information
|
||||
* @param object $query_id
|
||||
* @param bool $table_name
|
||||
* @return array
|
||||
*/
|
||||
function getTableInfo($query_id, $table_name) {
|
||||
$column_type = array();
|
||||
$module = '';
|
||||
|
|
@ -56,6 +76,10 @@
|
|||
return $column_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change code string from queryTag object
|
||||
* @return string
|
||||
*/
|
||||
function toString() {
|
||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
||||
. $this->queryTag->toString()
|
||||
|
|
|
|||
|
|
@ -1,17 +1,57 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Argument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/argument
|
||||
* @version 0.1
|
||||
*/
|
||||
class Argument {
|
||||
|
||||
/**
|
||||
* argument value
|
||||
* @var mixed
|
||||
*/
|
||||
var $value;
|
||||
/**
|
||||
* argument name
|
||||
* @var string
|
||||
*/
|
||||
var $name;
|
||||
/**
|
||||
* argument type
|
||||
* @var string
|
||||
*/
|
||||
var $type;
|
||||
/**
|
||||
* result of argument type check
|
||||
* @var bool
|
||||
*/
|
||||
var $isValid;
|
||||
/**
|
||||
* error message
|
||||
* @var Object
|
||||
*/
|
||||
var $errorMessage;
|
||||
/**
|
||||
* column operation
|
||||
*/
|
||||
var $column_operation;
|
||||
|
||||
var $uses_default_value; // Check if arg value is user submnitted or default
|
||||
var $_value; // Caches escaped and toString value so that the parsing won't happen multiple times;
|
||||
/**
|
||||
* Check if arg value is user submnitted or default
|
||||
* @var mixed
|
||||
*/
|
||||
var $uses_default_value;
|
||||
/**
|
||||
* Caches escaped and toString value so that the parsing won't happen multiple times
|
||||
* @var mixed
|
||||
*/
|
||||
var $_value; //
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
function Argument($name, $value) {
|
||||
$this->value = $value;
|
||||
$this->name = $name;
|
||||
|
|
@ -60,6 +100,11 @@ class Argument {
|
|||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* mixed value to string
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
function toString($value) {
|
||||
if (is_array($value)) {
|
||||
if (count($value) === 0)
|
||||
|
|
@ -71,6 +116,11 @@ class Argument {
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape value
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
function escapeValue($value) {
|
||||
$column_type = $this->getType();
|
||||
if ($column_type == 'column_name') {
|
||||
|
|
@ -106,6 +156,11 @@ class Argument {
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape string value
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
function _escapeStringValue($value) {
|
||||
$db = &DB::getInstance();
|
||||
$value = $db->addQuotes($value);
|
||||
|
|
@ -135,6 +190,11 @@ class Argument {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check filter by filter type
|
||||
* @param string $filter_type
|
||||
* @return void
|
||||
*/
|
||||
function checkFilter($filter_type) {
|
||||
if (isset($this->value) && $this->value != '') {
|
||||
global $lang;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ConditionArgument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/argument
|
||||
* @version 0.1
|
||||
*/
|
||||
class ConditionArgument extends Argument {
|
||||
/**
|
||||
* Operator keyword. for example 'in', 'notint', 'between'
|
||||
* @var string
|
||||
*/
|
||||
var $operation;
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param string $operation
|
||||
* @return void
|
||||
*/
|
||||
function ConditionArgument($name, $value, $operation){
|
||||
if(isset($value) && in_array($operation, array('in', 'notin','not_in', 'between')) && !is_array($value) && $value != ''){
|
||||
$value = str_replace(' ', '', $value);
|
||||
|
|
@ -14,6 +30,10 @@
|
|||
$this->operation = $operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* create condition value. set $this->value
|
||||
* @return void
|
||||
*/
|
||||
function createConditionValue(){
|
||||
if(!isset($this->value)) return;
|
||||
|
||||
|
|
@ -64,16 +84,16 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Since ConditionArgument is used in WHERE clause,
|
||||
* where the argument value is compared to a table column,
|
||||
* it is assumed that all arguments have type. There are cases though
|
||||
* where the column does not have any type - if it was removed from
|
||||
* the XML schema for example - see the is_secret column in xe_documents table.
|
||||
* In this case, the column type is retrieved according to argument
|
||||
* value type (using the PHP function is_numeric).
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
* Since ConditionArgument is used in WHERE clause,
|
||||
* where the argument value is compared to a table column,
|
||||
* it is assumed that all arguments have type. There are cases though
|
||||
* where the column does not have any type - if it was removed from
|
||||
* the XML schema for example - see the is_secret column in xe_documents table.
|
||||
* In this case, the column type is retrieved according to argument
|
||||
* value type (using the PHP function is_numeric).
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
function getType(){
|
||||
if($this->type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SortArgument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/argument
|
||||
* @version 0.1
|
||||
*/
|
||||
class SortArgument extends Argument {
|
||||
|
||||
function getValue(){
|
||||
|
|
|
|||
|
|
@ -1,15 +1,53 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* DefaultValue class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/queryargument
|
||||
* @version 0.1
|
||||
*/
|
||||
class DefaultValue {
|
||||
/**
|
||||
* Column name
|
||||
* @var string
|
||||
*/
|
||||
var $column_name;
|
||||
/**
|
||||
* Value
|
||||
* @var mixed
|
||||
*/
|
||||
var $value;
|
||||
/**
|
||||
* sequnence status
|
||||
* @var bool
|
||||
*/
|
||||
var $is_sequence = false;
|
||||
/**
|
||||
* operation status
|
||||
* @var bool
|
||||
*/
|
||||
var $is_operation = false;
|
||||
/**
|
||||
* operation
|
||||
* @var string
|
||||
*/
|
||||
var $operation = '';
|
||||
/**
|
||||
* Checks if value is plain string or name of XE function (ipaddress, plus, etc).
|
||||
* @var bool
|
||||
*/
|
||||
var $_is_string = false;
|
||||
/**
|
||||
* Checks if value is string resulted from evaluating a piece of PHP code (see $_SERVER[REMOTE_ADDR])
|
||||
* @var bool
|
||||
*/
|
||||
var $_is_string_from_function = false;
|
||||
|
||||
var $_is_string = false; ///< Checks if value is plain string or name of XE function (ipaddress, plus, etc).
|
||||
var $_is_string_from_function = false; //< Checks if value is string resulted from evaluating a piece of PHP code (see $_SERVER[REMOTE_ADDR])
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $column_name column name
|
||||
* @param mixed $value value
|
||||
* @return void
|
||||
*/
|
||||
function DefaultValue($column_name, $value){
|
||||
$dbParser = &DB::getParser();
|
||||
$this->column_name = $dbParser->parseColumnName($column_name);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,53 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* QueryArgument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/queryargument
|
||||
* @version 0.1
|
||||
*/
|
||||
class QueryArgument {
|
||||
|
||||
/**
|
||||
* Argument name
|
||||
* @var string
|
||||
*/
|
||||
var $argument_name;
|
||||
/**
|
||||
* Variable name
|
||||
* @var string
|
||||
*/
|
||||
var $variable_name;
|
||||
/**
|
||||
* Argument validator
|
||||
* @var QueryArgumentValidator
|
||||
*/
|
||||
var $argument_validator;
|
||||
/**
|
||||
* Column name
|
||||
* @var string
|
||||
*/
|
||||
var $column_name;
|
||||
/**
|
||||
* Table name
|
||||
* @var string
|
||||
*/
|
||||
var $table_name;
|
||||
/**
|
||||
* Operation
|
||||
* @var string
|
||||
*/
|
||||
var $operation;
|
||||
/**
|
||||
* Ignore value
|
||||
* @var bool
|
||||
*/
|
||||
var $ignore_value;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $tag tag object
|
||||
* @param bool $ignore_value
|
||||
* @return void
|
||||
*/
|
||||
function QueryArgument($tag, $ignore_value = false) {
|
||||
static $number_of_arguments = 0;
|
||||
|
||||
|
|
@ -64,6 +102,10 @@ class QueryArgument {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change QueryArgument object to string
|
||||
* @return string
|
||||
*/
|
||||
function toString() {
|
||||
if ($this->isConditionArgument()) {
|
||||
// Instantiation
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SortQueryArgument class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/queryargument
|
||||
* @version 0.1
|
||||
*/
|
||||
class SortQueryArgument extends QueryArgument{
|
||||
/**
|
||||
* Change SortQueryArgument object to string
|
||||
* @return string
|
||||
*/
|
||||
function toString(){
|
||||
$arg = sprintf("\n" . '${\'%s_argument\'} = new SortArgument(\'%s\', %s);' . "\n"
|
||||
, $this->argument_name
|
||||
|
|
|
|||
|
|
@ -1,16 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* QueryArgumentValidator class
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /classes/xml/xmlquery/queryargument/validator
|
||||
* @version 0.1
|
||||
*/
|
||||
class QueryArgumentValidator {
|
||||
/**
|
||||
* Argument name
|
||||
* @var string
|
||||
*/
|
||||
var $argument_name;
|
||||
/**
|
||||
* Default value
|
||||
* @var string
|
||||
*/
|
||||
var $default_value;
|
||||
/**
|
||||
* Notnull status setting, if value should be not null, this value is 'notnull'
|
||||
* @var string
|
||||
*/
|
||||
var $notnull;
|
||||
/**
|
||||
* Filter for value type, for example number
|
||||
* @var string
|
||||
*/
|
||||
var $filter;
|
||||
/**
|
||||
* Minimum length for value
|
||||
* @var int
|
||||
*/
|
||||
var $min_length;
|
||||
/**
|
||||
* Maximum length for value
|
||||
* @var int
|
||||
*/
|
||||
var $max_length;
|
||||
|
||||
var $validator_string;
|
||||
|
||||
/**
|
||||
* Query argument for validate
|
||||
* @var QueryArgument object
|
||||
*/
|
||||
var $argument;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param Xml_Node_ $tag tag object by Query xml file parse
|
||||
* @param QueryArgument $argument
|
||||
* @return void
|
||||
*/
|
||||
function QueryArgumentValidator($tag, $argument){
|
||||
$this->argument = $argument;
|
||||
$this->argument_name = $this->argument->getArgumentName();
|
||||
|
|
|
|||
|
|
@ -1,19 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* @class ColumnTag
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file
|
||||
*
|
||||
* Since the <column> tag supports different attributes depending on
|
||||
* the type of query (select, update, insert, delete) this is only
|
||||
* the base class for the classes that will model each type <column> tag.
|
||||
/**
|
||||
* ColumnTag class
|
||||
* Models the <column> tag inside an XML Query file
|
||||
* Since the <column> tag supports different attributes depending on
|
||||
* the type of query (select, update, insert, delete) this is only
|
||||
* the base class for the classes that will model each type <column> tag.
|
||||
*
|
||||
**/
|
||||
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class ColumnTag {
|
||||
/**
|
||||
* Column name
|
||||
* @var string
|
||||
*/
|
||||
var $name;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
function ColumnTag($name){
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* @class InsertColumnTag
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'insert'
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* InsertColumnTag
|
||||
* Models the <column> tag inside an XML Query file whose action is 'insert'
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class InsertColumnTag extends ColumnTag {
|
||||
/**
|
||||
* argument
|
||||
* @var QueryArgument object
|
||||
*/
|
||||
var $argument;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $column
|
||||
* @return void
|
||||
*/
|
||||
function InsertColumnTag($column) {
|
||||
parent::ColumnTag($column->attrs->name);
|
||||
$dbParser = DB::getParser();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* @class InsertColumnTagWithoutArgument
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'insert-select'
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* InsertColumnTagWithoutArgument
|
||||
* Models the <column> tag inside an XML Query file whose action is 'insert-select'
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class InsertColumnTagWithoutArgument extends ColumnTag {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $column
|
||||
* @return void
|
||||
*/
|
||||
function InsertColumnTagWithoutArgument($column) {
|
||||
parent::ColumnTag($column->attrs->name);
|
||||
$dbParser = DB::getParser();
|
||||
|
|
@ -23,4 +28,4 @@
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* @class InsertColumnsTag
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'insert'
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* InsertColumnsTag class
|
||||
* Models the <column> tag inside an XML Query file whose action is 'insert'
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class InsertColumnsTag{
|
||||
/**
|
||||
* Column list
|
||||
* @var array value is InsertColumnTag object
|
||||
*/
|
||||
var $columns;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param array|string $xml_columns
|
||||
* @return void
|
||||
*/
|
||||
function InsertColumnsTag($xml_columns) {
|
||||
$this->columns = array();
|
||||
|
||||
|
|
@ -24,6 +34,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* InsertColumnTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function toString(){
|
||||
$output_columns = 'array(' . PHP_EOL;
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -34,6 +48,10 @@
|
|||
return $output_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return argument list
|
||||
* @return array
|
||||
*/
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -44,4 +62,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class SelectColumnTag
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'select'
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* SelectColumnTag
|
||||
* Models the <column> tag inside an XML Query file whose action is 'select'
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class SelectColumnTag extends ColumnTag{
|
||||
/**
|
||||
* alias
|
||||
* @var string
|
||||
*/
|
||||
var $alias;
|
||||
/**
|
||||
* click count status
|
||||
* @var bool
|
||||
*/
|
||||
var $click_count;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string|object $column
|
||||
* @return void
|
||||
*/
|
||||
function SelectColumnTag($column){
|
||||
if ($column == "*" || $column->attrs->name == '*')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SelectColumnTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class SelectColumnsTag {
|
||||
/**
|
||||
* Column list
|
||||
* @var array value is SelectColumnTag object
|
||||
*/
|
||||
var $columns;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param Xml_Node_ $xml_columns
|
||||
* @return void
|
||||
*/
|
||||
function SelectColumnsTag($xml_columns_tag){
|
||||
if (!$xml_columns_tag)
|
||||
$xml_columns_tag = new Xml_Node_();
|
||||
|
|
@ -35,6 +50,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SelectColumnTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function toString(){
|
||||
$output_columns = 'array(' . PHP_EOL;
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -48,6 +67,10 @@
|
|||
return $output_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return argument list
|
||||
* @return array
|
||||
*/
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->columns as $column){
|
||||
|
|
|
|||
|
|
@ -1,18 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class UpdateColumnTag
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'update'
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* UpdateColumnTag
|
||||
* Models the <column> tag inside an XML Query file whose action is 'update'
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class UpdateColumnTag extends ColumnTag {
|
||||
/**
|
||||
* argument
|
||||
* @var QueryArgument object
|
||||
*/
|
||||
var $argument;
|
||||
/**
|
||||
* default value
|
||||
* @var string
|
||||
*/
|
||||
var $default_value;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $column
|
||||
* @return void
|
||||
*/
|
||||
function UpdateColumnTag($column) {
|
||||
parent::ColumnTag($column->attrs->name);
|
||||
$dbParser = DB::getParser();
|
||||
|
|
|
|||
|
|
@ -1,15 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class UpdateColumnsTag
|
||||
* @author Arnia Software
|
||||
* @brief Models the <column> tag inside an XML Query file whose action is 'update'
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* UpdateColumnsTag
|
||||
* Models the <column> tag inside an XML Query file whose action is 'update'
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/column
|
||||
* @version 0.1
|
||||
*/
|
||||
class UpdateColumnsTag{
|
||||
/**
|
||||
* Column list
|
||||
* @var array value is UpdateColumnTag object
|
||||
*/
|
||||
var $columns;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param array|string $xml_columns
|
||||
* @return void
|
||||
*/
|
||||
function UpdateColumnsTag($xml_columns) {
|
||||
$this->columns = array();
|
||||
|
||||
|
|
@ -21,6 +30,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateColumnTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function toString(){
|
||||
$output_columns = 'array(' . PHP_EOL;
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -31,6 +44,10 @@
|
|||
return $output_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return argument list
|
||||
* @return array
|
||||
*/
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -41,4 +58,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ConditionGroupTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/condition
|
||||
* @version 0.1
|
||||
*/
|
||||
class ConditionGroupTag {
|
||||
/**
|
||||
* condition list
|
||||
* @var string|array value is ConditionTag object
|
||||
*/
|
||||
var $conditions;
|
||||
/**
|
||||
* pipe
|
||||
* @var string
|
||||
*/
|
||||
var $pipe;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param string|array $conditions
|
||||
* @param string $pipe
|
||||
* @return void
|
||||
*/
|
||||
function ConditionGroupTag($conditions, $pipe = ""){
|
||||
$this->pipe = $pipe;
|
||||
|
||||
|
|
@ -19,6 +39,10 @@
|
|||
return $this->conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* ConditionTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function getConditionGroupString(){
|
||||
$conditions_string = 'array('.PHP_EOL;
|
||||
foreach($this->conditions as $condition){
|
||||
|
|
@ -39,4 +63,4 @@
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,22 +1,54 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class ConditionTag
|
||||
* @author Corina
|
||||
* @brief Models the <condition> tag inside an XML Query file. Base class.
|
||||
* ConditionTag
|
||||
* Models the <condition> tag inside an XML Query file. Base class.
|
||||
*
|
||||
* @author Corina
|
||||
* @package /classes/xml/xmlquery/tags/condition
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
class ConditionTag {
|
||||
/**
|
||||
* operation for example 'in', 'between', 'not in'...
|
||||
* @var string
|
||||
*/
|
||||
var $operation;
|
||||
/**
|
||||
* Column name
|
||||
* @var string
|
||||
*/
|
||||
var $column_name;
|
||||
|
||||
/**
|
||||
* Pipe
|
||||
* @var string
|
||||
*/
|
||||
var $pipe;
|
||||
/**
|
||||
* Argument name
|
||||
* @var string
|
||||
*/
|
||||
var $argument_name;
|
||||
/**
|
||||
* QueryArgument object
|
||||
* @var QueryArgument
|
||||
*/
|
||||
var $argument;
|
||||
/**
|
||||
* Default column
|
||||
* @var string
|
||||
*/
|
||||
var $default_column;
|
||||
|
||||
/**
|
||||
* QueryTag object
|
||||
* @var QueryTag
|
||||
*/
|
||||
var $query;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $condition
|
||||
* @return void
|
||||
*/
|
||||
function ConditionTag($condition){
|
||||
$this->operation = $condition->attrs->operation;
|
||||
$this->pipe = $condition->attrs->pipe;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* ConditionsTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/condition
|
||||
* @version 0.1
|
||||
*/
|
||||
class ConditionsTag {
|
||||
/**
|
||||
* ConditionGroupTag list
|
||||
* @var array value is ConditionGroupTag object
|
||||
*/
|
||||
var $condition_groups;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $xml_conditions
|
||||
* @return void
|
||||
*/
|
||||
function ConditionsTag($xml_conditions){
|
||||
$this->condition_groups = array();
|
||||
if (!$xml_conditions)
|
||||
|
|
@ -29,6 +45,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ConditionGroupTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function toString(){
|
||||
$output_conditions = 'array(' . PHP_EOL;
|
||||
foreach($this->condition_groups as $condition){
|
||||
|
|
|
|||
|
|
@ -1,11 +1,21 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* JoinConditionsTag class
|
||||
*
|
||||
* @author Corina
|
||||
* @package /classes/xml/xmlquery/tags/condition
|
||||
* @version 0.1
|
||||
*/
|
||||
class JoinConditionsTag extends ConditionsTag {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $xml_conditions
|
||||
* @return void
|
||||
*/
|
||||
function JoinConditionsTag($xml_conditions){
|
||||
parent::ConditionsTag($xml_conditions);
|
||||
$this->condition_groups[0]->conditions[0]->setPipe("");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* GroupsTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/group
|
||||
* @version 0.1
|
||||
*/
|
||||
class GroupsTag {
|
||||
/**
|
||||
* column list
|
||||
* @var array
|
||||
*/
|
||||
var $groups;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param array|string $xml_groups
|
||||
* @return void
|
||||
*/
|
||||
function GroupsTag($xml_groups){
|
||||
$this->groups = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,43 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* IndexTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/navigation
|
||||
* @version 0.1
|
||||
*/
|
||||
class IndexTag {
|
||||
/**
|
||||
* argument name
|
||||
* @var string
|
||||
*/
|
||||
var $argument_name;
|
||||
/**
|
||||
* QueryArgument object
|
||||
* @var QueryArgument
|
||||
*/
|
||||
var $argument;
|
||||
/**
|
||||
* Default value
|
||||
* @var string
|
||||
*/
|
||||
var $default;
|
||||
/**
|
||||
* Sort order
|
||||
* @var string
|
||||
*/
|
||||
var $sort_order;
|
||||
/**
|
||||
* Sort order argument
|
||||
* @var SortQueryArgument object
|
||||
*/
|
||||
var $sort_order_argument;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $index
|
||||
* @return void
|
||||
*/
|
||||
function IndexTag($index){
|
||||
$this->argument_name = $index->attrs->var;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* LimitTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/navigation
|
||||
* @version 0.1
|
||||
*/
|
||||
class LimitTag {
|
||||
/**
|
||||
* Value is relate to limit query
|
||||
* @var array
|
||||
*/
|
||||
var $arguments;
|
||||
/**
|
||||
* QueryArgument object
|
||||
* @var QueryArgument
|
||||
*/
|
||||
var $page;
|
||||
/**
|
||||
* QueryArgument object
|
||||
* @var QueryArgument
|
||||
*/
|
||||
var $page_count;
|
||||
/**
|
||||
* QueryArgument object
|
||||
* @var QueryArgument
|
||||
*/
|
||||
var $list_count;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $index
|
||||
* @return void
|
||||
*/
|
||||
function LimitTag($index){
|
||||
if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs){
|
||||
$this->page = new QueryArgument($index->page);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* NavigationTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/navigation
|
||||
* @version 0.1
|
||||
*/
|
||||
class NavigationTag {
|
||||
/**
|
||||
* Order
|
||||
* @var array
|
||||
*/
|
||||
var $order;
|
||||
/**
|
||||
* List count
|
||||
* @var int
|
||||
*/
|
||||
var $list_count;
|
||||
/**
|
||||
* Page count
|
||||
* @var int
|
||||
*/
|
||||
var $page_count;
|
||||
/**
|
||||
* Page
|
||||
* @var int
|
||||
*/
|
||||
var $page;
|
||||
/**
|
||||
* Limit
|
||||
* @var LimitTag object
|
||||
*/
|
||||
var $limit;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $xml_navigation
|
||||
* @return void
|
||||
*/
|
||||
function NavigationTag($xml_navigation){
|
||||
$this->order = array();
|
||||
if($xml_navigation) {
|
||||
|
|
@ -31,6 +63,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* NavigationTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function getOrderByString(){
|
||||
$output = 'array(' . PHP_EOL;
|
||||
foreach($this->order as $order){
|
||||
|
|
@ -41,6 +77,10 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* LimitTag object to string
|
||||
* @return string
|
||||
*/
|
||||
function getLimitString(){
|
||||
if ($this->limit) return $this->limit->toString();
|
||||
else return "";
|
||||
|
|
|
|||
|
|
@ -1,26 +1,104 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* QueryTag class
|
||||
*
|
||||
* @author Arnia Software
|
||||
* @package /classes/xml/xmlquery/tags/query
|
||||
* @version 0.1
|
||||
*/
|
||||
class QueryTag {
|
||||
|
||||
/**
|
||||
* Action for example, 'select', 'insert', 'delete'...
|
||||
* @var string
|
||||
*/
|
||||
var $action;
|
||||
/**
|
||||
* Query id
|
||||
* @var string
|
||||
*/
|
||||
var $query_id;
|
||||
/**
|
||||
* Priority
|
||||
* @var string
|
||||
*/
|
||||
var $priority;
|
||||
/**
|
||||
* column type list
|
||||
* @var array
|
||||
*/
|
||||
var $column_type;
|
||||
/**
|
||||
* Query stdClass object
|
||||
* @var object
|
||||
*/
|
||||
var $query;
|
||||
//xml tags
|
||||
/**
|
||||
* Columns in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $columns;
|
||||
/**
|
||||
* Tables in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $tables;
|
||||
/**
|
||||
* Subquery in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $subquery;
|
||||
/**
|
||||
* Conditions in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $conditions;
|
||||
/**
|
||||
* Groups in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $groups;
|
||||
/**
|
||||
* Navigation in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $navigation;
|
||||
/**
|
||||
* Arguments in xml tags
|
||||
* @var object
|
||||
*/
|
||||
var $arguments;
|
||||
/**
|
||||
* PreBuff
|
||||
* @var string
|
||||
*/
|
||||
var $preBuff;
|
||||
/**
|
||||
* Buff
|
||||
* @var string
|
||||
*/
|
||||
var $buff;
|
||||
/**
|
||||
* Subquery status
|
||||
* @var bool
|
||||
*/
|
||||
var $isSubQuery;
|
||||
/**
|
||||
* Join type
|
||||
* @var string
|
||||
*/
|
||||
var $join_type;
|
||||
/**
|
||||
* alias
|
||||
* @var string
|
||||
*/
|
||||
var $alias;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $query
|
||||
* @param bool $isSubQuery
|
||||
* @return void
|
||||
*/
|
||||
function QueryTag($query, $isSubQuery = false) {
|
||||
$this->action = $query->attrs->action;
|
||||
$this->query_id = $query->attrs->id;
|
||||
|
|
|
|||
|
|
@ -1,20 +1,26 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class HintTableTag
|
||||
* @author Arnia Sowftare
|
||||
* @brief Models the <table> tag inside an XML Query file
|
||||
* and the corresponding <index_hint> tag
|
||||
* HintTableTag
|
||||
* Models the <table> tag inside an XML Query file and the corresponding <index_hint> tag
|
||||
*
|
||||
* @author Arnia Sowftare
|
||||
* @package /classes/xml/xmlquery/tags/table
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
class HintTableTag extends TableTag {
|
||||
/**
|
||||
* Action for example, 'select', 'insert', 'delete'...
|
||||
* @var array
|
||||
*/
|
||||
var $index;
|
||||
|
||||
/**
|
||||
* @brief Initialises Table Tag properties
|
||||
* @param XML <table> tag $table
|
||||
*/
|
||||
/**
|
||||
* constructor
|
||||
* Initialises Table Tag properties
|
||||
* @param object $table XML <table> tag
|
||||
* @param array $index
|
||||
* @return void
|
||||
*/
|
||||
function HintTableTag($table, $index){
|
||||
parent::TableTag($table);
|
||||
$this->index = $index;
|
||||
|
|
|
|||
|
|
@ -1,34 +1,62 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class TableTag
|
||||
* @author Arnia Sowftare
|
||||
* @brief Models the <table> tag inside an XML Query file
|
||||
* TableTag
|
||||
* Models the <table> tag inside an XML Query file
|
||||
* @abstract
|
||||
* Example
|
||||
* <table name="modules" />
|
||||
* <table name="documents" alias="doc" />
|
||||
* Attributes
|
||||
* name - name of the table - table prefix will be automatically added
|
||||
* alias - table alias. If no value is specified, the table name will be set as default alias
|
||||
* join_type - in case the table is part of a join clause, this specifies the type of join: left, right etc.
|
||||
* - permitted values: 'left join','left outer join','right join','right outer join'
|
||||
* Children
|
||||
* Can have children of type <conditions>
|
||||
*
|
||||
* @abstract
|
||||
* Example
|
||||
* <table name="modules" />
|
||||
* <table name="documents" alias="doc" />
|
||||
* Attributes
|
||||
* name - name of the table - table prefix will be automatically added
|
||||
* alias - table alias. If no value is specified, the table name will be set as default alias
|
||||
* join_type - in case the table is part of a join clause, this specifies the type of join: left, right etc.
|
||||
* - permitted values: 'left join','left outer join','right join','right outer join'
|
||||
* Children
|
||||
* Can have children of type <conditions>
|
||||
* @author Arnia Sowftare
|
||||
* @package /classes/xml/xmlquery/tags/table
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
class TableTag {
|
||||
/**
|
||||
* Unescaped name
|
||||
* @var string
|
||||
*/
|
||||
var $unescaped_name;
|
||||
/**
|
||||
* name
|
||||
* @var string
|
||||
*/
|
||||
var $name;
|
||||
/**
|
||||
* alias
|
||||
* @var string
|
||||
*/
|
||||
var $alias;
|
||||
/**
|
||||
* Join type
|
||||
* @example 'left join', 'left outer join', 'right join', 'right outer join'
|
||||
* @var string
|
||||
*/
|
||||
var $join_type;
|
||||
/**
|
||||
* Condition object
|
||||
* @var object
|
||||
*/
|
||||
var $conditions;
|
||||
/**
|
||||
* JoinConditionsTag
|
||||
* @var JoinConditionsTag object
|
||||
*/
|
||||
var $conditionsTag;
|
||||
/**
|
||||
* @brief Initialises Table Tag properties
|
||||
* @param XML <table> tag $table
|
||||
*/
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* Initialises Table Tag properties
|
||||
* @param object $table XML <table> tag
|
||||
* @return void
|
||||
*/
|
||||
function TableTag($table){
|
||||
$dbParser = DB::getParser();
|
||||
|
||||
|
|
@ -60,12 +88,12 @@
|
|||
return $this->unescaped_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns string for printing in PHP query cache file
|
||||
* The string contains code for instantiation of either
|
||||
* a Table or a JoinTable object
|
||||
* @return string
|
||||
*/
|
||||
/**
|
||||
* Returns string for printing in PHP query cache file
|
||||
* The string contains code for instantiation of either
|
||||
* a Table or a JoinTable object
|
||||
* @return string
|
||||
*/
|
||||
function getTableString(){
|
||||
$dbParser = DB::getParser();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @class TablesTag
|
||||
* @author Arnia Sowftare
|
||||
* @brief Models the <tables> tag inside an XML Query file
|
||||
* TablesTag class
|
||||
* Models the <tables> tag inside an XML Query file
|
||||
* @abstract
|
||||
* Example
|
||||
* <tables>
|
||||
* <table name="documents" alias="doc" />
|
||||
* </tables>
|
||||
* Attributes
|
||||
* None.
|
||||
* Children
|
||||
* Can have children of type <table> or <query>
|
||||
*
|
||||
* @abstract
|
||||
* Example
|
||||
* <tables>
|
||||
* <table name="documents" alias="doc" />
|
||||
* </tables>
|
||||
* Attributes
|
||||
* None.
|
||||
* Children
|
||||
* Can have children of type <table> or <query>
|
||||
* @author Arnia Sowftare
|
||||
* @package /classes/xml/xmlquery/tags/table
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
class TablesTag {
|
||||
/**
|
||||
* Table list
|
||||
* @var array
|
||||
*/
|
||||
var $tables;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param object $xml_tables_tag
|
||||
* @param object $xml_index_hints_tag
|
||||
* @return void
|
||||
*/
|
||||
function TablesTag($xml_tables_tag, $xml_index_hints_tag = NULL){
|
||||
$this->tables = array();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue