Class SqlgUtil

java.lang.Object
org.umlg.sqlg.util.SqlgUtil

public class SqlgUtil extends Object
Date: 2014/07/12 Time: 3:13 PM
  • Method Details

    • loadRecursiveIncludeEdgeResultSetIntoResultIterator

      public static List<Emit<SqlgElement>> loadRecursiveIncludeEdgeResultSetIntoResultIterator(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, List<LinkedList<SchemaTableTree>> subQueryStacks, boolean first, Map<String,Integer> idColumnCountMap, boolean forParent) throws SQLException
      Throws:
      SQLException
    • loadRecursiveResultSetIntoResultIterator

      public static List<Emit<SqlgElement>> loadRecursiveResultSetIntoResultIterator(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, boolean first, Map<String,Integer> idColumnCountMap, boolean forParent) throws SQLException
      Throws:
      SQLException
    • loadResultSetIntoResultIterator

      public static List<Emit<SqlgElement>> loadResultSetIntoResultIterator(SqlgGraph sqlgGraph, ResultSetMetaData resultSetMetaData, ResultSet resultSet, SchemaTableTree rootSchemaTableTree, List<LinkedList<SchemaTableTree>> subQueryStacks, boolean first, Map<String,Integer> idColumnCountMap, boolean forParent) throws SQLException
      Parameters:
      forParent - Indicates that the gremlin query is for SqlgVertexStep. It is in the context of an incoming traverser, the parent.
      Returns:
      A list of @Emits that represent a single @Path
      Throws:
      SQLException
    • isBulkWithinAndOut

      public static boolean isBulkWithinAndOut(SqlgGraph sqlgGraph, org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer hasContainer)
    • isBulkWithin

      public static boolean isBulkWithin(SqlgGraph sqlgGraph, org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer hasContainer)
    • setParametersOnStatement

      public static void setParametersOnStatement(SqlgGraph sqlgGraph, LinkedList<SchemaTableTree> schemaTableTreeStack, PreparedStatement preparedStatement, boolean includeAdditionalPartitionHasContainer) throws SQLException
      Throws:
      SQLException
    • setKeyValuesAsParameterUsingPropertyColumn

      public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String,org.apache.commons.lang3.tuple.Pair<PropertyDefinition,Object>> properties) throws SQLException
      Throws:
      SQLException
    • setKeyValuesAsParameterUsingPropertyColumn

      public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, Collection<org.apache.commons.lang3.tuple.Pair<PropertyDefinition,Object>> typeAndValues) throws SQLException
      Throws:
      SQLException
    • setKeyValuesAsParameter

      public static int setKeyValuesAsParameter(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, Collection<org.apache.commons.lang3.tuple.ImmutablePair<PropertyDefinition,Object>> typeAndValues) throws SQLException
      Throws:
      SQLException
    • setKeyValueAsParameter

      public static int setKeyValueAsParameter(SqlgGraph sqlgGraph, boolean mod, int parameterStartIndex, PreparedStatement preparedStatement, org.apache.commons.lang3.tuple.ImmutablePair<PropertyDefinition,Object> pair) throws SQLException
      Throws:
      SQLException
    • parseLabel

      public static SchemaTable parseLabel(String label)
    • mapTokeyValues

      public static Object[] mapTokeyValues(Map<Object,Object> keyValues)
    • mapToStringKeyValues

      public static Object[] mapToStringKeyValues(Map<String,Object> keyValues)
    • transformToKeyList

      public static List<String> transformToKeyList(Object... keyValues)
    • transformToColumnDefinitionMap

      public static ConcurrentHashMap<String,PropertyDefinition> transformToColumnDefinitionMap(Object... keyValues)
    • validateAndTransformVertexKeysValues

      public static Map<String,Object> validateAndTransformVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues)
    • validateVertexKeysValues

      public static org.apache.commons.lang3.tuple.Pair<Map<String,PropertyDefinition>,Map<String,Object>> validateVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues)
      Validates the key values and converts it into a Triple with three maps. The left map is a map of keys together with their PropertyType. The middle map is a map of keys together with their values. The right map is a map of keys with values where the values are guaranteed not to be null.
      Parameters:
      sqlDialect - The dialect.
      keyValues - The key value pairs.
      Returns:
      A Triple with 3 maps.
    • validateAndTransformVertexKeysValues

      public static Map<String,Object> validateAndTransformVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues, List<String> previousBatchModeKeys)
    • validateVertexKeysValues

      public static org.apache.commons.lang3.tuple.Pair<Map<String,PropertyDefinition>,Map<String,Object>> validateVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues, List<String> previousBatchModeKeys)
    • removeTrailingInId

      public static String removeTrailingInId(String foreignKey)
    • removeTrailingOutId

      public static String removeTrailingOutId(String foreignKey)
    • dropDb

      public static void dropDb(SqlDialect sqlDialect, Connection conn)
    • dropDb

      public static void dropDb(SqlgGraph sqlgGraph)
    • convertPrimitiveByteArrayToByteArray

      public static Byte[] convertPrimitiveByteArrayToByteArray(byte[] value)
    • convertByteArrayToPrimitiveArray

      public static Object convertByteArrayToPrimitiveArray(Byte[] value)
    • convertObjectArrayToBytePrimitiveArray

      public static byte[] convertObjectArrayToBytePrimitiveArray(Object[] byteArray)
    • convertObjectArrayToBooleanArray

      public static Boolean[] convertObjectArrayToBooleanArray(Object[] booleanArray)
    • convertObjectArrayToBooleanPrimitiveArray

      public static boolean[] convertObjectArrayToBooleanPrimitiveArray(Object[] booleanArray)
    • convertObjectOfIntegersArrayToShortArray

      public static Short[] convertObjectOfIntegersArrayToShortArray(Object[] shortArray)
    • convertObjectOfShortsArrayToShortArray

      public static Short[] convertObjectOfShortsArrayToShortArray(Object[] shortArray)
    • convertObjectOfIntegersArrayToShortPrimitiveArray

      public static short[] convertObjectOfIntegersArrayToShortPrimitiveArray(Object[] shortArray)
    • convertObjectOfShortsArrayToShortPrimitiveArray

      public static short[] convertObjectOfShortsArrayToShortPrimitiveArray(Object[] shortArray)
    • convertObjectOfIntegersArrayToIntegerArray

      public static Integer[] convertObjectOfIntegersArrayToIntegerArray(Object[] integerArray)
    • convertObjectOfIntegersArrayToIntegerPrimitiveArray

      public static int[] convertObjectOfIntegersArrayToIntegerPrimitiveArray(Object[] integerArray)
    • convertObjectOfLongsArrayToLongPrimitiveArray

      public static long[] convertObjectOfLongsArrayToLongPrimitiveArray(Object[] longArray)
    • convertObjectOfDoublesArrayToDoublePrimitiveArray

      public static double[] convertObjectOfDoublesArrayToDoublePrimitiveArray(Object[] doubleArray)
    • convertObjectOfDoublesArrayToBigDecimalArray

      public static BigDecimal[] convertObjectOfDoublesArrayToBigDecimalArray(Object[] doubleArray)
    • convertObjectOfFloatsArrayToFloatPrimitiveArray

      public static float[] convertObjectOfFloatsArrayToFloatPrimitiveArray(Object[] floatArray)
    • convertObjectOfLongsArrayToLongArray

      public static Long[] convertObjectOfLongsArrayToLongArray(Object[] longArray)
    • convertObjectOfDoublesArrayToDoubleArray

      public static Double[] convertObjectOfDoublesArrayToDoubleArray(Object[] doubleArray)
    • convertObjectOfFloatsArrayToFloatArray

      public static Float[] convertObjectOfFloatsArrayToFloatArray(Object[] doubleArray)
    • convertObjectOfStringsArrayToStringArray

      public static String[] convertObjectOfStringsArrayToStringArray(Object[] stringArray)
    • copyToLocalDateTime

      public static <T> T copyToLocalDateTime(Timestamp[] value, T target)
    • copyObjectArrayOfTimestampToLocalDateTime

      public static <T> T copyObjectArrayOfTimestampToLocalDateTime(Object[] value, T target)
    • copyObjectArrayOfTimestampToLocalDate

      public static <T> T copyObjectArrayOfTimestampToLocalDate(Object[] value, T target)
    • copyToLocalDate

      public static <T> T copyToLocalDate(Date[] value, T target)
    • copyObjectArrayOfDateToLocalDate

      public static <T> T copyObjectArrayOfDateToLocalDate(Object[] value, T target)
    • copyToLocalTime

      public static <T> T copyToLocalTime(Time[] value, T target)
    • copyObjectArrayOfTimeToLocalTime

      public static <T> T copyObjectArrayOfTimeToLocalTime(Object[] value, T target)
    • originalLabel

      public static String originalLabel(String label)
    • getValue

      public static List<Comparable> getValue(ResultSet resultSet, List<ColumnList.Column> columns)
    • stringValueToType

      public static Object stringValueToType(PropertyType propertyType, String value)
    • validateIncomingPropertyType

      public static void validateIncomingPropertyType(String incomingPropertyDescription, PropertyDefinition incomingPropertyDefinition, String propertyDescription, PropertyDefinition propertyDefinition)