Commit 2e63f22a authored by tomas@poseidon.ndb.mysql.com's avatar tomas@poseidon.ndb.mysql.com

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-mysqladmin
parents 816fe259 77a58fb7
...@@ -638,23 +638,24 @@ row_sel_get_clust_rec( ...@@ -638,23 +638,24 @@ row_sel_get_clust_rec(
if (!node->read_view) { if (!node->read_view) {
/* Try to place a lock on the index record */ /* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used, /* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is we lock only the record, i.e. next-key locking is
not used. not used.
*/ */
if ( srv_locks_unsafe_for_binlog )
{ if (srv_locks_unsafe_for_binlog) {
err = lock_clust_rec_read_check_and_lock(0, clust_rec, err = lock_clust_rec_read_check_and_lock(0,
index,node->row_lock_mode, LOCK_REC_NOT_GAP, thr); clust_rec,
} index, node->row_lock_mode,
else LOCK_REC_NOT_GAP, thr);
{ } else {
err = lock_clust_rec_read_check_and_lock(0, clust_rec, index, err = lock_clust_rec_read_check_and_lock(0,
node->row_lock_mode, LOCK_ORDINARY, thr); clust_rec,
index, node->row_lock_mode,
} LOCK_ORDINARY, thr);
}
if (err != DB_SUCCESS) {
if (err != DB_SUCCESS) {
return(err); return(err);
} }
...@@ -1205,22 +1206,24 @@ rec_loop: ...@@ -1205,22 +1206,24 @@ rec_loop:
if (!consistent_read) { if (!consistent_read) {
/* If innodb_locks_unsafe_for_binlog option is used, /* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is we lock only the record, i.e. next-key locking is
not used. not used.
*/ */
if ( srv_locks_unsafe_for_binlog ) if (srv_locks_unsafe_for_binlog) {
{ err = sel_set_rec_lock(page_rec_get_next(rec),
err = sel_set_rec_lock(page_rec_get_next(rec), index, index,
node->row_lock_mode, LOCK_REC_NOT_GAP, thr); node->row_lock_mode,
} LOCK_REC_NOT_GAP, thr);
else } else {
{ err = sel_set_rec_lock(page_rec_get_next(rec),
err = sel_set_rec_lock(page_rec_get_next(rec), index, index,
node->row_lock_mode, LOCK_ORDINARY, thr); node->row_lock_mode,
} LOCK_ORDINARY, thr);
if (err != DB_SUCCESS) { }
if (err != DB_SUCCESS) {
/* Note that in this case we will store in pcur /* Note that in this case we will store in pcur
the PREDECESSOR of the record we are waiting the PREDECESSOR of the record we are waiting
the lock for */ the lock for */
...@@ -1245,21 +1248,18 @@ rec_loop: ...@@ -1245,21 +1248,18 @@ rec_loop:
if (!consistent_read) { if (!consistent_read) {
/* Try to place a lock on the index record */ /* Try to place a lock on the index record */
/* If innodb_locks_unsafe_for_binlog option is used, /* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is we lock only the record, i.e. next-key locking is
not used. not used.
*/ */
if ( srv_locks_unsafe_for_binlog ) if (srv_locks_unsafe_for_binlog) {
{ err = sel_set_rec_lock(rec, index, node->row_lock_mode,
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_REC_NOT_GAP, thr); LOCK_REC_NOT_GAP, thr);
} } else {
else err = sel_set_rec_lock(rec, index, node->row_lock_mode,
{
err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_ORDINARY, thr); LOCK_ORDINARY, thr);
} }
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
...@@ -3209,8 +3209,7 @@ rec_loop: ...@@ -3209,8 +3209,7 @@ rec_loop:
we do not lock gaps. Supremum record is really we do not lock gaps. Supremum record is really
a gap and therefore we do not set locks there. */ a gap and therefore we do not set locks there. */
if ( srv_locks_unsafe_for_binlog == FALSE ) if (srv_locks_unsafe_for_binlog == FALSE) {
{
err = sel_set_rec_lock(rec, index, err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type, prebuilt->select_lock_type,
LOCK_ORDINARY, thr); LOCK_ORDINARY, thr);
...@@ -3312,11 +3311,18 @@ rec_loop: ...@@ -3312,11 +3311,18 @@ rec_loop:
if (prebuilt->select_lock_type != LOCK_NONE if (prebuilt->select_lock_type != LOCK_NONE
&& set_also_gap_locks) { && set_also_gap_locks) {
/* Try to place a lock on the index record */
err = sel_set_rec_lock(rec, index, /* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
option is not set */
if (srv_locks_unsafe_for_binlog == FALSE) {
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type, prebuilt->select_lock_type,
LOCK_GAP, thr); LOCK_GAP, thr);
}
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
goto lock_wait_or_error; goto lock_wait_or_error;
...@@ -3338,11 +3344,18 @@ rec_loop: ...@@ -3338,11 +3344,18 @@ rec_loop:
if (prebuilt->select_lock_type != LOCK_NONE if (prebuilt->select_lock_type != LOCK_NONE
&& set_also_gap_locks) { && set_also_gap_locks) {
/* Try to place a lock on the index record */
err = sel_set_rec_lock(rec, index, /* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
option is not set */
if (srv_locks_unsafe_for_binlog == FALSE) {
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type, prebuilt->select_lock_type,
LOCK_GAP, thr); LOCK_GAP, thr);
}
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
goto lock_wait_or_error; goto lock_wait_or_error;
...@@ -3376,19 +3389,16 @@ rec_loop: ...@@ -3376,19 +3389,16 @@ rec_loop:
prebuilt->select_lock_type, prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr); LOCK_REC_NOT_GAP, thr);
} else { } else {
/* If innodb_locks_unsafe_for_binlog option is used, /* If innodb_locks_unsafe_for_binlog option is used,
we lock only the record, i.e. next-key locking is we lock only the record, i.e. next-key locking is
not used. not used. */
*/
if ( srv_locks_unsafe_for_binlog ) if (srv_locks_unsafe_for_binlog) {
{ err = sel_set_rec_lock(rec, index,
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type, prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr); LOCK_REC_NOT_GAP, thr);
} } else {
else err = sel_set_rec_lock(rec, index,
{
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type, prebuilt->select_lock_type,
LOCK_ORDINARY, thr); LOCK_ORDINARY, thr);
} }
......
...@@ -529,6 +529,7 @@ show keys from t1; ...@@ -529,6 +529,7 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
create table t2 (a int); create table t2 (a int);
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
insert t1 select * from t2; insert t1 select * from t2;
show keys from t1; show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
......
...@@ -44,6 +44,51 @@ a b c ...@@ -44,6 +44,51 @@ a b c
7 8 3 7 8 3
8 2 3 8 2 3
drop table t1; drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned,
c int unsigned,
UNIQUE bc(b,c)
) engine = ndb;
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
select * from t1 use index (bc) where b IS NULL order by a;
a b c
2 NULL 2
3 NULL NULL
select * from t1 use index (bc)order by a;
a b c
1 1 1
2 NULL 2
3 NULL NULL
4 4 NULL
select * from t1 use index (bc) order by a;
a b c
1 1 1
2 NULL 2
3 NULL NULL
4 4 NULL
select * from t1 use index (PRIMARY) where b IS NULL order by a;
a b c
2 NULL 2
3 NULL NULL
select * from t1 use index (bc) where b IS NULL order by a;
a b c
2 NULL 2
3 NULL NULL
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
a b c
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
a b c
select * from t1 use index (bc) where b < 4 order by a;
a b c
1 1 1
select * from t1 use index (bc) where b IS NOT NULL order by a;
a b c
1 1 1
4 4 NULL
insert into t1 values(5,1,1);
ERROR 23000: Duplicate entry '5' for key 1
drop table t1;
CREATE TABLE t2 ( CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY, a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null, b int unsigned not null,
...@@ -87,6 +132,13 @@ a b c ...@@ -87,6 +132,13 @@ a b c
7 8 3 7 8 3
8 2 3 8 2 3
drop table t2; drop table t2;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
UNIQUE USING HASH (b, c)
) engine=ndbcluster;
ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
CREATE TABLE t3 ( CREATE TABLE t3 (
a int unsigned NOT NULL, a int unsigned NOT NULL,
b int unsigned not null, b int unsigned not null,
......
...@@ -1990,3 +1990,18 @@ ac ...@@ -1990,3 +1990,18 @@ ac
700 700
NULL NULL
drop tables t1,t2; drop tables t1,t2;
create table t1 (a int not null, b int not null, c int, primary key (a,b));
insert into t1 values (1,1,1), (2,2,2), (3,3,3);
set @b:= 0;
explain select sum(a) from t1 where b > @b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index
set @a:= (select sum(a) from t1 where b > @b);
explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
do @a:= (select sum(a) from t1 where b > @b);
explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
...@@ -498,11 +498,12 @@ alter table t1 disable keys; ...@@ -498,11 +498,12 @@ alter table t1 disable keys;
show keys from t1; show keys from t1;
create table t2 (a int); create table t2 (a int);
let $i=1000; let $i=1000;
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
--disable_query_log --disable_query_log
while ($i) while ($i)
{ {
dec $i; dec $i;
eval insert t2 values (rand()*100000); insert t2 values (rand()*100000);
} }
--enable_query_log --enable_query_log
insert t1 select * from t2; insert t1 select * from t2;
......
...@@ -199,7 +199,7 @@ insert into t4 values (1, "Automatic"); ...@@ -199,7 +199,7 @@ insert into t4 values (1, "Automatic");
select * from t4; select * from t4;
# Remove the table from NDB # Remove the table from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
# #
# Test that correct error is returned # Test that correct error is returned
...@@ -230,7 +230,7 @@ select * from t4; ...@@ -230,7 +230,7 @@ select * from t4;
flush tables; flush tables;
# Remove the table from NDB # Remove the table from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
SHOW TABLES; SHOW TABLES;
...@@ -264,8 +264,8 @@ insert into t8 values (8, "myisam table 8"); ...@@ -264,8 +264,8 @@ insert into t8 values (8, "myisam table 8");
insert into t9 values (9); insert into t9 values (9);
# Remove t3, t5 from NDB # Remove t3, t5 from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk # Remove t6, t7 from disk
system rm var/master-data/test/t6.frm > /dev/null ; system rm var/master-data/test/t6.frm > /dev/null ;
system rm var/master-data/test/t7.frm > /dev/null ; system rm var/master-data/test/t7.frm > /dev/null ;
...@@ -306,8 +306,8 @@ insert into t8 values (8, "myisam table 8"); ...@@ -306,8 +306,8 @@ insert into t8 values (8, "myisam table 8");
insert into t9 values (9); insert into t9 values (9);
# Remove t3, t5 from NDB # Remove t3, t5 from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ; system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk # Remove t6, t7 from disk
system rm var/master-data/test/t6.frm > /dev/null ; system rm var/master-data/test/t6.frm > /dev/null ;
system rm var/master-data/test/t7.frm > /dev/null ; system rm var/master-data/test/t7.frm > /dev/null ;
...@@ -479,4 +479,4 @@ create table t10 ( ...@@ -479,4 +479,4 @@ create table t10 (
insert into t10 values (1, 'kalle'); insert into t10 values (1, 'kalle');
--exec $NDB_TOOLS_DIR/ndb_drop_table -d test `$NDB_TOOLS_DIR/ndb_show_tables | grep BLOB` > /dev/null 2>&1 || true --exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` > /dev/null 2>&1 || true
...@@ -30,6 +30,32 @@ select * from t1 order by a; ...@@ -30,6 +30,32 @@ select * from t1 order by a;
drop table t1; drop table t1;
#
# Indexing NULL values
#
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned,
c int unsigned,
UNIQUE bc(b,c)
) engine = ndb;
insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
select * from t1 use index (bc) where b IS NULL order by a;
select * from t1 use index (bc)order by a;
select * from t1 use index (bc) order by a;
select * from t1 use index (PRIMARY) where b IS NULL order by a;
select * from t1 use index (bc) where b IS NULL order by a;
select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
select * from t1 use index (bc) where b < 4 order by a;
select * from t1 use index (bc) where b IS NOT NULL order by a;
-- error 1062
insert into t1 values(5,1,1);
drop table t1;
# #
# Show use of UNIQUE USING HASH indexes # Show use of UNIQUE USING HASH indexes
...@@ -58,6 +84,14 @@ select * from t2 order by a; ...@@ -58,6 +84,14 @@ select * from t2 order by a;
drop table t2; drop table t2;
-- error 1121
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
UNIQUE USING HASH (b, c)
) engine=ndbcluster;
# #
# Show use of PRIMARY KEY USING HASH indexes # Show use of PRIMARY KEY USING HASH indexes
# #
......
...@@ -1282,3 +1282,22 @@ INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,' ...@@ -1282,3 +1282,22 @@ INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
drop tables t1,t2; drop tables t1,t2;
#
# Test for bug #6462. "Same request on same data returns different
# results." a.k.a. "Proper cleanup of subqueries is missing for
# SET and DO statements".
#
create table t1 (a int not null, b int not null, c int, primary key (a,b));
insert into t1 values (1,1,1), (2,2,2), (3,3,3);
set @b:= 0;
# Let us check that subquery will use covering index
explain select sum(a) from t1 where b > @b;
# This should not crash -debug server due to failing assertion
set @a:= (select sum(a) from t1 where b > @b);
# And this should not falsely report index usage
explain select a from t1 where c=2;
# Same for DO statement
do @a:= (select sum(a) from t1 where b > @b);
explain select a from t1 where c=2;
drop table t1;
...@@ -796,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase) ...@@ -796,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
error= create_unique_index(unique_index_name, key_info); error= create_unique_index(unique_index_name, key_info);
break; break;
case UNIQUE_INDEX: case UNIQUE_INDEX:
error= create_unique_index(unique_index_name, key_info); if (!(error= check_index_fields_not_null(i)))
error= create_unique_index(unique_index_name, key_info);
break; break;
case ORDERED_INDEX: case ORDERED_INDEX:
error= create_ordered_index(index_name, key_info); error= create_ordered_index(index_name, key_info);
...@@ -848,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const ...@@ -848,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const
ORDERED_INDEX); ORDERED_INDEX);
} }
int ha_ndbcluster::check_index_fields_not_null(uint inx)
{
KEY* key_info= table->key_info + inx;
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ENTER("check_index_fields_not_null");
for (; key_part != end; key_part++)
{
Field* field= key_part->field;
if (field->maybe_null())
{
my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX),
MYF(0),field->field_name);
DBUG_RETURN(ER_NULL_COLUMN_IN_INDEX);
}
}
DBUG_RETURN(0);
}
void ha_ndbcluster::release_metadata() void ha_ndbcluster::release_metadata()
{ {
......
...@@ -160,7 +160,8 @@ class ha_ndbcluster: public handler ...@@ -160,7 +160,8 @@ class ha_ndbcluster: public handler
void release_metadata(); void release_metadata();
NDB_INDEX_TYPE get_index_type(uint idx_no) const; NDB_INDEX_TYPE get_index_type(uint idx_no) const;
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const; NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
int check_index_fields_not_null(uint index_no);
int pk_read(const byte *key, uint key_len, byte *buf); int pk_read(const byte *key, uint key_len, byte *buf);
int complemented_pk_read(const byte *old_data, byte *new_data); int complemented_pk_read(const byte *old_data, byte *new_data);
int peek_row(); int peek_row();
......
...@@ -2733,13 +2733,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list) ...@@ -2733,13 +2733,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
while ((var=it++)) while ((var=it++))
{ {
if ((error=var->check(thd))) if ((error=var->check(thd)))
DBUG_RETURN(error); goto err;
} }
if (thd->net.report_error) if (!thd->net.report_error)
DBUG_RETURN(1); {
it.rewind(); it.rewind();
while ((var=it++)) while ((var= it++))
error|= var->update(thd); // Returns 0, -1 or 1 error|= var->update(thd); // Returns 0, -1 or 1
}
else
error= 1;
err:
free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -29,6 +29,7 @@ int mysql_do(THD *thd, List<Item> &values) ...@@ -29,6 +29,7 @@ int mysql_do(THD *thd, List<Item> &values)
DBUG_RETURN(-1); DBUG_RETURN(-1);
while ((value = li++)) while ((value = li++))
value->val_int(); value->val_int();
free_underlaid_joins(thd, &thd->lex->select_lex);
thd->clear_error(); // DO always is OK thd->clear_error(); // DO always is OK
send_ok(thd); send_ok(thd);
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -218,7 +218,6 @@ int main(int ac, char **av) ...@@ -218,7 +218,6 @@ int main(int ac, char **av)
*/ */
if (ndefs == MY_UCA_NCHARS) if (ndefs == MY_UCA_NCHARS)
{ {
printf("/* Don't dump w=%d pg=%3X: ndefs=%d */\n",w, page, ndefs);
continue; continue;
} }
switch (maxnum) switch (maxnum)
...@@ -263,7 +262,17 @@ int main(int ac, char **av) ...@@ -263,7 +262,17 @@ int main(int ac, char **av)
for (i=0; i < maxnum; i++) for (i=0; i < maxnum; i++)
{ {
printf("0x%04X",(int)weight[i]); /*
Invert weights for secondary level to
sort upper case letters before their
lower case counter part.
*/
int tmp= weight[i];
if (w == 2 && tmp)
tmp= (int)(0x100 - weight[i]);
printf("0x%04X", tmp);
if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum)) if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum))
printf(","); printf(",");
nchars++; nchars++;
...@@ -281,7 +290,7 @@ int main(int ac, char **av) ...@@ -281,7 +290,7 @@ int main(int ac, char **av)
printf("};\n\n"); printf("};\n\n");
} }
printf("uchar ucal%s[%d]={\n", pname[w], MY_UCA_NPAGES); printf("uchar uca_length%s[%d]={\n", pname[w], MY_UCA_NPAGES);
for (page=0; page < MY_UCA_NPAGES; page++) for (page=0; page < MY_UCA_NPAGES; page++)
{ {
printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n"); printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n");
...@@ -289,7 +298,7 @@ int main(int ac, char **av) ...@@ -289,7 +298,7 @@ int main(int ac, char **av)
printf("};\n"); printf("};\n");
printf("uint16 *ucaw%s[%d]={\n", pname[w], MY_UCA_NPAGES); printf("uint16 *uca_weight%s[%d]={\n", pname[w], MY_UCA_NPAGES);
for (page=0; page < MY_UCA_NPAGES; page++) for (page=0; page < MY_UCA_NPAGES; page++)
{ {
const char *comma= page < MY_UCA_NPAGES-1 ? "," : ""; const char *comma= page < MY_UCA_NPAGES-1 ? "," : "";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment