Protocol Buffers Reference

Avatica also supports Protocol Buffersas a message format since version 1.5.0. The Protocol Buffer, or protobuf forshort, implementation is extremely similar to the JSON implementation. Somedifferences include protobuf’s expanded type support (such as native byte arrays)and inability to differentiate between the default value for a field and theabsence of a value for a field.

Other notable structural differences to JSON include the addition of aWireMessage message which is used to identify the type of the wrapped messagereturned by the server (synonymous with request or response attribute on theJSON messages) and a change to TypedValue containing an Object value toa collection of optional strongly-typed values (as protobuf does not nativelysupport an Object type that is unwrapped at runtime).

Unless otherwise specified with use of the required modifier, all fields inall protocol buffer messages are optional by default.

Index

Requests

Responses

Miscellaneous

Requests

The collection of all protobuf objects accepted as requests to Avatica. All requestobjects should be wrapped in a WireMessage before being sent to Avatica.

CatalogsRequest

This request is used to fetch the available catalog names in the database.

  1. message CatalogsRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier for the connection to use.

CloseConnectionRequest

This request is used to close the Connection object in the Avatica server identified by the given IDs.

  1. message CloseConnectionRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier of the connection to close.

CloseStatementRequest

This request is used to close the Statement object in the Avatica server identified by the given IDs.

  1. message CloseStatementRequest {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. }

connection_id The identifier of the connection to which the statement belongs.

statement_id The identifier of the statement to close.

ColumnsRequest

This request is used to fetch columns in the database given some optional filtering criteria.

  1. message ColumnsRequest {
  2. string catalog = 1;
  3. string schema_pattern = 2;
  4. string table_name_pattern = 3;
  5. string column_name_pattern = 4;
  6. string connection_id = 5;
  7. }

catalog The name of a catalog to limit returned columns.

schema_pattern A Java Pattern against schemas to limit returned columns.

table_name_pattern A Java Pattern against table names to limit returned columns.

column_name_pattern A Java Pattern against column names to limit returned columns.

connection_id The identifier of the connection which to use to fetch the columns.

CommitRequest

This request is used to issue a commit on the Connection in the Avatica server identified by the given ID.

  1. message CommitRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier of the connection on which to invoke commit.

ConnectionSyncRequest

This request is used to ensure that the client and server have a consistent view of the database properties.

  1. message ConnectionSyncRequest {
  2. string connection_id = 1;
  3. ConnectionProperties conn_props = 2;
  4. }

connection_id The identifier of the connection to synchronize.

conn_props A ConnectionProperties object to synchronize between the client and server.

CreateStatementRequest

This request is used to create a new Statement in the Avatica server.

  1. message CreateStatementRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier of the connection to use in creating a statement.

DatabasePropertyRequest

This request is used to fetch all database properties.

  1. message DatabasePropertyRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier of the connection to use when fetching the database properties.

ExecuteBatchRequest

This request is used to execute a batch of updates against a PreparedStatement.

  1. message ExecuteBatchRequest {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. repeated UpdateBatch updates = 3;
  5. }

connection_id A string which refers to a connection.

statement_id An integer which refers to a statement.

updates A list of UpdateBatch’s; the batch of updates.

ExecuteRequest

This request is used to execute a PreparedStatement, optionally with values to bind to the parameters in the Statement.

  1. message ExecuteRequest {
  2. StatementHandle statementHandle = 1;
  3. repeated TypedValue parameter_values = 2;
  4. uint64 deprecated_first_frame_max_size = 3;
  5. bool has_parameter_values = 4;
  6. int32 first_frame_max_size = 5;
  7. }

statementHandle A StatementHandle object.

parameter_values The TypedValue for each parameter on the prepared statement.

deprecatedfirst_frame_max_size _Deprecated, use first_frame_max_size instead. Previously, the maximum number of rows returned in the response.

has_parameter_values A boolean which denotes if the user set a value for the parameter_values field.

first_frame_max_size The maximum number of rows to return in the first Frame.

FetchRequest

This request is used to fetch a batch of rows from a Statement previously created.

  1. message FetchRequest {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. uint64 offset = 3;
  5. uint32 fetch_max_row_count = 4; // Deprecated!
  6. int32 frame_max_size = 5;
  7. }

connection_id The identifier of the connection to use.

statement_id The identifier of the statement created using the above connection.

offset The positional offset into a result set to fetch.

fetchmatch_row_count The maximum number of rows to return in the response to this request. Negative means no limit. _Deprecated, use frame_max_size.

frame_max_size The maximum number of rows to return in the response. Negative means no limit.

OpenConnectionRequest

This request is used to open a new Connection in the Avatica server.

  1. message OpenConnectionRequest {
  2. string connection_id = 1;
  3. map<string, string> info = 2;
  4. }

connection_id The identifier of the connection to open in the server.

info A Map containing properties to include when creating the Connection.

PrepareAndExecuteBatchRequest

This request is used as short-hand to create a Statement and execute a batch of updates against that Statement.

  1. message PrepareAndExecuteBatchRequest {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. repeated string sql_commands = 3;
  5. }

connection_id The identifier for the connection to use.

statement_id The identifier for the statement created by the above connection to use.

sql_commands A list of SQL commands to execute; a batch.

PrepareAndExecuteRequest

This request is used as a short-hand for create a Statement and fetching the first batch of results in a single call without any parameter substitution.

  1. message PrepareAndExecuteRequest {
  2. string connection_id = 1;
  3. uint32 statement_id = 4;
  4. string sql = 2;
  5. uint64 max_row_count = 3; // Deprecated!
  6. int64 max_rows_total = 5;
  7. int32 first_frame_max_size = 6;
  8. }

connection_id The identifier for the connection to use.

statement_id The identifier for the statement created by the above connection to use.

sql A SQL statement

maxrow_count The maximum number of rows returned in the response. _Deprecated, use max_rows_total.

max_rows_total The maximum number of rows which this query should return (over all Frames).

first_frame_max_size The maximum number of rows which should be included in the first Frame in the ExecuteResponse.

PrepareRequest

This request is used to create create a new Statement with the given query in the Avatica server.

  1. message PrepareRequest {
  2. string connection_id = 1;
  3. string sql = 2;
  4. uint64 max_row_count = 3; // Deprecated!
  5. int64 max_rows_total = 4;
  6. }

connection_id The identifier for the connection to use.

sql A SQL statement

maxrow_count The maximum number of rows returned in the response. _Deprecated, use max_rows_total instead.

max_rows_total The maximum number of rows returned for the query in total.

SyncResultsRequest

This request is used to reset a ResultSet’s iterator to a specific offset in the Avatica server.

  1. message SyncResultsRequest {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. QueryState state = 3;
  5. uint64 offset = 4;
  6. }

connection_id The identifier for the connection to use.

statement_id The identifier for the statement to use.

state The QueryState object.

offset The offset into the ResultSet to seek to.

RollbackRequest

This request is used to issue a rollback on the Connection in the Avatica server identified by the given ID.

  1. message RollbackRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier for the connection on which to invoke rollback.

SchemasRequest

This request is used to fetch the schemas matching the provided criteria in the database.

  1. message SchemasRequest {
  2. string catalog = 1;
  3. string schema_pattern = 2;
  4. string connection_id = 3;
  5. }

catalog The name of the catalog to fetch the schema from.

schema_pattern A Java pattern of schemas to fetch.

connection_id The identifier for the connection to fetch schemas from.

TableTypesRequest

This request is used to fetch the table types available in this database.

  1. message TableTypesRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier of the connection to fetch the table types from.

TablesRequest

This request is used to fetch the tables available in this database filtered by the provided criteria.

  1. message TablesRequest {
  2. string catalog = 1;
  3. string schema_pattern = 2;
  4. string table_name_pattern = 3;
  5. repeated string type_list = 4;
  6. bool has_type_list = 6;
  7. string connection_id = 7;
  8. }

catalog The name of a catalog to restrict fetched tables.

schema_pattern A Java Pattern representing schemas to include in fetched tables.

table_name_pattern A Java Pattern representing table names to include in fetched tables.

type_list A list of table types used to restrict fetched tables.

has_type_list A boolean which denotes if the field type_list was provided.

connection_id The identifier of the connection to fetch the tables from.

TypeInfoRequest

This request is used to fetch the types available in this database.

  1. message TypeInfoRequest {
  2. string connection_id = 1;
  3. }

connection_id The identifier of the connection to fetch the types from.

Responses

The collection of all protobuf objects accepted as requests to Avatica. All responseobjects will be wrapped in a WireMessage before being returned from Avatica.

CloseConnectionResponse

A response to the CloseConnectionRequest.

  1. message CloseConnectionResponse {
  2. RpcMetadata metadata = 1;
  3. }

metadata Server metadata about this call.

CloseStatementResponse

A response to the CloseStatementRequest.

  1. message CloseStatementResponse {
  2. RpcMetadata metadata = 1;
  3. }

metadata Server metadata about this call.

CommitResponse

A response to the CommitRequest.

  1. message CommitResponse {
  2. }

There are no attributes on this Response.

ConnectionSyncResponse

A response to the ConnectionSyncRequest. Properties included in theresponse are those of the Connection in the Avatica server.

  1. message ConnectionSyncResponse {
  2. ConnectionProperties conn_props = 1;
  3. RpcMetadata metadata = 2;
  4. }

conn_props The ConnectionProperties that were synchronized.

metadata Server metadata about this call.

CreateStatementResponse

A response to the CreateStatementRequest. The ID of the statementthat was created is included in the response. Clients will use this statement_id in subsequent calls.

  1. message CreateStatementResponse {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. RpcMetadata metadata = 3;
  5. }

connection_id The identifier for the connection used to create the statement.

statement_id The identifier for the created statement.

metadata Server metadata about this call.

DatabasePropertyResponse

A response to the DatabasePropertyRequest. See DatabasePropertyfor information on the available property keys.

  1. message DatabasePropertyResponse {
  2. repeated DatabasePropertyElement props = 1;
  3. RpcMetadata metadata = 2;
  4. }

props A collection of DatabaseProperty’s.

metadata Server metadata about this call.

ErrorResponse

A response when an error was caught executing a request. Any request may return this response.

  1. message ErrorResponse {
  2. repeated string exceptions = 1;
  3. bool has_exceptions = 7;
  4. string error_message = 2;
  5. Severity severity = 3;
  6. uint32 error_code = 4;
  7. string sql_state = 5;
  8. RpcMetadata metadata = 6;
  9. }

exceptions A list of stringified Java StackTraces.

has_exceptions A boolean which denotes the presence of exceptions.

error_message A human-readable error message.

error_code A numeric code for this error.

sql_state A five character alphanumeric code for this error.

severity An AvaticaSeverity object which denotes how critical the error is.

metadata Server metadata about this call.

ExecuteBatchResponse

A response to the ExecuteBatchRequest and PrepareAndExecuteBatchRequest.

  1. message ExecuteBatchResponse {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. repeated uint32 update_counts = 3;
  5. bool missing_statement = 4;
  6. RpcMetadata metadata = 5;
  7. }

connection_id The ID referring to the connection that was used.

statment_id The ID referring to the statement that was used.

update_counts An array of integer values corresponding to the update count for each update in the batch.

missing_statement A boolean which denotes if the request failed due to a missing statement.

metadata Server metadata about this call.

ExecuteResponse

A response to the ExecuteRequest which contains the results for a metadata query.

  1. message ExecuteResponse {
  2. repeated ResultSetResponse results = 1;
  3. bool missing_statement = 2;
  4. RpcMetadata metadata = 3;
  5. }

results An array of ResultSetResponses.

missing_statement A boolean which denotes if the request failed due to a missing statement.

metadata Server metadata about this call.

FetchResponse

A response to the FetchRequest which contains the request for the query.

  1. message FetchResponse {
  2. Frame frame = 1;
  3. bool missing_statement = 2;
  4. bool missing_results = 3;
  5. RpcMetadata metadata = 4;
  6. }

frame A Frame containing the results of the fetch.

missing_statement A boolean which denotes if the request failed due to a missing Statement.

missing_results A boolean which denotes if the request failed due to a missing ResultSet.

metadata Server metadata about this call.

OpenConnectionResponse

A response to the OpenConnectionRequest. The ID for the connection thatthe client should use in subsequent calls was provided by the client in the request.

  1. message OpenConnectionResponse {
  2. RpcMetadata metadata = 1;
  3. }

metadata Server metadata about this call.

PrepareResponse

A response to the PrepareRequest. This response includes a StatementHandlewhich clients must use to fetch the results from the Statement.

  1. message PrepareResponse {
  2. StatementHandle statement = 1;
  3. RpcMetadata metadata = 2;
  4. }

statement A StatementHandle object.

metadata Server metadata about this call.

ResultSetResponse

A response which contains the results and type details from a query.

  1. message ResultSetResponse {
  2. string connection_id = 1;
  3. uint32 statement_id = 2;
  4. bool own_statement = 3;
  5. Signature signature = 4;
  6. Frame first_frame = 5;
  7. uint64 update_count = 6;
  8. RpcMetadata metadata = 7;
  9. }

connection_id The identifier for the connection used to generate this response.

statement_id The identifier for the statement used to generate this response.

own_statement Whether the result set has its own dedicated statement. If true, the server must automatically close thestatement when the result set is closed. This is used for JDBC metadata result sets, for instance.

signature A nested object Signature. This field will only be present for queries that return data.

first_frame A optional nested object Frame

update_count A number which is always -1 for normal result sets. Any other value denotes a “dummy” result setthat only contains this count and no additional data.

metadata Server metadata about this call.

RollbackResponse

A response to the RollBackRequest.

  1. message RollbackResponse {
  2. }

There are no attributes on this Response.

SyncResultsResponse

A response to the SyncResultsRequest. When moreResults is true, a FetchRequestshould be issued to get the next batch of records. When missingStatement is true, the statement must be re-created using PrepareRequestor the appropriate Request for a DDL request (e.g. CatalogsRequest or SchemasRequest).

  1. message SyncResultsResponse {
  2. bool missing_statement = 1;
  3. bool more_results = 2;
  4. RpcMetadata metadata = 3;
  5. }

more_results A boolean which denotes if results exist for the ResultSet being “synced” per the request.

missing_statement A boolean which denotes if the statement for the ResultSet still exists.

metadata Server metadata about this call.

Miscellaneous

AvaticaParameter

This object describes the “simple”, or scalar, JDBC type representation of a column in a result. This does not includecomplex types such as arrays.

  1. message AvaticaParameter {
  2. bool signed = 1;
  3. uint32 precision = 2;
  4. uint32 scale = 3;
  5. uint32 parameter_type = 4;
  6. string class_name = 5;
  7. string class_name = 6;
  8. string name = 7;
  9. }

signed A boolean denoting whether the column is a signed numeric.

precision The maximum numeric precision supported by this column.

scale The maximum numeric scale supported by this column.

parameter_type An integer corresponding to the JDBC Types class denoting the column’s type.

type_name The JDBC type name for this column.

class_name The Java class backing the JDBC type for this column.

name The name of the column.

AvaticaSeverity

This enumeration describes the various levels of concern for an error in the Avatica server.

  1. enum Severity {
  2. UNKNOWN_SEVERITY = 0;
  3. FATAL_SEVERITY = 1;
  4. ERROR_SEVERITY = 2;
  5. WARNING_SEVERITY = 3;
  6. }

AvaticaType

This object describes a simple or complex type for a column. Complex types will containadditional information in the component or columns attribute which describe the nestedtypes of the complex parent type.

  1. message AvaticaType {
  2. uint32 id = 1;
  3. string name = 2;
  4. Rep rep = 3;
  5. repeated ColumnMetaData columns = 4;
  6. AvaticaType component = 5;
  7. }

type One of: scalar, array, struct.

id A numeric value corresponding to the type of the object per the JDBC Types class.

name The readable name of the JDBC type.

rep A nested Rep object used by Avatica to hold additional type information.

columns For STRUCT types, a list of the columns contained in that STRUCT.

component For ARRAY types, the type of the elements contained in that ARRAY.

ColumnMetaData

This object represents the JDBC ResultSetMetaData for a column.

  1. message ColumnMetaData {
  2. uint32 ordinal = 1;
  3. bool auto_increment = 2;
  4. bool case_sensitive = 3;
  5. bool searchable = 4;
  6. bool currency = 5;
  7. uint32 nullable = 6;
  8. bool signed = 7;
  9. uint32 display_size = 8;
  10. string label = 9;
  11. string column_name = 10;
  12. string schema_name = 11;
  13. uint32 precision = 12;
  14. uint32 scale = 13;
  15. string table_name = 14;
  16. string catalog_name = 15;
  17. bool read_only = 16;
  18. bool writable = 17;
  19. bool definitely_writable = 18;
  20. string column_class_name = 19;
  21. AvaticaType type = 20;
  22. }

ordinal A positional offset number.

auto_increment A boolean denoting whether the column is automatically incremented.

case_sensitive A boolean denoting whether the column is case sensitive.

searchable A boolean denoting whether this column supports all WHERE search clauses.

currency A boolean denoting whether this column represents currency.

nullable A number denoting whether this column supports null values.

  • 0 = No null values are allowed
  • 1 = Null values are allowed
  • 2 = It is unknown if null values are allowed

signed A boolean denoting whether the column is a signed numeric.

display_size The character width of the column.

label A description for this column.

column_name The name of the column.

schema_name The schema to which this column belongs.

precision The maximum numeric precision supported by this column.

scale The maximum numeric scale supported by this column.

table_name The name of the table to which this column belongs.

catalog_name The name of the catalog to which this column belongs.

type A nested AvaticaType representing the type of the column.

read_only A boolean denoting whether the column is read-only.

writable A boolean denoting whether the column is possible to be updated.

definitely_writable A boolean denoting whether the column definitely can be updated.

column_class_name The name of the Java class backing the column’s type.

ConnectionProperties

This object represents the properties for a given JDBC Connection.

  1. message ConnectionProperties {
  2. bool is_dirty = 1;
  3. bool auto_commit = 2;
  4. bool has_auto_commit = 7;
  5. bool read_only = 3;
  6. bool has_read_only = 8;
  7. uint32 transaction_isolation = 4;
  8. string catalog = 5;
  9. string schema = 6;
  10. }

is_dirty A boolean denoting if the properties have been altered.

auto_commit A boolean denoting if autoCommit is enabled for transactions.

has_auto_commit A boolean denoting if auto_commit was set.

read_only A boolean denoting if a JDBC connection is read-only.

has_read_only A boolean denoting if read_only was set.

transaction_isolation An integer which denotes the level of transactions isolation per the JDBCspecification. This value is analogous to the values defined in java.sql.Connection.

  • 0 = Transactions are not supported
  • 1 = Dirty reads, non-repeatable reads and phantom reads may occur.
  • 2 = Dirty reads are prevented, but non-repeatable reads and phantom reads may occur.
  • 4 = Dirty reads and non-repeatable reads are prevented, but phantom reads may occur.
  • 8 = Dirty reads, non-repeatable reads, and phantom reads are all prevented.

catalog The name of a catalog to use when fetching connection properties.

schema The name of the schema to use when fetching connection properties.

CursorFactory

This object represents the information required to cast untyped objects into the necessary type for some results.

  1. message CursorFactory {
  2. enum Style {
  3. OBJECT = 0;
  4. RECORD = 1;
  5. RECORD_PROJECTION = 2;
  6. ARRAY = 3;
  7. LIST = 4;
  8. MAP = 5;
  9. }
  10. Style style = 1;
  11. string class_name = 2;
  12. repeated string field_names = 3;
  13. }

style A string denoting the Style of the contained objects.

class_name The name of the for RECORD or RECORD_PROJECTION.

DatabaseProperty

This object represents the exposed database properties for a Connection through the Avatica server.

  1. message DatabaseProperty {
  2. string name = 1;
  3. repeated string functions = 2;
  4. }

name The name of the database property.

functions A collection of values for the property.

Frame

This object represents a batch of results, tracking the offset into the results and whether more results still existto be fetched in the Avatica server.

  1. message Frame {
  2. uint64 offset = 1;
  3. bool done = 2;
  4. repeated Row rows = 3;
  5. }

offset The starting position of these rows in the encompassing result set.

done A boolean denoting whether more results exist for this result set.

rows A collection of Rows.

Row

This object represents a row in a relational database table.

  1. message Row {
  2. repeated ColumnValue value = 1;
  3. }

value A collection of ColumnValues, the columns in the row.

ColumnValue

  1. message ColumnValue {
  2. repeated TypedValue value = 1; // Deprecated!
  3. repeated ColumnValue array_value = 2;
  4. boolean has_array_value = 3;
  5. TypedValue scalar_value = 4;
  6. }

value The pre Calcite-1.6 means of serializing TypedValues. Not used anymore.

array_value The value of this column if it is an array (not a scalar).

has_array_value Should be set to true if array_value is set.

scalar_value The value of this column if it is a scalar (not an array).

QueryState

This object represents the way a ResultSet was created in the Avatica server. A ResultSet could be created by a user-providedSQL or by a DatabaseMetaData operation with arguments on that operation.

  1. message QueryState {
  2. StateType type = 1;
  3. string sql = 2;
  4. MetaDataOperation op = 3;
  5. repeated MetaDataOperationArgument args = 4;
  6. bool has_args = 5;
  7. bool has_sql = 6;
  8. bool has_op = 7;
  9. }

type A StateType object denoting what type of operation backs the ResultSet for this query.

sql The SQL statement which created the ResultSet for this query. Required if the type is SQL.

op The DML operation which created the ResultSet for this query. Required if the type is METADATA.

args The arguments to the invoked DML operation. Required if the type is METADATA.

has_args A boolean which denotes if the field args is provided.

has_sql A boolean which denotes if the field sql is provided.

has_op A boolean which denotes if the field op is provided.

Rep

This enumeration represents the concrete Java type for some value.

  1. enum Rep {
  2. PRIMITIVE_BOOLEAN = 0;
  3. PRIMITIVE_BYTE = 1;
  4. PRIMITIVE_CHAR = 2;
  5. PRIMITIVE_SHORT = 3;
  6. PRIMITIVE_INT = 4;
  7. PRIMITIVE_LONG = 5;
  8. PRIMITIVE_FLOAT = 6;
  9. PRIMITIVE_DOUBLE = 7;
  10. BOOLEAN = 8;
  11. BYTE = 9;
  12. CHARACTER = 10;
  13. SHORT = 11;
  14. INTEGER = 12;
  15. LONG = 13;
  16. FLOAT = 14;
  17. DOUBLE = 15;
  18. BIG_INTEGER = 25;
  19. BIG_DECIMAL = 26;
  20. JAVA_SQL_TIME = 16;
  21. JAVA_SQL_TIMESTAMP = 17;
  22. JAVA_SQL_DATE = 18;
  23. JAVA_UTIL_DATE = 19;
  24. BYTE_STRING = 20;
  25. STRING = 21;
  26. NUMBER = 22;
  27. OBJECT = 23;
  28. NULL = 24;
  29. ARRAY = 27;
  30. STRUCT = 28;
  31. MULTISET = 29;
  32. }

RpcMetadata

This object contains assorted per-call/contextual metadata returned by the Avatica server.

  1. message RpcMetadata {
  2. string server_address = 1;
  3. }

serverAddress The host:port of the server which created this object.

Signature

This object represents the result of preparing a Statement in the Avatica server.

  1. message Signature {
  2. repeated ColumnMetaData columns = 1;
  3. string sql = 2;
  4. repeated AvaticaParameter parameters = 3;
  5. CursorFactory cursor_factory = 4;
  6. StatementType statementType = 5;
  7. }

columns An array of ColumnMetaData objects denoting the schema of the result set.

sql The SQL executed.

parameters An array of AvaticaParameter objects denoting type-specific details.

cursor_factory An CursorFactory object representing the Java representation of the frame.

statementType The type of the statement.

StateType

This enumeration denotes whether user-provided SQL or a DatabaseMetaData operation was used to create some ResultSet.

  1. enum StateType {
  2. SQL = 0;
  3. METADATA = 1;
  4. }

StatementHandle

This object encapsulates all of the information of a Statement created in the Avatica server.

  1. message StatementHandle {
  2. string connection_id = 1;
  3. uint32 id = 2;
  4. Signature signature = 3;
  5. }

connection_id The identifier of the connection to which this statement belongs.

id The identifier of the statement.

signature A Signature object for the statement.

StatementType

This message represents what kind the Statement is.

  1. enum StatementType {
  2. SELECT = 0;
  3. INSERT = 1;
  4. UPDATE = 2;
  5. DELETE = 3;
  6. UPSERT = 4;
  7. MERGE = 5;
  8. OTHER_DML = 6;
  9. CREATE = 7;
  10. DROP = 8;
  11. ALTER = 9;
  12. OTHER_DDL = 10;
  13. CALL = 11;
  14. }

Style

This enumeration represents the generic “class” of type for a value. Defined within CursorFactory.

  1. enum Style {
  2. OBJECT = 0;
  3. RECORD = 1;
  4. RECORD_PROJECTION = 2;
  5. ARRAY = 3;
  6. LIST = 4;
  7. MAP = 5;
  8. }

TypedValue

This object encapsulates the type and value for a column in a row.

  1. message TypedValue {
  2. Rep type = 1;
  3. bool bool_value = 2;
  4. string string_value = 3;
  5. sint64 number_value = 4;
  6. bytes bytes_value = 5;
  7. double double_value = 6;
  8. bool null = 7;
  9. repeated TypedValue array_value = 8;
  10. Rep component_type = 9;
  11. bool implicitly_null = 10;
  12. }

type A name referring to which attribute is populated with the column’s value.

bool_value A boolean value.

string_value A character/string value.

number_value A numeric value (non-double).

bytes_value A byte-array value.

double_value A double value.

null A boolean which denotes if the value was null.

array_value A repetition of TypedValue messages, each of which are an element of an array_value (recursive)

component_type When this TypedValue represents an Array, this is the Array type’s representation.

implicitly_null A boolean to differentiate between explicitly (user-set) and implicitly null (user un-set) values

The following chart documents how each Rep value correspondsto the attributes in this message:

Rep ValueTypedValue attributeDescription
PRIMITIVE_BOOLEANbool_value
BOOLEANbool_value
PRIMITIVE_BYTEnumber_valueThe numeric value of the byte.
BYTEnumber_value
PRIMITIVE_CHARstring_value
CHARACTERstring_value
PRIMITIVE_SHORTnumber_value
SHORTnumber_value
PRIMITIVE_INTnumber_value
INTEGERnumber_value
PRIMITIVE_LONGnumber_value
LONGnumber_value
PRIMITIVE_FLOATnumber_value
FLOATnumber_valueIEEE 754 floating-point “single format” bit layout.
PRIMITIVE_DOUBLEnumber_value
DOUBLEnumber_value
BIG_INTEGERbytes_valueThe two’s-complement representation of the BigInteger. See BigInteger#toByteArray().
BIG_DECIMALstring_valueA string-ified representation of the value. See BigDecimal#toString().
JAVA_SQL_TIMEnumber_valueAs an integer, milliseconds since midnight.
JAVA_SQL_DATEnumber_valueAs an integer, the number of days since the epoch.
JAVA_SQL_TIMESTAMPnumber_valueAs a long, milliseconds since the epoch.
JAVA_UTIL_DATEnumber_valueAs a long, milliseconds since the epoch.
BYTE_STRINGbytes_value
STRINGstring_valueThis must be a UTF-8 string.
NUMBERnumber_valueA general number, unknown what concrete type.
OBJECTnullThe only general Object we can serialize is “null”. Non-null OBJECT’s will throw an error.
NULLnull
ARRAYN/AUnhandled.
STRUCTN/AUnhandled.
MULTISETN/AUnhandled.

UpdateBatch

This is a message which serves as a wrapper around a collection of TypedValue’s.

  1. message UpdateBatch {
  2. repeated TypedValue parameter_values = 1;
  3. }

parameter_values A collection of parameter values for one SQL command update.

WireMessage

This message wraps all Requests and Responses.

  1. message WireMessage {
  2. string name = 1;
  3. bytes wrapped_message = 2;
  4. }

name The Java class name of the wrapped message.

wrapped_message A serialized representation of the wrapped message of the same type specified by name.