Package org.eigenbase.sql.util

Examples of org.eigenbase.sql.util.SqlString


    return new AbstractTableQueryable<T>(queryProvider, schema, this,
        tableName) {
      public Enumerator<T> enumerator() {
        final JavaTypeFactory typeFactory =
            ((OptiqConnection) queryProvider).getTypeFactory();
        final SqlString sql = generateSql();
        //noinspection unchecked
        final Enumerable<T> enumerable = (Enumerable<T>) ResultSetEnumerable.of(
            jdbcSchema.getDataSource(),
            sql.getSql(),
            JdbcUtils.ObjectArrayRowBuilder.factory(fieldClasses(typeFactory)));
        return enumerable.enumerator();
      }
    };
  }
View Full Code Here


    }
    for (BasicSqlType type : SqlLimitsTest.getTypes()) {
      for (Object o : getValues(type, true)) {
        SqlLiteral literal =
            type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO);
        SqlString literalString =
            literal.toSqlString(SqlDialect.DUMMY);
        final String expr =
            "CAST(" + literalString
            + " AS " + type + ")";
        try {
View Full Code Here

    tester.setFor(SqlStdOperatorTable.CAST);
    for (BasicSqlType type : SqlLimitsTest.getTypes()) {
      for (Object o : getValues(type, false)) {
        SqlLiteral literal =
            type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO);
        SqlString literalString =
            literal.toSqlString(SqlDialect.DUMMY);

        if ((type.getSqlTypeName() == SqlTypeName.BIGINT)
            || ((type.getSqlTypeName() == SqlTypeName.DECIMAL)
            && (type.getPrecision() == 19))) {
View Full Code Here

    }
    for (BasicSqlType type : SqlLimitsTest.getTypes()) {
      for (Object o : getValues(type, true)) {
        SqlLiteral literal =
            type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO);
        SqlString literalString =
            literal.toSqlString(SqlDialect.DUMMY);
        final String expr =
            "CAST(" + literalString
            + " AS " + type + ")";
        try {
View Full Code Here

    tester.setFor(SqlStdOperatorTable.CAST);
    for (BasicSqlType type : SqlLimitsTest.getTypes()) {
      for (Object o : getValues(type, false)) {
        SqlLiteral literal =
            type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO);
        SqlString literalString =
            literal.toSqlString(SqlDialect.DUMMY);

        if ((type.getSqlTypeName() == SqlTypeName.BIGINT)
            || ((type.getSqlTypeName() == SqlTypeName.DECIMAL)
            && (type.getPrecision() == 19))) {
View Full Code Here

    return new AbstractTableQueryable<T>(queryProvider, schema, this,
        tableName) {
      public Enumerator<T> enumerator() {
        final JavaTypeFactory typeFactory =
            ((OptiqConnection) queryProvider).getTypeFactory();
        final SqlString sql = generateSql();
        //noinspection unchecked
        final Enumerable<T> enumerable = (Enumerable<T>) ResultSetEnumerable.of(
            jdbcSchema.getDataSource(),
            sql.getSql(),
            JdbcUtils.ObjectArrayRowBuilder.factory(fieldClasses(typeFactory)));
        return enumerable.enumerator();
      }
    };
  }
View Full Code Here

        tester.setFor(SqlStdOperatorTable.castFunc);
        for (BasicSqlType type : SqlLimitsTest.getTypes()) {
            for (Object o : getValues(type, true)) {
                SqlLiteral literal =
                    type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO);
                SqlString literalString =
                    literal.toSqlString(SqlDialect.DUMMY);
                final String expr =
                    "CAST(" + literalString
                    + " AS " + type + ")";
                if ((type.getSqlTypeName() == SqlTypeName.VARBINARY)
View Full Code Here

        tester.setFor(SqlStdOperatorTable.castFunc);
        for (BasicSqlType type : SqlLimitsTest.getTypes()) {
            for (Object o : getValues(type, false)) {
                SqlLiteral literal =
                    type.getSqlTypeName().createLiteral(o, SqlParserPos.ZERO);
                SqlString literalString =
                    literal.toSqlString(SqlDialect.DUMMY);

                if ((type.getSqlTypeName() == SqlTypeName.BIGINT)
                    || ((type.getSqlTypeName() == SqlTypeName.DECIMAL)
                        && (type.getPrecision() == 19)))
View Full Code Here

        timingTracer.traceTime("end validation");

        SqlDialect sqlDialect =
            SqlDialect.create(stmt.getSession().getDatabaseMetaData());
        final SqlString sql = validatedSqlNode.toSqlString(sqlDialect);

        if (analyzedSql != null) {
            if (validatedSqlNode instanceof SqlSelect) {
                // assume we're validating a view
                SqlSelect select = (SqlSelect) validatedSqlNode;
                if (select.getOrderList() != null) {
                    analyzedSql.hasTopLevelOrderBy = true;
                }
            }

            // Need to force preparation so we can dig out required info, so
            // don't use cache.  Also, don't need to go all the way with
            // stmt implementation either; can stop after validation, which
            // provides needed metadata.  (In fact, we CAN'T go much further,
            // because if a view is being created as part of a CREATE SCHEMA
            // statement, some of the tables it depends on may not have
            // storage defined yet.)
            analyzedSql.canonicalString = sql;
            stmt.analyzeSql(validatedSqlNode, analyzedSql);

            timingTracer.traceTime("end analyzeSql");

            return null;
        }

        String key = sql + ";label=";
        FarragoDbSession session = (FarragoDbSession) stmt.getSession();
        Long labelCsn = session.getSessionLabelCsn();
        if (labelCsn != null) {
            key += labelCsn;
        }
        final String stmtKey = key;

        FarragoObjectCache.Entry cacheEntry;
        FarragoObjectCache.CachedObjectFactory stmtFactory =
            new FarragoObjectCache.CachedObjectFactory() {
                public void initializeEntry(
                    Object key,
                    FarragoObjectCache.UninitializedEntry entry)
                {
                    timingTracer.traceTime("code cache miss");

                    assert (key.equals(stmtKey));
                    FarragoSessionExecutableStmt executableStmt =
                        stmt.prepare(validatedSqlNode, sqlNode);
                    long memUsage =
                        FarragoUtil.getStringMemoryUsage(sql.getSql())
                        + executableStmt.getMemoryUsage();
                    entry.initialize(
                        executableStmt,
                        memUsage,
                        stmt.mayCacheImplementation());
View Full Code Here

        RelDataTypeFactory typeFactory,
        RelDataType paramRowType,
        boolean optimize)
    {
        FarragoSessionAnalyzedSql analyzedSql = getAnalysisBlock(typeFactory);
        analyzedSql.rawString = new SqlString(SqlDialect.EIGENBASE, sql);
        analyzedSql.optimized = optimize;
        analyzedSql.paramRowType = paramRowType;
        FarragoSessionExecutableStmt stmt =
            prepare(
                null,
View Full Code Here

TOP

Related Classes of org.eigenbase.sql.util.SqlString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.