Skip to content

Commit ce541b2

Browse files
support for unsigned FLOAT/DOUBLE
1 parent 2ac18e9 commit ce541b2

File tree

10 files changed

+67
-16
lines changed

10 files changed

+67
-16
lines changed

Docs/manual.texi

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4532,7 +4532,7 @@ MySQL Server also supports
45324532
the following additional type attributes:
45334533
@itemize @bullet
45344534
@item
4535-
@code{UNSIGNED} option for integer columns.
4535+
@code{UNSIGNED} option for integer and floating point columns.
45364536
@item
45374537
@code{ZEROFILL} option for integer columns.
45384538
@item
@@ -8148,6 +8148,10 @@ version 4.0;
81488148

81498149
@itemize @bullet
81508150
@item
8151+
@code{DOUBLE} and @code{FLOAT} columns are now honoring the
8152+
@code{UNSIGNED} flag on storage (before @code{UNSIGNED} was ignored for
8153+
these columns).
8154+
@item
81518155
Use @code{ORDER BY column DESC} now always sorts @code{NULL} values
81528156
first; In 3.23 this was not always consistent.
81538157
@item
@@ -8177,6 +8181,9 @@ you need to rebuild them with @code{ALTER TABLE table_name TYPE=MyISAM},
81778181
@code{LOCATE()} and @code{INSTR()} are case sensitive if one of the
81788182
arguments is a binary string.
81798183
@item
8184+
@code{STRCMP()} now uses the current character set when doing comparison,
8185+
which means that the default comparison is case insensitive.
8186+
@item
81808187
@code{HEX(string)} now returns the characters in string converted to
81818188
hexadecimal. If you want to convert a number to hexadecimal, you should
81828189
ensure that you call @code{HEX()} with a numeric argument.
@@ -33467,15 +33474,20 @@ restrictions:
3346733474
@itemize @bullet
3346833475
@item
3346933476
Only the last @code{SELECT} command can have @code{INTO OUTFILE}.
33470-
@item
33471-
Only the last @code{SELECT} command can have @code{ORDER BY}.
3347233477
@end itemize
3347333478

3347433479
If you don't use the keyword @code{ALL} for the @code{UNION}, all
3347533480
returned rows will be unique, like if you had done a @code{DISTINCT} for
3347633481
the total result set. If you specify @code{ALL}, then you will get all
3347733482
matching rows from all the used @code{SELECT} statements.
3347833483

33484+
If you want to use an @code{ORDER BY} for the total @code{UNION} result,
33485+
you should use parentheses:
33486+
33487+
@example
33488+
(SELECT a FROM table_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10) UNION
33489+
(SELECT a FROM table_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10) ORDER BY a;
33490+
@end example
3347933491

3348033492
@findex HANDLER
3348133493
@node HANDLER, INSERT, SELECT, Data Manipulation
@@ -41741,9 +41753,11 @@ set has been read.
4174141753

4174241754
If you acquire a result set from a successful call to
4174341755
@code{mysql_store_result()}, the client receives the entire set in one
41744-
operation. In this case, a @code{NULL} return from @code{mysql_fetch_row()}
41745-
always means the end of the result set has been reached and it is
41746-
unnecessary to call @code{mysql_eof()}.
41756+
operation. In this case, a @code{NULL} return from
41757+
@code{mysql_fetch_row()} always means the end of the result set has been
41758+
reached and it is unnecessary to call @code{mysql_eof()}. When used
41759+
with @code{mysql_store_result()}, @code{mysql_eof()} will always return
41760+
true.
4174741761

4174841762
On the other hand, if you use @code{mysql_use_result()} to initiate a result
4174941763
set retrieval, the rows of the set are obtained from the server one by one as
@@ -48730,6 +48744,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
4873048744

4873148745
@itemize @bullet
4873248746
@item
48747+
A lot of fixes to @code{UNION}.
48748+
@item
48749+
@code{DOUBLE} and @code{FLOAT} columns are now honoring the
48750+
@code{UNSIGNED} flag on storage.
48751+
@item
4873348752
Fixed bug with indexless boolean fulltext search.
4873448753
@item
4873548754
Fixed bug that sometimes appeared when fulltext search was used
@@ -48934,6 +48953,9 @@ now handle signed and unsigned @code{BIGINT} numbers correctly.
4893448953
@item
4893548954
New character set @code{latin_de} which provides correct German sorting.
4893648955
@item
48956+
@code{STRCMP()} now uses the current character set when doing comparison,
48957+
which means that the default comparison is case insensitive.
48958+
@item
4893748959
@code{TRUNCATE TABLE} and @code{DELETE FROM table_name} are now separate
4893848960
functions. One bonus is that @code{DELETE FROM table_name} now returns
4893948961
the number of deleted rows.
@@ -49118,6 +49140,9 @@ not yet 100% confident in this code.
4911849140
@appendixsubsec Changes in release 3.23.50
4911949141
@itemize @bullet
4912049142
@item
49143+
Our Linux RPMS and binaries are now compiled with gcc 3.0.4, which should
49144+
make them a bit faster.
49145+
@item
4912149146
Fixed problem with @code{SHOW CREATE TABLE} and @code{PRIMARY KEY} when using
4912249147
32 indexes.
4912349148
@item

configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,8 @@ Reference Manual.])
974974
if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
975975
then
976976
with_named_thread="-lpthread -lmach -lexc"
977-
#with_named_thread="-lpthread -lmach -lexc -lc"
977+
CFLAGS="$CFLAGS -D_REENTRANT"
978+
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
978979
AC_DEFINE(HAVE_DEC_THREADS)
979980
AC_MSG_RESULT("yes")
980981
else

include/config-win.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define SYSTEM_TYPE "Win95/Win98"
3232
#endif
3333

34-
#ifdef _WIN64
34+
#if defined(_WIN64) || defined(WIN64)
3535
#define MACHINE_TYPE "ia64" /* Define to machine type name */
3636
#else
3737
#define MACHINE_TYPE "i32" /* Define to machine type name */

include/mysql_com.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
108108
struct st_vio; /* Only C */
109109
typedef struct st_vio Vio;
110110

111-
#define MAX_CHAR_WIDTH 255 // Max length for a CHAR colum
112-
#define MAX_BLOB_WIDTH 8192 // Default width for blob
111+
#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */
112+
#define MAX_BLOB_WIDTH 8192 /* Default width for blob */
113113

114114
typedef struct st_net {
115115
Vio* vio;

libmysql/libmysql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ static const char *default_options[]=
701701
"character-set-dir", "default-character-set", "interactive-timeout",
702702
"connect-timeout", "local-infile", "disable-local-infile",
703703
"replication-probe", "enable-reads-from-master", "repl-parse-query",
704-
"ssl-chiper",
704+
"ssl-cipher",
705705
NullS
706706
};
707707

myisam/ft_boolean_search.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,14 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
412412
FTB_EXPR *ftbe;
413413
FT_SEG_ITERATOR ftsi;
414414
const byte *end;
415-
uint i;
416415
my_off_t docid=ftb->info->lastpos;
417416

418417
if (docid == HA_POS_ERROR)
419418
return -2.0;
420419
if (!ftb->queue.elements)
421420
return 0;
422421

423-
#if 0
422+
#if NOT_USED
424423
if (ftb->state == READY || ftb->state == INDEX_DONE)
425424
ftb->state=SCAN;
426425
else if (ftb->state != SCAN)

mysys/array.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
*/
3030

3131
my_bool _init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
32-
uint init_alloc, uint alloc_increment CALLER_INFO_PROTO)
32+
uint init_alloc,
33+
uint alloc_increment CALLER_INFO_PROTO)
3334
{
3435
DBUG_ENTER("init_dynamic_array");
3536
if (!alloc_increment)

mysys/thr_alarm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1616

1717
/* To avoid problems with alarms in debug code, we disable DBUG here */
18+
#undef DBUG_OFF
1819
#define DBUG_OFF
1920
#include <my_global.h>
2021

sql/field.cc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,11 @@ void Field_float::store(double nr)
17131713
float j;
17141714
if (dec < NOT_FIXED_DEC)
17151715
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
1716+
if (unsigned_flag && nr < 0)
1717+
{
1718+
current_thd->cuted_fields++;
1719+
nr=0;
1720+
}
17161721
if (nr < -FLT_MAX)
17171722
{
17181723
j= -FLT_MAX;
@@ -1739,6 +1744,11 @@ void Field_float::store(double nr)
17391744
void Field_float::store(longlong nr)
17401745
{
17411746
float j= (float) nr;
1747+
if (unsigned_flag && j < 0)
1748+
{
1749+
current_thd->cuted_fields++;
1750+
j=0;
1751+
}
17421752
#ifdef WORDS_BIGENDIAN
17431753
if (table->db_low_byte_first)
17441754
{
@@ -1945,6 +1955,11 @@ void Field_double::store(const char *from,uint len)
19451955
double j= atof(tmp_str.c_ptr());
19461956
if (errno || current_thd->count_cuted_fields && !test_if_real(from,len))
19471957
current_thd->cuted_fields++;
1958+
if (unsigned_flag && j < 0)
1959+
{
1960+
current_thd->cuted_fields++;
1961+
j=0;
1962+
}
19481963
#ifdef WORDS_BIGENDIAN
19491964
if (table->db_low_byte_first)
19501965
{
@@ -1960,6 +1975,11 @@ void Field_double::store(double nr)
19601975
{
19611976
if (dec < NOT_FIXED_DEC)
19621977
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
1978+
if (unsigned_flag && nr < 0)
1979+
{
1980+
current_thd->cuted_fields++;
1981+
nr=0;
1982+
}
19631983
#ifdef WORDS_BIGENDIAN
19641984
if (table->db_low_byte_first)
19651985
{
@@ -1974,6 +1994,11 @@ void Field_double::store(double nr)
19741994
void Field_double::store(longlong nr)
19751995
{
19761996
double j= (double) nr;
1997+
if (unsigned_flag && j < 0)
1998+
{
1999+
current_thd->cuted_fields++;
2000+
j=0;
2001+
}
19772002
#ifdef WORDS_BIGENDIAN
19782003
if (table->db_low_byte_first)
19792004
{

sql/ha_innodb.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,7 +2408,7 @@ ha_innobase::rnd_pos(
24082408
int error;
24092409
uint keynr = active_index;
24102410
DBUG_ENTER("rnd_pos");
2411-
DBUG_DUMP("key", pos, ref_stored_len);
2411+
DBUG_DUMP("key", (char*) pos, ref_stored_len);
24122412

24132413
statistic_increment(ha_read_rnd_count, &LOCK_status);
24142414

@@ -2633,7 +2633,6 @@ ha_innobase::create(
26332633
dict_table_t* innobase_table;
26342634
trx_t* trx;
26352635
int primary_key_no;
2636-
KEY* key;
26372636
uint i;
26382637
char name2[FN_REFLEN];
26392638
char norm_name[FN_REFLEN];

0 commit comments

Comments
 (0)