Class SQLUtil

java.lang.Object
com.j_spaces.jdbc.SQLUtil

public class SQLUtil extends Object
SQLUtil defines utility methods for the SQL query classes
Since:
5.1
Version:
1.0
Author:
anna
  • 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

      public static Class<?> getPropertyType(ITypeDesc typeDesc, String propertyName) throws SQLException
      Throws:
      SQLException
    • getFieldValue

      public static Object getFieldValue(IEntryPacket e, ITypeDesc typeDesc, String propertyName)
    • getFieldValue

      public static Object getFieldValue(IEntryPacket entry, QueryColumnData columnData)
    • getAdmin

      public static IRemoteJSpaceAdmin getAdmin(IJSpace space) throws RemoteException
      Get this space admin
      Throws:
      RemoteException
    • checkTableExistence

      public static ITypeDesc checkTableExistence(String tableName, IJSpace space) throws SQLException
      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 stream
      inputStreamLength - 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 string
      inputStreamLength - The number of bytes to read from input stream
      Returns:
      The input stream as a string
      Throws:
      IOException
    • convertReaderToString

      public static String convertReaderToString(Reader reader, int readerLength) throws IOException
      Convert a reader to a string
      Parameters:
      reader - The reader
      readerLength - The number of characters to read from the reader
      Returns:
      The converted reader as a string
      Throws:
      IOException