Package org.conserve.connection

Examples of org.conserve.connection.ConnectionWrapper.prepareStatement()


    PersistenceManager persist = new PersistenceManager(driver, database,
        login, password);
    ConnectionWrapper cw = persist.getConnectionWrapper();
   
    PreparedStatement stmt = cw.prepareStatement("SELECT COUNT(*) FROM C__ARRAY");
    ResultSet rs = stmt.executeQuery();
    if(rs.next())
    {
      System.out.println("Found " + rs.getInt(1) + " objects.");
    }
View Full Code Here


    // get all c__IS_A entries
    String selectStmt = "SELECT * from " + Defaults.IS_A_TABLENAME;
    ConnectionWrapper cw = getConnectionWrapper();
    try
    {
      PreparedStatement ps = cw.prepareStatement(selectStmt);
      ResultSet rs = ps.executeQuery();
      while (rs.next())
      {
        String superClassName = rs.getString("SUPERCLASS");
        String subClassName = rs.getString("SUBCLASS");
View Full Code Here

    {
      ConnectionWrapper cw = null;
      try
      {
        cw = getConnectionWrapper();
        PreparedStatement ps = cw.prepareStatement(adapter
            .getShutdownCommand());
        ps.execute();
        ps.close();
        cw.commitAndDiscard();
      }
View Full Code Here

      // check if the version table exist
      if (tableExists(Defaults.SCHEMA_VERSION_TABLENAME, cw))
      {
        // get the existing schema version
        String query = "SELECT VERSION FROM " + Defaults.SCHEMA_VERSION_TABLENAME;
        PreparedStatement ps = cw.prepareStatement(query);
        Tools.logFine(ps);
        ResultSet rs = ps.executeQuery();
        if (rs.next())
        {
          existingSchema = rs.getInt(1);
View Full Code Here

      }
      else
      {
        String createString = "CREATE TABLE " + Defaults.SCHEMA_VERSION_TABLENAME + " (VERSION "
            + adapter.getIntegerTypeKeyword() + ")";
        PreparedStatement ps = cw.prepareStatement(createString);
        Tools.logFine(ps);
        ps.execute();
        ps.close();
        if (adapter.isRequiresCommitAfterTableCreation())
        {
View Full Code Here

        {
          cw.commit();
        }
        // insert the current version
        String commandString = "INSERT INTO  " + Defaults.SCHEMA_VERSION_TABLENAME + "  (VERSION ) values (?)";
        ps = cw.prepareStatement(commandString);
        ps.setInt(1, schemaTypeVersion);
        Tools.logFine(ps);
        ps.execute();
        ps.close();
      }
View Full Code Here

          throw new SchemaPermissionException(Defaults.IS_A_TABLENAME
              + " does not exist, but can't create it.");
        }
        String createString = "CREATE TABLE " + Defaults.IS_A_TABLENAME + " (SUPERCLASS "
            + adapter.getVarCharIndexed() + ",SUBCLASS " + adapter.getVarCharIndexed() + ")";
        PreparedStatement ps = cw.prepareStatement(createString);
        Tools.logFine(ps);
        ps.execute();
        ps.close();
        // create an index on the superclass name, since this is the
        // one we
View Full Code Here

        // create an index on the superclass name, since this is the
        // one we
        // will be searching for most frequently
        String commandString = "CREATE INDEX " + Defaults.IS_A_TABLENAME + "_SUPERCLASS_INDEX on "
            + Defaults.IS_A_TABLENAME + "(SUPERCLASS" + adapter.getKeyLength() + ")";
        ps = cw.prepareStatement(commandString);
        Tools.logFine(ps);
        ps.execute();
        ps.close();
      }
      if (!tableExists(Defaults.HAS_A_TABLENAME, cw))
View Full Code Here

        String commandString = "CREATE TABLE " + Defaults.HAS_A_TABLENAME + " (OWNER_TABLE "
            + adapter.getVarCharIndexed() + ", OWNER_ID " + adapter.getLongTypeKeyword() + ", "
            + Defaults.RELATION_NAME_COL + " " + adapter.getVarCharKeyword() + ", PROPERTY_TABLE "
            + adapter.getVarCharIndexed() + ", PROPERTY_ID " + adapter.getLongTypeKeyword()
            + ", PROPERTY_CLASS " + adapter.getVarCharIndexed() + ")";
        PreparedStatement ps = cw.prepareStatement(commandString);
        Tools.logFine(ps);
        ps.execute();
        ps.close();
        // create an index on the tablename/id combinations, since
        // this is
View Full Code Here

        // this is
        // the one we
        // will be searching for most frequently
        commandString = "CREATE INDEX " + Defaults.HAS_A_TABLENAME + "_OWNER_INDEX on "
            + Defaults.HAS_A_TABLENAME + "(OWNER_TABLE" + adapter.getKeyLength() + ",OWNER_ID)";
        ps = cw.prepareStatement(commandString);
        Tools.logFine(ps);
        ps.execute();
        ps.close();

        commandString = "CREATE INDEX " + Defaults.HAS_A_TABLENAME + "_PROPERTY_INDEX on "
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.