Package de.danet.an.util

Examples of de.danet.an.util.UniversalPrepStmt


      throw new IllegalStateException ("No connection set");
  }
  ResultSet result = null;
  try {
      if (loadPStmt == null ) {
    loadPStmt = new UniversalPrepStmt
        (dataSource, dbConnection, loadStatement);
      }
      setMapId (loadPStmt, 1);
      result = loadPStmt.executeQuery();
      // Remove current entries and then add loaded values
View Full Code Here


      if (!isNewMap) {
    /* First delete all existing values for that id in the
     * persistent store */
    try {
        if (deleteAllPStmt == null) {
      deleteAllPStmt = new UniversalPrepStmt
          (dataSource, dbConnection, deleteAllStatement);
        }
        setMapId (deleteAllPStmt, 1);
        int hits = deleteAllPStmt.executeUpdate();
    } catch (SQLException exc) {
View Full Code Here

  try {
      if (updateList.size() == 0) {
    return;
      }
      if (updatePStmt == null) {
    updatePStmt = new UniversalPrepStmt
        (dataSource, dbConnection, updateStatement);
      }
      Iterator keys = updateList.iterator();
      while (keys.hasNext()) {
    final String key = (String)keys.next();
View Full Code Here

  try {
      if (deleteList.size() == 0) {
    return;
      }
      if (deletePStmt == null) {
    deletePStmt = new UniversalPrepStmt
        (dataSource, dbConnection, deleteStatement);
      }
      Iterator keys = deleteList.iterator();
      while (keys.hasNext()) {
    final String key = (String)keys.next();
View Full Code Here

  try {
      if (insertList.size() == 0) {
    return;
      }
      if (insertPStmt == null) {
    insertPStmt = new UniversalPrepStmt
        (dataSource, dbConnection, insertStatement,
         new String[] { mapColumnName, itemColumnName});
      }
      Iterator keys = insertList.iterator();
      while (keys.hasNext()) {
View Full Code Here

        Statement statement = null;
        int result = 0;
        try {
            if (hasParameters()) {
                PreparedStatement ps
        = new UniversalPrepStmt (conn, sqlStatement);
                statement = ps;
                setParameters(ps);
                result = ps.executeUpdate();
            } else {
                statement = conn.createStatement();
                result = statement.executeUpdate(sqlStatement);
            }
            if (var != null) {
View Full Code Here

                logger.debug( "About to execute query: " + sqlStatement );
            }

            if (hasParameters()) {
                PreparedStatement ps
        = new UniversalPrepStmt (conn, sqlStatement);
                statement = ps;
                setParameters(ps);
                rs = ps.executeQuery();
            } else {
                statement = conn.createStatement();
                rs = statement.executeQuery(sqlStatement);
            }
View Full Code Here

    }
 
    public void insertLobs() throws Exception {
  String xpdl = importXPDL("test1.xml");
  Object header = new HashMap();
  UniversalPrepStmt prepStmt = null;
  try {
      // clean up
      assertTrue(cleanup() == 0);
      //con.commit();
      // insert
      prepStmt = new UniversalPrepStmt
    (con, "INSERT INTO ProcessDefinition ("
     + "DBId, PackageId, ProcessId, Xpdl, Header, Enabled) "
     + "VALUES (?, ?, ?, ?, ?, 'T')");
      int offset = 1;
      prepStmt.setLong (offset++, 1000000);
      prepStmt.setString(offset++, "univPrepStmtPackage");
      prepStmt.setString(offset++, "univPrepStmtTest");
      /*
      prepStmt.setLargeString(offset++, null);
        prepStmt.setBinary(offset++, null);
       prepStmt.setLargeString(offset++, xpdl);
      prepStmt.setBinary(offset++, header);
      */
      prepStmt.setLargeString(offset++, null);
        prepStmt.setBinary(offset++, null);
      prepStmt.executeUpdate();
      //con.commit();
      // select
      offset = 1;
      prepStmt = new UniversalPrepStmt
    (con, "SELECT Header, Xpdl FROM ProcessDefinition "
     + "WHERE DBId = 1000000");
      ResultSet rs = prepStmt.executeQuery();
      rs.next();
      if (!isOracle) {
    return;
      }
      Object blobObject = JDBCUtil.getBinary(rs, offset++);
View Full Code Here

                return idx.longValue();
            }
            // new finder, insert
            try {
                Connection con = ds.getConnection();
                UniversalPrepStmt prepStmt = null;
                long newIdx = EJBUtil.newPrimaryKey ("ActivityFinders");
                try {
                    prepStmt = new UniversalPrepStmt
                        (ds, con, "INSERT INTO ActivityFinders (DBId, LocData) "
                         + "VALUES (?, ?)");
                    prepStmt.setLong(1, newIdx);
                    prepStmt.setBinary(2, finder);
                    prepStmt.executeUpdate();
                } finally {
                    JDBCUtil.closeAll (null, prepStmt, con);
                }
                finderByDBIdCache.put (new Long(newIdx), finder);
                dbIdByFinderCache.put (finder, new Long(newIdx));
View Full Code Here

    }

    public void updateLobs() throws Exception {
  String xpdl = importXPDL("test2.xml");
  Object header = new HashMap();
  UniversalPrepStmt prepStmt = null;
  try {
      prepStmt = new UniversalPrepStmt
    (con, "UPDATE ProcessDefinition SET "
     + "PackageId = ?, ProcessId = ?, Xpdl = ?, Header = ? "
     + "WHERE DBId = ?");
      int offset = 1;
      prepStmt.setString(offset++, "updatedUnivPrepStmtPackage");
      prepStmt.setString(offset++, "updatedunivPrepStmtTest");
      prepStmt.setLargeString(offset++, xpdl);
      prepStmt.setBinary(offset++, header);
      prepStmt.setLong (offset++, 1000000);
      //prepStmt.setString(offset++, "univPrepStmtPackage");
      prepStmt.executeUpdate();
      //con.commit();
      assertTrue(cleanup() == 1);
   } catch (SQLException sqle) {
      sqle.printStackTrace();
  } finally {
View Full Code Here

TOP

Related Classes of de.danet.an.util.UniversalPrepStmt

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.