diff options
author | James Moger <james.moger@gitblit.com> | 2014-11-09 12:22:12 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-11-09 12:22:12 -0500 |
commit | 97358035987e26ea801abac461bf5b5c9a406aa7 (patch) | |
tree | e6a34fc922a9ca56092518db233526985c780630 /src/main/java/com/iciql/SQLDialectPostgreSQL.java | |
parent | 96d0aca9ff3b29be62bc6558af80fe115b646b88 (diff) | |
download | iciql-97358035987e26ea801abac461bf5b5c9a406aa7.tar.gz iciql-97358035987e26ea801abac461bf5b5c9a406aa7.zip |
Moved data type adapters into separate package, added gson and xstream
Diffstat (limited to 'src/main/java/com/iciql/SQLDialectPostgreSQL.java')
-rw-r--r-- | src/main/java/com/iciql/SQLDialectPostgreSQL.java | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/main/java/com/iciql/SQLDialectPostgreSQL.java b/src/main/java/com/iciql/SQLDialectPostgreSQL.java index f10017c..6998c24 100644 --- a/src/main/java/com/iciql/SQLDialectPostgreSQL.java +++ b/src/main/java/com/iciql/SQLDialectPostgreSQL.java @@ -16,11 +16,6 @@ package com.iciql;
-import java.sql.SQLException;
-
-import org.postgresql.util.PGobject;
-
-import com.iciql.Iciql.DataTypeAdapter;
import com.iciql.TableDefinition.IndexDefinition;
import com.iciql.util.StatementBuilder;
@@ -106,102 +101,4 @@ public class SQLDialectPostgreSQL extends SQLDialectDefault { stat.setSQL(buff.toString().trim());
}
- /**
- * Handles transforming raw strings to/from the Postgres JSON data type.
- */
- public class JsonStringAdapter implements DataTypeAdapter<String> {
-
- @Override
- public String getDataType() {
- return "json";
- }
-
- @Override
- public Class<String> getJavaType() {
- return String.class;
- }
-
- @Override
- public Object serialize(String value) {
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(value);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
-
- @Override
- public String deserialize(Object value) {
- return value.toString();
- }
- }
-
- /**
- * Handles transforming raw strings to/from the Postgres JSONB data type.
- */
- public class JsonbStringAdapter implements DataTypeAdapter<String> {
-
- @Override
- public String getDataType() {
- return "jsonb";
- }
-
- @Override
- public Class<String> getJavaType() {
- return String.class;
- }
-
- @Override
- public Object serialize(String value) {
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(value);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
-
- @Override
- public String deserialize(Object value) {
- return value.toString();
- }
- }
-
- /**
- * Handles transforming raw strings to/from the Postgres XML data type.
- */
- public class XmlStringAdapter implements DataTypeAdapter<String> {
-
- @Override
- public String getDataType() {
- return "xml";
- }
-
- @Override
- public Class<String> getJavaType() {
- return String.class;
- }
-
- @Override
- public Object serialize(String value) {
- PGobject pg = new PGobject();
- pg.setType(getDataType());
- try {
- pg.setValue(value);
- } catch (SQLException e) {
- // not thrown on base PGobject
- }
- return pg;
- }
-
- @Override
- public String deserialize(Object value) {
- return value.toString();
- }
- }
}
\ No newline at end of file |