  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: mysql.php 1120 2006-11-09 16:43:55Z hpdl $ |
| |
| 3 | + | $Id: mysql.php 1290 2007-03-01 19:36:08Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
7 | 7 | | |
  |
8 | | - | Copyright (c) 2006 osCommerce |
| |
| 8 | + | Copyright (c) 2007 osCommerce |
|
9 | 9 | | |
| |
10 | 10 | | Released under the GNU General Public License |
| |
11 | 11 | | */ |
| |
|
|
 |
… |
|
183 | 183 | | } |
| |
184 | 184 | | |
| |
185 | 185 | | function nextID() { |
  |
186 | | - | if ($id = @mysql_insert_id($this->link)) { |
| |
| 186 | + | if ( is_numeric($this->nextID) ) { |
| |
| 187 | + | $id = $this->nextID; |
| |
| 188 | + | $this->nextID = null; |
| |
| 189 | + | |
|
187 | 190 | | return $id; |
  |
| 191 | + | } elseif ($id = @mysql_insert_id($this->link)) { |
| |
| 192 | + | return $id; |
|
188 | 193 | | } else { |
| |
189 | 194 | | $this->setError(mysql_error($this->link), mysql_errno($this->link)); |
| |
190 | 195 | | |
| |
|
|
 |
… |
|
200 | 205 | | return mysql_affected_rows($this->link); |
| |
201 | 206 | | } |
| |
202 | 207 | | |
  |
203 | | - | function startTransaction() { |
| |
| 208 | + | function startTransaction($logging = false) { |
| |
| 209 | + | if ($logging === true) { |
| |
| 210 | + | $this->logging_transaction = true; |
| |
| 211 | + | } |
| |
| 212 | + | |
|
204 | 213 | | if ($this->use_transactions === true) { |
| |
205 | 214 | | return $this->simpleQuery('start transaction'); |
| |
206 | 215 | | } |
| |
|
|
 |
… |
|
209 | 218 | | } |
| |
210 | 219 | | |
| |
211 | 220 | | function commitTransaction() { |
  |
| 221 | + | if ($this->logging_transaction === true) { |
| |
| 222 | + | $this->logging_transaction = false; |
| |
| 223 | + | $this->logging_transaction_action = false; |
| |
| 224 | + | } |
| |
| 225 | + | |
|
212 | 226 | | if ($this->use_transactions === true) { |
| |
213 | 227 | | return $this->simpleQuery('commit'); |
| |
214 | 228 | | } |
| |
|
|
 |
… |
|
217 | 231 | | } |
| |
218 | 232 | | |
| |
219 | 233 | | function rollbackTransaction() { |
  |
| 234 | + | if ($this->logging_transaction === true) { |
| |
| 235 | + | $this->logging_transaction = false; |
| |
| 236 | + | $this->logging_transaction_action = false; |
| |
| 237 | + | } |
| |
| 238 | + | |
  |
220 | 239 | | if ($this->use_transactions === true) { |
| |
221 | 240 | | return $this->simpleQuery('rollback'); |
| |
222 | 241 | | } |