| @@ 394-413 (lines=20) @@ | ||
| 391 | * if the file has been read and queries executed |
|
| 392 | * @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector. |
|
| 393 | */ |
|
| 394 | public function queryFromFile($file) |
|
| 395 | { |
|
| 396 | $this->deprecated(); |
|
| 397 | ||
| 398 | if (false !== ($fp = fopen($file, 'r'))) { |
|
| 399 | $sql_queries = trim(fread($fp, filesize($file))); |
|
| 400 | SqlUtility::splitMySqlFile($pieces, $sql_queries); |
|
| 401 | foreach ($pieces as $query) { |
|
| 402 | // [0] contains the prefixed query |
|
| 403 | // [4] contains unprefixed table name |
|
| 404 | $prefixed_query |
|
| 405 | = SqlUtility::prefixQuery(trim($query), $this->prefix()); |
|
| 406 | if ($prefixed_query != false) { |
|
| 407 | $this->query($prefixed_query[0]); |
|
| 408 | } |
|
| 409 | } |
|
| 410 | return true; |
|
| 411 | } |
|
| 412 | return false; |
|
| 413 | } |
|
| 414 | ||
| 415 | /** |
|
| 416 | * Get field name |
|
| @@ 362-376 (lines=15) @@ | ||
| 359 | * @return bool FALSE if failed reading SQL file or |
|
| 360 | * TRUE if the file has been read and queries executed |
|
| 361 | */ |
|
| 362 | public function queryFromFile($file) |
|
| 363 | { |
|
| 364 | if (false !== ($fp = fopen($file, 'r'))) { |
|
| 365 | $sql_queries = trim(fread($fp, filesize($file))); |
|
| 366 | \SqlUtility::splitMySqlFile($pieces, $sql_queries); |
|
| 367 | foreach ($pieces as $query) { |
|
| 368 | $prefixed_query = \SqlUtility::prefixQuery(trim($query), $this->prefix()); |
|
| 369 | if ($prefixed_query != false) { |
|
| 370 | $this->query($prefixed_query[0]); |
|
| 371 | } |
|
| 372 | } |
|
| 373 | return true; |
|
| 374 | } |
|
| 375 | return false; |
|
| 376 | } |
|
| 377 | ||
| 378 | /** |
|
| 379 | * Duplicates original xoops quote. |
|