Java SQL Date Format formatLogParam(Array obj)

Here you can find the source of formatLogParam(Array obj)

Description

Formatter for debugging purposes only.

License

Apache License

Parameter

Parameter Description
obj to print

Return

String

Declaration

private static String formatLogParam(Array obj) 

Method Source Code

//package com.java2s;
/**// w  w  w  .  ja v  a2  s . c  om
 *  Copyright 2010 Wallace Wadge
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Ref;
import java.sql.SQLException;

public class Main {
    /** Formatter for debugging purposes only. 
     * @param obj to print
     * @return String
     */
    private static String formatLogParam(Blob obj) {
        String result = "";
        try {
            result = "(blob of length " + obj.length() + ")";
        } catch (SQLException e) {
            result = "(blob of unknown length)";
        }
        return result;
    }

    /** Formatter for debugging purposes only. 
     * @param obj to print
     * @return String
     */
    private static String formatLogParam(Clob obj) {
        String result = "";
        try {
            result = "(cblob of length " + obj.length() + ")";
        } catch (SQLException e) {
            result = "(cblob of unknown length)";
        }
        return result;
    }

    /** Formatter for debugging purposes only. 
     * @param obj to print
     * @return String
     */
    private static String formatLogParam(Array obj) {
        String result = "";
        try {
            result = "(array of type" + obj.getBaseTypeName().length() + ")";
        } catch (SQLException e) {
            result = "(array of unknown type)";
        }
        return result;
    }

    /** Formatter for debugging purposes only. 
     * @param obj to print
     * @return String
     */
    private static String formatLogParam(Ref obj) {
        String result = "";
        try {
            result = "(ref of type" + obj.getBaseTypeName().length() + ")";
        } catch (SQLException e) {
            result = "(ref of unknown type)";
        }
        return result;
    }
}

Related

  1. formatDate(String date)
  2. formatDateTd(Object obj)
  3. formatDateToCustfmt(java.util.Date date, String dateFmt)
  4. formatDurationMillisToString(long millis)
  5. formatFloat(int floatValue)
  6. formatNumberWithZeroPrefix(int numOfZero, Integer value)
  7. formatSQLError(SQLException e)
  8. formatSqlException( StringBuilder errorMessage, SQLException exception)
  9. formatSQLForColumnName(Connection conn, String strSQL)