Code Duplication    Length = 15-20 lines in 2 locations

htdocs/class/database/mysqldatabase.php 1 location

@@ 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

htdocs/xoops_lib/Xoops/Core/Database/Connection.php 1 location

@@ 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.