/*
 * Copyright (c) 2015, 2025, Oracle and/or its affiliates.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2.0,
 * as published by the Free Software Foundation.
 *
 * This program is designed to work with certain software (including
 * but not limited to OpenSSL) that is licensed under separate terms,
 * as designated in a particular file or component or in included license
 * documentation.  The authors of MySQL hereby grant you an additional
 * permission to link the program and your derivative works with the
 * separately licensed software that they have either included with
 * the program or referenced in the documentation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License, version 2.0, for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 */
syntax = "proto2";

import "mysqlx.proto"; // comment_out_if PROTOBUF_LITE

// ifdef PROTOBUF_LITE: option optimize_for = LITE_RUNTIME;

/**
@namespace Mysqlx::Sql
@brief Messages of the MySQL Package
*/
package Mysqlx.Sql;
option java_package = "com.mysql.cj.x.protobuf";

import "mysqlx_datatypes.proto";

/*
Execute a statement in the given namespace.

@startuml "Execute Statements"
client -> server: StmtExecute
... zero or more Resultsets ...
server --> client: StmtExecuteOk
@enduml

@notice This message may generate a notice containing WARNINGs generated by
  its execution. This message may generate a  notice containing INFO messages
  generated by its execution.

@returns zero or more  @ref Mysqlx::Resultset followed by @ref Mysqlx::Sql::StmtExecuteOk
*/
message StmtExecute {
  /** namespace of the statement to be executed */
  optional string namespace = 3 [ default = "sql" ];

  /** statement that shall be executed  */
  required bytes stmt = 1;

  /** values for wildcard replacements */
  repeated Mysqlx.Datatypes.Any args = 2;

  /** send only type information for @ref Mysqlx::Resultset::ColumnMetaData,
      skipping names and others */
  optional bool compact_metadata = 4 [ default = false ];

  option (client_message_id) = SQL_STMT_EXECUTE; // comment_out_if PROTOBUF_LITE
}

/**
Statement executed successfully
*/
message StmtExecuteOk {
  option (server_message_id) = SQL_STMT_EXECUTE_OK; // comment_out_if PROTOBUF_LITE
}


