Commit 2fc4270b authored by unknown's avatar unknown
Browse files

XID SQL syntax

minor cleanups
XA tests


include/m_ctype.h:
  minor cleanup
sql/field.cc:
  minor cleanup
sql/handler.cc:
  XID SQL syntax
sql/handler.h:
  XID SQL syntax
sql/item_sum.h:
  minor cleanup
sql/lock.cc:
  comments
sql/sql_class.cc:
  minor cleanup
sql/sql_lex.h:
  XID SQL syntax
sql/sql_parse.cc:
  XID SQL syntax
sql/sql_yacc.yy:
  XID SQL syntax
  cleanups
parent 5b0c7525
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ typedef struct my_charset_handler_st
			 int base, char **e, int *err);
  double      (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
			 int *err);
  longlong (*my_strtoll10)(struct charset_info_st *cs,
  longlong    (*strtoll10)(struct charset_info_st *cs,
                           const char *nptr, char **endptr, int *error);
  ulong        (*scan)(struct charset_info_st *, const char *b, const char *e,
		       int sq);

mysql-test/r/xa.result

0 → 100644
+45 −0
Original line number Diff line number Diff line
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
xa start 'test1';
insert t1 values (10);
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
select * from t1;
a
xa start 'test2';
xa start 'test-bad';
ERROR XAE07: XAER_RMFAIL: The command cannot be executed in the ACTIVE state
insert t1 values (20);
xa prepare 'test2';
ERROR XAE07: XAER_RMFAIL: The command cannot be executed in the ACTIVE state
xa end 'test2';
xa prepare 'test2';
xa commit 'test2';
select * from t1;
a
20
xa start 'testa','testb';
insert t1 values (30);
xa end 'testa','testb';
xa start 0x7465737462, 0x2030405060, 0xb;
insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
xa recover;
formatID	gtrid_length	bqual_length	data
11	5	5	testb 0@P`
xa prepare 'testa','testb';
xa recover;
formatID	gtrid_length	bqual_length	data
11	5	5	testb 0@P`
1	5	5	testatestb
xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb';
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
select * from t1;
a
20
40
drop table t1;

mysql-test/t/xa.test

0 → 100644
+57 −0
Original line number Diff line number Diff line
#
# WL#1756
#
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int) engine=innodb;
xa start 'test1';
insert t1 values (10);
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
select * from t1;

xa start 'test2';
--error 1399
xa start 'test-bad';
insert t1 values (20);
--error 1399
xa prepare 'test2';
xa end 'test2';
xa prepare 'test2';
xa commit 'test2';
select * from t1;

xa start 'testa','testb';
insert t1 values (30);
xa end 'testa','testb';

connect (con1,localhost,,,);
connection con1;

xa start 0x7465737462, 0x2030405060, 0xb;
insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;

xa recover;

# uncomment the line below when binlog will be able to prepare
#disconnect con1;
connection default;

xa prepare 'testa','testb';

xa recover;

xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb';

--error 1064
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';

select * from t1;
drop table t1;
+2 −2
Original line number Diff line number Diff line
@@ -3236,7 +3236,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
  from+= tmp_scan;

  end= (char*) from+len;
  tmp= cs->cset->my_strtoll10(cs, from, &end, &error);
  tmp= cs->cset->strtoll10(cs, from, &end, &error);

  if (error != MY_ERRNO_EDOM)
  {
+3 −6
Original line number Diff line number Diff line
@@ -750,17 +750,15 @@ int ha_autocommit_or_rollback(THD *thd, int error)
  DBUG_RETURN(error);
}

int ha_commit_or_rollback_by_xid(LEX_STRING *ident, bool commit)
int ha_commit_or_rollback_by_xid(XID *xid, bool commit)
{
  XID xid;
  handlerton **ht= handlertons, **end_ht=ht+total_ha;
  int res= 1;

  xid.set(ident);
  for ( ; ht < end_ht ; ht++)
    if ((*ht)->recover)
      res= res &&
        (*(commit ? (*ht)->commit_by_xid : (*ht)->rollback_by_xid))(&xid);
        (*(commit ? (*ht)->commit_by_xid : (*ht)->rollback_by_xid))(xid);
  return res;
}

@@ -2366,7 +2364,6 @@ TYPELIB *ha_known_exts(void)
    const char **ext, *old_ext;

    known_extensions_id= mysys_usage_id;
    found_exts.push_back((char*) ".db");
    for (types= sys_table_types; types->type; types++)
    {
      if (*types->value == SHOW_OPTION_YES)
Loading