@Test public void rdbmsStringTest() { final DataRdbms data = instance.getData("valeur"); Assert.assertEquals(data.getValue(), "valeur"); Assert.assertEquals(data.getParameter(), "'valeur'"); }
public DataRdbms getData(final Object object) { if (object == null) { return new GenericDataRdbms("NULL"); } if (object instanceof String) { final String s = (String) object; return new EscapeStringDataRdbms(s, "'"); } else if (object instanceof Timestamp) { final Timestamp timestamp = (Timestamp) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN); final NumberFormat nf = new DecimalFormat("000000000"); final String dateString = df.format(timestamp) + nf.format(timestamp.getNanos()); return new GenericDataRdbms(dateString, "'"); } else if (object instanceof Date) { final Date date = (Date) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN_MILLISECONDS); return new GenericDataRdbms(df.format(date), "'"); } else if (object instanceof Boolean) { return new GenericDataRdbms(((Boolean) object).booleanValue() ? "1" : "0", "'"); } else if (object instanceof Reader) { Reader reader = (Reader) object; int intValueOfChar; String targetString = ""; try { while ((intValueOfChar = reader.read()) != -1) { targetString += (char) intValueOfChar; } } catch (IOException e) { return new GenericDataRdbms(object.toString()); } return new GenericDataRdbms(targetString); } else { return new GenericDataRdbms(object.toString()); } }
GenericRdbmsSpecifics implements RdbmsSpecifics { public DataRdbms getData(final Object object) { if (object == null) { return new GenericDataRdbms("NULL"); } if (object instanceof String) { final String s = (String) object; return new EscapeStringDataRdbms(s, "'"); } else if (object instanceof Timestamp) { final Timestamp timestamp = (Timestamp) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN); final NumberFormat nf = new DecimalFormat("000000000"); final String dateString = df.format(timestamp) + nf.format(timestamp.getNanos()); return new GenericDataRdbms(dateString, "'"); } else if (object instanceof Date) { final Date date = (Date) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN_MILLISECONDS); return new GenericDataRdbms(df.format(date), "'"); } else if (object instanceof Boolean) { return new GenericDataRdbms(((Boolean) object).booleanValue() ? "1" : "0", "'"); } else if (object instanceof Reader) { Reader reader = (Reader) object; int intValueOfChar; String targetString = ""; try { while ((intValueOfChar = reader.read()) != -1) { targetString += (char) intValueOfChar; } } catch (IOException e) { return new GenericDataRdbms(object.toString()); } return new GenericDataRdbms(targetString); } else { return new GenericDataRdbms(object.toString()); } } }
GenericRdbmsSpecifics implements RdbmsSpecifics { public DataRdbms getData(final Object object) { if (object == null) { return new GenericDataRdbms("NULL"); } if (object instanceof String) { final String s = (String) object; return new EscapeStringDataRdbms(s, "'"); } else if (object instanceof Timestamp) { final Timestamp timestamp = (Timestamp) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN); final NumberFormat nf = new DecimalFormat("000000000"); final String dateString = df.format(timestamp) + nf.format(timestamp.getNanos()); return new GenericDataRdbms(dateString, "'"); } else if (object instanceof Date) { final Date date = (Date) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN_MILLISECONDS); return new GenericDataRdbms(df.format(date), "'"); } else if (object instanceof Boolean) { return new GenericDataRdbms(((Boolean) object).booleanValue() ? "1" : "0", "'"); } else if (object instanceof Reader) { Reader reader = (Reader) object; int intValueOfChar; String targetString = ""; try { while ((intValueOfChar = reader.read()) != -1) { targetString += (char) intValueOfChar; } } catch (IOException e) { return new GenericDataRdbms(object.toString()); } return new GenericDataRdbms(targetString); } else { return new GenericDataRdbms(object.toString()); } } private  GenericRdbmsSpecifics(); }
GenericRdbmsSpecifics implements RdbmsSpecifics { public DataRdbms getData(final Object object) { if (object == null) { return new GenericDataRdbms("NULL"); } if (object instanceof String) { final String s = (String) object; return new EscapeStringDataRdbms(s, "'"); } else if (object instanceof Timestamp) { final Timestamp timestamp = (Timestamp) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN); final NumberFormat nf = new DecimalFormat("000000000"); final String dateString = df.format(timestamp) + nf.format(timestamp.getNanos()); return new GenericDataRdbms(dateString, "'"); } else if (object instanceof Date) { final Date date = (Date) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN_MILLISECONDS); return new GenericDataRdbms(df.format(date), "'"); } else if (object instanceof Boolean) { return new GenericDataRdbms(((Boolean) object).booleanValue() ? "1" : "0", "'"); } else if (object instanceof Reader) { Reader reader = (Reader) object; int intValueOfChar; String targetString = ""; try { while ((intValueOfChar = reader.read()) != -1) { targetString += (char) intValueOfChar; } } catch (IOException e) { return new GenericDataRdbms(object.toString()); } return new GenericDataRdbms(targetString); } else { return new GenericDataRdbms(object.toString()); } } private  GenericRdbmsSpecifics(); static RdbmsSpecifics getInstance(); boolean isRdbms(final String classType); DataRdbms getData(final Object object); String getTypeQuery(String sql); int beginQuery(String sql, int index); String removeComment(String sql); boolean isCaseSensitive(); String toString(); }
GenericRdbmsSpecifics implements RdbmsSpecifics { public DataRdbms getData(final Object object) { if (object == null) { return new GenericDataRdbms("NULL"); } if (object instanceof String) { final String s = (String) object; return new EscapeStringDataRdbms(s, "'"); } else if (object instanceof Timestamp) { final Timestamp timestamp = (Timestamp) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN); final NumberFormat nf = new DecimalFormat("000000000"); final String dateString = df.format(timestamp) + nf.format(timestamp.getNanos()); return new GenericDataRdbms(dateString, "'"); } else if (object instanceof Date) { final Date date = (Date) object; final DateFormat df = new SimpleDateFormat(DATE_PATTERN_MILLISECONDS); return new GenericDataRdbms(df.format(date), "'"); } else if (object instanceof Boolean) { return new GenericDataRdbms(((Boolean) object).booleanValue() ? "1" : "0", "'"); } else if (object instanceof Reader) { Reader reader = (Reader) object; int intValueOfChar; String targetString = ""; try { while ((intValueOfChar = reader.read()) != -1) { targetString += (char) intValueOfChar; } } catch (IOException e) { return new GenericDataRdbms(object.toString()); } return new GenericDataRdbms(targetString); } else { return new GenericDataRdbms(object.toString()); } } private  GenericRdbmsSpecifics(); static RdbmsSpecifics getInstance(); boolean isRdbms(final String classType); DataRdbms getData(final Object object); String getTypeQuery(String sql); int beginQuery(String sql, int index); String removeComment(String sql); boolean isCaseSensitive(); String toString();  }