Class PostgreSQLStatementParser
java.lang.Object
com.google.cloud.spanner.connection.AbstractStatementParser
com.google.cloud.spanner.connection.PostgreSQLStatementParser
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.cloud.spanner.connection.AbstractStatementParser
AbstractStatementParser.ParametersInfo, AbstractStatementParser.ParsedStatement, AbstractStatementParser.StatementType
-
Field Summary
Fields inherited from class com.google.cloud.spanner.connection.AbstractStatementParser
DEFAULT_MAX_STATEMENT_CACHE_SIZE_MB
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkReturningClauseInternal
(String rawSql) Checks if the given SQL string contains a Returning clause.getQueryParameters
(String sql) Note: This is an internal API and breaking changes can be made without prior notice.protected boolean
Indicates whether the parser supports theEXPLAIN
clause.Methods inherited from class com.google.cloud.spanner.connection.AbstractStatementParser
checkReturningClause, convertPositionalParametersToNamedParameters, getInstance, isDdlStatement, isQuery, isUpdateStatement, parse, removeCommentsAndTrim
-
Method Details
-
supportsExplain
protected boolean supportsExplain()Indicates whether the parser supports theEXPLAIN
clause. The PostgreSQL parser does not support it.- Specified by:
supportsExplain
in classAbstractStatementParser
-
getQueryParameters
Note: This is an internal API and breaking changes can be made without prior notice.Returns the PostgreSQL-style query parameters ($1, $2, ...) in the given SQL string. The SQL-string is allowed to contain comments. Occurrences of query-parameter like strings inside quoted identifiers or string literals are ignored.
The following example will return a set containing ("$1", "$2").
select col1, col2, "col$4" from some_table where col1=$1 and col2=$2 and not col3=$1 and col4='$3'
- Parameters:
sql
- the SQL-string to check for parameters.- Returns:
- A set containing all the parameters in the SQL-string.
-
checkReturningClauseInternal
Description copied from class:AbstractStatementParser
Checks if the given SQL string contains a Returning clause. This method is used only in case of a DML statement.- Specified by:
checkReturningClauseInternal
in classAbstractStatementParser
- Parameters:
rawSql
- The sql string without comments that has to be evaluated.- Returns:
- A boolean indicating whether the sql string has a Returning clause or not.
-