Java Timestamp quoteMySQLDataField(Timestamp fieldData)

Here you can find the source of quoteMySQLDataField(Timestamp fieldData)

Description

quote My SQL Data Field

License

Open Source License

Declaration

public static String quoteMySQLDataField(Timestamp fieldData) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 SirLordT <sirlordt@gmail.com>.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * //from www  .ja  v  a2s .c  om
 * Contributors:
 *     SirLordT <sirlordt@gmail.com> - initial API and implementation
 ******************************************************************************/

import java.sql.Timestamp;

public class Main {
    public static String quoteMySQLDataField(Timestamp fieldData) {

        String strResult = "";

        if (fieldData != null)
            strResult = "\"" + fieldData + "\"";
        else
            strResult = "null";

        return strResult;

    }

    public static String quoteMySQLDataField(java.sql.Date fieldData) {

        String strResult = "";

        if (fieldData != null)
            strResult = "\"" + fieldData + "\"";
        else
            strResult = "null";

        return strResult;

    }

    public static String quoteMySQLDataField(java.sql.Time fieldData) {

        String strResult = "";

        if (fieldData != null)
            strResult = "\"" + fieldData + "\"";
        else
            strResult = "null";

        return strResult;

    }
}

Related

  1. normalizeDateTimeAsTimestamp(Date changedDate, Locale locale)
  2. nowAsTimestamp()
  3. nowUtcTimestamp()
  4. objToTimeStamp(Object obj)
  5. printFull(Timestamp ts)
  6. randomTimestamp()
  7. readTimestamp(ByteBuffer logBuf)
  8. readTimestamp(DataInput in)
  9. readTimestamp(ObjectInput in, long nullFlag)