db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Malte.Kem...@de.equens.com>
Subject AW: Information for derby-user@db.apache.org
Date Mon, 28 Sep 2009 14:38:04 GMT

Hi to all,
Well I found the trouble. I was doing something weird on Freiday evening, and was not able
to see it today as well being a bit blind.

So never mind ...

Malte 



-----Urspr√ľngliche Nachricht-----
Von: Malte.Kempff@de.equens.com [mailto:Malte.Kempff@de.equens.com] 
Gesendet: Montag, 28. September 2009 13:11
An: derby-user@db.apache.org
Betreff: AW: Information for derby-user@db.apache.org

Hi,

I have a little routine, that is supposed to delete some records after a
certain due date.

It looks like the following:

 

public void reorganize(long defermentPeriod)

      {

            

            m_strBuf.delete(0, m_strBuf.length());

            

            m_strBuf.append("delete from MEMO_RECORDS").append("\n")

                    .append("where TMPST_USED >= ?");

            

            PreparedStatement pStmtRecord = null;

            try

            {

                  pStmtRecord =
m_conn.prepareStatement(m_strBuf.toString());

                  

                  long dueDate = new
java.util.Date().getTime()+defermentPeriod;

                  pStmtRecord.setTimestamp(1, new Timestamp(dueDate));

                  

                  pStmtRecord.execute();

 

                  SimpleDateFormat dForm = new
SimpleDateFormat("dd.MM.yyyy-HH:mm:ss:SSS");

                  logger.debug("cut off date:"+dForm.format(new
Date(dueDate)));

                  if (pStmtRecord.getUpdateCount()>0)

                  {

                        logger.info("deleted records by
reorganisation:"+pStmtRecord.getUpdateCount());

                  }

            }

            catch (SQLException sqlEx)

            {

                  throw new RuntimeException(sqlEx);

            }

            finally

            {

                  try

                  {

                        pStmtRecord.close();

                  }

                  catch (Throwable th)

                  {

                        logger.trace("trouble closing
pStmtQRecord!",th);

                  }

            }

            

      }

 

 

Unfortunately it does not quite that I expect. It seems that it does not
really fined the records, even though the timestamps I give to this
routine should give me all the records that are in the data base. The
type of that column on this table is of course also a timestamp.

What am I doing wrong here, or is it a bug in Derby?

 

Thanks a lot in advance for helpful replies

Malte Kempff

Mime
View raw message