Java SQL Date Create createRecGetStatementsUpdate(String tip, String imeFirstCap)

Here you can find the source of createRecGetStatementsUpdate(String tip, String imeFirstCap)

Description

create Rec Get Statements Update

License

Open Source License

Declaration

public static String createRecGetStatementsUpdate(String tip,
            String imeFirstCap) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String createRecGetStatementsUpdate(String tip,
            String imeFirstCap) {
        StringBuilder sb = new StringBuilder();
        if (tip.toLowerCase().contains("timestamp")) {
            sb.append("rec.get")
                    .append(imeFirstCap)
                    .append("() == null ? null : new java.sql.Timestamp(rec.get")
                    .append(imeFirstCap).append("().getTime())");
        } else if (tip.contains("Date")) {
            sb.append("rec.get")
                    .append(imeFirstCap)
                    .append("() == null ? null : new java.sql.Date(rec.get")
                    .append(imeFirstCap).append("().getTime())");
        } else if (tip.contains("Integer") || tip.contains("Long")
                || tip.contains("Float") || tip.contains("Double")) {
            sb.append("rec.get").append(imeFirstCap)
                    .append("() == null ? 0 : rec.get").append(imeFirstCap)
                    .append("()");
        } else {//from  w  w w.ja  va 2  s  .  com
            sb.append("rec.get").append(imeFirstCap).append("()");
        }
        return sb.toString();
    }
}

Related

  1. convertToSqlDate(String str)
  2. convertToUDate(String dateInString)
  3. createDate(int day, int month, int year)
  4. createDateFormater(int dataType)
  5. createFutureDate(java.sql.Date lmpDate, int offSet)
  6. createSqlDate(String dateStr)
  7. createStreamingStatement(Connection conn, boolean update)
  8. createUpdateStatement(Connection conn, String databaseName, String[] fieldsToUpdate, String[] selectionFields)
  9. currentDate()