Package henplus.sqlmodel

Examples of henplus.sqlmodel.ColumnFkInfo


            }
        }

        if (rset != null) {
            while (rset.next()) {
                final ColumnFkInfo fk = new ColumnFkInfo(rset.getString(FK_FK_NAME), rset.getString(FK_PKTABLE_NAME),
                        rset.getString(FK_PKCOLUMN_NAME));
                final String col = rset.getString(FK_FKCOLUMN_NAME);
                fks.put(col, fk);
            }
            rset.close();
View Full Code Here


            } else {
                // dependency fulfilled?
                boolean nodep = true;
                final Iterator<ColumnFkInfo> iter2 = fks.iterator();
                while (iter2.hasNext() && nodep) {
                    final ColumnFkInfo fk = iter2.next();
                    if (!resolved.containsKey(fk.getPkTable())) {
                        nodep = false;
                    }
                }

                if (nodep) {
View Full Code Here

        boolean nodep = false;
        boolean firstrun = true;
        final Set<ColumnFkInfo> fks = t.getForeignKeys();
        final Iterator<ColumnFkInfo> iter = fks.iterator();
        while (iter.hasNext()) {
            final ColumnFkInfo fk = iter.next();

            Logger.debug("[resolveDep] FK -> %s: %s", fk.getPkTable(), resolved.containsKey(fk.getPkTable()));
            if (!resolved.containsKey(fk.getPkTable())) {

                final Table inner = unresolved.get(fk.getPkTable());

                // if there's yet a cycle with the two tables inner following t
                // then proceed to the next FK and ignore this potential cycle
                if (duplicateCycle(t, inner)) {
                    continue;
                }

                if (cyclePath != null && cyclePath.contains(inner)) {

                    cyclePath.add(t);

                    // create a new list for the detected cycle to add to the
                    // cyclicDeps, the former one (cyclePath) is used further on
                    final List<Table> cycle = new ArrayList<Table>(cyclePath);
                    cycle.add(inner);
                    if (_cyclicDependencies == null) {
                        _cyclicDependencies = new HashSet<List<Table>>();
                    }
                    Logger.debug("[resolveDep] +++ Putting cyclePath: %s", cycle);
                    _cyclicDependencies.add(cycle);
                    continue;

                } else {
                    if (cyclePath == null) {
                        Logger.debug("[resolveDep] Starting cyclePath with: %s", t);
                        cyclePath = new ArrayList<Table>();
                    }
                    cyclePath.add(t);
                }

                resolveDep(inner, cyclePath, resolved, unresolved);

                if (resolved.containsKey(fk.getPkTable())) {
                    nodep = (firstrun || nodep);
                    firstrun = false;
                }
            } else {
                nodep = (firstrun || nodep);
View Full Code Here

    }

    private static String getFkDesc(final henplus.sqlmodel.Column col) {
        String fkDesc = "";

        final ColumnFkInfo fkInfo = col.getFkInfo();
        if (fkInfo != null) {
            final StringBuilder sb = new StringBuilder();
            if (fkInfo.getFkName() != null) {
                sb.append(fkInfo.getFkName()).append("\n -> ");
            } else {
                sb.append(" -> ");
            }
            sb.append(fkInfo.getPkTable()).append("(").append(fkInfo.getPkColumn()).append(")");
            fkDesc = sb.toString();
        }

        return fkDesc;
    }
View Full Code Here

TOP

Related Classes of henplus.sqlmodel.ColumnFkInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.