summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-08-20 00:52:43 +0200
committerunknown <serg@serg.mylan>2004-08-20 00:52:43 +0200
commit04c39153435896d9f49fe1b5b80bd7e11edf7bf4 (patch)
tree5fff92365d8baf56b0bfb2391843398321d56ee2
parent6e1b567ab3afd324606918ebc30f5205aacdc14a (diff)
parentd1c5ca31f615592f62280ef2d005fa1201541027 (diff)
downloadmariadb-git-04c39153435896d9f49fe1b5b80bd7e11edf7bf4.tar.gz
merged
BitKeeper/etc/ignore: auto-union include/my_global.h: Auto merged mysys/mf_tempfile.c: Auto merged mysql-test/r/rpl_heap.result: Auto merged mysql-test/t/rpl_heap.test: Auto merged sql/ha_innodb.cc: Auto merged
-rw-r--r--.bzrignore187
-rw-r--r--include/my_global.h30
-rw-r--r--mysql-test/r/type_float.result3
-rw-r--r--mysql-test/t/type_float.test8
-rw-r--r--mysys/mf_tempfile.c4
-rw-r--r--sql/field.cc20
-rw-r--r--sql/ha_innodb.cc27
-rw-r--r--sql/log.cc5
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/sql_class.h2
10 files changed, 157 insertions, 130 deletions
diff --git a/.bzrignore b/.bzrignore
index 9542cfe8754..1a756801461 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -77,6 +77,7 @@ Docs/mysql.xml
Docs/safe-mysql.xml
Docs/tex.fmt
Docs/texi2dvi.out
+EXCEPTIONS-CLIENT
INSTALL-SOURCE
INSTALL-WIN-SOURCE
Logs/*
@@ -272,11 +273,13 @@ emacs.h
extra/comp_err
extra/my_print_defaults
extra/mysql_install
+extra/mysql_tzinfo_to_sql
extra/mysql_waitpid
extra/perror
extra/replace
extra/resolve_stack_dump
extra/resolveip
+extra/tztime.cc
fcns.c
fcns.h
gmon.out
@@ -316,6 +319,7 @@ isam/test3
libmysql/*.c
libmysql/conf_to_src
libmysql/my_static.h
+libmysql/my_time.c
libmysql/mysys_priv.h
libmysql/net.c
libmysql/vio_priv.h
@@ -382,6 +386,7 @@ libmysqld/log_event.cc
libmysqld/md5.c
libmysqld/mf_iocache.cc
libmysqld/mini_client.cc
+libmysqld/my_time.c
libmysqld/net_pkg.cc
libmysqld/net_serv.cc
libmysqld/opt_ft.cc
@@ -644,7 +649,71 @@ ndb/lib/libREP_API.so
ndb/lib/libndbclient.so
ndb/lib/libndbclient_extra.so
ndb/src/common/mgmcommon/printConfig/*.d
+ndb/src/cw/cpcd/ndb_cpcd
+ndb/src/kernel/blocks/backup/restore/ndb_restore
+ndb/src/kernel/ndbd
+ndb/src/mgmclient/ndb_mgm
ndb/src/mgmclient/test_cpcd/*.d
+ndb/src/mgmsrv/ndb_mgmd
+ndb/test/ndbapi/bank/bankCreator
+ndb/test/ndbapi/bank/bankMakeGL
+ndb/test/ndbapi/bank/bankSumAccounts
+ndb/test/ndbapi/bank/bankTimer
+ndb/test/ndbapi/bank/bankTransactionMaker
+ndb/test/ndbapi/bank/bankValidateAllGLs
+ndb/test/ndbapi/bank/testBank
+ndb/test/ndbapi/create_all_tabs
+ndb/test/ndbapi/create_tab
+ndb/test/ndbapi/drop_all_tabs
+ndb/test/ndbapi/flexAsynch
+ndb/test/ndbapi/flexBench
+ndb/test/ndbapi/flexHammer
+ndb/test/ndbapi/flexTT
+ndb/test/ndbapi/testBackup
+ndb/test/ndbapi/testBasic
+ndb/test/ndbapi/testBasicAsynch
+ndb/test/ndbapi/testBlobs
+ndb/test/ndbapi/testDataBuffers
+ndb/test/ndbapi/testDeadlock
+ndb/test/ndbapi/testDict
+ndb/test/ndbapi/testIndex
+ndb/test/ndbapi/testMgm
+ndb/test/ndbapi/testNdbApi
+ndb/test/ndbapi/testNodeRestart
+ndb/test/ndbapi/testOIBasic
+ndb/test/ndbapi/testOperations
+ndb/test/ndbapi/testRestartGci
+ndb/test/ndbapi/testScan
+ndb/test/ndbapi/testScanInterpreter
+ndb/test/ndbapi/testScanPerf
+ndb/test/ndbapi/testSystemRestart
+ndb/test/ndbapi/testTimeout
+ndb/test/ndbapi/testTransactions
+ndb/test/ndbapi/test_event
+ndb/test/run-test/atrt
+ndb/test/tools/copy_tab
+ndb/test/tools/create_index
+ndb/test/tools/hugoCalculator
+ndb/test/tools/hugoFill
+ndb/test/tools/hugoLoad
+ndb/test/tools/hugoLockRecords
+ndb/test/tools/hugoPkDelete
+ndb/test/tools/hugoPkRead
+ndb/test/tools/hugoPkReadRecord
+ndb/test/tools/hugoPkUpdate
+ndb/test/tools/hugoScanRead
+ndb/test/tools/hugoScanUpdate
+ndb/test/tools/ndb_cpcc
+ndb/test/tools/restart
+ndb/test/tools/verify_index
+ndb/tools/ndb_delete_all
+ndb/tools/ndb_desc
+ndb/tools/ndb_drop_index
+ndb/tools/ndb_drop_table
+ndb/tools/ndb_select_all
+ndb/tools/ndb_select_count
+ndb/tools/ndb_show_tables
+ndb/tools/ndb_waiter
pull.log
regex/re
repl-tests/test-repl-ts/repl-timestamp.master.reject
@@ -715,7 +784,10 @@ sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
sql/mini_client_errors.c
+sql/my_time.c
sql/mysql_tzinfo_to_sql
+sql/mysql_tzinfo_to_sql.cc
+sql/mysql_tzinfo_to_sql_tztime.cc
sql/mysqlbinlog
sql/mysqld
sql/mysqld-purecov
@@ -770,41 +842,13 @@ support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysql.spec
tags
-test_xml
-tests/client_test
-tests/connect_test
-thread_test
-tmp/*
-tools/my_vsnprintf.c
-tools/mysqlmanager
-tools/mysqlmngd
-tools/mysys_priv.h
-vi.h
-vio/test-ssl
-vio/test-sslclient
-vio/test-sslserver
-vio/viotest-ssl
-extra/tztime.cc
-extra/mysql_tzinfo_to_sql
-sql/mysql_tzinfo_to_sql_tztime.cc
-sql/my_time.c
-libmysql/my_time.c
-libmysqld/my_time.c
-sql/mysql_tzinfo_to_sql
-sql/mysql_tzinfo_to_sql.cc
-ndb/src/cw/cpcd/ndb_cpcd
-ndb/src/kernel/ndbd
-ndb/src/kernel/blocks/backup/restore/ndb_restore
-ndb/src/mgmclient/ndb_mgm
-ndb/src/mgmsrv/ndb_mgmd
-ndb/tools/ndb_delete_all
-ndb/tools/ndb_desc
-ndb/tools/ndb_drop_index
-ndb/tools/ndb_drop_table
-ndb/tools/ndb_select_all
-ndb/tools/ndb_select_count
-ndb/tools/ndb_show_tables
-ndb/tools/ndb_waiter
+test/ndbapi/bank/bankCreator
+test/ndbapi/bank/bankMakeGL
+test/ndbapi/bank/bankSumAccounts
+test/ndbapi/bank/bankTimer
+test/ndbapi/bank/bankTransactionMaker
+test/ndbapi/bank/bankValidateAllGLs
+test/ndbapi/bank/testBank
test/ndbapi/create_all_tabs
test/ndbapi/create_tab
test/ndbapi/drop_all_tabs
@@ -833,13 +877,6 @@ test/ndbapi/testSystemRestart
test/ndbapi/testTimeout
test/ndbapi/testTransactions
test/ndbapi/test_event
-test/ndbapi/bank/bankCreator
-test/ndbapi/bank/bankMakeGL
-test/ndbapi/bank/bankSumAccounts
-test/ndbapi/bank/bankTimer
-test/ndbapi/bank/bankTransactionMaker
-test/ndbapi/bank/bankValidateAllGLs
-test/ndbapi/bank/testBank
test/run-test/atrt
test/tools/copy_tab
test/tools/create_index
@@ -856,55 +893,17 @@ test/tools/hugoScanUpdate
test/tools/ndb_cpcc
test/tools/restart
test/tools/verify_index
-ndb/test/ndbapi/create_all_tabs
-ndb/test/ndbapi/create_tab
-ndb/test/ndbapi/drop_all_tabs
-ndb/test/ndbapi/flexAsynch
-ndb/test/ndbapi/flexBench
-ndb/test/ndbapi/flexHammer
-ndb/test/ndbapi/flexTT
-ndb/test/ndbapi/testBackup
-ndb/test/ndbapi/testBasic
-ndb/test/ndbapi/testBasicAsynch
-ndb/test/ndbapi/testBlobs
-ndb/test/ndbapi/testDataBuffers
-ndb/test/ndbapi/testDeadlock
-ndb/test/ndbapi/testDict
-ndb/test/ndbapi/testIndex
-ndb/test/ndbapi/testMgm
-ndb/test/ndbapi/testNdbApi
-ndb/test/ndbapi/testNodeRestart
-ndb/test/ndbapi/testOIBasic
-ndb/test/ndbapi/testOperations
-ndb/test/ndbapi/testRestartGci
-ndb/test/ndbapi/testScan
-ndb/test/ndbapi/testScanInterpreter
-ndb/test/ndbapi/testScanPerf
-ndb/test/ndbapi/testSystemRestart
-ndb/test/ndbapi/testTimeout
-ndb/test/ndbapi/testTransactions
-ndb/test/ndbapi/test_event
-ndb/test/ndbapi/bank/bankCreator
-ndb/test/ndbapi/bank/bankMakeGL
-ndb/test/ndbapi/bank/bankSumAccounts
-ndb/test/ndbapi/bank/bankTimer
-ndb/test/ndbapi/bank/bankTransactionMaker
-ndb/test/ndbapi/bank/bankValidateAllGLs
-ndb/test/ndbapi/bank/testBank
-ndb/test/run-test/atrt
-ndb/test/tools/copy_tab
-ndb/test/tools/create_index
-ndb/test/tools/hugoCalculator
-ndb/test/tools/hugoFill
-ndb/test/tools/hugoLoad
-ndb/test/tools/hugoLockRecords
-ndb/test/tools/hugoPkDelete
-ndb/test/tools/hugoPkRead
-ndb/test/tools/hugoPkReadRecord
-ndb/test/tools/hugoPkUpdate
-ndb/test/tools/hugoScanRead
-ndb/test/tools/hugoScanUpdate
-ndb/test/tools/ndb_cpcc
-ndb/test/tools/restart
-ndb/test/tools/verify_index
-EXCEPTIONS-CLIENT
+test_xml
+tests/client_test
+tests/connect_test
+thread_test
+tmp/*
+tools/my_vsnprintf.c
+tools/mysqlmanager
+tools/mysqlmngd
+tools/mysys_priv.h
+vi.h
+vio/test-ssl
+vio/test-sslclient
+vio/test-sslserver
+vio/viotest-ssl
diff --git a/include/my_global.h b/include/my_global.h
index a9ca5416c88..89a5363dc4b 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -644,29 +644,17 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/
-#if SIZEOF_LONG == 4
-#define INT_MIN32 ((long) 0x80000000L)
-#define INT_MAX32 ((long) 0x7FFFFFFFL)
-#define UINT_MAX32 ((long) 0xFFFFFFFFL)
-#define INT_MIN24 ((long) 0xFF800000L)
-#define INT_MAX24 0x007FFFFFL
-#define UINT_MAX24 0x00FFFFFFL
-#define INT_MIN16 ((short int) 0x8000)
+#define INT_MIN32 (~0x7FFFFFFFL)
+#define INT_MAX32 0x7FFFFFFFL
+#define UINT_MAX32 0xFFFFFFFFL
+#define INT_MIN24 (~0x007FFFFF)
+#define INT_MAX24 0x007FFFFF
+#define UINT_MAX24 0x00FFFFFF
+#define INT_MIN16 (~0x7FFF)
#define INT_MAX16 0x7FFF
#define UINT_MAX16 0xFFFF
-#define INT_MIN8 ((char) 0x80)
-#define INT_MAX8 ((char) 0x7F)
-#else /* Probably Alpha */
-#define INT_MIN32 ((long) (int) 0x80000000)
-#define INT_MAX32 ((long) (int) 0x7FFFFFFF)
-#define UINT_MAX32 ((long) (int) 0xFFFFFFFF)
-#define INT_MIN24 ((long) (int) 0xFF800000)
-#define INT_MAX24 ((long) (int) 0x007FFFFF)
-#define UINT_MAX24 ((long) (int) 0x00FFFFFF)
-#define INT_MIN16 ((short int) 0xFFFF8000)
-#define INT_MAX16 ((short int) 0x00007FFF)
-#define UINT_MAX16 ((short int) 0x0000FFFF)
-#endif
+#define INT_MIN8 (~0x7F)
+#define INT_MAX8 0x7F
/* From limits.h instead */
#ifndef DBL_MIN
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index f6a19a861a1..843bdc2bdc5 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -135,6 +135,9 @@ t1 CREATE TABLE `t1` (
`b` double(200,30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 (c20 char);
+insert into t1 values (5000.0);
+drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index cfaa5d611f2..4b627ea9b99 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -72,6 +72,13 @@ select * from t1;
show create table t1;
drop table t1;
+#
+# float in a char(1) field
+#
+create table t1 (c20 char);
+insert into t1 values (5000.0);
+drop table t1;
+
# Errors
--error 1063
@@ -79,3 +86,4 @@ create table t1 (f float(54)); # Should give an error
--disable_warnings
drop table if exists t1;
--enable_warnings
+
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index 0b337a74c19..af9ff0d6711 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -98,7 +98,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
if (strlen(dir)+ pfx_len > FN_REFLEN-2)
{
errno=my_errno= ENAMETOOLONG;
- return 1;
+ DBUG_RETURN(file);
}
strmov(convert_dirname(to,dir,NullS),prefix_buff);
org_file=mkstemp(to);
@@ -124,7 +124,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
#ifdef OS2
/* changing environ variable doesn't work with VACPP */
char buffer[256], *end;
- buffer[sizeof[buffer)-1]= 0;
+ buffer[sizeof(buffer)-1]= 0;
end= strxnmov(buffer, sizeof(buffer)-1, (char*) "TMP=", dir, NullS);
/* remove ending backslash */
if (end[-1] == '\\')
diff --git a/sql/field.cc b/sql/field.cc
index 522daa9e2cd..96f4fa8fd86 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4279,7 +4279,7 @@ int Field_str::store(double nr)
{
bool use_scientific_notation=TRUE;
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
- int length;
+ uint length;
if (field_length < 32 && nr > 1) // TODO: negative numbers
{
if (ceiling == 0)
@@ -4295,11 +4295,19 @@ int Field_str::store(double nr)
}
use_scientific_notation= (ceiling < nr);
}
- length= sprintf(buff, "%-.*g",
- use_scientific_notation ? max(0,field_length-5) : field_length,
- nr);
- DBUG_ASSERT(length <= field_length);
- return store((const char *)buff, (uint) length, charset());
+ length= (uint)sprintf(buff, "%-.*g",
+ use_scientific_notation ? max(0,(int)field_length-5) : field_length,
+ nr);
+ /*
+ +1 below is because "precision" in %g above means the
+ max. number of significant digits, not the output width.
+ Thus the width can be larger than number of significant digits by 1
+ (for decimal point)
+ the test for field_length < 5 is for extreme cases,
+ like inserting 500.0 in char(1)
+ */
+ DBUG_ASSERT(field_length < 5 || length <= field_length+1);
+ return store((const char *)buff, min(length, field_length), charset());
}
int Field_string::store(longlong nr)
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index b1e5a16bc32..5aa7c02fcc0 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -40,6 +40,7 @@ have disables the InnoDB inlining in this file. */
#include <m_ctype.h>
#include <hash.h>
#include <myisampack.h>
+#include <mysys_err.h>
#define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1))
@@ -433,6 +434,7 @@ innobase_mysql_tmpfile(void)
/* out: temporary file descriptor, or < 0 on error */
{
char filename[FN_REFLEN];
+ int fd2 = -1;
File fd = create_temp_file(filename, NullS, "ib",
#ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL |
@@ -440,12 +442,31 @@ innobase_mysql_tmpfile(void)
#endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
MYF(MY_WME));
-#ifndef __WIN__
if (fd >= 0) {
+#ifndef __WIN__
+ /* On Windows, open files cannot be removed, but files can be
+ created with the O_TEMPORARY flag to the same effect
+ ("delete on close"). */
unlink(filename);
- }
#endif /* !__WIN__ */
- return(fd);
+ /* Copy the file descriptor, so that the additional resources
+ allocated by create_temp_file() can be freed by invoking
+ my_close().
+
+ Because the file descriptor returned by this function
+ will be passed to fdopen(), it will be closed by invoking
+ fclose(), which in turn will invoke close() instead of
+ my_close(). */
+ fd2 = dup(fd);
+ if (fd2 < 0) {
+ DBUG_PRINT("error",("Got error %d on dup",fd2));
+ my_errno=errno;
+ my_error(EE_OUT_OF_FILERESOURCES,
+ MYF(ME_BELL+ME_WAITTANG), filename, my_errno);
+ }
+ my_close(fd, MYF(MY_WME));
+ }
+ return(fd2);
}
/*************************************************************************
diff --git a/sql/log.cc b/sql/log.cc
index bcac7267f8b..240965fdca3 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1878,11 +1878,10 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
Disable_binlog::Disable_binlog(THD *thd_arg) :
- thd(thd_arg),
- save_options(thd_arg->options)
+ thd(thd_arg), save_options(thd_arg->options)
{
thd_arg->options&= ~OPTION_BIN_LOG;
-};
+}
Disable_binlog::~Disable_binlog()
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 4b8a14474fa..031f021e261 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -519,6 +519,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields, List<Key> &keys,
bool tmp_table, uint select_field_count);
+
TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
const char *db, const char *name,
List<create_field> *extra_fields,
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 1fb2d5071f6..586458127d4 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1026,7 +1026,7 @@ public:
so we internally disable it temporarily by creating the Disable_binlog
object and reset the state by destroying the object (don't forget that! or
write code so that the object gets automatically destroyed when leaving a
- function...).
+ block, see example in sql_table.cc).
*/
class Disable_binlog {
private: