Exemple #1
0
 /**
  * Read URL for not-yet-inserted log-entry
  *
  * @param	integer		Queue field array,
  * @return	string
  */
 function readUrlFromArray($field_array)
 {
     // Set exec_time to lock record:
     $field_array['exec_time'] = $this->getCurrentTime();
     $this->db->exec_INSERTquery('tx_crawler_queue', $field_array);
     $queueId = $field_array['qid'] = $this->db->sql_insert_id();
     $result = $this->readUrl_exec($field_array);
     // Set result in log which also denotes the end of the processing of this entry.
     $field_array = array('result_data' => serialize($result));
     $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array);
     return $result;
 }
 /**
  * Adds a row to the storage
  *
  * @param string $tableName The database table name
  * @param array $row The row to be inserted
  * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
  * @return int The uid of the inserted row
  */
 public function addRow($tableName, array $row, $isRelation = FALSE)
 {
     $fields = array();
     $values = array();
     $parameters = array();
     if (isset($row['uid'])) {
         unset($row['uid']);
     }
     foreach ($row as $columnName => $value) {
         $fields[] = $columnName;
         $values[] = '?';
         $parameters[] = $value;
     }
     $sqlString = 'INSERT INTO ' . $tableName . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';
     $this->replacePlaceholders($sqlString, $parameters);
     // debug($sqlString,-2);
     $this->databaseHandle->sql_query($sqlString);
     $this->checkSqlErrors($sqlString);
     $uid = $this->databaseHandle->sql_insert_id();
     if (!$isRelation) {
         $this->clearPageCache($tableName, $uid);
     }
     return (int) $uid;
 }