Package net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint

Examples of net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint


          constraints.addConstraint(fk);
        }
        else if (constraintType.startsWith("PRIMARY KEY"))
        {
          PrimaryKeyConstraint pk = new PrimaryKeyConstraint();

          pk.setConstraintName(constraintName);
          pk.setClustered(constraintType.endsWith("(clustered)"));

          String cols[] = constraintKeys.split(", ");
          for (int i = 0; i < cols.length; i++)
            pk.addConstraintColumn(cols[i]);

          constraints.addConstraint(pk);
        }
      }
View Full Code Here


    {
      /* there can be only one PK in truth, but the model allows more than one. */
      List<PrimaryKeyConstraint> pks = constraints.getPrimaryKeyConstraints();
      if (pks != null && pks.size() == 1)
      {
        PrimaryKeyConstraint pk = pks.get(0);
        buf.append("\tCONSTRAINT [");
        buf.append(pk.getConstraintName());
        buf.append("] PRIMARY KEY ");
        buf.append(pk.isClustered() ? "CLUSTERED" : "NONCLUSTERED");
        buf.append("\n\t(\n\t\t");
        Object[] cols = pk.getConstraintColumns();
        for (int i = 0; i < cols.length; i++)
        {
          buf.append("[");
          buf.append((String) cols[i]);
          buf.append("]");
View Full Code Here

      assertEquals(1, list.size());
    }

    @Test
    public final void testGetPrimaryKeyConstraints() {
      PrimaryKeyConstraint constraint = new PrimaryKeyConstraint();
      constraintsUnderTest.addConstraint(constraint);
      List<PrimaryKeyConstraint> list = constraintsUnderTest.getPrimaryKeyConstraints();
      assertEquals(1, list.size());
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint

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.