Package org.voltdb

Class SQLStmt

java.lang.Object
org.voltdb.SQLStmt

public class SQLStmt extends Object

A simple wrapper of a parameterized SQL statement. VoltDB uses this instead of a Java String type for performance reasons and to cache statement meta-data like result schema, compiled plan, etc..

SQLStmts are used exclusively in subclasses of VoltProcedure

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    SQLStmt(String sqlText)
    Construct a SQLStmt instance from a SQL statement.
    SQLStmt(String sqlText, String joinOrder)
    Construct a SQLStmt instance from a SQL statement with joinOrder hint.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    In SQL statement the input without ending with a semicolon is legitimate, however in order to do a reverse look up (crc -> sql str), we'd like to use the same statement to compute crc.
    Get the join order hint supplied in the constructor.
    Get the text of the SQL statement represented.
    boolean
    Is this a read only statement?

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SQLStmt

      public SQLStmt(String sqlText)
      Construct a SQLStmt instance from a SQL statement.
      Parameters:
      sqlText - Valid VoltDB compliant SQL with question marks as parameter place holders.
    • SQLStmt

      public SQLStmt(String sqlText, String joinOrder)
      Construct a SQLStmt instance from a SQL statement with joinOrder hint.
      Parameters:
      sqlText - Valid VoltDB compliant SQL with question marks as parameter place holders.
      joinOrder - separated list of tables used by the query specifying the order they should be joined in
  • Method Details

    • getText

      public String getText()
      Get the text of the SQL statement represented.
      Returns:
      String containing the text of the SQL statement represented.
    • getJoinOrder

      public String getJoinOrder()
      Get the join order hint supplied in the constructor.
      Returns:
      String containing the join order hint.
    • isReadOnly

      public boolean isReadOnly()
      Is this a read only statement?
      Returns:
      true if it's read only, false otherwise
    • canonicalizeStmt

      public static String canonicalizeStmt(String stmtStr)
      In SQL statement the input without ending with a semicolon is legitimate, however in order to do a reverse look up (crc -> sql str), we'd like to use the same statement to compute crc.
      Parameters:
      stmtStr - the sql statement
      Returns:
      the canonicalized sql statement