コード例 #1
0
  @Test
  public void testGetErrorInfo() throws Exception {
    WbConnection con = OracleTestUtil.getOracleConnection();
    assertNotNull(con);

    String sql = "create procedure nocando\n" + "as \n" + "begin \n" + "   null; \n" + "ende;\n/\n";
    TestUtil.executeScript(con, sql, DelimiterDefinition.DEFAULT_ORA_DELIMITER);

    try {
      con.setBusy(true);
      OracleErrorInformationReader reader = new OracleErrorInformationReader(con);
      ErrorDescriptor errorInfo = reader.getErrorInfo(null, "nocando", "procedure", true);
      con.setBusy(false);
      assertNotNull(errorInfo);

      assertTrue(errorInfo.getErrorMessage().startsWith("Errors for PROCEDURE NOCANDO"));
      assertTrue(errorInfo.getErrorMessage().contains("PLS-00103"));
      assertEquals(4, errorInfo.getErrorLine());
      assertEquals(4, errorInfo.getErrorColumn());

      errorInfo = reader.getErrorInfo(null, "nocando", "procedure", false);
      assertNotNull(errorInfo);
      String msg = errorInfo.getErrorMessage();
      assertFalse(msg.contains("Errors for PROCEDURE NOCANDO"));
      assertTrue(msg.startsWith("L:5"));
    } finally {
      con.setBusy(false);
    }
  }
コード例 #2
0
  @Test
  public void testDeferrable() throws SQLException {
    WbConnection conn = OracleTestUtil.getOracleConnection();
    assertNotNull("No Oracle connection available", conn);
    OracleFKHandler fkHandler = new OracleFKHandler(conn);
    String create =
        "create table parent (id integer not null primary key);\n"
            + "create table child_deferred (id integer not null primary key, pid integer not null,\n"
            + " constraint fk_aaa foreign key (pid) references parent (id) deferrable initially deferred);\n"
            + "create table child_immediate (id integer not null primary key, pid integer not null,\n"
            + " constraint fk_bbb foreign key (pid) references parent (id) deferrable initially immediate);\n"
            + "create table child_not_deferred (id integer not null primary key, pid integer not null,\n"
            + " constraint fk_ccc foreign key (pid) references parent (id));\n";

    TestUtil.executeScript(conn, create);

    TableIdentifier parent = conn.getMetadata().findTable(new TableIdentifier("PARENt"));

    DataStore fklist = fkHandler.getReferencedBy(parent);
    assertNotNull(fklist);
    assertEquals(3, fklist.getRowCount());

    fklist.sortByColumn(0, true);
    //		DataStorePrinter printer = new DataStorePrinter(fklist);
    //		printer.printTo(System.out);

    String deferrable = fklist.getValueAsString(0, "DEFERRABLE");
    assertEquals("INITIALLY DEFERRED", deferrable);

    deferrable = fklist.getValueAsString(1, "DEFERRABLE");
    assertEquals("INITIALLY IMMEDIATE", deferrable);

    deferrable = fklist.getValueAsString(2, "DEFERRABLE");
    assertEquals("NOT DEFERRABLE", deferrable);
    OracleTestUtil.cleanUpTestCase();
  }
コード例 #3
0
 @AfterClass
 public static void tearDown() throws Exception {
   OracleTestUtil.cleanUpTestCase();
 }
コード例 #4
0
 @BeforeClass
 public static void setUp() throws Exception {
   OracleTestUtil.initTestCase();
 }