Commit 399baa6b authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

archi tests en place

schémas & séquences OK
parent 47423484
Loading
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Unicaen\BddAdmin\Ddl;

use Unicaen\BddAdmin\Util;

class DdlFilter implements \ArrayAccess
{
    /**
@@ -132,7 +134,7 @@ class DdlFilter implements \ArrayAccess



    public function toSql(string $colName): array
    public function toSql(?string $schemaColName, string $colName): array
    {
        $includes = $this->includes;
        $excludes = $this->excludes;
@@ -148,9 +150,17 @@ class DdlFilter implements \ArrayAccess
            if (!empty($includes)) {
                $f[] = 'AND (0=1';
                foreach ($includes as $include) {
                    [$includeSchema,$includeObject] = Util::explodedFullObjectName($include);

                    $i++;
                    if ($schemaColName && $includeSchema){
                        $f[]            = "OR ($schemaColName LIKE :includesc$i AND $colName LIKE :includeobj$i)";
                        $p["includesc$i"] = $includeSchema;
                        $p["includeobj$i"] = $includeObject;
                    }else{
                        $f[]            = "OR $colName LIKE :include$i";
                    $p["include$i"] = $include;
                        $p["include$i"] = $includeObject;
                    }
                }
                $f[] = ')';
            }
@@ -162,9 +172,17 @@ class DdlFilter implements \ArrayAccess
            }
            $i = 0;
            foreach ($excludes as $exclude) {
                [$excludeSchema,$excludeObject] = Util::explodedFullObjectName($exclude);

                $i++;
                $f[]            = "AND $colName NOT LIKE :exclude$i";
                $p["exclude$i"] = $exclude;
                if ($schemaColName && $excludeSchema){
                    $f[]            = "OR ($schemaColName LIKE :excludesc$i AND $colName LIKE :excludeobj$i)";
                    $p["excludesc$i"] = $excludeSchema;
                    $p["excludeobj$i"] = $excludeObject;
                }else{
                    $f[]            = "OR $colName LIKE :exclude$i";
                    $p["exclude$i"] = $excludeObject;
                }
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class IndexManager extends AbstractManager implements IndexManagerInterface
    public function get($includes = null, $excludes = null): array
    {
        $filter = DdlFilter::normalize2($includes, $excludes);
        [$f, $p] = $filter->toSql('index_name');
        [$f, $p] = $filter->toSql(null, 'index_name');

        $data = [];

+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class MaterializedViewManager extends AbstractManager implements MaterializedVie
    public function get($includes = null, $excludes = null): array
    {
        $filter = DdlFilter::normalize2($includes, $excludes);
        [$f, $p] = $filter->toSql('mview_name');
        [$f, $p] = $filter->toSql(null, 'mview_name');
        $data = [];

        $q = "SELECT
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class PackageManager extends AbstractManager implements PackageManagerInteface
    public function get($includes = null, $excludes = null): array
    {
        $filter = DdlFilter::normalize2($includes, $excludes);
        [$f, $p] = $filter->toSql('name');
        [$f, $p] = $filter->toSql(null,'name');
        $data = [];

        $q = "SELECT 
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ class PrimaryConstraintManager extends AbstractManagerDdlConstraint implements P
    public function get($includes = null, $excludes = null): array
    {
        $filter = DdlFilter::normalize2($includes, $excludes);
        [$f, $p] = $filter->toSql('c.constraint_name');
        [$f, $p] = $filter->toSql(null,'c.constraint_name');
        $data = [];

        $sql = "SELECT
Loading