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


PHP pg_fieldtype函数代码示例

本文整理汇总了PHP中pg_fieldtype函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_fieldtype函数的具体用法?PHP pg_fieldtype怎么用?PHP pg_fieldtype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: sqlCallback

/**
 * This is a callback function to display the result of each separate query
 * @param ADORecordSet $rs The recordset returned by the script execetor
 */
function sqlCallback($query, $rs, $lineno)
{
    global $data, $misc, $lang, $_connection;
    // Check if $rs is false, if so then there was a fatal error
    if ($rs === false) {
        echo htmlspecialchars($_FILES['script']['name']), ':', $lineno, ': ', nl2br(htmlspecialchars($_connection->getLastError())), "<br/>\n";
    } else {
        // Print query results
        switch (pg_result_status($rs)) {
            case PGSQL_TUPLES_OK:
                // If rows returned, then display the results
                $num_fields = pg_numfields($rs);
                echo "<p><table>\n<tr>";
                for ($k = 0; $k < $num_fields; $k++) {
                    echo "<th class=\"data\">", $misc->printVal(pg_fieldname($rs, $k)), "</th>";
                }
                $i = 0;
                $row = pg_fetch_row($rs);
                while ($row !== false) {
                    $id = $i % 2 == 0 ? '1' : '2';
                    echo "<tr class=\"data{$id}\">\n";
                    foreach ($row as $k => $v) {
                        echo "<td style=\"white-space:nowrap;\">", $misc->printVal($v, pg_fieldtype($rs, $k), array('null' => true)), "</td>";
                    }
                    echo "</tr>\n";
                    $row = pg_fetch_row($rs);
                    $i++;
                }
                echo "</table><br/>\n";
                echo $i, " {$lang['strrows']}</p>\n";
                break;
            case PGSQL_COMMAND_OK:
                // If we have the command completion tag
                if (version_compare(phpversion(), '4.3', '>=')) {
                    echo htmlspecialchars(pg_result_status($rs, PGSQL_STATUS_STRING)), "<br/>\n";
                } elseif ($data->conn->Affected_Rows() > 0) {
                    echo $data->conn->Affected_Rows(), " {$lang['strrowsaff']}<br/>\n";
                }
                // Otherwise output nothing...
                break;
            case PGSQL_EMPTY_QUERY:
                break;
            default:
                break;
        }
    }
}
开发者ID:yxwzaxns,项目名称:DaoCloud_phpPgAdmin,代码行数:51,代码来源:sql.php

示例2: IsTimestamp

 function IsTimestamp($vField)
 {
     // FIXME
     // substr because it could be timestamp or timestamptz
     return $this->res > 0 && substr(pg_fieldtype($this->res, $vField), 0, 9) == 'timestamp';
 }
开发者ID:ljvblfz,项目名称:mysoftwarebrasil,代码行数:6,代码来源:class.DCL_DB_oracle8.inc.php

示例3: field_type

 function field_type($result, $int)
 {
     $fieldtype = pg_fieldtype($result, $int);
     #echo $fieldtype.", ".$fieldlen."<br>";
     #if ( strstr($fieldtype, "char") ) $fieldtype = "string";
     #if ( $fieldtype == "text" ) $fieldtype = "blob";
     return $fieldtype;
 }
开发者ID:BackupTheBerlios,项目名称:ewebuki-svn,代码行数:8,代码来源:dbclass_postgres.php

示例4: sql_fieldtype

 function sql_fieldtype($offset, $query_id = 0)
 {
     if (!$query_id) {
         $query_id = $this->query_result;
     }
     return $query_id ? @pg_fieldtype($query_id, $offset) : false;
 }
开发者ID:rotvulpix,项目名称:php-nuke,代码行数:7,代码来源:postgres7.php

示例5: tableInfo

 /**
  * Returns information about a table or a result set
  *
  * NOTE: doesn't support table name and flags if called from a db_result
  *
  * @param  mixed $resource PostgreSQL result identifier or table name
  * @param  int $mode A valid tableInfo mode (DB_TABLEINFO_ORDERTABLE or
  *                   DB_TABLEINFO_ORDER)
  *
  * @return array An array with all the information
  */
 function tableInfo($result, $mode = null)
 {
     $count = 0;
     $id = 0;
     $res = array();
     /*
      * depending on $mode, metadata returns the following values:
      *
      * - mode is false (default):
      * $result[]:
      *   [0]["table"]  table name
      *   [0]["name"]   field name
      *   [0]["type"]   field type
      *   [0]["len"]    field length
      *   [0]["flags"]  field flags
      *
      * - mode is DB_TABLEINFO_ORDER
      * $result[]:
      *   ["num_fields"] number of metadata records
      *   [0]["table"]  table name
      *   [0]["name"]   field name
      *   [0]["type"]   field type
      *   [0]["len"]    field length
      *   [0]["flags"]  field flags
      *   ["order"][field name]  index of field named "field name"
      *   The last one is used, if you have a field name, but no index.
      *   Test:  if (isset($result['meta']['myfield'])) { ...
      *
      * - mode is DB_TABLEINFO_ORDERTABLE
      *    the same as above. but additionally
      *   ["ordertable"][table name][field name] index of field
      *      named "field name"
      *
      *      this is, because if you have fields from different
      *      tables with the same field name * they override each
      *      other with DB_TABLEINFO_ORDER
      *
      *      you can combine DB_TABLEINFO_ORDER and
      *      DB_TABLEINFO_ORDERTABLE with DB_TABLEINFO_ORDER |
      *      DB_TABLEINFO_ORDERTABLE * or with DB_TABLEINFO_FULL
      */
     // if $result is a string, then we want information about a
     // table without a resultset
     if (is_string($result)) {
         $id = pg_exec($this->connection, "SELECT * FROM {$result}");
         if (empty($id)) {
             return $this->pgsqlRaiseError();
         }
     } else {
         // else we want information about a resultset
         $id = $result;
         if (empty($id)) {
             return $this->pgsqlRaiseError();
         }
     }
     $count = @pg_numfields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (empty($mode)) {
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = is_string($result) ? $result : '';
             $res[$i]['name'] = @pg_fieldname($id, $i);
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = is_string($result) ? $this->_pgFieldflags($id, $i, $result) : '';
         }
     } else {
         // full
         $res["num_fields"] = $count;
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = is_string($result) ? $result : '';
             $res[$i]['name'] = @pg_fieldname($id, $i);
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = is_string($result) ? $this->_pgFieldFlags($id, $i, $result) : '';
             if ($mode & DB_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & DB_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if (is_resource($id)) {
         @pg_freeresult($id);
     }
     return $res;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:99,代码来源:pgsql.php

示例6: db_field_type

/**                                                       
 * Get the type of the specified field  
 *
 *  @param		$lhandle	(string) Query result set handle
 *  @param		$fnumber (int)	Column number
 */
function db_field_type($lhandle, $fnumber)
{
    return @pg_fieldtype($lhandle, $fnumber);
}
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:10,代码来源:database-pgsql.php

示例7: vty_field_type

function vty_field_type($list,$i){
        switch($this->vtAdi){
        case 'mysql': return mysql_field_type($list,$i); break;
        case 'odbc': return odbc_field_type($list,$i); break;
        case 'mssql': return mssql_field_type($list,$i); break;
        case 'postgresql': pg_fieldtype($list,$i); break;
        }
}
开发者ID:awddesign,项目名称:vty,代码行数:8,代码来源:vty.php

示例8: tableInfo

 /**
  * Returns information about a table or a result set.
  *
  * NOTE: only supports 'table' and 'flags' if <var>$result</var>
  * is a table name.
  *
  * @param object|string  $result  DB_result object from a query or a
  *                                string containing the name of a table
  * @param int            $mode    a valid tableInfo mode
  * @return array  an associative array with the information requested
  *                or an error object if something is wrong
  * @access public
  * @internal
  * @see DB_common::tableInfo()
  */
 function tableInfo($result, $mode = null)
 {
     if (isset($result->result)) {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->result;
         $got_string = false;
     } elseif (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         $id = @pg_exec($this->connection, "SELECT * FROM {$result} LIMIT 0");
         $got_string = true;
     } else {
         /*
          * Probably received a result resource identifier.
          * Copy it.
          * Deprecated.  Here for compatibility only.
          */
         $id = $result;
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
     }
     if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     $count = @pg_numfields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (!$mode) {
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func(@pg_fieldname($id, $i));
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = $got_string ? $this->_pgFieldflags($id, $i, $result) : '';
         }
     } else {
         // full
         $res['num_fields'] = $count;
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func(@pg_fieldname($id, $i));
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = $got_string ? $this->_pgFieldFlags($id, $i, $result) : '';
             if ($mode & DB_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & DB_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @pg_freeresult($id);
     }
     return $res;
 }
开发者ID:nanoprime,项目名称:sureinvoice,代码行数:81,代码来源:pgsql.php

示例9: pg_connect

<?php

include 'config.inc';
$db = pg_connect($conn_str);
$result = pg_exec("SELECT * FROM " . $table_name);
pg_numrows($result);
pg_numfields($result);
pg_fieldname($result, 0);
pg_fieldsize($result, 0);
pg_fieldtype($result, 0);
pg_fieldprtlen($result, 0);
pg_fieldisnull($result, 0);
pg_result($result, 0, 0);
$result = pg_exec("INSERT INTO " . $table_name . " VALUES (7777, 'KKK')");
$oid = pg_getlastoid($result);
pg_freeresult($result);
pg_errormessage();
$result = pg_exec("UPDATE " . $table_name . " SET str = 'QQQ' WHERE str like 'RGD';");
pg_cmdtuples($result);
echo "OK";
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:98old_api.php

示例10: db_lovrot


//.........这里部分代码省略.........
                    $loop .= $caracter . "'" . addslashes(str_replace('"', '', @pg_result($result, $i, strlen($arrayFuncao[$cont]) < 4 ? (int) $arrayFuncao[$cont] : $arrayFuncao[$cont]))) . "'";
                    //$loop .= $caracter."'".pg_result($result,$i,(int)$arrayFuncao[$cont])."'";
                    $caracter = ",";
                }
                $resultadoRetorno = $arrayFuncao[0] . "(" . $loop . ")";
            } else {
                $resultadoRetorno = $arrayFuncao[0] . "()";
            }
        }
        /*
        	if($NumRows==1){
        if($arquivo!=""){
        echo "<td>$resultadoRetorno<td>";
        exit;
        }else{
        echo "<script>JanBrowse = window.open('".$arquivo."?".base64_encode("retorno=".($BrowSe==1?0:trim(pg_result($result,0,0))))."','$aonde','width=800,height=600');</script>";
        exit;
        }
        }
        */
        if (isset($cor)) {
            $cor = $cor == $cor1 ? $cor2 : $cor1;
        } else {
            $cor = $cor1;
        }
        // implamentacao de informacoes complementares
        //    $mostradiv="";
        if ($campos_layer != "") {
            $campo_layerexe = split("\\|", $campos_layer);
            echo "<td id=\"funcao_aux" . $i . "\" style=\"text-decoration:none;color:#000000;\" bgcolor=\"{$cor}\" nowrap><a href=\"\" onclick=\"" . $campo_layerexe[1] . "({$loop});return false\" ><strong>" . $campo_layerexe[0] . "&nbsp;</strong></a></td>\n";
        }
        for ($j = 0; $j < $NumFields; $j++) {
            if (strlen(strstr(pg_fieldname($result, $j), "db_")) == 0 || strlen(strstr(pg_fieldname($result, $j), "db_m_")) != 0) {
                if (pg_fieldtype($result, $j) == "date") {
                    if (pg_result($result, $i, $j) != "") {
                        $matriz_data = split("-", pg_result($result, $i, $j));
                        $var_data = $matriz_data[2] . "/" . $matriz_data[1] . "/" . $matriz_data[0];
                    } else {
                        $var_data = "//";
                    }
                    echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;\" bgcolor=\"{$cor}\" nowrap>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim($var_data) . "</a>" : trim($var_data)) . "&nbsp;</td>\n";
                } else {
                    if (pg_fieldtype($result, $j) == "float8" || pg_fieldtype($result, $j) == "float4") {
                        $var_data = db_formatar(pg_result($result, $i, $j), 'f', ' ');
                        echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000\" bgcolor=\"{$cor}\" align=right nowrap>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim($var_data) . "</a>" : trim($var_data)) . "&nbsp;</td>\n";
                    } else {
                        if (pg_fieldtype($result, $j) == "bool") {
                            $var_data = pg_result($result, $i, $j) == 'f' || pg_result($result, $i, $j) == '' ? 'Não' : 'Sim';
                            echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;align:right\" bgcolor=\"{$cor}\" nowrap>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim($var_data) . "</a>" : trim($var_data)) . "&nbsp;</td>\n";
                        } else {
                            if (pg_fieldtype($result, $j) == "text") {
                                $var_data = substr(pg_result($result, $i, $j), 0, 10) . "...";
                                echo "<td onMouseOver=\"js_mostra_text(true,'div_text_" . $i . "_" . $j . "',event);\" onMouseOut=\"js_mostra_text(false,'div_text_" . $i . "_" . $j . "',event)\" id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;align:right\" bgcolor=\"{$cor}\" nowrap>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim($var_data) . "</a>" : trim($var_data)) . "&nbsp;</td>\n";
                            } else {
                                if (pg_fieldname($result, $j) == 'j01_matric') {
                                    echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;\" bgcolor=\"{$cor}\" nowrap><a title='Informações Imóvel' onclick=\"js_JanelaAutomatica('iptubase','" . trim(pg_result($result, $i, $j)) . "');return false;\">&nbsp;Inf->&nbsp;</a>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim(pg_result($result, $i, $j)) . "</a>" : trim(pg_result($result, $i, $j))) . "&nbsp;</td>\n";
                                } else {
                                    if (pg_fieldname($result, $j) == 'm80_codigo') {
                                        echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;\" bgcolor=\"{$cor}\" nowrap><a title='Informações Lançamento' onclick=\"js_JanelaAutomatica('matestoqueini','" . trim(pg_result($result, $i, $j)) . "');return false;\">&nbsp;Inf->&nbsp;</a>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim(pg_result($result, $i, $j)) . "</a>" : trim(pg_result($result, $i, $j))) . "&nbsp;</td>\n";
                                    } else {
                                        if (pg_fieldname($result, $j) == 'm40_codigo') {
                                            echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;\" bgcolor=\"{$cor}\" nowrap><a title='Informações Requisição' onclick=\"js_JanelaAutomatica('matrequi','" . trim(pg_result($result, $i, $j)) . "');return false;\">&nbsp;Inf->&nbsp;</a>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim(pg_result($result, $i, $j)) . "</a>" : trim(pg_result($result, $i, $j))) . "&nbsp;</td>\n";
                                        } else {
                                            if (pg_fieldname($result, $j) == 'm42_codigo') {
                                                echo "<td id=\"I" . $i . $j . "\" style=\"text-decoration:none;color:#000000;\" bgcolor=\"{$cor}\" nowrap><a title='Informações Atendimento' onclick=\"js_JanelaAutomatica('atendrequi','" . trim(pg_result($result, $i, $j)) . "');return false;\">&nbsp;Inf->&nbsp;</a>" . ($arquivo != "" ? "<a title=\"{$mensagem}\" style=\"text-decoration:none;color:#000000;\" href=\"\" " . ($arquivo == "()" ? "OnClick=\"" . $resultadoRetorno . ";return false\">" : "onclick=\"JanBrowse = window.open('" . $arquivo . "?" . base64_encode("retorno=" . ($BrowSe == 1 ? $i : trim(pg_result($result, $i, 0)))) . "','{$aonde}','width=800,height=600');return false\">") . trim(pg_result($result, $i, $j)) . "</a>" : trim(pg_result($result, $i, $j))) . "&nbsp;</td>\n";
                                            } else {
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:67,代码来源:db_stdlib.php

示例11: FieldType

 function FieldType($result, $offset)
 {
     switch ($this->dbType) {
         case "mssql":
             $r = mssql_field_type($result, $offset);
             break;
         case "mysql":
             $r = mysql_field_type($result, $offset);
             break;
         case "pg":
             $r = pg_fieldtype($result, $offset);
             break;
         default:
             $r = False;
             break;
     }
     return $r;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:18,代码来源:clsDatabase.php

示例12: pg_exec

        ?>
</th>
		<th><?php 
        echo $strType;
        ?>
</th>
		<th><?php 
        echo $strValue;
        ?>
</th>
		</tr>
		<?php 
        $result = pg_exec($link, pre_query($sql_get_fields));
        for ($i = 0; $i < pg_numfields($result); $i++) {
            $field = pg_fieldname($result, $i);
            $type = pg_fieldtype($result, $i);
            $len = pg_fieldsize($result, $i);
            if ($len < 1) {
                $len_disp = "var";
                $len = 50;
            } else {
                $len_disp = $len;
            }
            $bgcolor = $cfgBgcolorOne;
            $i % 2 ? 0 : ($bgcolor = $cfgBgcolorTwo);
            echo "<tr bgcolor=" . $bgcolor . ">";
            echo "<td>{$field}</td>";
            echo "<td>{$type} ({$len_disp})</td>";
            if ($type == "bool") {
                echo "<td><select name=fields[]><option value=\"t\">True<option value=\"f\">False</select></td>";
            } else {
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:tbl_select.php

示例13: updatesquirrel

        }
        updatesquirrel();
    }
    print "CREATE TABLE {$tbl_name} (" . implode(",", $create_fields) . ") WITH OIDS;\n";
    foreach ($sequences as $seq_name => $nextval) {
        print "SELECT setval('{$seq_name}',{$nextval});\n";
    }
    status("done creating query data.\n\n");
    // create the insert data queries
    status("dumping data for table... ");
    //print "BEGIN;\n";
    while ($fld_row = pg_fetch_row($flds_rslt)) {
        $idata = "";
        foreach ($fld_row as $key => $value) {
            // read the field information
            $f_type = pg_fieldtype($flds_rslt, $key);
            // if the type is numeric or float and empty set it to zero
            if (empty($value) && preg_match("/^(float|numeric|int)/", $f_type)) {
                $value = "0";
            }
            // escape the quotes
            $value = str_replace("'", "\\'", $value);
            $idata[] = "'{$value}'";
            updatesquirrel();
        }
        $query_indata = implode(",", $idata);
        print "INSERT INTO {$tbl_name} (" . implode(",", $insert_fields) . ") VALUES({$query_indata});\n";
    }
    //print "COMMIT;\n";
    status("done\n");
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:__dump_base.php

示例14: tableInfo

 /**
  * Returns information about a table or a result set.
  *
  * NOTE: only supports 'table' and 'flags' if <var>$result</var>
  * is a table name.
  *
  * @param object|string  $result  MDB2_result object from a query or a
  *                                string containing the name of a table
  * @param int            $mode    a valid tableInfo mode
  * @return array  an associative array with the information requested
  *                or an error object if something is wrong
  * @access public
  * @internal
  * @see MDB2_Driver_Common::tableInfo()
  */
 function tableInfo($result, $mode = null)
 {
     $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
     if ($db->options['portability'] & MDB2_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     if (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         if (MDB2::isError($connect = $db->connect())) {
             return $connect;
         }
         $id = @pg_exec($db->connection, "SELECT * FROM {$result} LIMIT 0");
         $got_string = true;
     } else {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->getResource();
         if (empty($id)) {
             return $db->raiseError();
         }
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA);
     }
     $count = @pg_numfields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (!$mode) {
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func(@pg_fieldname($id, $i));
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = $got_string ? $this->_pgFieldflags($id, $i, $result) : '';
         }
     } else {
         // full
         $res['num_fields'] = $count;
         for ($i = 0; $i < $count; $i++) {
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func(@pg_fieldname($id, $i));
             $res[$i]['type'] = @pg_fieldtype($id, $i);
             $res[$i]['len'] = @pg_fieldsize($id, $i);
             $res[$i]['flags'] = $got_string ? $this->_pgFieldFlags($id, $i, $result) : '';
             if ($mode & MDB2_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @pg_freeresult($id);
     }
     return $res;
 }
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:80,代码来源:pgsql.php

示例15: tipocampo_query

function tipocampo_query($query, $num)
{
    $risul = pg_fieldtype($query, $num);
    return $risul;
}
开发者ID:briaguya,项目名称:sleepover---old,代码行数:5,代码来源:funzioni_postgresql.php


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