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


PHP MDB2_Driver_Common::getSequenceName方法代码示例

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


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

示例1: getSequenceName

 /**
  * adds sequence name formatting to a sequence name
  *
  * @param   string  name of the sequence
  *
  * @return  string  formatted sequence name
  *
  * @access  public
  */
 function getSequenceName($sqn)
 {
     if (false === $this->options['disable_smart_seqname']) {
         if (strpos($sqn, '_') !== false) {
             list($table, $field) = explode('_', $sqn, 2);
         }
         $schema_list = $this->queryOne("SELECT array_to_string(current_schemas(false), ',')");
         if (PEAR::isError($schema_list) || empty($schema_list) || count($schema_list) < 2) {
             $order_by = ' a.attnum';
             $schema_clause = ' AND n.nspname=current_schema()';
         } else {
             $schemas = explode(',', $schema_list);
             $schema_clause = ' AND n.nspname IN (' . $schema_list . ')';
             $counter = 1;
             $order_by = ' CASE ';
             foreach ($schemas as $schema) {
                 $order_by .= ' WHEN n.nspname=' . $schema . ' THEN ' . $counter++;
             }
             $order_by .= ' ELSE ' . $counter . ' END, a.attnum';
         }
         $query = "SELECT substring((SELECT substring(pg_get_expr(d.adbin, d.adrelid) for 128)\r\n                    \t    FROM pg_attrdef d\r\n                    \t   WHERE d.adrelid = a.attrelid\r\n                    \t     AND d.adnum = a.attnum\r\n                    \t     AND a.atthasdef\r\n                    \t ) FROM 'nextval[^'']*''([^'']*)')\r\n                        FROM pg_attribute a\r\n                    LEFT JOIN pg_class c ON c.oid = a.attrelid\r\n                    LEFT JOIN pg_attrdef d ON d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef\r\n                    LEFT JOIN pg_namespace n ON c.relnamespace = n.oid\r\n                       WHERE (c.relname = " . $this->quote($sqn, 'text');
         if (!empty($field)) {
             $query .= " OR (c.relname = " . $this->quote($table, 'text') . " AND a.attname = " . $this->quote($field, 'text') . ")";
         }
         $query .= "      )" . $schema_clause . "\r\n                         AND NOT a.attisdropped\r\n                         AND a.attnum > 0\r\n                         AND pg_get_expr(d.adbin, d.adrelid) LIKE 'nextval%'\r\n                    ORDER BY " . $order_by;
         $seqname = $this->queryOne($query);
         if (!PEAR::isError($seqname) && !empty($seqname) && is_string($seqname)) {
             return $seqname;
         }
     }
     return parent::getSequenceName($sqn);
 }
开发者ID:phpontrax,项目名称:trax,代码行数:41,代码来源:pgsql.php

示例2: getSequenceName

 /**
  * adds sequence name formatting to a sequence name
  *
  * @param string $sqn name of the sequence
  * @return string formatted sequence name
  * @access public
  */
 function getSequenceName($sqn)
 {
     return strtoupper(parent::getSequenceName($sqn));
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:11,代码来源:ibase.php


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