1
1
<?php
2
+ /**
3
+ * PHPspeed
4
+ *
5
+ * @author http://www.phpspeed.com
6
+ * @copyright 2006 http://www.phpspeed.com
7
+ * @license GPLv2 (or later)
8
+ */
9
+
10
+ /**
11
+ * 2012/03/03 Modified by Kenji Suzuki <https://github.com/kenjis/>
12
+ */
13
+
14
+ /***************************************************************************
15
+ *
16
+ * PHPspeed.com | PHP Benchmarking Script
17
+ * http://www.phpspeed.com
18
+ *
19
+ * Sat Mar 17, 2007 3:53 pm
20
+ * PHPspeed is now GPL licensed!!
21
+ * See http://www.phpspeed.com/phpspeed-forums-f1/phpspeed-is-now-gpl-licensed-t18.html
22
+ *
23
+ ***************************************************************************/
24
+
2
25
/***************************************************************************
3
26
*
4
27
* PHPspeed.com | PHP Benchmarking Script
@@ -38,29 +61,29 @@ function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = tr
38
61
39
62
if ($ this ->persistency )
40
63
{
41
- $ this ->db_connect_id = @ mysql_pconnect ($ this ->server , $ this ->user , $ this ->password );
64
+ $ this ->db_connect_id = mysql_pconnect ($ this ->server , $ this ->user , $ this ->password );
42
65
}
43
66
else
44
67
{
45
- $ this ->db_connect_id = @ mysql_connect ($ this ->server , $ this ->user , $ this ->password );
68
+ $ this ->db_connect_id = mysql_connect ($ this ->server , $ this ->user , $ this ->password );
46
69
}
47
70
if ($ this ->db_connect_id )
48
71
{
49
72
if ($ database != "" )
50
73
{
51
74
$ this ->dbname = $ database ;
52
- $ dbselect = @ mysql_select_db ($ this ->dbname );
75
+ $ dbselect = mysql_select_db ($ this ->dbname );
53
76
if (!$ dbselect )
54
77
{
55
- @ mysql_close ($ this ->db_connect_id );
78
+ mysql_close ($ this ->db_connect_id );
56
79
$ this ->db_connect_id = $ dbselect ;
57
80
}
58
81
}
59
82
return $ this ->db_connect_id ;
60
83
}
61
84
else
62
85
{
63
- return false ;
86
+ die ( ' Could not connect to the Mysql server !! ' ) ;
64
87
}
65
88
}
66
89
@@ -73,9 +96,9 @@ function sql_close()
73
96
{
74
97
if ($ this ->query_result )
75
98
{
76
- @ mysql_free_result ($ this ->query_result );
99
+ mysql_free_result ($ this ->query_result );
77
100
}
78
- $ result = @ mysql_close ($ this ->db_connect_id );
101
+ $ result = mysql_close ($ this ->db_connect_id );
79
102
return $ result ;
80
103
}
81
104
else
@@ -94,7 +117,7 @@ function sql_query($query = "", $transaction = FALSE)
94
117
if ($ query != "" )
95
118
{
96
119
$ this ->num_queries ++;
97
- $ this ->query_result = @ mysql_query ($ query , $ this ->db_connect_id );
120
+ $ this ->query_result = mysql_query ($ query , $ this ->db_connect_id );
98
121
}
99
122
if ($ this ->query_result )
100
123
{
@@ -104,7 +127,7 @@ function sql_query($query = "", $transaction = FALSE)
104
127
}
105
128
else
106
129
{
107
- return ( $ transaction == END_TRANSACTION ) ? true : false ;
130
+ return false ;
108
131
}
109
132
}
110
133
@@ -119,7 +142,7 @@ function sql_numrows($query_id = 0)
119
142
}
120
143
if ($ query_id )
121
144
{
122
- $ result = @ mysql_num_rows ($ query_id );
145
+ $ result = mysql_num_rows ($ query_id );
123
146
return $ result ;
124
147
}
125
148
else
@@ -131,7 +154,7 @@ function sql_affectedrows()
131
154
{
132
155
if ($ this ->db_connect_id )
133
156
{
134
- $ result = @ mysql_affected_rows ($ this ->db_connect_id );
157
+ $ result = mysql_affected_rows ($ this ->db_connect_id );
135
158
return $ result ;
136
159
}
137
160
else
@@ -147,7 +170,7 @@ function sql_numfields($query_id = 0)
147
170
}
148
171
if ($ query_id )
149
172
{
150
- $ result = @ mysql_num_fields ($ query_id );
173
+ $ result = mysql_num_fields ($ query_id );
151
174
return $ result ;
152
175
}
153
176
else
@@ -163,7 +186,7 @@ function sql_fieldname($offset, $query_id = 0)
163
186
}
164
187
if ($ query_id )
165
188
{
166
- $ result = @ mysql_field_name ($ query_id , $ offset );
189
+ $ result = mysql_field_name ($ query_id , $ offset );
167
190
return $ result ;
168
191
}
169
192
else
@@ -179,7 +202,7 @@ function sql_fieldtype($offset, $query_id = 0)
179
202
}
180
203
if ($ query_id )
181
204
{
182
- $ result = @ mysql_field_type ($ query_id , $ offset );
205
+ $ result = mysql_field_type ($ query_id , $ offset );
183
206
return $ result ;
184
207
}
185
208
else
@@ -195,9 +218,9 @@ function sql_fetchrow($query_id = 0)
195
218
}
196
219
if ($ query_id )
197
220
{
198
- //// $this->row[$query_id] = @ mysql_fetch_array($query_id);
221
+ //// $this->row[$query_id] = mysql_fetch_array($query_id);
199
222
// return $this->row[$query_id];
200
- return @ mysql_fetch_array ($ query_id );
223
+ return mysql_fetch_array ($ query_id );
201
224
}
202
225
else
203
226
{
@@ -214,7 +237,7 @@ function sql_fetchrowset($query_id = 0)
214
237
{
215
238
unset($ this ->rowset [$ query_id ]);
216
239
unset($ this ->row [$ query_id ]);
217
- while ($ this ->rowset [$ query_id ] = @ mysql_fetch_array ($ query_id ))
240
+ while ($ this ->rowset [$ query_id ] = mysql_fetch_array ($ query_id ))
218
241
{
219
242
$ result [] = $ this ->rowset [$ query_id ];
220
243
}
@@ -235,7 +258,7 @@ function sql_fetchfield($field, $rownum = -1, $query_id = 0)
235
258
{
236
259
if ($ rownum > -1 )
237
260
{
238
- $ result = @ mysql_result ($ query_id , $ rownum , $ field );
261
+ $ result = mysql_result ($ query_id , $ rownum , $ field );
239
262
}
240
263
else
241
264
{
@@ -272,7 +295,7 @@ function sql_rowseek($rownum, $query_id = 0){
272
295
}
273
296
if ($ query_id )
274
297
{
275
- $ result = @ mysql_data_seek ($ query_id , $ rownum );
298
+ $ result = mysql_data_seek ($ query_id , $ rownum );
276
299
return $ result ;
277
300
}
278
301
else
@@ -283,7 +306,7 @@ function sql_rowseek($rownum, $query_id = 0){
283
306
function sql_nextid (){
284
307
if ($ this ->db_connect_id )
285
308
{
286
- $ result = @ mysql_insert_id ($ this ->db_connect_id );
309
+ $ result = mysql_insert_id ($ this ->db_connect_id );
287
310
return $ result ;
288
311
}
289
312
else
@@ -302,7 +325,7 @@ function sql_freeresult($query_id = 0){
302
325
unset($ this ->row [$ query_id ]);
303
326
unset($ this ->rowset [$ query_id ]);
304
327
305
- @ mysql_free_result ($ query_id );
328
+ mysql_free_result ($ query_id );
306
329
307
330
return true ;
308
331
}
@@ -313,8 +336,8 @@ function sql_freeresult($query_id = 0){
313
336
}
314
337
function sql_error ($ query_id = 0 )
315
338
{
316
- $ result ["message " ] = @ mysql_error ($ this ->db_connect_id );
317
- $ result ["code " ] = @ mysql_errno ($ this ->db_connect_id );
339
+ $ result ["message " ] = mysql_error ($ this ->db_connect_id );
340
+ $ result ["code " ] = mysql_errno ($ this ->db_connect_id );
318
341
319
342
return $ result ;
320
343
}
0 commit comments