Ejemplo n.º 1
0
    DataContextImpl(OptiqConnectionImpl connection, List<Object> parameterValues) {
      this.queryProvider = connection;
      this.typeFactory = connection.getTypeFactory();
      this.rootSchema = connection.rootSchema;

      // Store the time at which the query started executing. The SQL
      // standard says that functions such as CURRENT_TIMESTAMP return the
      // same value throughout the query.
      final long time = System.currentTimeMillis();
      final TimeZone timeZone = connection.getTimeZone();
      final long localOffset = timeZone.getOffset(time);
      final long currentOffset = localOffset;

      ImmutableMap.Builder<Object, Object> builder = ImmutableMap.builder();
      builder
          .put("utcTimestamp", time)
          .put("currentTimestamp", time + currentOffset)
          .put("localTimestamp", time + localOffset)
          .put("timeZone", timeZone);
      for (Ord<Object> value : Ord.zip(parameterValues)) {
        Object e = value.e;
        if (e == null) {
          e = AvaticaParameter.DUMMY_VALUE;
        }
        builder.put("?" + value.i, e);
      }
      map = builder.build();
    }
Ejemplo n.º 2
0
 public DataContext getDataContext() {
   return connection.createDataContext(ImmutableList.of());
 }
Ejemplo n.º 3
0
 public OptiqConnectionConfig config() {
   return connection.config();
 }
Ejemplo n.º 4
0
 public List<String> getDefaultSchemaPath() {
   final String schemaName = connection.getSchema();
   return schemaName == null
       ? Collections.<String>emptyList()
       : Collections.singletonList(schemaName);
 }