From d13a7b53c130b8dbe87741d8a1fac5e765db2855 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Apr 2005 09:51:56 -0700 Subject: Add cp932 and eucjpms character sets to Windows build. (Bug #9479) VC++Files/client/mysqlclient.dsp: Add new character sets VC++Files/client/mysqlclient_ia64.dsp: Add new character sets VC++Files/libmysql/libmysql.dsp: Add new character sets VC++Files/libmysql/libmysql_ia64.dsp: Add new character sets VC++Files/strings/strings.dsp: Add new character sets VC++Files/strings/strings_ia64.dsp: Add new character sets include/config-win.h: Add new character sets --- VC++Files/client/mysqlclient.dsp | 8 ++++++++ VC++Files/client/mysqlclient_ia64.dsp | 8 ++++++++ VC++Files/libmysql/libmysql.dsp | 8 ++++++++ VC++Files/libmysql/libmysql_ia64.dsp | 8 ++++++++ VC++Files/strings/strings.dsp | 8 ++++++++ VC++Files/strings/strings_ia64.dsp | 8 ++++++++ include/config-win.h | 2 ++ 7 files changed, 50 insertions(+) diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index 75008858e55..157c576b187 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -147,6 +147,10 @@ SOURCE="..\strings\ctype-bin.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-cp932.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-czech.c" # End Source File # Begin Source File @@ -155,6 +159,10 @@ SOURCE="..\strings\ctype-euc_kr.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-eucjpms.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-extra.c" # End Source File # Begin Source File diff --git a/VC++Files/client/mysqlclient_ia64.dsp b/VC++Files/client/mysqlclient_ia64.dsp index e91245c12b2..a69c5cf58af 100644 --- a/VC++Files/client/mysqlclient_ia64.dsp +++ b/VC++Files/client/mysqlclient_ia64.dsp @@ -147,6 +147,10 @@ SOURCE="..\strings\ctype-bin.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-cp932.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-czech.c" # End Source File # Begin Source File @@ -155,6 +159,10 @@ SOURCE="..\strings\ctype-euc_kr.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-eucjpms.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-extra.c" # End Source File # Begin Source File diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp index ce81a3b7435..34c479c73b4 100644 --- a/VC++Files/libmysql/libmysql.dsp +++ b/VC++Files/libmysql/libmysql.dsp @@ -139,6 +139,10 @@ SOURCE="..\strings\ctype-bin.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-cp932.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-czech.c" # End Source File # Begin Source File @@ -147,6 +151,10 @@ SOURCE="..\strings\ctype-euc_kr.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-eucjpms.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-extra.c" # End Source File # Begin Source File diff --git a/VC++Files/libmysql/libmysql_ia64.dsp b/VC++Files/libmysql/libmysql_ia64.dsp index 4c4776dfc2f..fa851cb81c5 100644 --- a/VC++Files/libmysql/libmysql_ia64.dsp +++ b/VC++Files/libmysql/libmysql_ia64.dsp @@ -138,6 +138,10 @@ SOURCE="..\strings\ctype-bin.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-cp932.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-czech.c" # End Source File # Begin Source File @@ -146,6 +150,10 @@ SOURCE="..\strings\ctype-euc_kr.c" # End Source File # Begin Source File +SOURCE="..\strings\ctype-eucjpms.c" +# End Source File +# Begin Source File + SOURCE="..\strings\ctype-extra.c" # End Source File # Begin Source File diff --git a/VC++Files/strings/strings.dsp b/VC++Files/strings/strings.dsp index 340617344f2..320cdaf2132 100644 --- a/VC++Files/strings/strings.dsp +++ b/VC++Files/strings/strings.dsp @@ -113,10 +113,18 @@ SOURCE=".\ctype-bin.c" # End Source File # Begin Source File +SOURCE=".\ctype-cp932.c" +# End Source File +# Begin Source File + SOURCE=".\ctype-czech.c" # End Source File # Begin Source File +SOURCE=".\ctype-eucjpms.c" +# End Source File +# Begin Source File + SOURCE=".\ctype-euc_kr.c" # End Source File # Begin Source File diff --git a/VC++Files/strings/strings_ia64.dsp b/VC++Files/strings/strings_ia64.dsp index 6449b2b1355..a34a238dfdc 100644 --- a/VC++Files/strings/strings_ia64.dsp +++ b/VC++Files/strings/strings_ia64.dsp @@ -112,6 +112,10 @@ SOURCE=".\ctype-bin.c" # End Source File # Begin Source File +SOURCE=".\ctype-cp932.c" +# End Source File +# Begin Source File + SOURCE=".\ctype-czech.c" # End Source File # Begin Source File @@ -120,6 +124,10 @@ SOURCE=".\ctype-euc_kr.c" # End Source File # Begin Source File +SOURCE=".\ctype-eucjpms.c" +# End Source File +# Begin Source File + SOURCE=".\ctype-extra.c" # End Source File # Begin Source File diff --git a/include/config-win.h b/include/config-win.h index df0530fbef3..bc392ce73d8 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -378,6 +378,7 @@ inline double ulonglong2double(ulonglong value) /* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_ascii */ #define HAVE_CHARSET_big5 1 +#define HAVE_CHARSET_cp932 #define HAVE_CHARSET_cp1250 1 /* #undef HAVE_CHARSET_cp1251 */ /* #undef HAVE_CHARSET_cp1256 */ @@ -386,6 +387,7 @@ inline double ulonglong2double(ulonglong value) /* #undef HAVE_CHARSET_cp852 */ /* #undef HAVE_CHARSET_cp866 */ /* #undef HAVE_CHARSET_dec8 */ +#define HAVE_CHARSET_eucjpms 1 #define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gbk 1 -- cgit v1.2.1 From 533b3f0af114e5d84f5bce204b97f16fbbb7cf1f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Apr 2005 16:49:14 +0200 Subject: Merge from fix of Bug #9675 Auto-increment not working with INSERT..SELECT and NDB storage --- mysql-test/r/ndb_alter_table.result | 2 +- mysql-test/r/ndb_basic.result | 60 +++++++++++++++++++++++++++++++++++++ mysql-test/t/ndb_basic.test | 27 +++++++++++++++++ sql/ha_ndbcluster.cc | 14 ++++++++- 4 files changed, 101 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result index 9bc82e7a24a..d3a9289283e 100644 --- a/mysql-test/r/ndb_alter_table.result +++ b/mysql-test/r/ndb_alter_table.result @@ -40,7 +40,7 @@ insert into t1 values (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 ndbcluster 10 Dynamic 9 96 # # 0 # 101 # # # latin1_swedish_ci NULL # +t1 ndbcluster 10 Dynamic 9 96 # # 0 # 102 # # # latin1_swedish_ci NULL # select * from t1 order by col1; col1 col2 col3 col4 col5 col6 to_be_deleted 0 4 3 5 PENDING 1 7 diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index e1aa045d16e..6383a636cad 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -607,3 +607,63 @@ primary key (a)) engine=ndb max_rows=1; drop table t1; +create table t1 +(counter int(64) NOT NULL auto_increment, +datavalue char(40) default 'XXXX', +primary key (counter) +) ENGINE=ndbcluster; +insert into t1 (datavalue) values ('newval'); +insert into t1 (datavalue) values ('newval'); +select * from t1 order by counter; +counter datavalue +1 newval +2 newval +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +select * from t1 order by counter; +counter datavalue +1 newval +2 newval +3 newval +4 newval +5 newval +6 newval +7 newval +8 newval +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +select * from t1 order by counter; +counter datavalue +1 newval +2 newval +3 newval +4 newval +5 newval +6 newval +7 newval +8 newval +35 newval +36 newval +37 newval +38 newval +39 newval +40 newval +41 newval +42 newval +43 newval +44 newval +45 newval +46 newval +47 newval +48 newval +49 newval +50 newval +51 newval +52 newval +53 newval +54 newval +55 newval +56 newval +57 newval +58 newval +drop table t1; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index a6064f30556..5dfc2d5ec58 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -577,3 +577,30 @@ create table t1 engine=ndb max_rows=1; drop table t1; + +# +# Test auto_increment +# + +connect (con1,localhost,,,test); +connect (con2,localhost,,,test); + +create table t1 + (counter int(64) NOT NULL auto_increment, + datavalue char(40) default 'XXXX', + primary key (counter) + ) ENGINE=ndbcluster; + +connection con1; +insert into t1 (datavalue) values ('newval'); +insert into t1 (datavalue) values ('newval'); +select * from t1 order by counter; +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +select * from t1 order by counter; +connection con2; +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +insert into t1 (datavalue) select datavalue from t1 where counter < 100; +select * from t1 order by counter; + +drop table t1; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 0668c3db7a8..6d843605e2f 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1919,8 +1919,12 @@ int ha_ndbcluster::write_row(byte *record) if (has_auto_increment) { + THD *thd= table->in_use; + m_skip_auto_increment= FALSE; update_auto_increment(); + /* Ensure that handler is always called for auto_increment values */ + thd->next_insert_id= 0; m_skip_auto_increment= !auto_increment_column_changed; } @@ -2970,7 +2974,11 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows) DBUG_PRINT("enter", ("rows: %d", (int)rows)); m_rows_inserted= 0; - m_rows_to_insert= rows; + if (rows == 0) + /* We don't know how many will be inserted, guess */ + m_rows_to_insert= m_autoincrement_prefetch; + else + m_rows_to_insert= rows; /* Calculate how many rows that should be inserted @@ -4080,6 +4088,10 @@ ulonglong ha_ndbcluster::get_auto_increment() DBUG_ENTER("get_auto_increment"); DBUG_PRINT("enter", ("m_tabname: %s", m_tabname)); Ndb *ndb= get_ndb(); + + if (m_rows_inserted > m_rows_to_insert) + /* We guessed too low */ + m_rows_to_insert+= m_autoincrement_prefetch; cache_size= (m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ? m_rows_to_insert - m_rows_inserted -- cgit v1.2.1