Package com.j_spaces.jdbc
Class SQLUtil
java.lang.Object
com.j_spaces.jdbc.SQLUtil
SQLUtil defines utility methods for the SQL query classes
- Since:
- 5.1
- Version:
- 1.0
- Author:
- anna
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectVerifies that the correct type of object is supplied for given column.static ITypeDesccheckTableExistence(String tableName, SpaceTypeManager typeManager) static ITypeDesccheckTableExistence(String tableName, IJSpace space) Checks if given table (class name) exists in spacestatic StringconvertAsciiInputStreamToString(InputStream inputStream, int inputStreamLength) Converts an ascii input stream to a stringstatic byte[]convertInputStreamToByteArray(InputStream inputStream, int inputStreamLength) Converts an input stream to a byte arraystatic StringconvertReaderToString(Reader reader, int readerLength) Convert a reader to a stringstatic IRemoteJSpaceAdminGet this space adminstatic ObjectgetFieldValue(IEntryPacket e, ITypeDesc typeDesc, String propertyName) static ObjectgetFieldValue(IEntryPacket entry, QueryColumnData columnData) static Class<?>getPropertyType(ITypeDesc typeDesc, String propertyName)
-
Constructor Details
-
SQLUtil
public SQLUtil()
-
-
Method Details
-
cast
public static Object cast(ITypeDesc typeDesc, String propertyName, Object obj, boolean isPreparedValue) throws SQLException Verifies that the correct type of object is supplied for given column. If types don't match - object is converted to the column type.- Throws:
SQLException
-
getPropertyType
- Throws:
SQLException
-
getFieldValue
-
getFieldValue
-
getAdmin
Get this space admin- Throws:
RemoteException
-
checkTableExistence
Checks if given table (class name) exists in space- Throws:
SQLException
-
checkTableExistence
public static ITypeDesc checkTableExistence(String tableName, SpaceTypeManager typeManager) throws SQLException - Throws:
SQLException
-
convertInputStreamToByteArray
public static byte[] convertInputStreamToByteArray(InputStream inputStream, int inputStreamLength) throws IOException Converts an input stream to a byte array- Parameters:
inputStream- The input streaminputStreamLength- Number of bytes to read from input stream- Returns:
- The converted input stream as a byte array
- Throws:
IOException
-
convertAsciiInputStreamToString
public static String convertAsciiInputStreamToString(InputStream inputStream, int inputStreamLength) throws IOException Converts an ascii input stream to a string- Parameters:
inputStream- The input stream to convert to stringinputStreamLength- The number of bytes to read from input stream- Returns:
- The input stream as a string
- Throws:
IOException
-
convertReaderToString
Convert a reader to a string- Parameters:
reader- The readerreaderLength- The number of characters to read from the reader- Returns:
- The converted reader as a string
- Throws:
IOException
-