Code Duplication    Length = 11-14 lines in 3 locations

src/Phinx/Db/Adapter/PostgresAdapter.php 1 location

@@ 338-351 (lines=14) @@
335
    /**
336
     * {@inheritdoc}
337
     */
338
    public function hasColumn($tableName, $columnName)
339
    {
340
        $sql = sprintf(
341
            "SELECT count(*)
342
            FROM information_schema.columns
343
            WHERE table_schema = '%s' AND table_name = '%s' AND column_name = '%s'",
344
            $this->getSchemaName(),
345
            $tableName,
346
            $columnName
347
        );
348
349
        $result = $this->fetchRow($sql);
350
351
        return $result['count'] > 0;
352
    }
353
354
    /**

src/Phinx/Db/Adapter/SqlServerAdapter.php 1 location

@@ 411-423 (lines=13) @@
408
    /**
409
     * {@inheritdoc}
410
     */
411
    public function hasColumn($tableName, $columnName)
412
    {
413
        $sql = sprintf(
414
            "SELECT count(*) as [count]
415
             FROM information_schema.columns
416
             WHERE table_name = '%s' AND column_name = '%s'",
417
            $tableName,
418
            $columnName
419
        );
420
        $result = $this->fetchRow($sql);
421
422
        return $result['count'] > 0;
423
    }
424
425
    /**
426
     * {@inheritdoc}

src/Phinx/Db/Adapter/OracleAdapter.php 1 location

@@ 382-392 (lines=11) @@
379
    /**
380
     * {@inheritdoc}
381
     */
382
    public function hasColumn($tableName, $columnName)
383
    {
384
        $sql = sprintf("select count(*) as count from ALL_TAB_COLUMNS 
385
            where table_name = '%s' and column_name = '%s'",
386
            $tableName,
387
            $columnName
388
        );
389
390
        $result = $this->fetchRow($sql);
391
        return $result['COUNT'] > 0;
392
    }
393
394
    /**
395
     * {@inheritdoc}