本文整理汇总了PHP中SqlParser\Components\OptionsArray::build方法的典型用法代码示例。如果您正苦于以下问题:PHP OptionsArray::build方法的具体用法?PHP OptionsArray::build怎么用?PHP OptionsArray::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlParser\Components\OptionsArray
的用法示例。
在下文中一共展示了OptionsArray::build方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
/**
* @return string
*/
public function build()
{
$ret = OptionsArray::build($this->options);
if ($this->type === TransactionStatement::TYPE_BEGIN) {
foreach ($this->statements as $statement) {
$ret .= ';' . $statement->build();
}
$ret .= ';' . $this->end->build();
}
return $ret;
}
示例2: build
/**
* @return string
*/
public function build()
{
$ret = 'DELETE ' . OptionsArray::build($this->options);
if ($this->columns != NULL && count($this->columns) > 0) {
$ret .= ' ' . ExpressionArray::build($this->columns);
}
if ($this->from != NULL && count($this->from) > 0) {
$ret .= ' FROM ' . ExpressionArray::build($this->from);
}
if ($this->using != NULL && count($this->using) > 0) {
$ret .= ' USING ' . ExpressionArray::build($this->using);
}
if ($this->where != NULL && count($this->where) > 0) {
$ret .= ' WHERE ' . Condition::build($this->where);
}
if ($this->order != NULL && count($this->order) > 0) {
$ret .= ' ORDER BY ' . ExpressionArray::build($this->order);
}
if ($this->limit != NULL && count($this->limit) > 0) {
$ret .= ' LIMIT ' . Limit::build($this->limit);
}
return $ret;
}
示例3: build
/**
* @return string
*/
public function build()
{
$fields = '';
if (!empty($this->fields)) {
if (is_array($this->fields)) {
$fields = CreateDefinition::build($this->fields) . ' ';
} elseif ($this->fields instanceof ArrayObj) {
$fields = ArrayObj::build($this->fields);
}
}
if ($this->options->has('DATABASE')) {
return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . OptionsArray::build($this->entityOptions);
} elseif ($this->options->has('TABLE')) {
$partition = '';
if (!empty($this->partitionBy)) {
$partition .= "\nPARTITION BY " . $this->partitionBy;
}
if (!empty($this->partitionsNum)) {
$partition .= "\nPARTITIONS " . $this->partitionsNum;
}
if (!empty($this->subpartitionBy)) {
$partition .= "\nSUBPARTITION BY " . $this->subpartitionBy;
}
if (!empty($this->subpartitionsNum)) {
$partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum;
}
if (!empty($this->partitions)) {
$partition .= "\n" . PartitionDefinition::build($this->partitions);
}
return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . $fields . OptionsArray::build($this->entityOptions) . $partition;
} elseif ($this->options->has('VIEW')) {
return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . $fields . ' AS ' . TokensList::build($this->body) . ' ' . OptionsArray::build($this->entityOptions);
} elseif ($this->options->has('TRIGGER')) {
return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . OptionsArray::build($this->entityOptions) . ' ' . 'ON ' . Expression::build($this->table) . ' ' . 'FOR EACH ROW ' . TokensList::build($this->body);
} elseif ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
$tmp = '';
if ($this->options->has('FUNCTION')) {
$tmp = 'RETURNS ' . DataType::build($this->return);
}
return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . ParameterDefinition::build($this->parameters) . ' ' . $tmp . ' ' . TokensList::build($this->body);
} else {
return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . TokensList::build($this->body);
}
return '';
}
示例4: testBuild
public function testBuild()
{
$component = new OptionsArray(array('ALL', 'SQL_CALC_FOUND_ROWS', array('name' => 'MAX_STATEMENT_TIME', 'value' => '42', 'equals' => true)));
$this->assertEquals(OptionsArray::build($component), 'ALL SQL_CALC_FOUND_ROWS MAX_STATEMENT_TIME=42');
}
示例5: build
/**
* @param FieldDefinition|FieldDefinition[] $component The component to be built.
*
* @return string
*/
public static function build($component)
{
if (is_array($component)) {
$ret = array();
foreach ($component as $c) {
$ret[] = static::build($c);
}
return "(\n" . implode(",\n", $ret) . "\n)";
} else {
$tmp = '';
if ($component->isConstraint) {
$tmp .= 'CONSTRAINT ';
}
if (!empty($component->name)) {
$tmp .= Context::escape($component->name) . ' ';
}
if (!empty($component->type)) {
$tmp .= DataType::build($component->type) . ' ';
}
if (!empty($component->key)) {
$tmp .= Key::build($component->key) . ' ';
}
if (!empty($component->references)) {
$tmp .= 'REFERENCES ' . Reference::build($component->references) . ' ';
}
$tmp .= OptionsArray::build($component->options);
return trim($tmp);
}
}
示例6: build
/**
* @param Key $component The component to be built.
*
* @return string
*/
public static function build($component)
{
$ret = $component->type . ' ';
if (!empty($component->name)) {
$ret .= Context::escape($component->name) . ' ';
}
$ret .= '(' . implode(',', Context::escape($component->columns)) . ')';
$ret .= OptionsArray::build($component->options);
return trim($ret);
}
示例7: build
/**
* @param AlterOperation $component The component to be built.
*
* @return string
*/
public static function build($component)
{
$ret = OptionsArray::build($component->options) . ' ';
if (!empty($component->field)) {
$ret .= Expression::build($component->field) . ' ';
}
$ret .= TokensList::build($component->unknown);
return $ret;
}
示例8: build
/**
* @return string
*/
public function build()
{
$tmp = array();
foreach ($this->altered as $altered) {
$tmp[] = $altered::build($altered);
}
return 'ALTER ' . OptionsArray::build($this->options) . ' TABLE ' . Expression::build($this->table) . ' ' . implode(', ', $tmp);
}
示例9: build
/**
* @param DataType $component The component to be built.
*
* @return string
*/
public static function build($component)
{
$tmp = '';
if (!empty($component->parameters)) {
$tmp = '(' . implode(',', $component->parameters) . ')';
}
return trim(strtolower($component->name) . $tmp . ' ' . OptionsArray::build($component->options));
}
示例10: build
/**
* @param Reference $component The component to be built.
*
* @return string
*/
public static function build($component)
{
return trim(Context::escape($component->table) . ' (' . implode(', ', Context::escape($component->columns)) . ') ' . OptionsArray::build($component->options));
}
示例11: build
/**
* @return string
*/
public function build()
{
return 'SET ' . OptionsArray::build($this->options) . ' ' . SetOperation::build($this->set);
}