ENHANCEMENT: added transaction support

This commit is contained in:
Andreas Piening 2010-06-24 05:37:45 +00:00
parent 1e22a12cd6
commit 77f453c036

View File

@ -72,7 +72,7 @@ class MSSQLDatabase extends SS_Database {
*/
public static $noiseWords = array("about", "1", "after", "2", "all", "also", "3", "an", "4", "and", "5", "another", "6", "any", "7", "are", "8", "as", "9", "at", "0", "be", "$", "because", "been", "before", "being", "between", "both", "but", "by", "came", "can", "come", "could", "did", "do", "does", "each", "else", "for", "from", "get", "got", "has", "had", "he", "have", "her", "here", "him", "himself", "his", "how", "if", "in", "into", "is", "it", "its", "just", "like", "make", "many", "me", "might", "more", "most", "much", "must", "my", "never", "no", "now", "of", "on", "only", "or", "other", "our", "out", "over", "re", "said", "same", "see", "should", "since", "so", "some", "still", "such", "take", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "those", "through", "to", "too", "under", "up", "use", "very", "want", "was", "way", "we", "well", "were", "what", "when", "where", "which", "while", "who", "will", "with", "would", "you", "your", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
protected $supportsTransactions = false;
protected $supportsTransactions = true;
/**
* Cached flag to determine if full-text is enabled. This is set by
@ -1325,14 +1325,14 @@ class MSSQLDatabase extends SS_Database {
* See http://developer.postgresql.org/pgdocs/postgres/sql-set-transaction.html for details on transaction isolation options
*/
public function startTransaction($transaction_mode=false, $session_characteristics=false){
//Transactions not set up for MSSQL yet
DB::query('BEGIN TRANSACTION');
}
/*
* Create a savepoint that you can jump back to if you encounter problems
*/
public function transactionSavepoint($savepoint){
//Transactions not set up for MSSQL yet
DB::query("SAVE TRANSACTION \"$savepoint\"");
}
/*
@ -1341,14 +1341,19 @@ class MSSQLDatabase extends SS_Database {
* need to rollback that particular query, or return to a savepoint
*/
public function transactionRollback($savepoint=false){
//Transactions not set up for MSSQL yet
if($savepoint) {
DB::query("ROLLBACK TRANSACTION \"$savepoint\"");
} else {
DB::query('ROLLBACK TRANSACTION');
}
}
/*
* Commit everything inside this transaction so far
*/
public function endTransaction(){
//Transactions not set up for MSSQL yet
DB::query('COMMIT TRANSACTION');
}
/**
@ -1529,6 +1534,7 @@ class MSSQLQuery extends SS_Query {
}
public function numRecords() {
if(!is_resource($this->handle)) return false;
if($this->mssql) {
return mssql_num_rows($this->handle);
} else {
@ -1540,6 +1546,9 @@ class MSSQLQuery extends SS_Query {
}
public function nextRecord() {
if(!is_resource($this->handle)) return false;
// Coalesce rather than replace common fields.
$output = array();