Java Object Array Convert To convertObjectToSqlSyntaxe(Object value)

Here you can find the source of convertObjectToSqlSyntaxe(Object value)

Description

convert Object To Sql Syntaxe

License

LGPL

Declaration

private static String convertObjectToSqlSyntaxe(Object value) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    private static String convertObjectToSqlSyntaxe(Object value) {
        String valuesSql = "''";
        if (value != null) {
            if (value instanceof String) {
                valuesSql = "'" + ((String) value).replaceAll("'", "''") + "'";
            } else if (value instanceof Boolean) {
                valuesSql = "" + ((Boolean) value ? 1 : 0);
            } else {
                valuesSql = value.toString();
            }/*from  w w w .j a v a 2s .  c  o  m*/
        }
        return valuesSql;
    }
}

Related

  1. convertObjectGUIToByteString(byte[] objectGUID)
  2. convertObjectToBean(Object obj, Class clazz)
  3. convertObjectToBoolean(Object value)
  4. convertObjectToInt(Object value)
  5. convertObjectToIntegerIfNecessary(final Object configValue)
  6. objectArrayToIntArray(Object[] objectArray)
  7. objectArrayToObjectArray(Object[] objArray)
  8. objectArrayToRVector(Object[] rValues)
  9. objectToIntegerArray(Object[] objects)