Class SQLUtil
java.lang.Object
com.vividsolutions.jump.datastore.SQLUtil
Utililty class containing methods to manipulate SQL Strings
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCompose a concatenated quoted schema name and table name.static StringescapeSingleQuote(String identifier) Escape single quotes in the given identifier.static AttributeTypegetAttributeType(int sqlType, String dataTypeName) Returns OpenJUMP attributeType from sql type and datatype name. dataTypeName is nullable.static byte[]getByteArrayFromGeometry(org.locationtech.jts.geom.Geometry geom, int srid, int dimension) Converts the geometry into a byte array in EWKB formatstatic StringNormalize an identifier name (use only lower case)static StringReturns s if s is already quoted (with double-quotes), and a quoted version of s otherwise.static String[]splitTableName(String fullName) Returns a pair of strings containing unquoted schema and table names from a full table name.static StringReturns s without initial and final double quotes if any.
-
Constructor Details
-
SQLUtil
public SQLUtil()
-
-
Method Details
-
splitTableName
Returns a pair of strings containing unquoted schema and table names from a full table name. If the fullName contains only one part (table name), the returned array contains a null element at index 0
Examples :
- myschema.mytable -> [myschema, mytable]
- "MySchema"."MyTable" -> [MySchema, MyTable]
- MyTable -> [null, MyTable]
- 2_table -> [null, 2_table]
-
quote
-
unquote
-
escapeSingleQuote
Escape single quotes in the given identifier. Replace all single quotes ("'") by double single quotes ("''")- Parameters:
identifier- string identifier to escape- Returns:
- the identifier with single quotes escaped, or identifier if no string found
-
compose
-
normalize
-
getByteArrayFromGeometry
public static byte[] getByteArrayFromGeometry(org.locationtech.jts.geom.Geometry geom, int srid, int dimension) Converts the geometry into a byte array in EWKB format- Parameters:
geom- the geometry to convert to a byte arraysrid- the srid of the geometrydimension- geometry dimension (2 or 3)- Returns:
- a byte array containing a EWKB representation of the geometry
-
getAttributeType
Returns OpenJUMP attributeType from sql type and datatype name. dataTypeName is nullable. If dataTypeName = "geometry", binary field will be interpreted into AttributeType.GEOMETRY- Parameters:
sqlType- jdbc sql datatypedataTypeName- native datatype name
-