Package java.sql

Examples of java.sql.PreparedStatement.executeUpdate()


        StatementBuilder buff = new StatementBuilder("DELETE FROM ");
        appendTableName(buff);
        appendKeyCondition(buff);
        PreparedStatement prep = conn.prepareStatement(buff.toString());
        setKey(prep, 1, current);
        int count = prep.executeUpdate();
        if (count != 1) {
            // the row has already been deleted
            throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
        }
    }
View Full Code Here


                v = current[i];
            }
            v.set(prep, j++);
        }
        setKey(prep, j, current);
        int count = prep.executeUpdate();
        if (count != 1) {
            // the row has been deleted
            throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
        }
    }
View Full Code Here

            if (v == null) {
                v = ValueNull.INSTANCE;
            }
            v.set(prep, i + 1);
        }
        int count = prep.executeUpdate();
        if (count != 1) {
            throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
        }
    }
View Full Code Here

  public static int removeObject(JDCConnection oConn, String sIdObject, int iClassId) throws SQLException {
     int iRetVal;
     PreparedStatement oStmt = oConn.prepareStatement("DELETE FROM " + DB.k_x_cat_objs + " WHERE " + DB.gu_object + "=? AND " + DB.id_class + "=?");
     oStmt.setString(1, sIdObject);
     oStmt.setInt(2, iClassId);
     iRetVal = oStmt.executeUpdate();
     oStmt.close();
     return iRetVal;
  } // removeObject

  //----------------------------------------------------------------------------
View Full Code Here

        oUpdt.setString(2, sAlphaCode);
        if (DebugFile.trace) {
        DebugFile.writeln("Could not get conversion rate to "+sAlphaCode+" "+xcpt.getClass().getName()+" "+xcpt.getMessage());
        }
      }
      oUpdt.executeUpdate();
    } // wend
    oUpdt.close();
    oInsr.close();
    if (DebugFile.trace) {   
    DebugFile.writeln("updating all rates took "+String.valueOf((new Date().getTime() - lTsStart)/1000)+" seconds");
View Full Code Here

            long time = format.parse(txt).getTime();
            Date date = new Date(time);
            System.out.println("Date: '" + time + "' is '" + date.toString() + "' and again as millis: '" + date.getTime());
            PreparedStatement st1 = conn.prepareStatement("INSERT INTO " + this.tableName + " VALUES (?)");
            st1.setDate(1, date);
            st1.executeUpdate();
            st1.close();
            st1 = null;

            st1 = conn.prepareStatement("SELECT * FROM " + tableName);
            ResultSet rs = st1.executeQuery();
View Full Code Here

            Timestamp date = new Timestamp(time);
            date.setNanos(999);
            System.out.println("Date: '" + time + "' is '" + date.toString() + "' and again as millis: '" + date.getTime());
            PreparedStatement st1 = conn.prepareStatement("INSERT INTO " + this.tableName + " VALUES (?)");
            st1.setTimestamp(1, date);
            st1.executeUpdate();
            st1.close();
            st1 = null;
            // Timestamp. timestamp = new Timestamp();
            st1 = conn.prepareStatement("SELECT * FROM " + tableName);
            ResultSet rs = st1.executeQuery();
View Full Code Here

    oStmt.setTimestamp(1, new Timestamp(dtCreated.getTime()));
    int p=1;
    oIter = oList.listIterator();
    while (oIter.hasNext())
      oStmt.setObject(++p, get(oIter.next()));
    oStmt.executeUpdate();
    oStmt.close();
    oStmt=null;
    } catch (Exception xcpt) {
      if (null!=oStmt) { try { oStmt.close(); } catch (Exception ignore) { /* ignore */ } }
      throw new SQLException ("DBPersist.getCreationDate() "+xcpt.getClass().getName()+" "+xcpt.getMessage());
View Full Code Here

      oIns.setString(8, sTxEmail);
    if (null==sTxVote)
      oIns.setNull(9, Types.VARCHAR);
    else
      oIns.setString(9, sTxVote);
    oIns.executeUpdate();
    oIns.close();

    PreparedStatement oUpd = oCon.prepareStatement("UPDATE "+DB.k_newsmsgs+" SET "+DB.nu_votes+"="+DB.nu_votes+"+1 WHERE "+DB.gu_msg+"=?");
    oUpd.setString(1, sGuMsg);
    oUpd.executeUpdate();
View Full Code Here

    oIns.executeUpdate();
    oIns.close();

    PreparedStatement oUpd = oCon.prepareStatement("UPDATE "+DB.k_newsmsgs+" SET "+DB.nu_votes+"="+DB.nu_votes+"+1 WHERE "+DB.gu_msg+"=?");
    oUpd.setString(1, sGuMsg);
    oUpd.executeUpdate();
    oUpd.close();

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End NewsMessageVote.insert() : " + String.valueOf(iPgVote));
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.