Пример #1
0
 /**
  * Obtain a list of a given type of objects
  *
  * @param string $type  the kind of objects you want to retrieve
  *
  * @return array  the array containing the list of objects requested
  *
  * @access protected
  * @see DB_common::getListOf()
  */
 function getSpecialQuery($type)
 {
     switch ($type) {
         case 'databases':
             $id = @msql_list_dbs($this->connection);
             break;
         case 'tables':
             $id = @msql_list_tables($this->dsn['database'], $this->connection);
             break;
         default:
             return null;
     }
     if (!$id) {
         return $this->msqlRaiseError();
     }
     $out = array();
     while ($row = @msql_fetch_row($id)) {
         $out[] = $row[0];
     }
     return $out;
 }
Пример #2
0
function sql_fetch_row(&$res, $nr = 0)
{
    global $dbtype;
    switch ($dbtype) {
        case "MySQL":
            $row = mysql_fetch_row($res);
            return $row;
            break;
        case "mSQL":
            $row = msql_fetch_row($res);
            return $row;
            break;
        case "postgres":
        case "postgres_local":
            if ($res->get_total_rows() > $res->get_fetched_rows()) {
                $row = pg_fetch_row($res->get_result(), $res->get_fetched_rows());
                $res->increment_fetched_rows();
                return $row;
            } else {
                return false;
            }
            break;
        case "ODBC":
        case "ODBC_Adabas":
            $row = array();
            $cols = odbc_fetch_into($res, $nr, $row);
            return $row;
            break;
        case "Interbase":
            $row = ibase_fetch_row($res);
            return $row;
            break;
        case "Sybase":
            $row = sybase_fetch_row($res);
            return $row;
            break;
        default:
            break;
    }
}
Пример #3
0
 /**
  * Fetch a row and insert the data into an existing array.
  *
  * Formating of the array and the data therein are configurable.
  * See DB_result::fetchInto() for more information.
  *
  * @param resource $result    query result identifier
  * @param array    $arr       (reference) array where data from the row
  *                            should be placed
  * @param int      $fetchmode how the resulting array should be indexed
  * @param int      $rownum    the row number to fetch
  *
  * @return mixed DB_OK on success, null when end of result set is
  *               reached or on failure
  *
  * @see DB_result::fetchInto()
  * @access private
  */
 function fetchInto($result, &$arr, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@msql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $arr = @msql_fetch_array($result, MSQL_ASSOC);
         if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
             $arr = array_change_key_case($arr, CASE_LOWER);
         }
     } else {
         $arr = @msql_fetch_row($result);
     }
     if (!$arr) {
         if ($error = @msql_error()) {
             return $this->raiseError($error);
         } else {
             return null;
         }
     }
     if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
         $this->_rtrimArrayValues($arr);
     }
     if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
         $this->_convertNullArrayValuesToEmpty($arr);
     }
     return DB_OK;
 }
Пример #4
0
 function fetchInto($result, &$ar, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@msql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $ar = @msql_fetch_array($result, MSQL_ASSOC);
     } else {
         $ar = @msql_fetch_row($result);
     }
     if (!$ar) {
         if ($error = msql_error()) {
             return $this->raiseError($error);
         } else {
             return null;
         }
     }
     return DB_OK;
 }
Пример #5
0
 function FetchResultArray($result, &$array, $row)
 {
     if (isset($this->limits[$result])) {
         if ($row > $this->limits[$result][1]) {
             return $this->SetError("Fetch result array", "attempted to retrieve a row beyhond the result limit");
         }
         $actual_row = $row + $this->limits[$result][0];
     } else {
         $actual_row = $row;
     }
     if (!msql_data_seek($result, $row) || !($array = msql_fetch_row($result))) {
         return $this->SetError("Fetch result array", msql_error());
     }
     $this->highest_fetched_row[$result] = max($this->highest_fetched_row[$result], $row);
     return $this->ConvertResultRow($result, $array);
 }
Пример #6
0
function FullSearchNextMatch($dbi, $res)
{
    global $WikiPageStore;
    if ($row = msql_fetch_row($res)) {
        return RetrievePage($dbi, $row[0], $WikiPageStore);
    } else {
        return 0;
    }
}