  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: mysql.php 757 2006-08-23 12:22:54Z hpdl $ |
| |
| 3 | + | $Id: mysql.php 1319 2007-03-05 20:43:07Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
7 | 7 | | |
  |
8 | | - | Copyright (c) 2004 osCommerce |
| |
| 8 | + | Copyright (c) 2006 osCommerce |
|
9 | 9 | | |
| |
10 | 10 | | Released under the GNU General Public License |
| |
11 | 11 | | */ |
| |
12 | 12 | | |
  |
13 | | - | if (!function_exists('mysql_fetch_assoc')) { |
| |
14 | | - | function mysql_fetch_assoc($resource) { |
| |
15 | | - | return mysql_fetch_array($resource, MYSQL_ASSOC); |
| |
16 | | - | } |
| |
17 | | - | } |
| |
18 | | - | |
|
19 | 13 | | class osC_Database_mysql extends osC_Database { |
  |
20 | | - | var $sql_parse_string = 'addslashes', |
| |
21 | | - | $sql_parse_string_with_connection_handler = false, |
| |
22 | | - | $use_transactions = false, |
| |
| 14 | + | var $use_transactions = false, |
|
23 | 15 | | $use_fulltext = false, |
  |
24 | | - | $use_fulltext_boolean = false; |
| |
| 16 | + | $use_fulltext_boolean = false, |
| |
| 17 | + | $sql_parse_string = 'mysql_escape_string', |
| |
| 18 | + | $sql_parse_string_with_connection_handler = false; |
|
25 | 19 | | |
| |
26 | 20 | | function osC_Database_mysql($server, $username, $password) { |
| |
27 | 21 | | $this->server = $server; |
| |
|
|
 |
… |
|
31 | 25 | | if (function_exists('mysql_real_escape_string')) { |
| |
32 | 26 | | $this->sql_parse_string = 'mysql_real_escape_string'; |
| |
33 | 27 | | $this->sql_parse_string_with_connection_handler = true; |
  |
34 | | - | } elseif (function_exists('mysql_escape_string')) { |
| |
35 | | - | $this->sql_parse_string = 'mysql_escape_string'; |
|
36 | 28 | | } |
| |
37 | 29 | | |
| |
38 | 30 | | if ($this->is_connected === false) { |
| |
|
|
 |
… |
|
84 | 76 | | } |
| |
85 | 77 | | } |
| |
86 | 78 | | |
  |
| 79 | + | function parseString($value) { |
| |
| 80 | + | if ($this->sql_parse_string_with_connection_handler === true) { |
| |
| 81 | + | return call_user_func_array($this->sql_parse_string, array($value, $this->link)); |
| |
| 82 | + | } else { |
| |
| 83 | + | return call_user_func_array($this->sql_parse_string, array($value)); |
| |
| 84 | + | } |
| |
| 85 | + | } |
| |
| 86 | + | |
  |
87 | 87 | | function simpleQuery($query, $debug = false) { |
| |
88 | 88 | | global $messageStack, $osC_Services; |
| |
89 | 89 | | |