install plugin mysqlx soname "mysqlx.so";
call mtr.add_suppression("Plugin mysqlx reported: .Failed at SSL configuration: .SSL context is not usable without certificate and private key..");
call mtr.add_suppression("Plugin mysqlx reported: .SSL_CTX_load_verify_locations failed.");
RUN use test

0 rows affected
RUN create table chartab (d varchar(1))

0 rows affected
RUN set @old_sql_mode=@@sql_mode

0 rows affected
RUN set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO'

0 rows affected
send Mysqlx.Sql.StmtExecute {
  stmt: "select 1/0, 1/0"
}

Mysqlx.Resultset.ColumnMetaData {
  type: DECIMAL
  name: "1/0"
  original_name: ""
  table: ""
  original_table: ""
  schema: ""
  catalog: "def"
  collation: 0
  fractional_digits: 4
  length: 7
  flags: 0
}

Mysqlx.Resultset.ColumnMetaData {
  type: DECIMAL
  name: "1/0"
  original_name: ""
  table: ""
  original_table: ""
  schema: ""
  catalog: "def"
  collation: 0
  fractional_digits: 4
  length: 7
  flags: 0
}

Mysqlx.Resultset.Row {
  field: ""
  field: ""
}

Mysqlx.Resultset.FetchDone {
}

Mysqlx.Notice.Frame {
  type: 1
  scope: LOCAL
  payload: "Mysqlx.Notice.Warning { level: WARNING\ncode: 1365\nmsg: \"Division by 0\"\n }"
}

Mysqlx.Notice.Frame {
  type: 1
  scope: LOCAL
  payload: "Mysqlx.Notice.Warning { level: WARNING\ncode: 1365\nmsg: \"Division by 0\"\n }"
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n  type: V_UINT\n  v_unsigned_int: 0\n}\n }"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Sql.StmtExecute {
  stmt: "disable_notices"
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "warnings"
      }
    }
  }
  namespace: "xplugin"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Sql.StmtExecute {
  stmt: "select 1/0"
}

Mysqlx.Resultset.ColumnMetaData {
  type: DECIMAL
  name: "1/0"
  original_name: ""
  table: ""
  original_table: ""
  schema: ""
  catalog: "def"
  collation: 0
  fractional_digits: 4
  length: 7
  flags: 0
}

Mysqlx.Resultset.Row {
  field: ""
}

Mysqlx.Resultset.FetchDone {
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n  type: V_UINT\n  v_unsigned_int: 0\n}\n }"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Sql.StmtExecute {
  stmt: "enable_notices"
  args {
    type: SCALAR
    scalar {
      type: V_STRING
      v_string {
        value: "warnings"
      }
    }
  }
  namespace: "xplugin"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Sql.StmtExecute {
  stmt: "select 1/0"
}

Mysqlx.Resultset.ColumnMetaData {
  type: DECIMAL
  name: "1/0"
  original_name: ""
  table: ""
  original_table: ""
  schema: ""
  catalog: "def"
  collation: 0
  fractional_digits: 4
  length: 7
  flags: 0
}

Mysqlx.Resultset.Row {
  field: ""
}

Mysqlx.Resultset.FetchDone {
}

Mysqlx.Notice.Frame {
  type: 1
  scope: LOCAL
  payload: "Mysqlx.Notice.Warning { level: WARNING\ncode: 1365\nmsg: \"Division by 0\"\n }"
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n  type: V_UINT\n  v_unsigned_int: 0\n}\n }"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Crud.Insert {
  collection {
    name: "chartab"
    schema: "test"
  }
  data_model: TABLE
  projection {
    name: "d"
  }
  row {
    field {
      type: LITERAL
      literal {
        type: V_STRING
        v_string {
          value: "XX"
        }
      }
    }
  }
}

Mysqlx.Notice.Frame {
  type: 1
  scope: LOCAL
  payload: "Mysqlx.Notice.Warning { level: WARNING\ncode: 1265\nmsg: \"Data truncated for column \\\'d\\\' at row 1\"\n }"
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n  type: V_UINT\n  v_unsigned_int: 1\n}\n }"
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: GENERATED_INSERT_ID\nvalue {\n  type: V_UINT\n  v_unsigned_int: 0\n}\n }"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Crud.Find {
  collection {
    name: "chartab"
    schema: "test"
  }
  data_model: TABLE
  criteria {
    type: OPERATOR
    operator {
      name: "/"
      param {
        type: LITERAL
        literal {
          type: V_SINT
          v_signed_int: 1
        }
      }
      param {
        type: LITERAL
        literal {
          type: V_SINT
          v_signed_int: 0
        }
      }
    }
  }
}

Mysqlx.Resultset.ColumnMetaData {
  type: BYTES
  name: "d"
  original_name: "d"
  table: "chartab"
  original_table: "chartab"
  schema: "test"
  catalog: "def"
  collation: 8
  fractional_digits: 0
  length: 1
  flags: 0
}

Mysqlx.Resultset.FetchDone {
}

Mysqlx.Notice.Frame {
  type: 1
  scope: LOCAL
  payload: "Mysqlx.Notice.Warning { level: WARNING\ncode: 1365\nmsg: \"Division by 0\"\n }"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Crud.Update {
  collection {
    name: "chartab"
    schema: "test"
  }
  data_model: TABLE
  operation {
    source {
      name: "d"
    }
    operation: SET
    value {
      type: LITERAL
      literal {
        type: V_STRING
        v_string {
          value: "XX"
        }
      }
    }
  }
}

Mysqlx.Notice.Frame {
  type: 1
  scope: LOCAL
  payload: "Mysqlx.Notice.Warning { level: WARNING\ncode: 1265\nmsg: \"Data truncated for column \\\'d\\\' at row 1\"\n }"
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: ROWS_AFFECTED\nvalue {\n  type: V_UINT\n  v_unsigned_int: 0\n}\n }"
}

Mysqlx.Notice.Frame {
  type: 3
  scope: LOCAL
  payload: "Mysqlx.Notice.SessionStateChanged { param: PRODUCED_MESSAGE\nvalue {\n  type: V_STRING\n  v_string {\n    value: \"Rows matched: 1  Changed: 0  Warnings: 1\"\n  }\n}\n }"
}

Mysqlx.Sql.StmtExecuteOk {
}

send Mysqlx.Sql.StmtExecute {
  stmt: "list_notices"
  namespace: "xplugin"
}

Mysqlx.Resultset.ColumnMetaData {
  type: BYTES
  name: "notice"
  original_name: ""
  table: ""
  original_table: ""
  schema: ""
  catalog: ""
  collation: 0
  fractional_digits: 0
  length: 0
  flags: 0
}

Mysqlx.Resultset.ColumnMetaData {
  type: SINT
  name: "enabled"
  original_name: ""
  table: ""
  original_table: ""
  schema: ""
  catalog: ""
  collation: 0
  fractional_digits: 0
  length: 0
  flags: 0
}

Mysqlx.Resultset.Row {
  field: "warnings\000"
  field: "\002"
}

Mysqlx.Resultset.Row {
  field: "account_expired\000"
  field: "\002"
}

Mysqlx.Resultset.Row {
  field: "generated_insert_id\000"
  field: "\002"
}

Mysqlx.Resultset.Row {
  field: "rows_affected\000"
  field: "\002"
}

Mysqlx.Resultset.Row {
  field: "produced_message\000"
  field: "\002"
}

Mysqlx.Resultset.FetchDone {
}

Mysqlx.Sql.StmtExecuteOk {
}

RUN drop table chartab

0 rows affected
RUN set @@sql_mode = @old_sql_mode

0 rows affected
Mysqlx.Ok {
  msg: "bye!"
}
ok
uninstall plugin mysqlx;
