/** * make execute return the result instead of a bool * * @param array $input * @return \OC_DB_StatementWrapper|int */ public function execute($input = array()) { if (OC_Config::getValue("log_query", false)) { $params_str = str_replace("\n", " ", var_export($input, true)); OC_Log::write('core', 'DB execute with arguments : ' . $params_str, OC_Log::DEBUG); } $this->lastArguments = $input; if (count($input) > 0) { if (!isset($type)) { $type = OC_Config::getValue("dbtype", "sqlite"); } if ($type == 'mssql') { $input = $this->tryFixSubstringLastArgumentDataForMSSQL($input); } $result = $this->statement->execute($input); } else { $result = $this->statement->execute(); } if ($result === false) { return false; } if ($this->isManipulation) { return $this->statement->rowCount(); } else { return $this; } }
/** * make execute return the result instead of a bool * * @param array $input * @return \OC_DB_StatementWrapper|int */ public function execute($input = array()) { if (\OC::$server->getSystemConfig()->getValue("log_query", false)) { $params_str = str_replace("\n", " ", var_export($input, true)); \OCP\Util::writeLog('core', 'DB execute with arguments : ' . $params_str, \OCP\Util::DEBUG); } $this->lastArguments = $input; if (count($input) > 0) { $result = $this->statement->execute($input); } else { $result = $this->statement->execute(); } if ($result === false) { return false; } if ($this->isManipulation) { $count = $this->statement->rowCount(); return $count; } else { return $this; } }
/** * Return an object property * * @param string $strKey The property name * * @return mixed|null The property value or null */ public function __get($strKey) { switch ($strKey) { case 'query': return $this->strQuery; break; case 'error': $info = $this->statement->errorInfo(); return 'SQLSTATE ' . $info[0] . ': error ' . $info[1] . ': ' . $info[2]; break; case 'affectedRows': return $this->statement->rowCount(); break; case 'insertId': return $this->resConnection->lastInsertId(); break; } return null; }
/** * Acts as the relative *_result() function of most DB drivers and fetches a * specific line and a field * * @param Statement $resource * @param int $row * @param string $field * * @return mixed */ public static function result(Statement $resource, $row, $field = '') { if ($resource->rowCount() > 0) { $result = $resource->fetchAll(PDO::FETCH_BOTH); return $result[$row][$field]; } }
/** * Performs a DELETE or UPDATE query to the database. * @param \Doctrine\DBAL\Driver\Statement $query * @param array $parameters * @return bool true if at least one row was modified, false otherwise */ protected function modify($query, $parameters) { $result = $query->execute($parameters); return $result === true && $query->rowCount() > 0; }
public function rowCount() { return $this->stmt->rowCount(); }
public function rowCount() { return $this->wrapped->rowCount(); }
/** * rowCount * rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement * executed by the corresponding object. * * If the last SQL statement executed by the associated Statement object was a SELECT statement, * some databases may return the number of rows returned by that statement. However, * this behaviour is not guaranteed for all databases and should not be * relied on for portable applications. * * @return integer Returns the number of rows. */ public function rowCount() { return $this->statement->rowCount(); }
/** * Acts as the relative *_result() function of most DB drivers and fetches a * specific line and a field * @param \Doctrine\DBAL\Driver\Statement The database resource to get data from * @param integer The row number * @param string Optional field name or number * @return mixed One cell of the result, or FALSE on error */ public static function result(\Doctrine\DBAL\Driver\Statement $resource, $row, $field = 0) { if ($resource->rowCount() > 0) { $result = $resource->fetchAll(PDO::FETCH_BOTH); return $result[$row][$field]; } return null; }
/** * Get the number of rows for a query from the MySQL database via the result * * @param \Doctrine\DBAL\Driver\Statement $result * @return int The number of rows reported from the database */ public function getNumberOfRowsFromResult(\Doctrine\DBAL\Driver\Statement $result) { return (int) $result->rowCount(); }