Package de.fuberlin.wiwiss.d2rq.sql.vendor

Examples of de.fuberlin.wiwiss.d2rq.sql.vendor.Vendor


    }

    public void run() {
      Connection c;
      Statement s = null;
      Vendor v = null;
      while (!shutdown) {
        try { Thread.sleep(interval*1000); }
        catch (InterruptedException e) { if (shutdown) break; }

        try {
          if (log.isDebugEnabled())
            log.debug("Keep alive agent is executing noop query '" + query + "'...");
          c = connection();
          v = vendor();
          s = c.createStatement();

          v.beforeQuery(c);
          s.execute(query);
          v.afterQuery(c);
         
          v.beforeClose(c);
          s.close();
          v.afterClose(c);
         
        } catch (Throwable e) { // may throw D2RQException at runtime
          log.error("Keep alive connection test failed: " + e.getMessage());
         
          log.info("Connection will be reset since a failure is detected by keep alive agent.");
View Full Code Here


    assertEquals("`table`.`column`",
        db.quoteAttribute(new Attribute(null, "table", "column")));
  }

  public void testRelationNameQuoting() {
    Vendor db = new DummyDB().vendor();
    assertEquals("\"schema\".\"table\"",
        db.quoteRelationName(new RelationName("schema", "table")));
    assertEquals("\"table\"",
        db.quoteRelationName(new RelationName(null, "table")));
  }
View Full Code Here

    assertEquals("\"table\"",
        db.quoteRelationName(new RelationName(null, "table")));
  }
 
  public void testBackticksInRelationsAreEscapedMySQL() {
    Vendor db = Vendor.MySQL;
    assertEquals("`ta``ble`",
        db.quoteRelationName(new RelationName(null, "ta`ble")));
  }
View Full Code Here

    assertEquals("`ta``ble`",
        db.quoteRelationName(new RelationName(null, "ta`ble")));
  }
 
  public void testRelationNameQuotingMySQL() {
    Vendor db = Vendor.MySQL;
    assertEquals("`table`",
        db.quoteRelationName(new RelationName(null, "table")));
  }
View Full Code Here

*/
public class SQLBuildingTest extends TestCase {
  private final static Attribute foo = new Attribute(null, "table", "foo");
 
  public void testSingleQuoteEscapeMySQL() {
    Vendor vendor = Vendor.MySQL;
    assertEquals("'a'", vendor.quoteStringLiteral("a"));
    assertEquals("''''", vendor.quoteStringLiteral("'"));
    assertEquals("'\\\\'", vendor.quoteStringLiteral("\\"));
    assertEquals("'Joe''s'", vendor.quoteStringLiteral("Joe's"));
    assertEquals("'\\\\''\\\\''\\\\'", vendor.quoteStringLiteral("\\'\\'\\"));
    assertEquals("'\"'", vendor.quoteStringLiteral("\""));
    assertEquals("'`'", vendor.quoteStringLiteral("`"));
  }
View Full Code Here

    assertEquals("'\"'", vendor.quoteStringLiteral("\""));
    assertEquals("'`'", vendor.quoteStringLiteral("`"));
  }

  public void testSingleQuoteEscape() {
    Vendor vendor = Vendor.SQL92;
    assertEquals("'a'", vendor.quoteStringLiteral("a"));
    assertEquals("''''", vendor.quoteStringLiteral("'"));
    assertEquals("'\\'", vendor.quoteStringLiteral("\\"));
    assertEquals("'Joe''s'", vendor.quoteStringLiteral("Joe's"));
    assertEquals("'\\''\\''\\'", vendor.quoteStringLiteral("\\'\\'\\"));
    assertEquals("'\"'", vendor.quoteStringLiteral("\""));
    assertEquals("'`'", vendor.quoteStringLiteral("`"));
  }
View Full Code Here

    assertEquals("'\"'", vendor.quoteStringLiteral("\""));
    assertEquals("'`'", vendor.quoteStringLiteral("`"));
  }

  public void testQuoteIdentifierEscape() {
    Vendor db = Vendor.SQL92;
    assertEquals("\"a\"", db.quoteIdentifier("a"));
    assertEquals("\"'\"", db.quoteIdentifier("'"));
    assertEquals("\"\"\"\"", db.quoteIdentifier("\""));
    assertEquals("\"`\"", db.quoteIdentifier("`"));
    assertEquals("\"\\\"", db.quoteIdentifier("\\"));
    assertEquals("\"A \"\"good\"\" idea\"", db.quoteIdentifier("A \"good\" idea"));
  }
View Full Code Here

    assertEquals("\"\\\"", db.quoteIdentifier("\\"));
    assertEquals("\"A \"\"good\"\" idea\"", db.quoteIdentifier("A \"good\" idea"));
  }

  public void testQuoteIdentifierEscapeMySQL() {
    Vendor db = Vendor.MySQL;
    assertEquals("`a`", db.quoteIdentifier("a"));
    assertEquals("````", db.quoteIdentifier("`"));
    assertEquals("`\\\\`", db.quoteIdentifier("\\"));
    assertEquals("`Joe``s`", db.quoteIdentifier("Joe`s"));
    assertEquals("`\\\\``\\\\``\\\\`", db.quoteIdentifier("\\`\\`\\"));
    assertEquals("`'`", db.quoteIdentifier("'"));
  }
View Full Code Here

    assertEquals("`\\\\``\\\\``\\\\`", db.quoteIdentifier("\\`\\`\\"));
    assertEquals("`'`", db.quoteIdentifier("'"));
  }

  public void testAttributeQuoting() {
    Vendor db = Vendor.SQL92;
    assertEquals("\"schema\".\"table\".\"column\"",
        db.quoteAttribute(new Attribute("schema", "table", "column")));
    assertEquals("\"table\".\"column\"",
        db.quoteAttribute(new Attribute(null, "table", "column")));
  }
View Full Code Here

    assertEquals("\"table\".\"column\"",
        db.quoteAttribute(new Attribute(null, "table", "column")));
  }
 
  public void testDoubleQuotesInAttributesAreEscaped() {
    Vendor db = Vendor.SQL92;
    assertEquals("\"sch\"\"ema\".\"ta\"\"ble\".\"col\"\"umn\"",
        db.quoteAttribute(new Attribute("sch\"ema", "ta\"ble", "col\"umn")));
  }
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.sql.vendor.Vendor

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.