Class

com.alpine.plugin.test.mock

SimpleSQLGenerator

Related Doc: package mock

Permalink

class SimpleSQLGenerator extends SQLGenerator

Linear Supertypes
SQLGenerator, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SimpleSQLGenerator
  2. SQLGenerator
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SimpleSQLGenerator(dbType: TypeValue = DatabaseType.postgres)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. val dbType: TypeValue

    Permalink

    Returns the DatabaseType.TypeValue object that represents the database type.

    Returns the DatabaseType.TypeValue object that represents the database type. Each SQLGenerator is instantiated for a particular database type.

    returns

    the DatabaseType.TypeValue object that represents the database type of this SQLGenerator

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  7. def doubleToString(d: Double): String

    Permalink

    Converts a double to String representation.

    Converts a double to String representation. For most database vendors, this is just invoking toString on the double object. For Teradata, this will format the number of digits to no more than 15.

    d

    the double

    returns

    String representation of the double, limited to 15 characters for Teradata

    Definition Classes
    SQLGenerator
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def getCorrelationExpression(columnX: String, columnY: String): String

    Permalink

    Returns the expression for the correlation function to be used for this database.

    Returns the expression for the correlation function to be used for this database. Most RDBMSs have a CORR(X,Y) function, but some do not. For those that do not have a built-in function, we substitute it with the expression (AVG(XY)-AVG(X)AVG(Y))/(STDDEV_POP(X)*STDDEV_POP(Y)) where both X and Y are NOT NULL.

    columnX

    expression used for column X, typically a column name

    columnY

    expression used for column Y, typically a column name

    returns

    an expression returning the Pearson correlation coefficient, typically CORR(columnX, columnY)

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  13. def getCreateTableAsSelectSQL(selectQuery: String, destinationTable: String): String

    Permalink

    Returns a SQL DDL statement to generate a table based on a SELECT query, not necessarily from any particular table.

    Returns a SQL DDL statement to generate a table based on a SELECT query, not necessarily from any particular table. The entire SELECT query must be supplied to generate something like "CREATE TABLE destinationTable AS selectQuery". This method is useful for calls to UDFs or stored procedures that might be database-specific and don't conform to selecting columns from a source table.

    NOTE: Currently, this works only on certain databases like PostgreSQL, Greenplum, Oracle, MySQL, Teradata, but not MSSQL, which does not support CREATE TABLE ... AS SELECT ....

    Table name should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename").

    selectQuery is not necessarily a SELECT query, but any query that can feed the CREATE TABLE statement.

    selectQuery

    query (not necessary SELECT) to be used for CREATE TABLE

    destinationTable

    name of destination table to be created from SELECT query

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  14. def getCreateTableAsSelectSQL(columns: String, sourceTable: String, destinationTable: String): String

    Permalink

    Returns a SQL DDL statement to generate a table based on a SELECT query from an existing table.

    Returns a SQL DDL statement to generate a table based on a SELECT query from an existing table. For most databases, this is something like "CREATE TABLE destinationTable AS SELECT columns FROM sourceTable"

    Table names should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename"). it is acceptable to specify a table join as the source table (i.e. table1 INNER JOIN table2 ...), but in such cases, column names might not be unique and full qualification and aliasing may be required (i.e. "schemaname"."tablename"."columnname" AS "aliasname")

    columns

    String of comma-separated columns to be SELECTed

    sourceTable

    name of source table from which we SELECT

    destinationTable

    name of destination table to be created from SELECT query

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  15. def getCreateTableAsSelectSQL(columns: String, sourceTable: String, destinationTable: String, whereClause: String): String

    Permalink

    Returns a SQL DDL statement to generate a table based on a SELECT query from an existing table.

    Returns a SQL DDL statement to generate a table based on a SELECT query from an existing table. For most databases, this is something like "CREATE TABLE destinationTable AS SELECT columns FROM sourceTable whereClause"

    Table names should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename"). it is acceptable to specify a table join as the source table (i.e. table1 INNER JOIN table2 ...), but in such cases, column names might not be unique and full qualification and aliasing may be required (i.e. "schemaname"."tablename"."columnname" AS "aliasname")

    The specified WHERE clause should include the "WHERE" keyword. Note that this is simply SQL that is appended to the query as "SELECT columns FROM sourceTable whereClause" and can include other SQL outside of just a WHERE clause, such as GROUP BY, ORDER BY, etc.

    columns

    String of comma-separated columns to be SELECTed

    sourceTable

    name of source table from which we SELECT

    destinationTable

    name of destination table to be created from SELECT query

    whereClause

    where clause of the SELECT query, including the literal "WHERE" keyword

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  16. def getCreateTableOrViewAsSelectSQL(selectQuery: String, destinationTable: String, isView: Boolean): String

    Permalink

    Returns a SQL DDL statement to generate a table or view based on a SELECT query, not necessarily from any particular table.

    Returns a SQL DDL statement to generate a table or view based on a SELECT query, not necessarily from any particular table. The entire SELECT query must be supplied to generate something like "CREATE TABLE destinationTable AS selectQuery" or "CREATE VIEW destinationTable AS selectQuery", depending on the isView parameter. This method is useful for calls to UDFs or stored procedures that might be database-specific and don't conform to selecting columns from a source table.

    NOTE: Currently, creating a table works only on certain databases but not MSSQL, which does not support CREATE TABLE ... AS SELECT ....

    Table or view name should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename" or "schemaname"."viewname").

    selectQuery is not necessarily a SELECT query, but any query that can feed the CREATE TABLE statement.

    selectQuery

    query (not necessary SELECT) to be used for CREATE TABLE

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  17. def getCreateTableOrViewAsSelectSQL(columns: String, sourceTable: String, destinationTable: String, isView: Boolean): String

    Permalink

    Returns a SQL DDL statement to generate a table or view based on a SELECT query from an existing table.

    Returns a SQL DDL statement to generate a table or view based on a SELECT query from an existing table. For most databases, this is something like "CREATE TABLE destinationTable AS SELECT columns FROM sourceTable" or "CREATE VIEW destinationTable AS SELECT columns FROM sourceTable", depending on the isView parameter

    Table and view names should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename", "schemaname"."viewname"). it is acceptable to specify a table join as the source table (i.e. table1 INNER JOIN table2 ...), but in such cases, column names might not be unique and full qualification and aliasing may be required (i.e. "schemaname"."tablename"."columnname" AS "aliasname")

    columns

    String of comma-separated columns to be SELECTed

    sourceTable

    name of source table from which we SELECT

    destinationTable

    name of destination table or view to be created from SELECT query

    isView

    true if generating a view, false if generating a table

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  18. def getCreateTableOrViewAsSelectSQL(columns: String, sourceTable: String, destinationTable: String, whereClause: String, isView: Boolean): String

    Permalink

    Returns a SQL DDL statement to generate a table or view based on a SELECT query from an existing table.

    Returns a SQL DDL statement to generate a table or view based on a SELECT query from an existing table. For most databases, this is something like "CREATE TABLE destinationTable AS SELECT columns FROM sourceTable whereClause" or "CREATE VIEW destinationTable AS SELECT columns FROM sourceTable whereClause", depending on the isView parameter

    Table and view names should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename", "schemaname"."viewname"). it is acceptable to specify a table join as the source table (i.e. table1 INNER JOIN table2 ...), but in such cases, column names might not be unique and full qualification and aliasing may be required (i.e. "schemaname"."tablename"."columnname" AS "aliasname")

    The specified WHERE clause should include the "WHERE" keyword. Note that this is simply SQL that is appended to the query as "SELECT columns FROM sourceTable whereClause" and can include other SQL outside of just a WHERE clause, such as GROUP BY, ORDER BY, etc.

    columns

    String of comma-separated columns to be SELECTed

    sourceTable

    name of source table from which we SELECT

    destinationTable

    name of destination table or view to be created from SELECT query

    whereClause

    where clause of the SELECT query, including the literal "WHERE" keyword

    isView

    true if generating a view, false if generating a table

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  19. def getCreateTempTableAsSelectSQL(selectQuery: String, destinationTable: String): String

    Permalink

    Returns a SQL DDL statement to generate a temporary table based on a SELECT query, not necessarily from any particular table.

    Returns a SQL DDL statement to generate a temporary table based on a SELECT query, not necessarily from any particular table. The entire SELECT query must be supplied to generate something like "CREATE TEMP TABLE destinationTable AS selectQuery". This method is useful for calls to UDFs or stored procedures that might be database-specific and don't conform to selecting columns from a source table.

    NOTE: Currently, this works only on certain databases that support temporary tables.

    Table name should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename").

    selectQuery is not necessarily a SELECT query, but any query that can feed the CREATE TABLE statement.

    selectQuery

    query (not necessary SELECT) to be used for CREATE TABLE

    destinationTable

    name of destination table to be created from SELECT query

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  20. def getCreateViewAsSelectSQL(selectQuery: String, destinationView: String): String

    Permalink

    Returns a SQL DDL statement to generate a view based on a SELECT query, not necessarily from any particular table.

    Returns a SQL DDL statement to generate a view based on a SELECT query, not necessarily from any particular table. The entire SELECT query must be supplied to generate something like "CREATE VIEW destinationTable AS selectQuery". This method is useful for calls to UDFs or stored procedures that might be database-specific and don't conform to selecting columns from a source table.

    Table name should be fully qualified and delimited, if necessary (i.e. "schemaname"."tablename").

    selectQuery is not necessarily a SELECT query, but any query that can feed the CREATE TABLE statement.

    selectQuery

    query (not necessary SELECT) to be used for CREATE VIEW

    destinationView

    name of destination table to be created from SELECT query

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  21. def getCreateViewAsSelectSQL(columns: String, sourceTable: String, destinationView: String): String

    Permalink

    Returns a SQL DDL statement to generate a view based on a SELECT query from an existing table.

    Returns a SQL DDL statement to generate a view based on a SELECT query from an existing table. For most databases, this is something like "CREATE VIEW destinationTable AS SELECT columns FROM sourceTable"

    View names should be fully qualified and delimited, if necessary (i.e. "schemaname"."viewname"). it is acceptable to specify a table join as the source table (i.e. table1 INNER JOIN table2 ...), but in such cases, column names might not be unique and full qualification and aliasing may be required (i.e. "schemaname"."tablename"."columnname" AS "aliasname")

    columns

    String of comma-separated columns to be SELECTed

    sourceTable

    name of source table from which we SELECT

    destinationView

    name of destination view to be created from SELECT query

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  22. def getCreateViewAsSelectSQL(columns: String, sourceTable: String, destinationView: String, whereClause: String): String

    Permalink

    Returns a SQL DDL statement to generate a view based on a SELECT query from an existing table.

    Returns a SQL DDL statement to generate a view based on a SELECT query from an existing table. For most databases, this is something like "CREATE VIEW destinationTable AS SELECT columns FROM sourceTable [whereClause]"

    View names should be fully qualified and delimited, if necessary (i.e. "schemaname"."viewname"). it is acceptable to specify a table join as the source table (i.e. table1 INNER JOIN table2 ...), but in such cases, column names might not be unique and full qualification and aliasing may be required (i.e. "schemaname"."tablename"."columnname" AS "aliasname")

    The specified WHERE clause should include the "WHERE" keyword. Note that this is simply SQL that is appended to the query as "SELECT columns FROM sourceTable whereClause" and can include other SQL outside of just a WHERE clause, such as GROUP BY, ORDER BY, etc.

    columns

    String of comma-separated columns to be SELECTed

    sourceTable

    name of source table from which we SELECT

    destinationView

    name of destination view to be created from SELECT query

    whereClause

    where clause of the SELECT query, including the literal "WHERE" keyword

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  23. def getDropTableIfExistsSQL(tableName: String, cascade: Boolean = false): String

    Permalink

    Returns a SQL DDL statement to drop a table if it exists, and optionally, cascade the drop to dependent tables.

    Returns a SQL DDL statement to drop a table if it exists, and optionally, cascade the drop to dependent tables. For most databases, this is something like "DROP TABLE IF EXISTS tableName [CASCADE]"

    NOTE: Not all databases support CASCADE DROP

    tableName

    table to be dropped

    cascade

    true if dependent objects should also be dropped

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  24. def getDropViewIfExistsSQL(viewName: String, cascade: Boolean = false): String

    Permalink

    Returns a SQL DDL statement to drop a view if it exists, and optionally, cascade the drop to dependent views.

    Returns a SQL DDL statement to drop a view if it exists, and optionally, cascade the drop to dependent views. For most databases, this is something like "DROP VIEW IF EXISTS viewName [CASCADE]"

    NOTE: Not all databases support CASCADE DROP

    viewName

    view to be dropped

    cascade

    true if dependent objects should also be dropped

    returns

    generated SQL statement

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  25. def getModuloExpression(dividend: String, divisor: String): String

    Permalink

    Returns the expression for modulo division for this database.

    Returns the expression for modulo division for this database. This differs widely among databases. For example, in PostgreSQL, this is "dividend % divisor". But in Oracle, this is "MODULO(dividend, divisor)". For this reason, we must pass in the expressions used for dividend and divisor.

    dividend

    SQL expression for the dividend to be passed to the MODULO (can be a simple column name)

    divisor

    SQL expression for the divisor to be passed to the MODULO (can be a simple number)

    returns

    a SQL expression for the given dividend modulo the given divisor

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  26. def getStandardDeviationPopulationFunctionName: String

    Permalink

    Returns the name of the entire population standard deviation function to be used for this database.

    Returns the name of the entire population standard deviation function to be used for this database. This is defined as σ=SQRT((1/N)Σi=1N (xi)-μ)2). Note that this is a different function from the sample standard deviation function. Different RDBMSs have different names:
    PostgreSQL/GreenPlum: STDDEV_POP() MSSQL: STDEVP() MySQL/MariaDB: STD(), STDDEV(), or STDDEV_POP() Oracle: STDDEV_POP() Teradata: STDDEV_POP() Hive: STDDEV_POP() DB2: STDDEV() Sybase: STDDEV_POP()

    returns

    name of the standard deviation population function for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  27. def getStandardDeviationSampleFunctionName: String

    Permalink

    Returns the name of the sample standard deviation function to be used for this database.

    Returns the name of the sample standard deviation function to be used for this database. This is defined as s=SQRT((1/(n-1))Σi=1N (xi-xˉ)2). Note that this is a different function from the entire population standard deviation function. Different RDBMSs have different names:
    PostgreSQL/GreenPlum: STDDEV_SAMP() MSSQL: STDEV() MySQL/MariaDB: STDDEV_SAMP() Oracle: STDDEV_SAMP(), STDDEV() Teradata: STDDEV_SAMP() Hive: STDDEV_SAMP() DB2: STDDEV_SAMP() Sybase: STDDEV_SAMP(), STDDEVIATION(), STDDEV()

    returns

    name of the standard deviation population function for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  28. def getVariancePopulationFunctionName: String

    Permalink

    Returns the name of the entire population standard deviation function to be used for this database.

    Returns the name of the entire population standard deviation function to be used for this database. This is defined as σ2=(1/N)Σi=1N (xi)-μ)2. Note that this is a different function from the sample standard deviation function. Different RDBMSs have different names:
    PostgreSQL/GreenPlum: VAR_POP() MSSQL: VARP() MySQL/MariaDB: VARIANCE(), VAR_POP() Oracle: VAR_POP() Teradata: VAR_POP() Hive: VARIANCE(), VAR_POP() DB2: VARIANCE() Sybase: VAR_POP()

    returns

    name of the standard deviation population function for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  29. def getVarianceSampleFunctionName: String

    Permalink

    Returns the name of the sample variance function to be used for this database.

    Returns the name of the sample variance function to be used for this database. This is defined as s2=(1/(n-1))Σ(i=1..n (xi)-xˉ))2). Note that this is a different function from the entire population standard deviation function. Different RDBMSs have different names:
    PostgreSQL/GreenPlum: , "VAR_POP"(), VARIANCE() MSSQL: VAR() MySQL/MariaDB: VAR_SAMP() Oracle: VAR_SAMP(), VARIANCE() Teradata: VAR_SAMP() Hive: VAR_SAMP() DB2: VARIANCE_SAMP() Sybase: VAR_SAMP()

    returns

    name of the standard deviation population function for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  30. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. def quoteChar: String

    Permalink

    Character or String to use when quoting identifiers.

    Character or String to use when quoting identifiers. Typically, this is a double-quote (for PostgreSQL and other databases), but can be other characters or even Strings for other platforms.

    returns

    the character or characters to be used to delimit identifiers for this database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  36. def quoteIdentifier(s: String): String

    Permalink

    Wraps an identifier in the appropriate quote character to preserve case and special characters.

    Wraps an identifier in the appropriate quote character to preserve case and special characters. If there is no quoting mechanism for this database type, just return the argument.

    s

    string to be delimited

    returns

    the given string, but with the appropriate delimiters for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  37. def quoteObjectName(schemaName: String, objectName: String): String

    Permalink

    Wraps a schema and table or view name in the appropriate quote character to preserve case and special characters.

    Wraps a schema and table or view name in the appropriate quote character to preserve case and special characters. If schemaName is unspecified, quote only the objectName. Uses quoteIdentifier() for quoting.

    schemaName

    the schema name of the object (or "" if none)

    objectName

    the object name of the object

    returns

    a string composed of the given schema and object names, properly delimited

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  39. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  40. def useAliasForSelectSubQueries: Boolean

    Permalink

    If true, subqueries must be aliased.

    If true, subqueries must be aliased. Some databases, such as Oracle, require subqueries (queries that appear in the FROM clause) to be aliased. For example:

    SELECT ... FROM ( SELECT ... FROM foo WHERE ... ) AS fooalias WHERE ...

    returns

    true if subqueries must be aliased, false if otherwise

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
  41. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def escapeColumnName(s: String): String

    Permalink

    Wraps a column name in the appropriate quote character to preserve case and special characters.

    Wraps a column name in the appropriate quote character to preserve case and special characters. If there is no quoting mechanism for this database type, just return the argument.

    Note: Deprecated -- please use quoteIdentifier instead.

    s

    string to be delimited

    returns

    the given string, but with appropriate delimiters for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
    Annotations
    @deprecated
    Deprecated

    (Since version 2016-04-22) Please use quoteIdentifier instead [Paul]

  2. def getStandardDeviationFunctionName: String

    Permalink

    Returns the name of the standard deviation function to be used for this database.

    Returns the name of the standard deviation function to be used for this database. For example, in PostgreSQL, this is "stddev". Note that this is just the function name, and does not include the argument. A typical SQL call would be "stddev(expression)".

    returns

    name of the standard deviation function for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
    Deprecated

    the standard deviation function is ambiguous, as it varies on different RDBMS platforms. Replace with getStandardDeviationPopulationFunctionName or getStandardDeviationSampleFunctionName

  3. def getVarianceFunctionName: String

    Permalink

    Returns the name of the variance function to be used for this database.

    Returns the name of the variance function to be used for this database. For example, in PostgreSQL, this is "variance". Note that this is just the function name, and does not include the argument. A typical call would be "variance(expression)".

    returns

    name of the variance function for the current database type

    Definition Classes
    SimpleSQLGeneratorSQLGenerator
    Deprecated

    the variance function is ambiguous, as it varies on different RDBMS platforms. Replace with getVariancePopulationFunctionName or getVarianceSampleFunctionName

Inherited from SQLGenerator

Inherited from AnyRef

Inherited from Any

Ungrouped