// Initialize the result data, this need to be rewritten e.g. if a local file cannot be read
$resultData = array(
- 'status' => LocalfileDatabase::RESULT_OKAY,
- 'rows' => array()
+ BaseDatabaseFrontend::RESULT_INDEX_STATUS => LocalfileDatabase::RESULT_OKAY,
+ BaseDatabaseFrontend::RESULT_INDEX_ROWS => array()
);
// Initialize limit/skip
$idx = 1;
// Read the directory with some exceptions
- while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', "info." . $this->getFileExtension()))) && ($limitFound < $criteriaInstance->getLimit())) {
+ while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', 'info.' . $this->getFileExtension()))) && (($limitFound < $criteriaInstance->getLimit()) || ($criteriaInstance->getLimit() == 0))) {
// Does the extension match?
if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
// Skip this file!
$criteria = $criteriaInstance->getCriteriaElemnent($key);
// Is the criteria met?
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: criteria[' . gettype($criteria) . ']=' . $criteria . ',()=' . strlen($criteria) . ',value=' . $value . ',()=' . strlen($value));
if ((!is_null($criteria)) && ($criteria == $value)) {
-
// Shall we skip this entry?
if ($criteriaInstance->getSkip() > 0) {
// We shall skip some entries
$dataArray[$this->getIndexKey()] = $idx;
// Entry found!
- $resultData['rows'][] = $dataArray;
+ //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: indexKey=' . $this->getIndexKey() . ',idx=' . $idx . ',dataArray=' . print_r($dataArray, true));
+ $resultData[BaseDatabaseFrontend::RESULT_INDEX_ROWS][] = $dataArray;
// Count found entries up
$limitFound++;
} catch (PathIsNoDirectoryException $e) {
// Path not found means "table not found" for real databases...
$this->lastException = $e;
- $this->lastError = $e->getMessage();
+ $this->lastError = $e->getMessage();
// So throw an SqlException here with faked error message
throw new SqlException (array($this, sprintf("Table '%s' not found", $tableName), self::DB_CODE_TABLE_MISSING), self::EXCEPTION_SQL_QUERY);
} catch (FrameworkException $e) {
// Catch all exceptions and store them in last error
$this->lastException = $e;
- $this->lastError = $e->getMessage();
+ $this->lastError = $e->getMessage();
}
// Return the gathered result
$this->lastError = $e->getMessage();
// Throw an SQL exception
- throw new SqlException (array($this, sprintf("Cannot write data to table '%s', is the table created?", $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
+ throw new SqlException(array($this, sprintf("Cannot write data to table '%s', is the table created?", $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
}
}
$this->lastError = $e->getMessage();
// Throw an SQL exception
- throw new SqlException (array($this, sprintf("Cannot write data to table '%s', is the table created?", $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
+ throw new SqlException(array($this, sprintf("Cannot write data to table '%s', is the table created?", $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
}
}