Project

General

Profile

« Previous | Next » 

Revision 1751

Added by Jing Tao over 20 years ago

Get rid of to_date function.

View differences:

DocumentImpl.java
311 311
      Date localtime = new Date();
312 312
      String dateString = formatter.format(localtime);
313 313
  
314
      String sqlDateString = "to_date('" + dateString + 
315
                                          "', 'YY-MM-DD HH24:MI:SS')";
314
      /*String sqlDateString = "to_date('" + dateString + 
315
                                          "', 'YY-MM-DD HH24:MI:SS')";*/
316
      String sqlDateString=dbAdapter.toDate(dateString, "YY-MM-DD HH24:MI:SS");
316 317
  
317 318
      StringBuffer sql = new StringBuffer();
318 319
      sql.append("insert into xml_documents (docid, docname, doctype, ");
......
329 330
      sql.append(sqlDateString).append(",");
330 331
      sql.append("'0')");
331 332
      pstmt = dbconn.prepareStatement(sql.toString());
333
      MetaCatUtil.debugMessage("2, new sql for todate:================== "+
334
                               sql.toString(), 1);
332 335
      pstmt.execute();
333 336
      pstmt.close();
334 337
      //dbconn.close();
......
428 431
      Date localtime = new Date();
429 432
      String dateString = formatter.format(localtime);
430 433
  
431
      String sqlDateString = "to_date('" + dateString + 
432
                                          "', 'YY-MM-DD HH24:MI:SS')";
433
  
434
      /*String sqlDateString = "to_date('" + dateString + 
435
                                          "', 'YY-MM-DD HH24:MI:SS')";*/
436
      String sqlDateString=dbAdapter.toDate(dateString, "YY-MM-DD HH24:MI:SS");
434 437
      StringBuffer sql = new StringBuffer();
435 438
      sql.append("insert into xml_documents (docid, docname, doctype, ");
436 439
      sql.append("user_owner, user_updated, server_location, rev,date_created");
......
448 451
      // Set auto commit fasle
449 452
      dbconn.setAutoCommit(false);
450 453
      pstmt = dbconn.prepareStatement(sql.toString());
454
      MetaCatUtil.debugMessage("3, new sql for todate:================== "+
455
                               sql.toString(), 1);
451 456
      pstmt.execute();
452 457
      // Commit the insert
453 458
      dbconn.commit();
......
2729 2734
      {
2730 2735
        // Set auto commit false
2731 2736
        dbConn.setAutoCommit(false);
2732
        pStmt = dbConn.prepareStatement("INSERT INTO xml_replication " +
2737
        /*pStmt = dbConn.prepareStatement("INSERT INTO xml_replication " +
2733 2738
                      "(server, last_checked, replicate, datareplicate, hub) " +
2734 2739
                       "VALUES ('" + server + "', to_date(" +
2735 2740
                       "'01/01/00', 'MM/DD/YY'), '" +
2741
                       replicate +"', '"+dataReplicate+"','"+ hub + "')");*/
2742
        pStmt = dbConn.prepareStatement("INSERT INTO xml_replication " +
2743
                      "(server, last_checked, replicate, datareplicate, hub) " +
2744
                       "VALUES ('" + server + "', " + 
2745
                       dbAdapter.toDate("01/01/00", "MM/DD/YY") + ", '" +
2736 2746
                       replicate +"', '"+dataReplicate+"','"+ hub + "')");
2747
        MetaCatUtil.debugMessage("4, new sql for todate:================== ", 1);
2748
                              
2737 2749
        pStmt.execute();
2738 2750
        dbConn.commit();
2739 2751
        // Increase usage number

Also available in: Unified diff