Skip to content

Commit

Permalink
Fixing FormAuthenticateTest for Sqlsrv
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jun 21, 2011
1 parent f1108b2 commit a34358f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
15 changes: 1 addition & 14 deletions lib/Cake/Model/Datasource/Database/Sqlserver.php
Expand Up @@ -517,20 +517,7 @@ public function renderStatement($type, $data) {
$offset = intval($offset[1]) + intval($limitVal[1]);
$rOrder = $this->__switchSort($order);
list($order2, $rOrder) = array($this->__mapFields($order), $this->__mapFields($rOrder));
$limit2 = str_replace('TOP', '', $limit);
if (!$order) {
$order = 'ORDER BY (SELECT NULL)';
}

$pagination = "
SELECT {$limit} * FROM (
SELECT {$fields}, ROW_NUMBER() OVER ({$order}) AS ssma\$rownum
FROM {$table} {$alias} {$joins} {$conditions} {$group}
) AS ssma\$sub1
WHERE ssma\$sub1.[ssma\$rownum] > {$limit2}
ORDER BY ssma\$sub1.[ssma\$rownum]
";
return $pagination;
return "SELECT * FROM (SELECT {$limit} * FROM (SELECT TOP {$offset} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}) AS Set1 {$rOrder}) AS Set2 {$order2}";
} else {
return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}";
}
Expand Down
Expand Up @@ -245,7 +245,7 @@ public function testCakeAdmin() {
$this->assertTrue($result);

$this->assertEqual(Configure::read('Routing.prefixes'), array('my_prefix'));
$file->delete();
@$file->delete();
}

/**
Expand Down
Expand Up @@ -44,7 +44,8 @@ public function setUp() {
'userModel' => 'User'
));
$password = Security::hash('password', null, true);
ClassRegistry::init('User')->updateAll(array('password' => '"' . $password . '"'));
$User = ClassRegistry::init('User');
$User->updateAll(array('password' => $User->getDataSource()->value($password)));
$this->response = $this->getMock('CakeResponse');
}

Expand Down

0 comments on commit a34358f

Please sign in to comment.