/**
  * Fetch a row and return data in an array.
  *
  * @param resource $result result identifier
  * @param int $fetchmode ignored
  * @param int $rownum the row number to fetch
  * @return mixed data array or NULL on success, a MDB error on failure
  * @access public
  */
 function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = NULL)
 {
     $result_value = intval($result);
     if ($rownum == NULL) {
         ++$this->highest_fetched_row[$result_value];
     } else {
         if (!@fbsql_data_seek($result, $rownum)) {
             return NULL;
         }
         $this->highest_fetched_row[$result_value] = max($this->highest_fetched_row[$result_value], $rownum);
     }
     if ($fetchmode == MDB_FETCHMODE_DEFAULT) {
         $fetchmode = $this->fetchmode;
     }
     if ($fetchmode & MDB_FETCHMODE_ASSOC) {
         $row = @fbsql_fetch_assoc($result);
         if (is_array($row) && $this->options['optimize'] == 'portability') {
             $row = array_change_key_case($row, CASE_LOWER);
         }
     } else {
         $row = @fbsql_fetch_row($result);
     }
     if (!$row) {
         if ($this->options['autofree']) {
             $this->freeResult($result);
         }
         return NULL;
     }
     if (isset($this->result_types[$result_value])) {
         $row = $this->convertResultRow($result, $row);
     }
     return $row;
 }
Ejemplo n.º 2
0
 public function fetchAssoc()
 {
     if (!empty($this->query)) {
         return fbsql_fetch_assoc($this->query);
     } else {
         return false;
     }
 }
Ejemplo n.º 3
0
 function Send()
 {
     $this->error_message();
     $this->getHeader();
     if ($this->smtp) {
         $this->checkSmtp($this->hostSmtp, $this->portSmtp, $this->authenticate, $this->userSmtp, $this->passSmtp);
         $this->socket = $this->connectSmtp($this->hostSmtp, $this->portSmtp, $this->timeoutSmtp);
         switch ($this->smtpServer) {
             case 'esmtp':
                 $this->smtpEhlo($this->socket);
                 break;
             case 'smtp':
                 $this->smtpHelo($this->socket);
                 break;
             case 'test':
                 if ($this->smtpEhlo($this->socket)) {
                     echo nl2br("Connection successful... \r\n Server type: esmtp server \n");
                     return false;
                 } else {
                     $this->smtpQuit($this->socket);
                     $this->disconnectSmtp($this->socket);
                     $this->socket = $this->connectSmtp($this->hostSmtp, $this->portSmtp, $this->timeoutSmtp);
                     if ($this->smtpHelo($this->socket)) {
                         echo nl2br("Connection successful... \r\n Server type: smtp server \n");
                         return false;
                     } else {
                         echo nl2br("Server type: unknown server. \n");
                         return false;
                     }
                 }
         }
         $this->smtpAuth($this->authenticate);
     }
     if ($this->use == "whom") {
         $this->readData($this->setWhom($this->whom));
     } elseif ($this->use == "maillist") {
         $this->readData($this->checkMaillist($this->list));
     } elseif ($this->use == "DB" || $this->use == "all") {
         switch ($this->dbfbasa) {
             case 'mysql':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = mysql_fetch_assoc($this->query_result)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'pgsql':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = pg_fetch_assoc($this->query_result)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'ibase':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = ibase_fetch_assoc($this->query_result)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'msql':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = msql_fetch_array($this->query_result, MSQL_ASSOC)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'fbsql':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = fbsql_fetch_assoc($this->query_result)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'sqli':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = sqlite_fetch_array($this->query_result, SQLITE_ASSOC)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'oci':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = oci_fetch_assoc($this->query_result)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'sybase':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = sybase_fetch_assoc($this->query_result)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'ingres':
                 if (!$this->query_result) {
                     return false;
                 }
                 while ($this->tos = ingres_fetch_array($this->query_result, INGRES_ASSOC)) {
                     $this->readData($this->tos);
                 }
                 break;
             case 'phpmm':
                 if ($this->use == "all") {
                     $this->tos = array_merge($this->setWhom($this->whom), $this->checkMaillist($this->list));
                     $this->readData($this->tos);
                 }
                 break;
         }
     }
     if ($this->smtp) {
         $this->smtpQuit($this->socket);
         $this->disconnectSmtp($this->socket);
     }
 }
Ejemplo n.º 4
0
 /**
  * Fetch a row and insert the data into an existing array.
  *
  * @param int       $fetchmode  how the array data should be indexed
  * @param int    $rownum    number of the row where the data can be found
  * @return int data array on success, a MDB2 error on failure
  * @access public
  */
 function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
 {
     if (null !== $rownum) {
         $seek = $this->seek($rownum);
         if (MDB2::isError($seek)) {
             return $seek;
         }
     }
     if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
         $fetchmode = $this->db->fetchmode;
     }
     if ($fetchmode == MDB2_FETCHMODE_ASSOC || $fetchmode == MDB2_FETCHMODE_OBJECT) {
         $row = @fbsql_fetch_assoc($this->result);
         if (is_array($row) && $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
             $row = array_change_key_case($row, $this->db->options['field_case']);
         }
     } else {
         $row = @fbsql_fetch_row($this->result);
     }
     if (!$row) {
         if (false === $this->result) {
             $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__);
             return $err;
         }
         $null = null;
         return $null;
     }
     $mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
     if ($mode) {
         $this->db->_fixResultArrayValues($row, $mode);
     }
     if ($fetchmode == MDB2_FETCHMODE_ORDERED) {
         if (!empty($this->types)) {
             $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
         }
     } elseif (!empty($this->types_assoc)) {
         $row = $this->db->datatype->convertResultRow($this->types_assoc, $row, $rtrim);
     }
     if (!empty($this->values)) {
         $this->_assignBindColumns($row);
     }
     if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
         $object_class = $this->db->options['fetch_class'];
         if ($object_class == 'stdClass') {
             $row = (object) $row;
         } else {
             $row = new $object_class($row);
         }
     }
     ++$this->rownum;
     return $row;
 }