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
|
* constructor
|
||||||
*
|
*
|
||||||
* Doctrine_Table $table
|
* @param Doctrine_Connection|null $connection
|
||||||
*/
|
*/
|
||||||
public function __construct(Doctrine_Session $session) {
|
public function __construct($connection = null) {
|
||||||
$this->session = $session;
|
if( ! ($connection instanceof Doctrine_Session))
|
||||||
$dir = $session->getAttribute(Doctrine::ATTR_CACHE_DIR);
|
$connection = Doctrine_Manager::getInstance()->getCurrentConnection();
|
||||||
|
|
||||||
if( ! is_dir($dir))
|
$this->session = $connection;
|
||||||
mkdir($dir, 0777);
|
$dir = $this->session->getAttribute(Doctrine::ATTR_CACHE_DIR);
|
||||||
|
|
||||||
$this->path = $dir.DIRECTORY_SEPARATOR;
|
$this->path = $dir.DIRECTORY_SEPARATOR;
|
||||||
$this->dbh = new PDO("sqlite::memory:");
|
$this->dbh = new PDO("sqlite::memory:");
|
||||||
@ -83,6 +83,17 @@ class Doctrine_Cache_Query_Sqlite implements Countable {
|
|||||||
$stmt = $this->dbh->query($sql);
|
$stmt = $this->dbh->query($sql);
|
||||||
return $stmt->rowCount();
|
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
|
* delete
|
||||||
* returns whether or not the given
|
* returns whether or not the given
|
||||||
|
@ -250,7 +250,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isLimitSubqueryUsed() {
|
public function isLimitSubqueryUsed() {
|
||||||
return true;
|
return $this->limitSubqueryUsed;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* returns the built sql query
|
* returns the built sql query
|
||||||
|
@ -35,7 +35,8 @@ class Doctrine_ViewTestCase extends Doctrine_UnitTestCase {
|
|||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
$this->assertTrue($success);
|
$this->assertTrue($success);
|
||||||
|
}
|
||||||
|
public function testConstructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ require_once("QueryLimitTestCase.php");
|
|||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$test = new GroupTest("Doctrine Framework Unit Tests");
|
$test = new GroupTest("Doctrine Framework Unit Tests");
|
||||||
/**
|
|
||||||
$test->addTestCase(new Doctrine_RecordTestCase());
|
$test->addTestCase(new Doctrine_RecordTestCase());
|
||||||
|
|
||||||
$test->addTestCase(new Doctrine_SessionTestCase());
|
$test->addTestCase(new Doctrine_SessionTestCase());
|
||||||
@ -64,10 +64,10 @@ $test->addTestCase(new Doctrine_ValidatorTestCase());
|
|||||||
$test->addTestCase(new Doctrine_CollectionTestCase());
|
$test->addTestCase(new Doctrine_CollectionTestCase());
|
||||||
|
|
||||||
$test->addTestCase(new Doctrine_QueryTestCase());
|
$test->addTestCase(new Doctrine_QueryTestCase());
|
||||||
*/
|
|
||||||
$test->addTestCase(new Doctrine_Query_Limit_TestCase());
|
$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_FileTestCase());
|
||||||
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
|
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user