Class Statement
java.lang.Object
com.google.cloud.bigtable.data.v2.models.sql.Statement
A SQL statement that can be executed by calling
BigtableDataClient.executeQuery(Statement).
A statement contains a SQL string and optional parameters. A parameterized query should contain placeholders in the form of @ followed by the parameter name. Parameter names may consist of any combination of letters, numbers, and underscores.
Parameters can appear anywhere that a literal value is expected. The same parameter name can
be used more than once, for example: WHERE cf["qualifier1"] = @value OR cf["qualifier2"]
= @value
It is an error to execute an SQL query with placeholders for unset parameters.
Parameterized Statements are constructed using a Statement.Builder and calling
setTypeParam(String paramName, Type value) for the appropriate type. For example:
Statement statement = Statement
.newBuilder("SELECT cf[@qualifer] FROM table WHERE _key=@key")
.setBytesParam("qualifier", ByteString.copyFromUtf8("test"))
.setBytesParam("key", ByteString.copyFromUtf8("testKey"))
.build();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Statement.BuildernewBuilder(String sql) Creates a newBuilderwith the given SQL querystatic StatementCreates aStatementwith the given SQL query and no query parameters.toProto(com.google.cloud.bigtable.data.v2.internal.RequestContext requestContext) Creates the request protobuf.
-
Method Details
-
of
Creates aStatementwith the given SQL query and no query parameters. -
newBuilder
Creates a newBuilderwith the given SQL query -
toProto
@InternalApi("For internal use only") public ExecuteQueryRequest toProto(com.google.cloud.bigtable.data.v2.internal.RequestContext requestContext) Creates the request protobuf. This method is considered an internal implementation detail and not meant to be used by applications.
-