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