當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。