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


PHP db2_fetch_assoc函数代码示例

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


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

示例1: fetch_row

 public function fetch_row()
 {
     if ($this->flags['fetch_all_rows']) {
         return false;
     }
     if ($this->num_fields) {
         $this->flags['fetch_row']++;
         return @db2_fetch_assoc($this->resource);
     }
     return false;
 }
开发者ID:codifyllc,项目名称:phpopenfw,代码行数:11,代码来源:dr_db2.class.php

示例2: updateTicket

function updateTicket()
{
    // connect db=> stmt sql => insert => refresh page
    if (isset($_POST['id_value'])) {
        $transID = $_POST['id_value'];
    }
    $conn = dbConnect();
    // start connect db
    if ($conn) {
        $update = "UPDATE EMM_ZOO.TICKETTRANS_TRANSACTION SET TICKETTRANS_TIMEIN = CURRENT TIME WHERE TICKETTRANS_ID = " . $transID . ";";
        //echo $update;
        $rc = db2_exec($conn, $update);
        if ($rc) {
            //header("Refresh:0; url=TranspotationIN.php");
        } else {
            // If statement is error why see the code
            die('Critical error:' . db2_stmt_error($stmt));
        }
        // finish all query statement
        db2_free_stmt($rc);
        $sql = "SELECT * FROM EMM_ZOO.TICKETTRANS_TRANSACTION JOIN EMM_ZOO.TICKETTRANS_TYPE ON VEHICLETRANS_ID = TRANSTYPE_ID WHERE TICKETTRANS_ID = " . $transID . ";";
        $stmt = db2_exec($conn, $sql);
        while ($row = db2_fetch_assoc($stmt)) {
            $tran_price = $row['TRANSTYPE_PRICE'];
            $tran_type = $row['TRANSTYPE_NAME'];
            $hourOut = (int) substr($row['TICKETTRANS_TIMEOUT'], 0, 2);
            $hourIn = (int) substr($row['TICKETTRANS_TIMEIN'], 0, 2);
            $extraOut = (int) substr($row['TICKETTRANS_TIMEOUT'], 3, 2);
            $extraIn = (int) substr($row['TICKETTRANS_TIMEIN'], 3, 2);
            $price = ($hourIn - $hourOut) * $tran_price;
            // ราคาต้องดึงมาจาก trans_Type table
            if ($extraIn - $extraOut > 0) {
                $price += $tran_price;
            }
            if ($extraIn - $extraOut == 0 && $hourIn - $hourOut == 0 && (int) substr($row['TICKETTRANS_TIMEOUT'], 6, 2) != (int) substr($row['TICKETTRANS_TIMEIN'], 6, 2)) {
                $price += $tran_price;
            }
            if ($stmt) {
                // echo "Insert successfully!!";
                echo "<script>alert('Price of {$tran_type} is {$price}');window.location='TranspotationIN.php';</script>";
                //header("Refresh:0; url=TranspotationIN.php");
            } else {
                // If statement is error why see the code
                die('Critical error:' . db2_stmt_error($stmt));
            }
        }
        db2_free_stmt($rc);
        db2_close($conn);
    } else {
        echo db2_conn_errormsg($conn);
    }
}
开发者ID:Juklabs,项目名称:emmaline,代码行数:52,代码来源:trans_return.php

示例3: db_getfieldslist

 /**
  * @param String strSQL
  * @return Array
  */
 public function db_getfieldslist($table)
 {
     $res = array();
     $arr = implode(".", $table);
     $stmt = db2_columns($this->connectionObj->conn, null, $arr[0], $arr[1], '%');
     if ($stmt) {
         while ($rowC = db2_fetch_assoc($stmt)) {
             $ntype = $this->getFieldTypeNumber($rowC["TYPE_NAME"]);
             $res[$i] = array("fieldname" => $rowC["COLUMN_NAME"], "type" => $ntype, "is_nullable" => 0);
         }
     }
     return $res;
 }
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:17,代码来源:DB2Info.php

示例4: updateTicket

function updateTicket()
{
    // connect db=> stmt sql => insert => refresh page
    if (isset($_POST)) {
        $type[0] = $_POST['typeC'];
        $type[1] = $_POST['typeA'];
        $type[2] = $_POST['typeF'];
        $num[0] = intval($_POST['TicketNumC']);
        $num[1] = intval($_POST['TicketNumA']);
        $num[2] = intval($_POST['TicketNumF']);
        //$num = $_POST['TicketNum'];
    }
    // start connect db
    $conn = dbConnect();
    if ($conn) {
        //Part one select data from tickettype
        for ($i = 0; $i <= 2; $i++) {
            if ($num[$i] == 0) {
                continue;
            }
            $sql = "SELECT * FROM EMM_ZOO.TICKETGATE_TYPE WHERE TICKETGATE_TYPE = '{$type[$i]}';";
            $stmt = db2_prepare($conn, $sql);
            $result = db2_execute($stmt);
            while ($row = db2_fetch_assoc($stmt)) {
                $ticket_price = $row['TICKETGATETYPE_PRICE'];
                $ticket_type = $row['TICKETGATE_TYPE'];
                $ticket_id = intval($row['TICKETGATETYPE_ID']);
                //printf ("%-5d %-16s %-32d\n",
                //   $ticket_price, $ticket_type, $ticket_id);
            }
            $insert = "INSERT INTO EMM_ZOO.TICKETGATE_TRANSACTION (TICKETGATE_ID, TICKETGATETYPE_ID, TICKETGATE_DATE, TICKETGATE_NUM, TICKETGATE_PRICE) VALUES (DEFAULT, {$ticket_id}, CURRENT DATE, {$num[$i]}" . "," . $ticket_price * $num[$i] . ");";
            //echo $insert;
            $rc = db2_exec($conn, $insert);
            // ตรงนี้ error ยังไม่เสร็จ
            if ($rc) {
                // echo "Insert successfully!!";
                echo "<script>alert('{$num[$i]} {$type[$i]} ticket has sole  in price " . $ticket_price * $num[$i] . "');window.location='GateTricket.php';</script>";
            } else {
                // If statement is error why see the code
                die('Critical error:' . db2_stmt_error($stmt));
            }
            // finish all query statement
            db2_free_stmt($stmt);
        }
        db2_close($conn);
    } else {
        echo db2_conn_errormsg($conn);
    }
}
开发者ID:Juklabs,项目名称:emmaline,代码行数:49,代码来源:saleController.php

示例5: addRound

function addRound()
{
    if (isset($_POST)) {
        $showID = $_POST['showID'];
        $roundID = $_POST['roundID'];
        $starttime = $_POST['starttime'];
        $endtime = $_POST['endtime'];
        $showdate = $_POST['showdate'];
    }
    $conn = dbConnect();
    if ($conn) {
        $insert = "INSERT INTO EMM_ZOO.SHOW_TIMETABLE(SHOWID, ROUNDID, STARTTIME, ENDTIME, DATES) values({$showID}, {$roundID}, '{$starttime}', '{$endtime}', '{$showdate}');";
        //$insert = "INSERT INTO EMM_ZOO.SHOW_TIMETABLE(SHOWID, ROUNDID, STARTTIME, ENDTIME, DATES) values(1, 3, '16:00:00', '16:30:00', '11/12/2015');";
        $rc = db2_exec($conn, $insert);
        if ($rc) {
            echo "Insert Successful";
        } else {
            die('Critical error: ' . db2_stmt_error($rc));
        }
        $sql = "SELECT * from EMM_ZOO.SHOW WHERE SHOWID = {$showID};";
        $stmt = db2_prepare($conn, $sql);
        $result = db2_execute($stmt);
        while ($row = db2_fetch_assoc($stmt)) {
            $zone = $row['BUILDINGID'];
            $name = $row['SHOWNAME'];
        }
        $insert = "INSERT INTO EMM_ZOO.SHOW_TICKET(SHOWID, STARTTIME, ENDTIME, DATES, SHOWNAME, ZONEID) values({$showID}, '{$starttime}', '{$endtime}', '{$showdate}', '{$name}', {$zone});";
        $rc = db2_exec($conn, $insert);
        if ($rc) {
            echo "Insert Successful";
        } else {
            die('Critical error: ' . db2_stmt_error($rc));
        }
        db2_free_stmt($stmt);
        db2_close($conn);
    } else {
        echo db2_conn_errormsg($conn);
    }
}
开发者ID:Juklabs,项目名称:emmaline,代码行数:39,代码来源:addRoundExe.php

示例6: updateTicket

function updateTicket()
{
    // connect db=> stmt sql => insert => refresh page
    if (isset($_POST)) {
        $type = $_POST['type'];
    }
    // start connect db
    $conn = dbConnect();
    if ($conn) {
        //Part one select data from tickettype
        $sql = "SELECT * FROM EMM_ZOO.TICKETTRANS_TYPE WHERE TRANSTYPE_NAME = '{$type}';";
        //echo $sql;
        $stmt = db2_prepare($conn, $sql);
        $result = db2_execute($stmt);
        while ($row = db2_fetch_assoc($stmt)) {
            $tran_price = $row['TRANSTYPE_PRICE'];
            $tran_type = $row['TRANSTYPE_NAME'];
            $tran_id = $row['TRANSTYPE_ID'];
            // printf ("%-5d %-16s %-32d\n",
            //    $tran_price, $tran_type, $tran_id);
        }
        $insert = " INSERT INTO EMM_ZOO.TICKETTRANS_TRANSACTION (TICKETTRANS_ID, VEHICLETRANS_ID, TICKETTRANS_DATE , TICKETTRANS_TIMEIN ,TICKETTRANS_TIMEOUT) VALUES (DEFAULT, '{$tran_id}',CURRENT DATE , NULL, CURRENT TIME);";
        $rc = db2_exec($conn, $insert);
        if ($rc) {
            echo "<script>alert('1 {$tran_type} has rent');window.location='TranspotationTricket.php';</script>";
        } else {
            // If statement is error why see the code
            die('Critical error:' . db2_stmt_error($stmt));
        }
        // finish all query statement
        db2_free_stmt($stmt);
        db2_close($conn);
    } else {
        echo db2_conn_errormsg($conn);
    }
}
开发者ID:Juklabs,项目名称:emmaline,代码行数:36,代码来源:RantTran.php

示例7: fetch

 /**
  * Fetches a row from the result set.
  *
  * @param int $style  OPTIONAL Fetch mode for this fetch operation.
  * @param int $cursor OPTIONAL Absolute, relative, or other.
  * @param int $offset OPTIONAL Number for absolute or relative cursors.
  * @return mixed Array, object, or scalar depending on fetch mode.
  * @throws \Zend\Db\Statement\Db2Exception
  */
 public function fetch($style = null, $cursor = null, $offset = null)
 {
     if (!$this->_stmt) {
         return false;
     }
     if ($style === null) {
         $style = $this->_fetchMode;
     }
     switch ($style) {
         case Db\Db::FETCH_NUM:
             $row = db2_fetch_array($this->_stmt);
             break;
         case Db\Db::FETCH_ASSOC:
             $row = db2_fetch_assoc($this->_stmt);
             break;
         case Db\Db::FETCH_BOTH:
             $row = db2_fetch_both($this->_stmt);
             break;
         case Db\Db::FETCH_OBJ:
             $row = db2_fetch_object($this->_stmt);
             break;
         case Db\Db::FETCH_BOUND:
             $row = db2_fetch_both($this->_stmt);
             if ($row !== false) {
                 return $this->_fetchBound($row);
             }
             break;
         default:
             throw new Db2Exception("Invalid fetch mode '{$style}' specified");
             break;
     }
     return $row;
 }
开发者ID:hjr3,项目名称:zf2,代码行数:42,代码来源:Db2.php

示例8: performQuery

 /**
  * Executes an SQL query
  * 
  * @param  string|fStatement $statement  The statement to perform
  * @param  fResult           $result     The result object for the query
  * @param  array             $params     The parameters for prepared statements
  * @return void
  */
 private function performQuery($statement, $result, $params)
 {
     fCore::startErrorCapture();
     $extra = NULL;
     if (is_object($statement)) {
         $statement->executeQuery($result, $params, $extra, $statement != $this->statement);
     } elseif ($this->extension == 'ibm_db2') {
         $extra = db2_exec($this->connection, $statement, array('cursor' => DB2_FORWARD_ONLY));
         if (is_resource($extra)) {
             $rows = array();
             while ($row = db2_fetch_assoc($extra)) {
                 $rows[] = $row;
             }
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult($extra);
         }
     } elseif ($this->extension == 'mssql') {
         $result->setResult(mssql_query($result->getSQL(), $this->connection));
     } elseif ($this->extension == 'mysql') {
         $result->setResult(mysql_query($result->getSQL(), $this->connection));
     } elseif ($this->extension == 'mysqli') {
         $result->setResult(mysqli_query($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'oci8') {
         $extra = oci_parse($this->connection, $result->getSQL());
         if ($extra && oci_execute($extra, $this->inside_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS)) {
             oci_fetch_all($extra, $rows, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC);
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult(FALSE);
         }
     } elseif ($this->extension == 'pgsql') {
         $result->setResult(pg_query($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'sqlite') {
         $result->setResult(sqlite_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $extra));
     } elseif ($this->extension == 'sqlsrv') {
         $extra = sqlsrv_query($this->connection, $result->getSQL());
         if (is_resource($extra)) {
             $rows = array();
             while ($row = sqlsrv_fetch_array($extra, SQLSRV_FETCH_ASSOC)) {
                 $rows[] = $row;
             }
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult($extra);
         }
     } elseif ($this->extension == 'pdo') {
         if (preg_match('#^\\s*CREATE(\\s+OR\\s+REPLACE)?\\s+TRIGGER#i', $result->getSQL())) {
             $this->connection->exec($result->getSQL());
             $extra = FALSE;
             $returned_rows = array();
         } else {
             $extra = $this->connection->query($result->getSQL());
             if (is_object($extra)) {
                 // This fixes a segfault issue with blobs and fetchAll() for pdo_ibm
                 if ($this->type == 'db2') {
                     $returned_rows = array();
                     while (($row = $extra->fetch(PDO::FETCH_ASSOC)) !== FALSE) {
                         foreach ($row as $key => $value) {
                             if (is_resource($value)) {
                                 $row[$key] = stream_get_contents($value);
                             }
                         }
                         $returned_rows[] = $row;
                     }
                     // pdo_dblib doesn't throw an exception on error when executing
                     // a prepared statement when compiled against FreeTDS, so we have
                     // to manually check the error info to see if something went wrong
                 } elseif ($this->type == 'mssql' && !fCore::checkOS('windows') && preg_match('#^\\s*EXEC(UTE)?\\s+#i', $result->getSQL())) {
                     $error_info = $extra->errorInfo();
                     if ($error_info && strpos($error_info[2], '(null) [0] (severity 0)') !== 0) {
                         $returned_rows = FALSE;
                     }
                 } else {
                     $returned_rows = $extra->fetchAll(PDO::FETCH_ASSOC);
                 }
             } else {
                 $returned_rows = $extra;
             }
             // The pdo_pgsql driver likes to return empty rows equal to the number of affected rows for insert and deletes
             if ($this->type == 'postgresql' && $returned_rows && $returned_rows[0] == array()) {
                 $returned_rows = array();
             }
         }
         $result->setResult($returned_rows);
     }
     $this->statement = $statement;
     $this->handleErrors(fCore::stopErrorCapture());
     // The mssql extension will sometimes not return FALSE even if there are errors
//.........这里部分代码省略.........
开发者ID:daerduoCarey,项目名称:oj,代码行数:101,代码来源:fDatabase.php

示例9: db2_prepare

    $sqlGuide = "SELECT FIRSTNAME, LASTNAME FROM EMM_ZOO.TOUR_GUIDE WHERE GUIDEID = ?";
    $stmtGuide = db2_prepare($conn, $sqlGuide);
    db2_bind_param($stmtGuide, 1, $gID);
    db2_execute($stmtGuide);
    ?>
                                            <tr>
                                                <td class=""><?php 
    echo $id;
    ?>
</td>
                                                <td class=""><?php 
    echo $name;
    ?>
</td>
                                                <?php 
    while ($row = db2_fetch_assoc($stmtGuide)) {
        $gName = $row['FIRSTNAME'] . "  " . $row['LASTNAME'];
        ?>
                                                <td class=""><?php 
        echo $gName;
        ?>
</td>
                                                <?php 
    }
    ?>
                                                <td class=""><?php 
    echo $amount;
    ?>
</td>
                                                <td class="last"><a href="#">View</a>
                                                </td>
开发者ID:Juklabs,项目名称:emmaline,代码行数:31,代码来源:tour_vehicle.php

示例10: fetch_assoc

 public static function fetch_assoc($psql, $conn)
 {
     if ($psql) {
         return db2_fetch_assoc($psql);
     }
     return false;
 }
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:7,代码来源:jqGridDb2.php

示例11: addShow

function addShow()
{
    if (isset($_POST)) {
        $showName = $_POST['showName'];
        $animalID = $_POST['animalID'];
        $staffID = $_POST['staffID'];
        $buildingID = $_POST['buildingID'];
        $seat = $_POST['seat'];
        $price = $_POST['price'];
    }
    $conn = dbConnect();
    if ($conn) {
        $sql = "SELECT EMPID FROM EMM_ZOO.EMPLOYEE WHERE EMPID = " . $staffID;
        $stmt = db2_prepare($conn, $sql);
        $result = db2_execute($stmt);
        $count = 0;
        while ($row = db2_fetch_assoc($stmt)) {
            $count++;
        }
        if ($count <= 0) {
            echo "Wrong Staff ID.";
        } else {
            // Query
            db2_free_stmt($stmt);
            $sql = "SELECT ANIMALID FROM EMM_ZOO.ANIMAL WHERE ANIMALID = " . $animalID;
            $stmt = db2_prepare($conn, $sql);
            $result = db2_execute($stmt);
            $count = 0;
            while ($row = db2_fetch_assoc($stmt)) {
                $count++;
            }
            if ($count <= 0) {
                echo "Wrong Animal ID.";
            } else {
                $insert = "INSERT INTO EMM_ZOO.SHOW(SHOWID, SHOWNAME, BUILDINGID, SEAT_AMOUNT, PRICE) values(DEFAULT, '{$showName}', {$buildingID}, {$seat}, {$price});";
                $rc = db2_exec($conn, $insert);
                if ($rc) {
                    db2_free_stmt($stmt);
                    $sql = "SELECT SHOWID from EMM_ZOO.SHOW;";
                    $stmt = db2_prepare($conn, $sql);
                    $result = db2_execute($stmt);
                    while ($row = db2_fetch_assoc($stmt)) {
                        $show_showID = $row['SHOWID'];
                    }
                    $insert = "INSERT INTO EMM_ZOO.SHOW_ANIMAL (SHOWID, ANIMALID) VALUES ({$show_showID}, {$animalID});";
                    $rc = db2_exec($conn, $insert);
                    if ($rc) {
                        echo "Insert Successful";
                    } else {
                        die('Critical error: ' . db2_stmt_error($stmt));
                    }
                    $insert = "INSERT INTO EMM_ZOO.SHOW_STAFF (SHOWID, EMPID) VALUES ({$show_showID}, {$staffID});";
                    $rc = db2_exec($conn, $insert);
                    if ($rc) {
                        echo "Insert Successful";
                    } else {
                        die('Critical error: ' . db2_stmt_error($stmt));
                    }
                    /*
                                        $insert = "INSERT INTO EMM_ZOO.SHOW_TICKET (SHOWID, SHOWNAME, BUILDINGID) VALUES ($show_showID, '$showName', $buildingID);";
                                        $rc=db2_exec($conn, $insert);
                    
                                        if($rc) {
                                            echo "Insert Successful";
                                        }
                                        else { 
                                            die('Critical error: '. db2_stmt_error($stmt));
                                        }*/
                } else {
                }
            }
        }
        db2_free_stmt($stmt);
        db2_close($conn);
    } else {
        echo db2_conn_errormsg($conn);
    }
}
开发者ID:Juklabs,项目名称:emmaline,代码行数:78,代码来源:addShow.php

示例12: fetch

 /**
  * Fetches a row from the result set.
  *
  * @param int $style  OPTIONAL Fetch mode for this fetch operation.
  * @param int $cursor OPTIONAL Absolute, relative, or other.
  * @param int $offset OPTIONAL Number for absolute or relative cursors.
  * @return mixed Array, object, or scalar depending on fetch mode.
  * @throws Zend_Db_Statement_Db2_Exception
  */
 public function fetch($style = null, $cursor = null, $offset = null)
 {
     if (!$this->_stmt) {
         return false;
     }
     if ($style === null) {
         $style = $this->_fetchMode;
     }
     switch ($style) {
         case Zend_Db::FETCH_NUM:
             $row = db2_fetch_array($this->_stmt);
             break;
         case Zend_Db::FETCH_ASSOC:
             $row = db2_fetch_assoc($this->_stmt);
             break;
         case Zend_Db::FETCH_BOTH:
             $row = db2_fetch_both($this->_stmt);
             break;
         case Zend_Db::FETCH_OBJ:
             $row = db2_fetch_object($this->_stmt);
             break;
         case Zend_Db::FETCH_BOUND:
             $row = db2_fetch_both($this->_stmt);
             if ($row !== false) {
                 return $this->_fetchBound($row);
             }
             break;
         default:
             /**
              * @see Zend_Db_Statement_Db2_Exception
              */
             require_once PHP_LIBRARY_PATH . 'Zend/Db/Statement/Db2/Exception.php';
             throw new Zend_Db_Statement_Db2_Exception("Invalid fetch mode '{$style}' specified");
             break;
     }
     return $row;
 }
开发者ID:netixx,项目名称:Stock,代码行数:46,代码来源:Db2.php

示例13: fetch

 /**
  * {@inheritdoc}
  */
 public function fetch($fetchMode = null)
 {
     $fetchMode = $fetchMode ?: $this->_defaultFetchMode;
     switch ($fetchMode) {
         case \PDO::FETCH_BOTH:
             return db2_fetch_both($this->_stmt);
         case \PDO::FETCH_ASSOC:
             return db2_fetch_assoc($this->_stmt);
         case \PDO::FETCH_NUM:
             return db2_fetch_array($this->_stmt);
         default:
             throw new DB2Exception("Given Fetch-Style " . $fetchMode . " is not supported.");
     }
 }
开发者ID:ashimidashajia,项目名称:zendstore,代码行数:17,代码来源:DB2Statement.php

示例14: performQuery

 /**
  * Executes an SQL query
  * 
  * @param  string|fStatement $statement  The statement to perform
  * @param  fResult           $result     The result object for the query
  * @param  array             $params     The parameters for prepared statements
  * @return void
  */
 private function performQuery($statement, $result, $params)
 {
     $this->setErrorHandler();
     $extra = NULL;
     if (is_object($statement)) {
         $statement->executeQuery($result, $params, $extra, $statement != $this->statement);
     } elseif ($this->extension == 'ibm_db2') {
         $extra = db2_exec($this->connection, $statement, array('cursor' => DB2_FORWARD_ONLY));
         if (is_resource($extra)) {
             $rows = array();
             while ($row = db2_fetch_assoc($extra)) {
                 $rows[] = $row;
             }
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult($extra);
         }
     } elseif ($this->extension == 'mssql') {
         $result->setResult(mssql_query($result->getSQL(), $this->connection));
     } elseif ($this->extension == 'mysql') {
         $result->setResult(mysql_query($result->getSQL(), $this->connection));
     } elseif ($this->extension == 'mysqli') {
         $result->setResult(mysqli_query($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'oci8') {
         $extra = oci_parse($this->connection, $result->getSQL());
         if (oci_execute($extra, $this->inside_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS)) {
             oci_fetch_all($extra, $rows, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC);
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult(FALSE);
         }
     } elseif ($this->extension == 'odbc') {
         $extra = odbc_exec($this->connection, $result->getSQL());
         if (is_resource($extra)) {
             $rows = array();
             // Allow up to 1MB of binary data
             odbc_longreadlen($extra, 1048576);
             odbc_binmode($extra, ODBC_BINMODE_CONVERT);
             while ($row = odbc_fetch_array($extra)) {
                 $rows[] = $row;
             }
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult($extra);
         }
     } elseif ($this->extension == 'pgsql') {
         $result->setResult(pg_query($this->connection, $result->getSQL()));
     } elseif ($this->extension == 'sqlite') {
         $result->setResult(sqlite_query($this->connection, $result->getSQL(), SQLITE_ASSOC, $extra));
     } elseif ($this->extension == 'sqlsrv') {
         $extra = sqlsrv_query($this->connection, $result->getSQL());
         if (is_resource($extra)) {
             $rows = array();
             while ($row = sqlsrv_fetch_array($extra, SQLSRV_FETCH_ASSOC)) {
                 $rows[] = $row;
             }
             $result->setResult($rows);
             unset($rows);
         } else {
             $result->setResult($extra);
         }
     } elseif ($this->extension == 'pdo') {
         if (preg_match('#^\\s*CREATE(\\s+OR\\s+REPLACE)?\\s+TRIGGER#i', $result->getSQL())) {
             $this->connection->exec($result->getSQL());
             $extra = FALSE;
             $returned_rows = array();
         } else {
             $extra = $this->connection->query($result->getSQL());
             $returned_rows = is_object($extra) ? $extra->fetchAll(PDO::FETCH_ASSOC) : $extra;
             // The pdo_pgsql driver likes to return empty rows equal to the number of affected rows for insert and deletes
             if ($this->type == 'postgresql' && $returned_rows && $returned_rows[0] == array()) {
                 $returned_rows = array();
             }
         }
         $result->setResult($returned_rows);
     }
     $this->statement = $statement;
     $this->restoreErrorHandler();
     $this->checkForError($result, $extra);
     if ($this->extension == 'ibm_db2') {
         $this->setAffectedRows($result, $extra);
         if ($extra && !is_object($statement)) {
             db2_free_result($extra);
         }
     } elseif ($this->extension == 'pdo') {
         $this->setAffectedRows($result, $extra);
         if ($extra && !is_object($statement)) {
             $extra->closeCursor();
         }
//.........这里部分代码省略.........
开发者ID:philip,项目名称:flourish,代码行数:101,代码来源:fDatabase.php

示例15: fetch_assoc

 /**
  * fetch_assoc()
  *
  * This function fetches a result as an associative array.
  *
  * @param   mixed $result
  * @return  array
  * @access  public
  * @author  Thorsten Rinne <thorsten@phpmyfaq.de>
  * @since   2005-04-16
  */
 function fetch_assoc($result)
 {
     $_result = db2_fetch_assoc($result);
     if (is_array($_result)) {
         return array_change_key_case($_result, CASE_LOWER);
     } else {
         return false;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:20,代码来源:ibm_db2.php


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