/** * Creates one new xmldb_index */ function __construct($name, $type = null, $fields = array()) { $this->unique = false; $this->fields = array(); parent::__construct($name); return $this->set_attributes($type, $fields); }
/** * Creates one new xmldb_table */ function __construct($name) { parent::__construct($name); $this->fields = array(); $this->keys = array(); $this->indexes = array(); }
/** * Creates one new xmldb_statement */ function __construct($name) { parent::__construct($name); $this->table = NULL; $this->type = XMLDB_STATEMENT_INCORRECT; $this->sentences = array(); }
/** * Creates one new xmldb_structure * @param string $name */ public function __construct($name) { parent::__construct($name); $this->path = null; $this->version = null; $this->tables = array(); }
/** * Creates one new xmldb_structure */ function __construct($name) { parent::__construct($name); $this->path = NULL; $this->version = NULL; $this->tables = array(); }
/** * Creates one new xmldb_index * * @param string $name * @param string $type XMLDB_INDEX_UNIQUE, XMLDB_INDEX_NOTUNIQUE * @param array $fields an array of fieldnames to build the index over * @param array $hints an array of optional hints */ public function __construct($name, $type=null, $fields=array(), $hints=array()) { $this->unique = false; $this->fields = array(); $this->hints = array(); parent::__construct($name); $this->set_attributes($type, $fields, $hints); }
/** * Creates one new xmldb_key */ function __construct($name, $type=null, $fields=array(), $reftable=null, $reffields=null) { $this->type = NULL; $this->fields = array(); $this->reftable = NULL; $this->reffields = array(); parent::__construct($name); $this->set_attributes($type, $fields, $reftable, $reffields); }
/** * Creates one new xmldb_field */ function __construct($name, $type=null, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $default=null, $previous=null) { $this->type = NULL; $this->length = NULL; $this->notnull = false; $this->default = NULL; $this->sequence = false; $this->decimals = NULL; parent::__construct($name); $this->set_attributes($type, $precision, $unsigned, $notnull, $sequence, $default, $previous); }
/** * Constructor of the xmldb_file * @param string $path */ public function __construct($path) { parent::__construct($path); $this->path = $path; $this->xmldb_structure = null; }
/** * Given one XMLDB Statement, build the needed SQL insert sentences to execute it. * * @param string $statement SQL statement. * @return array Array of sentences in the SQL statement. */ function getExecuteInsertSQL($statement) { $results = array(); //Array where all the sentences will be stored if ($sentences = $statement->getSentences()) { foreach ($sentences as $sentence) { /// Get the list of fields $fields = $statement->getFieldsFromInsertSentence($sentence); /// Get the values of fields $values = $statement->getValuesFromInsertSentence($sentence); /// Look if we have some CONCAT value and transform it dynamically foreach ($values as $key => $value) { /// Trim single quotes $value = trim($value, "'"); if (stristr($value, 'CONCAT') !== false) { /// Look for data between parenthesis preg_match("/CONCAT\\s*\\((.*)\\)\$/is", trim($value), $matches); if (isset($matches[1])) { $part = $matches[1]; /// Convert the comma separated string to an array $arr = xmldb_object::comma2array($part); if ($arr) { $value = $this->getConcatSQL($arr); } } } /// Values to be sent to DB must be properly escaped $value = $this->addslashes($value); /// Back trimmed quotes $value = "'" . $value . "'"; /// Back to the array $values[$key] = $value; } /// Iterate over fields, escaping them if necessary foreach ($fields as $key => $field) { $fields[$key] = $this->getEncQuoted($field); } /// Build the final SQL sentence and add it to the array of results $sql = 'INSERT INTO ' . $this->getEncQuoted($this->prefix . $statement->getTable()) . '(' . implode(', ', $fields) . ') ' . 'VALUES (' . implode(', ', $values) . ')'; $results[] = $sql; } } return $results; }
/** * Constructor of the xmldb_file */ function __construct($path) { parent::__construct($path); $this->path = $path; $this->xmldb_structure = NULL; }