当前位置: 首页>>代码示例>>PHP>>正文


PHP format::get_quoted_column_name方法代码示例

本文整理汇总了PHP中format::get_quoted_column_name方法的典型用法代码示例。如果您正苦于以下问题:PHP format::get_quoted_column_name方法的具体用法?PHP format::get_quoted_column_name怎么用?PHP format::get_quoted_column_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在format的用法示例。


在下文中一共展示了format::get_quoted_column_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: primary_key_expression

 /**
  * determine SQL clause expression to match for data_row primary keys
  *
  * @return string
  */
 public static function primary_key_expression($db_doc, $node_schema, $node_table, $data_row_columns, $data_row)
 {
     $primary_keys = format_table::primary_key_columns($node_table);
     $primary_key_index = xml_parser::data_row_overlay_primary_key_index($primary_keys, $data_row_columns, $data_row_columns);
     $primary_key_index = $primary_key_index['base'];
     // figure out the primary key expression
     $primary_key_expression = array();
     foreach ($primary_keys as $primary_column_name) {
         if (!isset($primary_key_index[$primary_column_name])) {
             throw new exception("primary key column named {$primary_column_name} not found in primary_key_index");
         }
         $column_index = $primary_key_index[$primary_column_name];
         // get the type of the column, chasing foreign keys if necessary
         $node_column = dbx::get_table_column($node_table, $primary_column_name);
         $value_type = format_column::column_type($db_doc, $node_schema, $node_table, $node_column, $foreign);
         $primary_key_expression[] = format::get_quoted_column_name($primary_column_name) . ' = ' . format::value_escape($value_type, $data_row->col[$column_index]);
     }
     if (count($primary_key_expression) == 0) {
         throw new exception($node_table['name'] . " primary_key_expression is empty, determinate loop failed");
     }
     return implode(' AND ', $primary_key_expression);
 }
开发者ID:williammoran,项目名称:DBSteward,代码行数:27,代码来源:dbx.php

示例2: get_data_row_update

 protected static function get_data_row_update($node_schema, $node_table, $old_data_row_columns, $old_data_row, $new_data_row_columns, $new_data_row, $changed_columns)
 {
     if (count($changed_columns) == 0) {
         throw new exception("empty changed_columns passed");
     }
     // what columns from new_data_row are different in old_data_row?
     // those are the ones to push through the update statement to make the database current
     $old_columns = array();
     $update_columns = array();
     foreach ($changed_columns as $changed_column) {
         if (!isset($changed_column['old_col'])) {
             $old_columns[] = 'NOTDEFINED';
         } else {
             $old_col_value = format::column_value_default($node_schema, $node_table, $changed_column['name'], $changed_column['old_col']);
             $old_columns[] = $changed_column['name'] . ' = ' . $old_col_value;
         }
         $update_col_name = format::get_quoted_column_name($changed_column['name']);
         $update_col_value = format::column_value_default($node_schema, $node_table, $changed_column['name'], $changed_column['new_col']);
         $update_columns[] = $update_col_name . ' = ' . $update_col_value;
     }
     // if the computed update_columns expression is < 5 chars, complain
     // if ( strlen($update_columns) < 5 ) {
     //   var_dump($update_columns);
     //   throw new exception(sprintf("%s.%s update_columns is < 5 chars, unexpected", $node_schema['name'], $node_table['name']));
     // }
     $old_columns = implode(', ', $old_columns);
     $update_columns = implode(', ', $update_columns);
     // use multiline comments here, so when data has newlines they can be preserved, but upgrade scripts don't catch on fire
     $sql = sprintf("UPDATE %s SET %s WHERE (%s); /* old values: %s */\n", format::get_fully_qualified_table_name($node_schema['name'], $node_table['name']), $update_columns, dbx::primary_key_expression(dbsteward::$new_database, $node_schema, $node_table, $new_data_row_columns, $new_data_row), $old_columns);
     return $sql;
 }
开发者ID:williammoran,项目名称:DBSteward,代码行数:31,代码来源:mysql5_diff_tables.php

示例3: get_foreign_key_reference_sql

 public static function get_foreign_key_reference_sql($foreign)
 {
     return format::get_fully_qualified_table_name($foreign['schema']['name'], $foreign['table']['name']) . ' (' . format::get_quoted_column_name($foreign['column']['name']) . ')';
 }
开发者ID:williammoran,项目名称:DBSteward,代码行数:4,代码来源:sql99_constraint.php


注:本文中的format::get_quoted_column_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。