Commit ce541b29 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

support for unsigned FLOAT/DOUBLE

parent 2ac18e9b
...@@ -4532,7 +4532,7 @@ MySQL Server also supports ...@@ -4532,7 +4532,7 @@ MySQL Server also supports
the following additional type attributes: the following additional type attributes:
@itemize @bullet @itemize @bullet
@item @item
@code{UNSIGNED} option for integer columns. @code{UNSIGNED} option for integer and floating point columns.
@item @item
@code{ZEROFILL} option for integer columns. @code{ZEROFILL} option for integer columns.
@item @item
...@@ -8148,6 +8148,10 @@ version 4.0; ...@@ -8148,6 +8148,10 @@ version 4.0;
@itemize @bullet @itemize @bullet
@item @item
@code{DOUBLE} and @code{FLOAT} columns are now honoring the
@code{UNSIGNED} flag on storage (before @code{UNSIGNED} was ignored for
these columns).
@item
Use @code{ORDER BY column DESC} now always sorts @code{NULL} values Use @code{ORDER BY column DESC} now always sorts @code{NULL} values
first; In 3.23 this was not always consistent. first; In 3.23 this was not always consistent.
@item @item
...@@ -8177,6 +8181,9 @@ you need to rebuild them with @code{ALTER TABLE table_name TYPE=MyISAM}, ...@@ -8177,6 +8181,9 @@ you need to rebuild them with @code{ALTER TABLE table_name TYPE=MyISAM},
@code{LOCATE()} and @code{INSTR()} are case sensitive if one of the @code{LOCATE()} and @code{INSTR()} are case sensitive if one of the
arguments is a binary string. arguments is a binary string.
@item @item
@code{STRCMP()} now uses the current character set when doing comparison,
which means that the default comparison is case insensitive.
@item
@code{HEX(string)} now returns the characters in string converted to @code{HEX(string)} now returns the characters in string converted to
hexadecimal. If you want to convert a number to hexadecimal, you should hexadecimal. If you want to convert a number to hexadecimal, you should
ensure that you call @code{HEX()} with a numeric argument. ensure that you call @code{HEX()} with a numeric argument.
...@@ -33467,8 +33474,6 @@ restrictions: ...@@ -33467,8 +33474,6 @@ restrictions:
@itemize @bullet @itemize @bullet
@item @item
Only the last @code{SELECT} command can have @code{INTO OUTFILE}. Only the last @code{SELECT} command can have @code{INTO OUTFILE}.
@item
Only the last @code{SELECT} command can have @code{ORDER BY}.
@end itemize @end itemize
If you don't use the keyword @code{ALL} for the @code{UNION}, all If you don't use the keyword @code{ALL} for the @code{UNION}, all
...@@ -33476,6 +33481,13 @@ returned rows will be unique, like if you had done a @code{DISTINCT} for ...@@ -33476,6 +33481,13 @@ returned rows will be unique, like if you had done a @code{DISTINCT} for
the total result set. If you specify @code{ALL}, then you will get all the total result set. If you specify @code{ALL}, then you will get all
matching rows from all the used @code{SELECT} statements. matching rows from all the used @code{SELECT} statements.
If you want to use an @code{ORDER BY} for the total @code{UNION} result,
you should use parentheses:
@example
(SELECT a FROM table_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10) UNION
(SELECT a FROM table_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10) ORDER BY a;
@end example
@findex HANDLER @findex HANDLER
@node HANDLER, INSERT, SELECT, Data Manipulation @node HANDLER, INSERT, SELECT, Data Manipulation
...@@ -41741,9 +41753,11 @@ set has been read. ...@@ -41741,9 +41753,11 @@ set has been read.
If you acquire a result set from a successful call to If you acquire a result set from a successful call to
@code{mysql_store_result()}, the client receives the entire set in one @code{mysql_store_result()}, the client receives the entire set in one
operation. In this case, a @code{NULL} return from @code{mysql_fetch_row()} operation. In this case, a @code{NULL} return from
always means the end of the result set has been reached and it is @code{mysql_fetch_row()} always means the end of the result set has been
unnecessary to call @code{mysql_eof()}. reached and it is unnecessary to call @code{mysql_eof()}. When used
with @code{mysql_store_result()}, @code{mysql_eof()} will always return
true.
On the other hand, if you use @code{mysql_use_result()} to initiate a result On the other hand, if you use @code{mysql_use_result()} to initiate a result
set retrieval, the rows of the set are obtained from the server one by one as 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}. ...@@ -48730,6 +48744,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet @itemize @bullet
@item @item
A lot of fixes to @code{UNION}.
@item
@code{DOUBLE} and @code{FLOAT} columns are now honoring the
@code{UNSIGNED} flag on storage.
@item
Fixed bug with indexless boolean fulltext search. Fixed bug with indexless boolean fulltext search.
@item @item
Fixed bug that sometimes appeared when fulltext search was used Fixed bug that sometimes appeared when fulltext search was used
...@@ -48934,6 +48953,9 @@ now handle signed and unsigned @code{BIGINT} numbers correctly. ...@@ -48934,6 +48953,9 @@ now handle signed and unsigned @code{BIGINT} numbers correctly.
@item @item
New character set @code{latin_de} which provides correct German sorting. New character set @code{latin_de} which provides correct German sorting.
@item @item
@code{STRCMP()} now uses the current character set when doing comparison,
which means that the default comparison is case insensitive.
@item
@code{TRUNCATE TABLE} and @code{DELETE FROM table_name} are now separate @code{TRUNCATE TABLE} and @code{DELETE FROM table_name} are now separate
functions. One bonus is that @code{DELETE FROM table_name} now returns functions. One bonus is that @code{DELETE FROM table_name} now returns
the number of deleted rows. the number of deleted rows.
...@@ -49118,6 +49140,9 @@ not yet 100% confident in this code. ...@@ -49118,6 +49140,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.50 @appendixsubsec Changes in release 3.23.50
@itemize @bullet @itemize @bullet
@item @item
Our Linux RPMS and binaries are now compiled with gcc 3.0.4, which should
make them a bit faster.
@item
Fixed problem with @code{SHOW CREATE TABLE} and @code{PRIMARY KEY} when using Fixed problem with @code{SHOW CREATE TABLE} and @code{PRIMARY KEY} when using
32 indexes. 32 indexes.
@item @item
...@@ -974,7 +974,8 @@ Reference Manual.]) ...@@ -974,7 +974,8 @@ Reference Manual.])
if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
then then
with_named_thread="-lpthread -lmach -lexc" with_named_thread="-lpthread -lmach -lexc"
#with_named_thread="-lpthread -lmach -lexc -lc" CFLAGS="$CFLAGS -D_REENTRANT"
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
AC_DEFINE(HAVE_DEC_THREADS) AC_DEFINE(HAVE_DEC_THREADS)
AC_MSG_RESULT("yes") AC_MSG_RESULT("yes")
else else
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define SYSTEM_TYPE "Win95/Win98" #define SYSTEM_TYPE "Win95/Win98"
#endif #endif
#ifdef _WIN64 #if defined(_WIN64) || defined(WIN64)
#define MACHINE_TYPE "ia64" /* Define to machine type name */ #define MACHINE_TYPE "ia64" /* Define to machine type name */
#else #else
#define MACHINE_TYPE "i32" /* Define to machine type name */ #define MACHINE_TYPE "i32" /* Define to machine type name */
......
...@@ -108,8 +108,8 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, ...@@ -108,8 +108,8 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
struct st_vio; /* Only C */ struct st_vio; /* Only C */
typedef struct st_vio Vio; typedef struct st_vio Vio;
#define MAX_CHAR_WIDTH 255 // Max length for a CHAR colum #define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */
#define MAX_BLOB_WIDTH 8192 // Default width for blob #define MAX_BLOB_WIDTH 8192 /* Default width for blob */
typedef struct st_net { typedef struct st_net {
Vio* vio; Vio* vio;
......
...@@ -701,7 +701,7 @@ static const char *default_options[]= ...@@ -701,7 +701,7 @@ static const char *default_options[]=
"character-set-dir", "default-character-set", "interactive-timeout", "character-set-dir", "default-character-set", "interactive-timeout",
"connect-timeout", "local-infile", "disable-local-infile", "connect-timeout", "local-infile", "disable-local-infile",
"replication-probe", "enable-reads-from-master", "repl-parse-query", "replication-probe", "enable-reads-from-master", "repl-parse-query",
"ssl-chiper", "ssl-cipher",
NullS NullS
}; };
......
...@@ -412,7 +412,6 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) ...@@ -412,7 +412,6 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
FTB_EXPR *ftbe; FTB_EXPR *ftbe;
FT_SEG_ITERATOR ftsi; FT_SEG_ITERATOR ftsi;
const byte *end; const byte *end;
uint i;
my_off_t docid=ftb->info->lastpos; my_off_t docid=ftb->info->lastpos;
if (docid == HA_POS_ERROR) if (docid == HA_POS_ERROR)
...@@ -420,7 +419,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) ...@@ -420,7 +419,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
if (!ftb->queue.elements) if (!ftb->queue.elements)
return 0; return 0;
#if 0 #if NOT_USED
if (ftb->state == READY || ftb->state == INDEX_DONE) if (ftb->state == READY || ftb->state == INDEX_DONE)
ftb->state=SCAN; ftb->state=SCAN;
else if (ftb->state != SCAN) else if (ftb->state != SCAN)
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
*/ */
my_bool _init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, my_bool _init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
uint init_alloc, uint alloc_increment CALLER_INFO_PROTO) uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO)
{ {
DBUG_ENTER("init_dynamic_array"); DBUG_ENTER("init_dynamic_array");
if (!alloc_increment) if (!alloc_increment)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* To avoid problems with alarms in debug code, we disable DBUG here */ /* To avoid problems with alarms in debug code, we disable DBUG here */
#undef DBUG_OFF
#define DBUG_OFF #define DBUG_OFF
#include <my_global.h> #include <my_global.h>
......
...@@ -1713,6 +1713,11 @@ void Field_float::store(double nr) ...@@ -1713,6 +1713,11 @@ void Field_float::store(double nr)
float j; float j;
if (dec < NOT_FIXED_DEC) if (dec < NOT_FIXED_DEC)
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
if (unsigned_flag && nr < 0)
{
current_thd->cuted_fields++;
nr=0;
}
if (nr < -FLT_MAX) if (nr < -FLT_MAX)
{ {
j= -FLT_MAX; j= -FLT_MAX;
...@@ -1739,6 +1744,11 @@ void Field_float::store(double nr) ...@@ -1739,6 +1744,11 @@ void Field_float::store(double nr)
void Field_float::store(longlong nr) void Field_float::store(longlong nr)
{ {
float j= (float) nr; float j= (float) nr;
if (unsigned_flag && j < 0)
{
current_thd->cuted_fields++;
j=0;
}
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
{ {
...@@ -1945,6 +1955,11 @@ void Field_double::store(const char *from,uint len) ...@@ -1945,6 +1955,11 @@ void Field_double::store(const char *from,uint len)
double j= atof(tmp_str.c_ptr()); double j= atof(tmp_str.c_ptr());
if (errno || current_thd->count_cuted_fields && !test_if_real(from,len)) if (errno || current_thd->count_cuted_fields && !test_if_real(from,len))
current_thd->cuted_fields++; current_thd->cuted_fields++;
if (unsigned_flag && j < 0)
{
current_thd->cuted_fields++;
j=0;
}
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
{ {
...@@ -1960,6 +1975,11 @@ void Field_double::store(double nr) ...@@ -1960,6 +1975,11 @@ void Field_double::store(double nr)
{ {
if (dec < NOT_FIXED_DEC) if (dec < NOT_FIXED_DEC)
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
if (unsigned_flag && nr < 0)
{
current_thd->cuted_fields++;
nr=0;
}
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
{ {
...@@ -1974,6 +1994,11 @@ void Field_double::store(double nr) ...@@ -1974,6 +1994,11 @@ void Field_double::store(double nr)
void Field_double::store(longlong nr) void Field_double::store(longlong nr)
{ {
double j= (double) nr; double j= (double) nr;
if (unsigned_flag && j < 0)
{
current_thd->cuted_fields++;
j=0;
}
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
{ {
......
...@@ -2408,7 +2408,7 @@ ha_innobase::rnd_pos( ...@@ -2408,7 +2408,7 @@ ha_innobase::rnd_pos(
int error; int error;
uint keynr = active_index; uint keynr = active_index;
DBUG_ENTER("rnd_pos"); DBUG_ENTER("rnd_pos");
DBUG_DUMP("key", pos, ref_stored_len); DBUG_DUMP("key", (char*) pos, ref_stored_len);
statistic_increment(ha_read_rnd_count, &LOCK_status); statistic_increment(ha_read_rnd_count, &LOCK_status);
...@@ -2633,7 +2633,6 @@ ha_innobase::create( ...@@ -2633,7 +2633,6 @@ ha_innobase::create(
dict_table_t* innobase_table; dict_table_t* innobase_table;
trx_t* trx; trx_t* trx;
int primary_key_no; int primary_key_no;
KEY* key;
uint i; uint i;
char name2[FN_REFLEN]; char name2[FN_REFLEN];
char norm_name[FN_REFLEN]; char norm_name[FN_REFLEN];
......
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