@@ -336,6 +336,9 @@ discard block |
||
336 | 336 | return $result; |
337 | 337 | } |
338 | 338 | |
339 | +/** |
|
340 | + * @param string $sql |
|
341 | + */ |
|
339 | 342 | function sqlf($sql) |
340 | 343 | { |
341 | 344 | global $db; |
@@ -349,6 +352,9 @@ discard block |
||
349 | 352 | return $result; |
350 | 353 | } |
351 | 354 | |
355 | +/** |
|
356 | + * @param string $sql |
|
357 | + */ |
|
352 | 358 | function sqlf_slave($sql) |
353 | 359 | { |
354 | 360 | global $db; |
@@ -362,6 +368,9 @@ discard block |
||
362 | 368 | return $result; |
363 | 369 | } |
364 | 370 | |
371 | +/** |
|
372 | + * @param string $sql |
|
373 | + */ |
|
365 | 374 | function sqll($sql) |
366 | 375 | { |
367 | 376 | global $db; |
@@ -375,6 +384,10 @@ discard block |
||
375 | 384 | return $result; |
376 | 385 | } |
377 | 386 | |
387 | +/** |
|
388 | + * @param string $sql |
|
389 | + * @param integer $default |
|
390 | + */ |
|
378 | 391 | function sqlf_value($sql, $default) |
379 | 392 | { |
380 | 393 | global $db; |
@@ -388,6 +401,10 @@ discard block |
||
388 | 401 | return $result; |
389 | 402 | } |
390 | 403 | |
404 | +/** |
|
405 | + * @param string $sql |
|
406 | + * @param integer $default |
|
407 | + */ |
|
391 | 408 | function sqll_value($sql, $default) |
392 | 409 | { |
393 | 410 | global $db; |
@@ -463,6 +480,9 @@ discard block |
||
463 | 480 | return sql_value_internal(true, $sql, $default, $args); |
464 | 481 | } |
465 | 482 | |
483 | +/** |
|
484 | + * @param boolean $bQuerySlave |
|
485 | + */ |
|
466 | 486 | function sql_value_internal($bQuerySlave, $sql, $default) |
467 | 487 | { |
468 | 488 | $args = func_get_args(); |
@@ -563,7 +583,7 @@ discard block |
||
563 | 583 | } |
564 | 584 | |
565 | 585 | /** |
566 | - * @param $rs |
|
586 | + * @param resource $rs |
|
567 | 587 | * |
568 | 588 | * @return array |
569 | 589 | */ |
@@ -616,11 +636,17 @@ discard block |
||
616 | 636 | return mysql_insert_id($db['dblink_slave']); |
617 | 637 | } |
618 | 638 | |
639 | +/** |
|
640 | + * @param resource $rs |
|
641 | + */ |
|
619 | 642 | function sql_num_rows($rs) |
620 | 643 | { |
621 | 644 | return mysql_num_rows($rs); |
622 | 645 | } |
623 | 646 | |
647 | +/** |
|
648 | + * @param string $table |
|
649 | + */ |
|
624 | 650 | function sql_temp_table($table) |
625 | 651 | { |
626 | 652 | global $db, $opt; |
@@ -650,6 +676,9 @@ discard block |
||
650 | 676 | $db['temptables'][$table] = $table; |
651 | 677 | } |
652 | 678 | |
679 | +/** |
|
680 | + * @param string $table |
|
681 | + */ |
|
653 | 682 | function sql_temp_table_slave($table) |
654 | 683 | { |
655 | 684 | global $db, $opt; |
@@ -670,6 +699,9 @@ discard block |
||
670 | 699 | $db['temptables_slave'][$table] = $table; |
671 | 700 | } |
672 | 701 | |
702 | +/** |
|
703 | + * @param string $table |
|
704 | + */ |
|
673 | 705 | function sql_drop_temp_table($table) |
674 | 706 | { |
675 | 707 | global $db, $opt; |
@@ -706,6 +738,9 @@ discard block |
||
706 | 738 | $db['temptables'][$newname] = $newname; |
707 | 739 | } |
708 | 740 | |
741 | +/** |
|
742 | + * @param string $table |
|
743 | + */ |
|
709 | 744 | function sql_drop_temp_table_slave($table) |
710 | 745 | { |
711 | 746 | global $db, $opt; |
@@ -1070,6 +1105,9 @@ discard block |
||
1070 | 1105 | } |
1071 | 1106 | } |
1072 | 1107 | |
1108 | +/** |
|
1109 | + * @param string $warnmessage |
|
1110 | + */ |
|
1073 | 1111 | function sql_warn($warnmessage) |
1074 | 1112 | { |
1075 | 1113 | global $opt; |
@@ -1097,6 +1135,9 @@ discard block |
||
1097 | 1135 | } |
1098 | 1136 | } |
1099 | 1137 | |
1138 | +/** |
|
1139 | + * @param resource $rs |
|
1140 | + */ |
|
1100 | 1141 | function sql_export_recordset($f, $rs, $table, $truncate = true) |
1101 | 1142 | { |
1102 | 1143 | fwrite($f, "SET NAMES 'utf8';\n"); |
@@ -1127,6 +1168,9 @@ discard block |
||
1127 | 1168 | } |
1128 | 1169 | } |
1129 | 1170 | |
1171 | +/** |
|
1172 | + * @param resource $f |
|
1173 | + */ |
|
1130 | 1174 | function sql_export_table($f, $table) |
1131 | 1175 | { |
1132 | 1176 | $primary = []; |
@@ -1148,6 +1192,10 @@ discard block |
||
1148 | 1192 | sql_free_result($rs); |
1149 | 1193 | } |
1150 | 1194 | |
1195 | +/** |
|
1196 | + * @param string $filename |
|
1197 | + * @param string[] $tables |
|
1198 | + */ |
|
1151 | 1199 | function sql_export_tables_to_file($filename, $tables) |
1152 | 1200 | { |
1153 | 1201 | $f = fopen($filename, 'w'); |
@@ -1175,6 +1223,9 @@ discard block |
||
1175 | 1223 | fclose($f); |
1176 | 1224 | } |
1177 | 1225 | |
1226 | +/** |
|
1227 | + * @param resource $f |
|
1228 | + */ |
|
1178 | 1229 | function sql_export_structure($f, $table) |
1179 | 1230 | { |
1180 | 1231 | $rs = sql("SHOW CREATE TABLE `&1`", $table); |
@@ -1190,6 +1241,9 @@ discard block |
||
1190 | 1241 | fwrite($f, $sTableSql . " ;\n"); |
1191 | 1242 | } |
1192 | 1243 | |
1244 | +/** |
|
1245 | + * @param string $filename |
|
1246 | + */ |
|
1193 | 1247 | function sql_export_structure_to_file($filename, $table) |
1194 | 1248 | { |
1195 | 1249 | $f = fopen($filename, 'w'); |
@@ -1263,6 +1317,9 @@ discard block |
||
1263 | 1317 | } |
1264 | 1318 | |
1265 | 1319 | // test if a function or procedure exists |
1320 | +/** |
|
1321 | + * @param string $type |
|
1322 | + */ |
|
1266 | 1323 | function sql_fp_exists($type, $name) |
1267 | 1324 | { |
1268 | 1325 | global $opt; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | // & escaped? |
182 | 182 | $escapesCount = 0; |
183 | 183 | while ((($nextarg - $escapesCount - 1) > 0) && (substr($sql, $nextarg - $escapesCount - 1, 1) == '\\')) { |
184 | - $escapesCount ++; |
|
184 | + $escapesCount++; |
|
185 | 185 | } |
186 | 186 | if (($escapesCount % 2) === 1) { |
187 | 187 | $nextarg++; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | while (preg_match('/^[0-9]{1}/', $nextchar) === 1) { |
196 | 196 | $arg .= $nextchar; |
197 | 197 | |
198 | - $arglength ++; |
|
198 | + $arglength++; |
|
199 | 199 | $nextchar = substr($sql, $nextarg + $arglength + 1, 1); |
200 | 200 | } |
201 | 201 | |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | // strip apostroph and insert NULL |
222 | 222 | $filtered_sql = substr($filtered_sql, 0, strlen($filtered_sql) - 1); |
223 | 223 | $filtered_sql .= 'NULL'; |
224 | - $sqlpos ++; |
|
224 | + $sqlpos++; |
|
225 | 225 | } else { |
226 | 226 | $filtered_sql .= 'NULL'; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - $sqlpos ++; |
|
230 | + $sqlpos++; |
|
231 | 231 | } else { |
232 | 232 | $arglength = 0; |
233 | 233 | $arg = ''; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | while (preg_match('/^[a-zA-Z0-9_]{1}/', $nextchar) == 1) { |
238 | 238 | $arg .= $nextchar; |
239 | 239 | |
240 | - $arglength ++; |
|
240 | + $arglength++; |
|
241 | 241 | $nextchar = substr($sql, $nextarg + $arglength + 1, 1); |
242 | 242 | } |
243 | 243 | |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | $escapesCount = 0; |
285 | 285 | while ((($nextarg - $escapesCount - 1) > 0) |
286 | 286 | && (substr($filtered_sql, $nextarg - $escapesCount - 1, 1) == '\\')) { |
287 | - $escapesCount ++; |
|
287 | + $escapesCount++; |
|
288 | 288 | } |
289 | 289 | if (($escapesCount % 2) == 0) { |
290 | 290 | // strip escapes of & |
291 | 291 | $filtered_sql = substr($filtered_sql, 0, $nextarg) . '&' . substr($filtered_sql, $nextarg + 2); |
292 | - $nextarg --; |
|
292 | + $nextarg--; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $nextarg = strpos($filtered_sql, '\&', $nextarg + 2); |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | AND `online`= 1 |
827 | 827 | AND (TIMESTAMP(NOW())-TIMESTAMP(`last_check`)+`time_diff`<'&1') |
828 | 828 | ORDER BY `w` DESC LIMIT 1", |
829 | - - 1, |
|
829 | + -1, |
|
830 | 830 | $nMaxTimeDiff |
831 | 831 | ); |
832 | 832 |