Examples of DBDatabaseDriver


Examples of org.apache.empire.db.DBDatabaseDriver

     
      Connection conn = getJDBCConnection();

      // STEP 2: Choose a driver
      System.out.println("*** Step 2: getDatabaseProvider() ***");
      DBDatabaseDriver driver = getDatabaseDriver(config.getDatabaseProvider(), conn);

            // STEP 3: Open Database (and create if not existing)
            System.out.println("*** Step 3: openDatabase() ***");
      try {
          db.open(driver, conn);
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

  @Test
  public void testChineseCharacters()
  {
    Connection conn = dbResource.getConnection();

    DBDatabaseDriver driver = dbResource.newDriver();
    CompanyDB db = new CompanyDB();

    // Encoding issue occur when prepared statement is disabled
    //db.setPreparedStatementsEnabled(true);
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

  @Test
  public void testBlobDDL() throws SQLException
  {
    Connection conn = dbResource.getConnection();

    DBDatabaseDriver driver = dbResource.newDriver();
    CompanyDB db = new CompanyDB();

    // Encoding issue occurs when prepared statement is disabled
    //db.setPreparedStatementsEnabled(true);
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

  @Test
  public void testBlobWritingReading() throws SQLException
  {
    Connection conn = dbResource.getConnection();

    DBDatabaseDriver driver = dbResource.newDriver();
    CompanyDB db = new CompanyDB();

    // Encoding issue occurs when prepared statement is disabled
    //db.setPreparedStatementsEnabled(true);
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

      System.out.println("*** Step 1: getJDBCConnection() ***");
      Connection conn = getJDBCConnection();

      // STEP 2: Choose a driver
      System.out.println("*** Step 2: getDatabaseProvider() ***");
      DBDatabaseDriver driver = getDatabaseDriver(config.getDatabaseProvider());

            // STEP 3: Open Database (and create if not existing)
            System.out.println("*** Step 3: openDatabase() ***");
      try {
          db.open(driver, conn);
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

            System.out.println("*** Step 1: getJDBCConnection() ***");
            Connection conn = getJDBCConnection();

            // STEP 2: Choose a driver
            System.out.println("*** Step 2: getDatabaseProvider() ***");
            DBDatabaseDriver driver = getDatabaseDriver(config.getDatabaseProvider());

            // STEP 3: Open Database (and create if not existing)
            System.out.println("*** Step 3: openDatabase() ***");
            try {
                db.open(driver, conn);
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

    }

    @Override
    public void addSQL(StringBuilder sql, long context)
    {
        DBDatabaseDriver driver = getDatabase().getDriver();
        StringBuilder inner = new StringBuilder();
        // Generate parts
        for (Iterator<?> i = valueMap.keySet().iterator(); i.hasNext();)
        {
            Object key = i.next();
            Object val = valueMap.get(key);

            String part = driver.getSQLPhrase(DBDatabaseDriver.SQL_FUNC_DECODE_PART);
            part = StringUtils.replaceAll(part, "{0}", getObjectValue(expr.getDataType(), key, DBExpr.CTX_DEFAULT, ""));
            part = StringUtils.replaceAll(part, "{1}", getObjectValue(this.getDataType(), val, DBExpr.CTX_DEFAULT, ""));

            inner.append(driver.getSQLPhrase(DBDatabaseDriver.SQL_FUNC_DECODE_SEP));
            inner.append(part);
        }
        // Generate other
        if (elseExpr != null)
        { // Else
            String other = driver.getSQLPhrase(DBDatabaseDriver.SQL_FUNC_DECODE_ELSE);
            other = StringUtils.replaceAll(other, "{0}", getObjectValue(getDataType(), elseExpr, DBExpr.CTX_DEFAULT, ""));

            inner.append(driver.getSQLPhrase(DBDatabaseDriver.SQL_FUNC_DECODE_SEP));
            inner.append(other);
        }
        DBValueExpr param = new DBValueExpr(getDatabase(), inner, DataType.UNKNOWN);
        // Set Params
        String template = driver.getSQLPhrase(DBDatabaseDriver.SQL_FUNC_DECODE);
        super.addSQL(sql, template, new Object[] { param }, context);
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

     * @param context the current SQL-Command context
     */
    @Override
    public void addSQL(StringBuilder buf, long context)
    {
        DBDatabaseDriver driver = db.getDriver();
        String text = (driver!=null) ? driver.getValueString(value, getDataType()) : String.valueOf(value);
        buf.append(text);
    }
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

    sampleDB = new SampleDB();

    // Open Database (and create if not existing)
    log.info("*** open database ***");
    String driverProvider = config.getDatabaseProvider();
    DBDatabaseDriver driver = getDatabaseDriver(driverProvider);
    Connection conn = null;
    try {
      conn = getConnection(sampleDB);
      sampleDB.open(driver, conn);
      if (!databaseExists(conn)) {
View Full Code Here

Examples of org.apache.empire.db.DBDatabaseDriver

     
      Connection conn = getJDBCConnection();

      // STEP 2: Choose a driver
      System.out.println("*** Step 2: getDatabaseProvider() ***");
      DBDatabaseDriver driver = getDatabaseDriver(config.getDatabaseProvider(), conn);

            // STEP 3: Open Database (and create if not existing)
            System.out.println("*** Step 3: openDatabase() ***");
      try {
          // Open the database
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.