mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 06:05:53 +00:00
FEATURE semi-numRows support on SQLSRV
This commit is contained in:
parent
f728294be2
commit
ab245adc60
@ -1193,7 +1193,7 @@ class MSSQLQuery extends Query {
|
|||||||
if($this->mssql) {
|
if($this->mssql) {
|
||||||
mssql_free_result($this->handle);
|
mssql_free_result($this->handle);
|
||||||
} else {
|
} else {
|
||||||
sqsrv_free_stmt($this->handle);
|
sqlsrv_free_stmt($this->handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1215,6 +1215,9 @@ class MSSQLQuery extends Query {
|
|||||||
* This is (usually) called from Database::rewind(), which in turn seems to be called when a foreach...
|
* This is (usually) called from Database::rewind(), which in turn seems to be called when a foreach...
|
||||||
* is started on a recordset
|
* is started on a recordset
|
||||||
*
|
*
|
||||||
|
* If you are using SQLSRV, this functon will just return a true or false based on whether you got
|
||||||
|
* /ANY/ rows.
|
||||||
|
*
|
||||||
* For this function, and seek() (above), we will be returning false.
|
* For this function, and seek() (above), we will be returning false.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1222,7 +1225,8 @@ class MSSQLQuery extends Query {
|
|||||||
if($this->mssql) {
|
if($this->mssql) {
|
||||||
return mssql_num_rows($this->handle);
|
return mssql_num_rows($this->handle);
|
||||||
} else {
|
} else {
|
||||||
user_error("MSSQLQuery::numRecords() sqlserv doesn't support numRecords.", E_USER_WARNING);
|
$this->firstRecord = $this->nextRecord();
|
||||||
|
return count($this->firstRecord) ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,6 +1249,11 @@ class MSSQLQuery extends Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if isset($this->firstRecord) && $this->firstRecord) {
|
||||||
|
$toReturn = $this->firstRecord;
|
||||||
|
$this->firstRecord = false;
|
||||||
|
return $toReturn;
|
||||||
|
}
|
||||||
if($data = sqlsrv_fetch_array($this->handle, SQLSRV_FETCH_NUMERIC)) {
|
if($data = sqlsrv_fetch_array($this->handle, SQLSRV_FETCH_NUMERIC)) {
|
||||||
$output = array();
|
$output = array();
|
||||||
$fields = sqlsrv_field_metadata($this->handle);
|
$fields = sqlsrv_field_metadata($this->handle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user