little DQL LIMIT fix
This commit is contained in:
parent
beda312f1c
commit
bdce1d8d62
@ -15,14 +15,14 @@ class Doctrine_Cache_Query_Sqlite implements Countable {
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* Doctrine_Table $table
|
||||
* @param Doctrine_Connection|null $connection
|
||||
*/
|
||||
public function __construct(Doctrine_Session $session) {
|
||||
$this->session = $session;
|
||||
$dir = $session->getAttribute(Doctrine::ATTR_CACHE_DIR);
|
||||
public function __construct($connection = null) {
|
||||
if( ! ($connection instanceof Doctrine_Session))
|
||||
$connection = Doctrine_Manager::getInstance()->getCurrentConnection();
|
||||
|
||||
if( ! is_dir($dir))
|
||||
mkdir($dir, 0777);
|
||||
$this->session = $connection;
|
||||
$dir = $this->session->getAttribute(Doctrine::ATTR_CACHE_DIR);
|
||||
|
||||
$this->path = $dir.DIRECTORY_SEPARATOR;
|
||||
$this->dbh = new PDO("sqlite::memory:");
|
||||
@ -83,6 +83,17 @@ class Doctrine_Cache_Query_Sqlite implements Countable {
|
||||
$stmt = $this->dbh->query($sql);
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
/**
|
||||
* deleteExpired
|
||||
* returns the number of deleted rows
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function deleteExpired() {
|
||||
$sql = "DELETE FROM ".self::CACHE_TABLE." WHERE expired < ?";
|
||||
$stmt = $this->dbh->prepare($sql);
|
||||
$stmt->execute(array(time()));
|
||||
}
|
||||
/**
|
||||
* delete
|
||||
* returns whether or not the given
|
||||
|
@ -250,7 +250,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
|
||||
* @return boolean
|
||||
*/
|
||||
public function isLimitSubqueryUsed() {
|
||||
return true;
|
||||
return $this->limitSubqueryUsed;
|
||||
}
|
||||
/**
|
||||
* returns the built sql query
|
||||
|
@ -35,7 +35,8 @@ class Doctrine_ViewTestCase extends Doctrine_UnitTestCase {
|
||||
$success = false;
|
||||
}
|
||||
$this->assertTrue($success);
|
||||
|
||||
}
|
||||
public function testConstructor() {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ require_once("QueryLimitTestCase.php");
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$test = new GroupTest("Doctrine Framework Unit Tests");
|
||||
/**
|
||||
|
||||
$test->addTestCase(new Doctrine_RecordTestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_SessionTestCase());
|
||||
@ -64,10 +64,10 @@ $test->addTestCase(new Doctrine_ValidatorTestCase());
|
||||
$test->addTestCase(new Doctrine_CollectionTestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_QueryTestCase());
|
||||
*/
|
||||
|
||||
$test->addTestCase(new Doctrine_Query_Limit_TestCase());
|
||||
|
||||
//$test->addTestCase(new Doctrine_RawSql_TestCase());
|
||||
$test->addTestCase(new Doctrine_RawSql_TestCase());
|
||||
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
|
||||
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user