summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore6
-rw-r--r--BitKeeper/etc/logging_ok4
-rwxr-xr-xBuild-tools/Do-pkg15
-rw-r--r--client/my_readline.h2
-rw-r--r--client/mysql.cc28
-rw-r--r--client/mysqldump.c4
-rw-r--r--client/readline.cc40
-rw-r--r--extra/Makefile.am2
-rw-r--r--extra/perror.c24
-rw-r--r--heap/heapdef.h3
-rw-r--r--heap/hp_clear.c145
-rw-r--r--include/heap.h7
-rw-r--r--include/my_base.h2
-rw-r--r--include/mysql.h9
-rw-r--r--include/violite.h10
-rw-r--r--innobase/btr/btr0cur.c6
-rw-r--r--innobase/btr/btr0sea.c4
-rw-r--r--innobase/buf/buf0buf.c8
-rw-r--r--innobase/ibuf/ibuf0ibuf.c2
-rw-r--r--innobase/include/buf0buf.h14
-rw-r--r--innobase/include/buf0buf.ic2
-rw-r--r--innobase/include/mem0mem.h96
-rw-r--r--innobase/include/mem0mem.ic96
-rw-r--r--innobase/include/mtr0mtr.h8
-rw-r--r--innobase/include/mtr0mtr.ic4
-rw-r--r--innobase/include/pars0pars.h2
-rw-r--r--innobase/include/sync0arr.h2
-rw-r--r--innobase/include/sync0ipm.ic4
-rw-r--r--innobase/include/sync0rw.h44
-rw-r--r--innobase/include/sync0rw.ic22
-rw-r--r--innobase/include/sync0sync.h16
-rw-r--r--innobase/include/sync0sync.ic8
-rw-r--r--innobase/include/univ.i5
-rw-r--r--innobase/include/ut0dbg.h6
-rw-r--r--innobase/include/ut0mem.h31
-rw-r--r--innobase/include/ut0mem.ic12
-rw-r--r--innobase/lock/lock0lock.c2
-rw-r--r--innobase/log/log0recv.c6
-rw-r--r--innobase/mem/mem0mem.c34
-rw-r--r--innobase/os/os0file.c25
-rw-r--r--innobase/pars/pars0pars.c3
-rw-r--r--innobase/sync/sync0arr.c4
-rw-r--r--innobase/sync/sync0rw.c12
-rw-r--r--innobase/sync/sync0sync.c13
-rw-r--r--innobase/trx/trx0rec.c2
-rw-r--r--innobase/ut/ut0mem.c50
-rw-r--r--libmysql/client_settings.h2
-rw-r--r--libmysql/libmysql.c13
-rw-r--r--libmysqld/emb_qcache.cc6
-rw-r--r--libmysqld/examples/Makefile.am11
-rw-r--r--myisam/mi_open.c83
-rw-r--r--myisam/myisamdef.h5
-rw-r--r--mysql-test/r/auto_increment.result2
-rw-r--r--mysql-test/r/bench_count_distinct.result2
-rw-r--r--mysql-test/r/case.result6
-rw-r--r--mysql-test/r/cast.result2
-rw-r--r--mysql-test/r/ctype_collate.result2
-rw-r--r--mysql-test/r/ctype_latin1.result298
-rw-r--r--mysql-test/r/ctype_recoding.result7
-rw-r--r--mysql-test/r/date_formats.result2
-rw-r--r--mysql-test/r/explain.result9
-rw-r--r--mysql-test/r/fulltext.result4
-rw-r--r--mysql-test/r/func_compress.result4
-rw-r--r--mysql-test/r/func_crypt.result2
-rw-r--r--mysql-test/r/func_default.result2
-rw-r--r--mysql-test/r/func_gconcat.result6
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_if.result4
-rw-r--r--mysql-test/r/func_in.result2
-rw-r--r--mysql-test/r/func_math.result26
-rw-r--r--mysql-test/r/func_op.result4
-rw-r--r--mysql-test/r/func_regexp.result2
-rw-r--r--mysql-test/r/func_set.result2
-rw-r--r--mysql-test/r/func_str.result2
-rw-r--r--mysql-test/r/func_system.result2
-rw-r--r--mysql-test/r/func_test.result12
-rw-r--r--mysql-test/r/func_time.result2
-rw-r--r--mysql-test/r/gis.result22
-rw-r--r--mysql-test/r/grant.result24
-rw-r--r--mysql-test/r/group_by.result2
-rw-r--r--mysql-test/r/having.result2
-rw-r--r--mysql-test/r/innodb.result98
-rw-r--r--mysql-test/r/insert_update.result4
-rw-r--r--mysql-test/r/null.result6
-rw-r--r--mysql-test/r/olap.result2
-rw-r--r--mysql-test/r/query_cache.result2
-rw-r--r--mysql-test/r/range.result8
-rw-r--r--mysql-test/r/row.result2
-rw-r--r--mysql-test/r/rpl000001.result4
-rw-r--r--mysql-test/r/rpl_get_lock.result2
-rw-r--r--mysql-test/r/rpl_master_pos_wait.result2
-rw-r--r--mysql-test/r/select.result2
-rw-r--r--mysql-test/r/subselect.result181
-rw-r--r--mysql-test/r/type_blob.result2
-rw-r--r--mysql-test/r/type_float.result12
-rw-r--r--mysql-test/r/union.result4
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--mysql-test/r/variables.result6
-rw-r--r--mysql-test/t/ctype_latin1.test55
-rw-r--r--mysql-test/t/ctype_recoding.test8
-rw-r--r--mysql-test/t/explain.test11
-rw-r--r--mysql-test/t/grant.test23
-rw-r--r--mysql-test/t/innodb.test43
-rw-r--r--mysql-test/t/key_cache.test6
-rw-r--r--mysql-test/t/range.test3
-rw-r--r--mysql-test/t/subselect.test34
-rw-r--r--mysql-test/t/type_float.test6
-rw-r--r--mysys/my_lock.c10
-rw-r--r--ndb/Defs.mk30
-rw-r--r--ndb/Epilogue.mk2
-rw-r--r--ndb/Makefile9
-rw-r--r--ndb/bin/regression.sh2
-rw-r--r--ndb/config/Defs.LINUX.x86.GCC.mk10
-rwxr-xr-xndb/config/GuessConfig.sh5
-rw-r--r--ndb/examples/ndbapi_async_example/ndbapi_async.cpp12
-rw-r--r--ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp12
-rw-r--r--ndb/include/debugger/SignalLoggerManager.hpp3
-rw-r--r--ndb/include/kernel/LogLevel.hpp3
-rw-r--r--ndb/include/kernel/signaldata/BuildIndx.hpp1
-rw-r--r--ndb/include/kernel/signaldata/SignalData.hpp4
-rw-r--r--ndb/include/kernel/signaldata/SignalDataPrint.hpp2
-rw-r--r--ndb/include/logger/FileLogHandler.hpp4
-rw-r--r--ndb/include/logger/LogHandler.hpp1
-rw-r--r--ndb/include/logger/Logger.hpp2
-rw-r--r--ndb/include/mgmapi/mgmapi.h12
-rw-r--r--ndb/include/mgmcommon/MgmtErrorReporter.hpp2
-rw-r--r--ndb/include/ndb_global.h89
-rw-r--r--ndb/include/ndb_net.h7
-rw-r--r--ndb/include/ndb_types.h13
-rw-r--r--ndb/include/ndb_version.h5
-rw-r--r--ndb/include/ndbapi/Ndb.hpp6
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp3
-rw-r--r--ndb/include/ndbapi/NdbError.hpp58
-rw-r--r--ndb/include/ndbapi/NdbEventOperation.hpp6
-rw-r--r--ndb/include/ndbapi/NdbOperation.hpp17
-rw-r--r--ndb/include/ndbapi/NdbRecAttr.hpp17
-rw-r--r--ndb/include/ndbapi/NdbReceiver.hpp2
-rw-r--r--ndb/include/ndbapi/NdbScanOperation.hpp19
-rw-r--r--ndb/include/ndbapi/NdbSchemaOp.hpp4
-rw-r--r--ndb/include/ndbapi/ndberror.h98
-rw-r--r--ndb/include/newtonapi/dba.h4
-rw-r--r--ndb/include/newtonapi/defs/pcn_types.h11
-rw-r--r--ndb/include/portlib/NdbConstant.hpp28
-rw-r--r--ndb/include/portlib/NdbMem.h3
-rw-r--r--ndb/include/portlib/NdbMutex.h3
-rw-r--r--ndb/include/portlib/NdbTCP.h67
-rw-r--r--ndb/include/portlib/NdbThread.h3
-rw-r--r--ndb/include/portlib/NdbTick.h2
-rw-r--r--ndb/include/portlib/NdbUnistd.h39
-rw-r--r--ndb/include/transporter/TransporterDefinitions.hpp2
-rw-r--r--ndb/include/util/BaseString.hpp4
-rw-r--r--ndb/include/util/Bitmask.hpp5
-rw-r--r--ndb/include/util/File.hpp17
-rw-r--r--ndb/include/util/InputStream.hpp2
-rw-r--r--ndb/include/util/NdbAutoPtr.hpp2
-rw-r--r--ndb/include/util/NdbString.h48
-rw-r--r--ndb/include/util/OutputStream.hpp2
-rw-r--r--ndb/include/util/Properties.hpp5
-rw-r--r--ndb/include/util/SimpleProperties.hpp3
-rw-r--r--ndb/include/util/UtilBuffer.hpp4
-rw-r--r--ndb/include/util/Vector.hpp3
-rw-r--r--ndb/include/util/getarg.h2
-rw-r--r--ndb/include/util/socket_io.h3
-rw-r--r--ndb/include/util/uucode.h2
-rw-r--r--ndb/src/client/odbc/common/Ctx.cpp6
-rw-r--r--ndb/src/client/odbc/common/DataField.cpp8
-rw-r--r--ndb/src/client/odbc/common/DataType.cpp1
-rw-r--r--ndb/src/client/odbc/common/OdbcData.cpp4
-rw-r--r--ndb/src/common/debugger/DebuggerNames.cpp6
-rw-r--r--ndb/src/common/debugger/EventLogger.cpp6
-rw-r--r--ndb/src/common/debugger/SignalLoggerManager.cpp8
-rw-r--r--ndb/src/common/debugger/signaldata/CloseComReqConf.cpp1
-rw-r--r--ndb/src/common/debugger/signaldata/ContinueB.cpp1
-rw-r--r--ndb/src/common/debugger/signaldata/CreateFragmentation.cpp2
-rw-r--r--ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp1
-rw-r--r--ndb/src/common/debugger/signaldata/SystemError.cpp1
-rw-r--r--ndb/src/common/editline/editline.c4
-rw-r--r--ndb/src/common/editline/editline_internal.h5
-rw-r--r--ndb/src/common/editline/editline_win32.c3
-rw-r--r--ndb/src/common/editline/test/testit.c6
-rw-r--r--ndb/src/common/editline/unix.h3
-rw-r--r--ndb/src/common/logger/FileLogHandler.cpp18
-rw-r--r--ndb/src/common/logger/LogHandler.cpp3
-rw-r--r--ndb/src/common/logger/LogHandlerList.cpp2
-rw-r--r--ndb/src/common/logger/Logger.cpp8
-rw-r--r--ndb/src/common/logger/SysLogHandler.cpp1
-rw-r--r--ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp5
-rw-r--r--ndb/src/common/logger/loggertest/LoggerUnitTest.cpp4
-rw-r--r--ndb/src/common/mgmcommon/Config.hpp2
-rw-r--r--ndb/src/common/mgmcommon/ConfigRetriever.cpp9
-rw-r--r--ndb/src/common/mgmcommon/InitConfigFileParser.cpp7
-rw-r--r--ndb/src/common/mgmcommon/InitConfigFileParser.hpp3
-rw-r--r--ndb/src/common/mgmcommon/LocalConfig.hpp4
-rw-r--r--ndb/src/common/mgmcommon/NdbConfig.c3
-rw-r--r--ndb/src/common/mgmcommon/printConfig/printConfig.cpp3
-rw-r--r--ndb/src/common/portlib/Makefile32
-rw-r--r--ndb/src/common/portlib/memtest/memtest.c6
-rw-r--r--ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp9
-rw-r--r--ndb/src/common/portlib/mmstest/mmslist.cpp4
-rw-r--r--ndb/src/common/portlib/mmstest/mmstest.cpp4
-rw-r--r--ndb/src/common/portlib/ose/NdbCondition.c1
-rw-r--r--ndb/src/common/portlib/ose/NdbMem.c2
-rw-r--r--ndb/src/common/portlib/ose/NdbMutex.c1
-rw-r--r--ndb/src/common/portlib/ose/NdbOut.cpp7
-rw-r--r--ndb/src/common/portlib/ose/NdbThread.c1
-rw-r--r--ndb/src/common/portlib/test/NdbPortLibTest.cpp7
-rw-r--r--ndb/src/common/portlib/unix/NdbCondition.c62
-rw-r--r--ndb/src/common/portlib/unix/NdbDaemon.c39
-rw-r--r--ndb/src/common/portlib/unix/NdbEnv.c6
-rw-r--r--ndb/src/common/portlib/unix/NdbHost.c2
-rw-r--r--ndb/src/common/portlib/unix/NdbMem.c22
-rw-r--r--ndb/src/common/portlib/unix/NdbMutex.c7
-rw-r--r--ndb/src/common/portlib/unix/NdbSleep.c12
-rw-r--r--ndb/src/common/portlib/unix/NdbTCP.c26
-rw-r--r--ndb/src/common/portlib/unix/NdbThread.c13
-rw-r--r--ndb/src/common/portlib/unix/NdbTick.c14
-rw-r--r--ndb/src/common/portlib/win32/NdbCondition.c1
-rw-r--r--ndb/src/common/portlib/win32/NdbDaemon.c7
-rw-r--r--ndb/src/common/portlib/win32/NdbMem.c2
-rw-r--r--ndb/src/common/portlib/win32/NdbMutex.c1
-rw-r--r--ndb/src/common/portlib/win32/NdbThread.c1
-rw-r--r--ndb/src/common/transporter/Makefile27
-rw-r--r--ndb/src/common/transporter/OSE_Receiver.cpp1
-rw-r--r--ndb/src/common/transporter/OSE_Transporter.cpp2
-rw-r--r--ndb/src/common/transporter/Packer.cpp4
-rw-r--r--ndb/src/common/transporter/SCI_Transporter.cpp9
-rw-r--r--ndb/src/common/transporter/SHM_Buffer.hpp5
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.cpp9
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.unix.cpp5
-rw-r--r--ndb/src/common/transporter/SHM_Transporter.win32.cpp4
-rw-r--r--ndb/src/common/transporter/SendBuffer.hpp3
-rw-r--r--ndb/src/common/transporter/TCP_Transporter.cpp6
-rw-r--r--ndb/src/common/transporter/Transporter.cpp1
-rw-r--r--ndb/src/common/transporter/TransporterInternalDefinitions.hpp35
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp5
-rw-r--r--ndb/src/common/transporter/basictest/basicTransporterTest.cpp5
-rw-r--r--ndb/src/common/transporter/buddy.cpp3
-rw-r--r--ndb/src/common/transporter/buddy.hpp3
-rw-r--r--ndb/src/common/transporter/failoverSCI/failoverSCI.cpp9
-rw-r--r--ndb/src/common/transporter/perftest/perfTransporterTest.cpp5
-rw-r--r--ndb/src/common/transporter/priotest/prioTransporterTest.cpp4
-rw-r--r--ndb/src/common/util/Base64.cpp3
-rw-r--r--ndb/src/common/util/BaseString.cpp8
-rw-r--r--ndb/src/common/util/File.cpp54
-rw-r--r--ndb/src/common/util/InputStream.cpp4
-rw-r--r--ndb/src/common/util/Makefile10
-rw-r--r--ndb/src/common/util/NdbErrHnd.cpp1
-rw-r--r--ndb/src/common/util/NdbOut.cpp8
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp1
-rw-r--r--ndb/src/common/util/OutputStream.cpp3
-rw-r--r--ndb/src/common/util/Parser.cpp6
-rw-r--r--ndb/src/common/util/Properties.cpp7
-rw-r--r--ndb/src/common/util/SimpleProperties.cpp4
-rw-r--r--ndb/src/common/util/SocketServer.cpp6
-rw-r--r--ndb/src/common/util/filetest/FileUnitTest.cpp1
-rw-r--r--ndb/src/common/util/getarg.c16
-rw-r--r--ndb/src/common/util/new.cpp3
-rw-r--r--ndb/src/common/util/random.c10
-rw-r--r--ndb/src/common/util/socket_io.cpp6
-rw-r--r--ndb/src/common/util/strdup.c2
-rw-r--r--ndb/src/common/util/strlcat.c8
-rw-r--r--ndb/src/common/util/strlcpy.c10
-rw-r--r--ndb/src/common/util/testProperties/testProperties.cpp3
-rw-r--r--ndb/src/common/util/testSimpleProperties/sp_test.cpp4
-rw-r--r--ndb/src/common/util/uucode.c3
-rw-r--r--ndb/src/common/util/version.c10
-rw-r--r--ndb/src/cw/cpcc-win32/C++/StdAfx.h5
-rw-r--r--ndb/src/cw/cpcd/APIService.cpp1
-rw-r--r--ndb/src/cw/cpcd/CPCD.cpp5
-rw-r--r--ndb/src/cw/cpcd/Monitor.cpp3
-rw-r--r--ndb/src/cw/cpcd/Process.cpp97
-rw-r--r--ndb/src/cw/cpcd/common.cpp9
-rw-r--r--ndb/src/cw/cpcd/common.hpp2
-rw-r--r--ndb/src/cw/cpcd/main.cpp4
-rw-r--r--ndb/src/cw/test/socketclient/socketClientTest.cpp3
-rw-r--r--ndb/src/cw/util/ClientInterface.hpp4
-rw-r--r--ndb/src/kernel/blocks/backup/FsBuffer.hpp5
-rw-r--r--ndb/src/kernel/blocks/backup/read.cpp4
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Makefile6
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.cpp7
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.hpp5
-rw-r--r--ndb/src/kernel/blocks/backup/restore/main.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp6
-rw-r--r--ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp6
-rw-r--r--ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp7
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp2
-rw-r--r--ndb/src/kernel/blocks/dbtux/Dbtux.hpp3
-rw-r--r--ndb/src/kernel/blocks/dbutil/DbUtil.cpp65
-rw-r--r--ndb/src/kernel/blocks/grep/Grep.cpp2
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp14
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp4
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Filename.cpp6
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Filename.hpp2
-rw-r--r--ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp1
-rw-r--r--ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp1
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp13
-rw-r--r--ndb/src/kernel/blocks/suma/SumaInit.cpp4
-rw-r--r--ndb/src/kernel/error/ErrorReporter.cpp5
-rw-r--r--ndb/src/kernel/error/ErrorReporter.hpp3
-rw-r--r--ndb/src/kernel/error/TimeModule.cpp2
-rw-r--r--ndb/src/kernel/ndb-main/Main.cpp18
-rw-r--r--ndb/src/kernel/vm/ArrayPool.hpp4
-rw-r--r--ndb/src/kernel/vm/ClusterConfiguration.cpp5
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp1
-rw-r--r--ndb/src/kernel/vm/DLHashTable.hpp3
-rw-r--r--ndb/src/kernel/vm/DLHashTable2.hpp5
-rw-r--r--ndb/src/kernel/vm/Emulator.cpp9
-rw-r--r--ndb/src/kernel/vm/GlobalData.hpp3
-rw-r--r--ndb/src/kernel/vm/SimulatedBlock.cpp4
-rw-r--r--ndb/src/kernel/vm/TransporterCallback.cpp3
-rw-r--r--ndb/src/kernel/vm/VMSignal.hpp7
-rw-r--r--ndb/src/kernel/vm/al_test/arrayListTest.cpp4
-rw-r--r--ndb/src/kernel/vm/al_test/arrayPoolTest.cpp5
-rw-r--r--ndb/src/kernel/vm/al_test/main.cpp4
-rw-r--r--ndb/src/kernel/vm/testCopy/rr.cpp5
-rw-r--r--ndb/src/kernel/vm/testCopy/testCopy.cpp4
-rw-r--r--ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp6
-rw-r--r--ndb/src/kernel/vm/testLongSig/testLongSig.cpp3
-rw-r--r--ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp5
-rw-r--r--ndb/src/mgmapi/Makefile2
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp8
-rw-r--r--ndb/src/mgmapi/test/keso.c9
-rw-r--r--ndb/src/mgmapi/test/mgmSrvApi.cpp4
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp9
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.hpp4
-rw-r--r--ndb/src/mgmclient/CpcClient.cpp6
-rw-r--r--ndb/src/mgmclient/main.cpp4
-rw-r--r--ndb/src/mgmclient/test_cpcd/test_cpcd.cpp21
-rw-r--r--ndb/src/mgmsrv/CommandInterpreter.cpp2
-rw-r--r--ndb/src/mgmsrv/CommandInterpreter.hpp4
-rw-r--r--ndb/src/mgmsrv/Makefile2
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp8
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.hpp1
-rw-r--r--ndb/src/mgmsrv/NodeLogLevel.hpp3
-rw-r--r--ndb/src/mgmsrv/NodeLogLevelList.cpp4
-rw-r--r--ndb/src/mgmsrv/convertStrToInt.cpp4
-rw-r--r--ndb/src/mgmsrv/main.cpp6
-rw-r--r--ndb/src/mgmsrv/mkconfig/mkconfig.cpp9
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp8
-rw-r--r--ndb/src/ndbapi/DictCache.cpp2
-rw-r--r--ndb/src/ndbapi/Makefile4
-rw-r--r--ndb/src/ndbapi/Ndb.cpp14
-rw-r--r--ndb/src/ndbapi/NdbConnectionScan.cpp11
-rw-r--r--ndb/src/ndbapi/NdbDictionary.cpp1
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp1
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.hpp2
-rw-r--r--ndb/src/ndbapi/NdbErrorOut.cpp (renamed from ndb/include/portlib/NdbStdio.h)39
-rw-r--r--ndb/src/ndbapi/NdbEventOperationImpl.cpp13
-rw-r--r--ndb/src/ndbapi/NdbOperation.cpp1
-rw-r--r--ndb/src/ndbapi/NdbOperationDefine.cpp2
-rw-r--r--ndb/src/ndbapi/NdbOperationExec.cpp9
-rw-r--r--ndb/src/ndbapi/NdbOperationSearch.cpp2
-rw-r--r--ndb/src/ndbapi/NdbPoolImpl.cpp2
-rw-r--r--ndb/src/ndbapi/NdbRecAttr.cpp2
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp25
-rw-r--r--ndb/src/ndbapi/NdbScanReceiver.hpp1
-rw-r--r--ndb/src/ndbapi/NdbSchemaOp.cpp3
-rw-r--r--ndb/src/ndbapi/NdbUtil.hpp3
-rw-r--r--ndb/src/ndbapi/Ndberr.cpp75
-rw-r--r--ndb/src/ndbapi/Ndbif.cpp1
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp4
-rw-r--r--ndb/src/ndbapi/ObjectMap.hpp4
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp5
-rw-r--r--ndb/src/ndbapi/ndberror.c (renamed from ndb/src/ndbapi/Ndberror.cpp)313
-rw-r--r--ndb/src/ndbapi/signal-sender/SignalSender.cpp1
-rw-r--r--ndb/src/ndbapi/signal-sender/SignalSender.hpp2
-rw-r--r--ndb/src/newtonapi/dba_binding.cpp6
-rw-r--r--ndb/src/newtonapi/dba_error.cpp4
-rw-r--r--ndb/src/newtonapi/dba_internal.hpp5
-rw-r--r--ndb/src/rep/Makefile2
-rw-r--r--ndb/src/rep/RepApiService.cpp2
-rw-r--r--ndb/src/rep/RepComponents.hpp1
-rw-r--r--ndb/src/rep/RepMain.cpp3
-rw-r--r--ndb/src/rep/Requestor.cpp1
-rw-r--r--ndb/src/rep/Requestor.hpp3
-rw-r--r--ndb/src/rep/adapters/AppNDB.hpp4
-rw-r--r--ndb/src/rep/adapters/ExtNDB.cpp1
-rw-r--r--ndb/src/rep/adapters/ExtNDB.hpp3
-rw-r--r--ndb/src/rep/dbug_hack.cpp6
-rw-r--r--ndb/src/rep/rep_version.hpp2
-rw-r--r--ndb/src/rep/repapi/repapi.cpp7
-rw-r--r--ndb/src/rep/state/Interval.cpp2
-rw-r--r--ndb/src/rep/state/RepState.cpp8
-rw-r--r--ndb/src/rep/storage/GCIBuffer.cpp3
-rw-r--r--ndb/src/rep/storage/GCIBuffer.hpp2
-rw-r--r--ndb/src/rep/storage/GCIContainer.hpp1
-rw-r--r--ndb/src/rep/storage/LogRecord.hpp3
-rw-r--r--ndb/src/rep/storage/NodeGroupInfo.hpp2
-rw-r--r--ndb/src/rep/transfer/TransPS.cpp1
-rw-r--r--ndb/src/rep/transfer/TransPS.hpp2
-rw-r--r--ndb/src/rep/transfer/TransSS.cpp1
-rw-r--r--ndb/src/rep/transfer/TransSS.hpp2
-rw-r--r--ndb/test/include/NDBT_Stats.hpp4
-rw-r--r--ndb/test/include/NDBT_Table.hpp4
-rw-r--r--ndb/test/include/NDBT_Test.hpp1
-rw-r--r--ndb/test/include/NdbTimer.hpp1
-rw-r--r--ndb/test/ndbapi/acid2/acid2.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp3
-rw-r--r--ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp3
-rw-r--r--ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp3
-rw-r--r--ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp4
-rw-r--r--ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp4
-rw-r--r--ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp4
-rw-r--r--ndb/test/ndbapi/bulk_copy/bulk_copy.cpp1
-rw-r--r--ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp2
-rw-r--r--ndb/test/ndbapi/create_tab/create_tab.cpp2
-rw-r--r--ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp2
-rw-r--r--ndb/test/ndbapi/flexAsynch/flexAsynch.cpp2
-rw-r--r--ndb/test/ndbapi/flexBench/flexBench.cpp34
-rw-r--r--ndb/test/ndbapi/flexHammer/flexHammer.cpp2
-rw-r--r--ndb/test/ndbapi/flexScan/flexScan.cpp3
-rw-r--r--ndb/test/ndbapi/flexTT/flexTT.cpp7
-rw-r--r--ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp4
-rw-r--r--ndb/test/ndbapi/indexTest/index.cpp5
-rw-r--r--ndb/test/ndbapi/indexTest2/index2.cpp5
-rw-r--r--ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp3
-rw-r--r--ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp3
-rw-r--r--ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp5
-rw-r--r--ndb/test/ndbapi/lmc-bench/async-src/user/macros.h3
-rw-r--r--ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp2
-rw-r--r--ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp5
-rw-r--r--ndb/test/ndbapi/lmc-bench/include/testDefinitions.h22
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c3
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c6
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c4
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c4
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c2
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/macros.h3
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp1
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp2
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c5
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c3
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp4
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c3
-rw-r--r--ndb/test/ndbapi/restarter/restarter.cpp2
-rw-r--r--ndb/test/ndbapi/restarter2/restarter2.cpp2
-rw-r--r--ndb/test/ndbapi/restarts/restarts.cpp2
-rw-r--r--ndb/test/ndbapi/ronja/benchronja/benchronja.cpp7
-rw-r--r--ndb/test/ndbapi/telco/msa.cpp5
-rw-r--r--ndb/test/ndbapi/testBlobs/testBlobs.cpp9
-rw-r--r--ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp6
-rw-r--r--ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp2
-rw-r--r--ndb/test/ndbapi/testOIBasic/testOIBasic.cpp9
-rw-r--r--ndb/test/ndbapi/vw_test/bcd.h3
-rw-r--r--ndb/test/ndbapi/vw_test/cdrserver.cpp12
-rw-r--r--ndb/test/ndbapi/vw_test/size.cpp2
-rw-r--r--ndb/test/newtonapi/basic_test/basic/basic.cpp1
-rw-r--r--ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp1
-rw-r--r--ndb/test/newtonapi/basic_test/common.cpp4
-rw-r--r--ndb/test/newtonapi/basic_test/common.hpp3
-rw-r--r--ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp1
-rw-r--r--ndb/test/newtonapi/basic_test/too_basic.cpp10
-rw-r--r--ndb/test/newtonapi/perf_test/perf.cpp9
-rw-r--r--ndb/test/odbc/driver/testOdbcDriver.cpp9
-rw-r--r--ndb/test/run-test/main.cpp2
-rw-r--r--ndb/test/run-test/run-test.hpp2
-rw-r--r--ndb/test/src/HugoAsynchTransactions.cpp4
-rw-r--r--ndb/test/src/HugoCalculator.cpp4
-rw-r--r--ndb/test/src/HugoOperations.cpp6
-rw-r--r--ndb/test/src/HugoTransactions.cpp6
-rw-r--r--ndb/test/src/NDBT_Error.cpp4
-rw-r--r--ndb/test/src/NDBT_ResultRow.cpp8
-rw-r--r--ndb/test/src/NDBT_ReturnCodes.cpp6
-rw-r--r--ndb/test/src/NDBT_Table.cpp2
-rw-r--r--ndb/test/src/NDBT_Tables.cpp1
-rw-r--r--ndb/test/src/NdbBackup.cpp2
-rw-r--r--ndb/test/src/NdbConfig.cpp3
-rw-r--r--ndb/test/src/NdbGrep.cpp1
-rw-r--r--ndb/test/src/NdbRestarter.cpp5
-rw-r--r--ndb/test/tools/hugoCalculator/hugoCalculator.cpp4
-rw-r--r--ndb/test/tools/hugoFill/hugoFill.cpp2
-rw-r--r--ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp4
-rw-r--r--ndb/test/tools/hugoPkDelete/hugoPkDel.cpp4
-rw-r--r--ndb/test/tools/hugoPkRead/hugoPkRead.cpp4
-rw-r--r--ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp3
-rw-r--r--ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp4
-rw-r--r--ndb/test/tools/hugoScanRead/hugoScanRead.cpp4
-rw-r--r--ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp4
-rw-r--r--ndb/test/tools/restart/restart.cpp5
-rw-r--r--ndb/test/tools/waiter/waiter.cpp1
-rw-r--r--ndb/tools/copy_tab/copy_tab.cpp2
-rw-r--r--ndb/tools/cpcc/cpcc.cpp4
-rw-r--r--ndb/tools/create_index/create_index.cpp2
-rw-r--r--ndb/tools/delete_all/delete_all.cpp2
-rw-r--r--ndb/tools/drop_index/drop_index.cpp2
-rw-r--r--ndb/tools/drop_tab/drop_tab.cpp2
-rw-r--r--ndb/tools/list_tables/listTables.cpp3
-rw-r--r--ndb/tools/select_all/select_all.cpp4
-rw-r--r--ndb/tools/select_count/select_count.cpp4
-rw-r--r--ndb/tools/transproxy/transproxy.cpp9
-rw-r--r--ndb/tools/verify_index/verify_index.cpp3
-rw-r--r--scripts/mysql_install_db.sh10
-rw-r--r--sql/examples/ha_example.cc370
-rw-r--r--sql/examples/ha_example.h40
-rw-r--r--sql/field.cc6
-rw-r--r--sql/ha_heap.cc144
-rw-r--r--sql/ha_heap.h6
-rw-r--r--sql/ha_myisam.cc160
-rw-r--r--sql/ha_myisam.h7
-rw-r--r--sql/handler.h14
-rw-r--r--sql/item_cmpfunc.cc1
-rw-r--r--sql/item_func.cc5
-rw-r--r--sql/item_subselect.cc107
-rw-r--r--sql/item_subselect.h4
-rw-r--r--sql/item_sum.cc8
-rw-r--r--sql/item_sum.h8
-rw-r--r--sql/repl_failsafe.cc4
-rw-r--r--sql/share/charsets/Index.xml4
-rw-r--r--sql/sql_acl.cc26
-rw-r--r--sql/sql_analyse.cc12
-rw-r--r--sql/sql_class.cc73
-rw-r--r--sql/sql_class.h11
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_select.cc51
-rw-r--r--sql/sql_select.h1
-rw-r--r--sql/sql_table.cc81
-rw-r--r--sql/sql_union.cc29
-rw-r--r--sql/sql_yacc.yy34
-rw-r--r--strings/ctype-czech.c2
-rw-r--r--strings/ctype-latin1.c340
-rw-r--r--strings/ctype-sjis.c8
-rw-r--r--strings/ctype-win1250ch.c2
-rw-r--r--strings/dump_map.c10
-rw-r--r--strings/my_strtoll10.c20
-rw-r--r--strings/strings-x86.s4
-rw-r--r--support-files/MacOSX/StartupItem.Description.plist2
-rw-r--r--support-files/my-huge.cnf.sh1
-rw-r--r--support-files/my-large.cnf.sh1
-rw-r--r--support-files/my-medium.cnf.sh2
-rw-r--r--support-files/my-small.cnf.sh2
-rw-r--r--tests/client_test.c48
533 files changed, 4124 insertions, 2546 deletions
diff --git a/.bzrignore b/.bzrignore
index ab096c20d6e..338bc04fabc 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -774,3 +774,9 @@ ndb/lib/libndbclient.so
ndb/lib/libndbclient_extra.so
libmysqld/discover.cc
include/readline
+ndb/config/autom4te.cache/*
+ndb/config/config.mk
+ndb/src/common/mgmcommon/printConfig/*.d
+ndb/src/mgmclient/test_cpcd/*.d
+*.d
+libmysqld/examples/client_test.c
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 44593cef0af..c89c60287fd 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -33,6 +33,7 @@ dlenev@build.mysql.com
dlenev@jabberwock.localdomain
dlenev@mysql.com
ejonore@mc03.ndb.mysql.com
+georg@beethoven.local
gerberb@ou800.zenez.com
gluh@gluh.(none)
gluh@gluh.mysql.r18.ru
@@ -111,6 +112,7 @@ mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
mysqldev@build.mysql2.com
+ndbdev@ndbmaster.mysql.com
nick@mysql.com
nick@nick.leippe.com
papa@gbichot.local
@@ -162,6 +164,8 @@ tonu@hundin.mysql.fi
tonu@volk.internalnet
tonu@x153.internalnet
tonu@x3.internalnet
+tsmith@build.mysql.com
+tulin@build.mysql.com
ulli@morbus.(none)
venu@hundin.mysql.fi
venu@myvenu.com
diff --git a/Build-tools/Do-pkg b/Build-tools/Do-pkg
index 2fd1946ed0e..286e33f6dd4 100755
--- a/Build-tools/Do-pkg
+++ b/Build-tools/Do-pkg
@@ -95,6 +95,7 @@ $SI_DESC= <$SUPFILEDIR/StartupItem.Description.plist>;
$SI_PARAMS= <$SUPFILEDIR/StartupParameters.plist>;
$SI_POST= <$SUPFILEDIR/StartupItem.postinstall>;
$SI_NAME= "MySQLStartupItem";
+$SI_DIR_NAME= "MySQLCOM";
$SI_SCRIPT= <$SUPFILEDIR/MySQL>;
@RESOURCES= qw/ ReadMe.txt postinstall preinstall /;
@LICENSES= ("$SRCBASEDIR/COPYING","$SRCBASEDIR/MySQLEULA.txt");
@@ -195,16 +196,18 @@ unless ($opt_skip_si)
&logger("Cleaning up $RESOURCE_DIR");
&run_command("rm -rf $RESOURCE_DIR/*", "Unable to clean up $RESOURCE_DIR!");
- &logger("Installing MySQL StartupItem files into $PKGROOT/MySQL");
+ my $SI_DIR= $PKGROOT . "/" . $SI_DIR_NAME;
+ &logger("Installing MySQL StartupItem files into $SI_DIR");
unless($opt_dry_run)
{
- mkdir("$PKGROOT/MySQL") or &abort("Error creating $PKGROOT/MySQL");
- copy("$SI_SCRIPT", "$PKGROOT/MySQL/")
+ mkdir("$SI_DIR")
+ or &abort("Error creating $SI_DIR");
+ copy("$SI_SCRIPT", "$SI_DIR/")
or &abort("Error copying $SI_SCRIPT!");
- chmod(0755, "$PKGROOT/MySQL/" . basename("$SI_SCRIPT"));
- copy("$SI_PARAMS", "$PKGROOT/MySQL/")
+ chmod(0755, "$SI_DIR/" . basename("$SI_SCRIPT"));
+ copy("$SI_PARAMS", "$SI_DIR/")
or &abort("Error copying $SI_PARAMS!");
- chmod(0644, "$PKGROOT/MySQL/" . basename("$SI_PARAMS"));
+ chmod(0644, "$SI_DIR/" . basename("$SI_PARAMS"));
&run_command("chown -R root:wheel $PKGROOT/*", "Cannot chown $PKGROOT!");
copy("$SI_POST", "$RESOURCE_DIR/postinstall")
or &abort("Error copying $SI_POST!");
diff --git a/client/my_readline.h b/client/my_readline.h
index 2e716eec4cf..6052d462ab9 100644
--- a/client/my_readline.h
+++ b/client/my_readline.h
@@ -29,6 +29,6 @@ typedef struct st_line_buffer
} LINE_BUFFER;
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
-extern LINE_BUFFER *batch_readline_command(my_string str);
+extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str);
extern char *batch_readline(LINE_BUFFER *buffer);
extern void batch_readline_end(LINE_BUFFER *buffer);
diff --git a/client/mysql.cc b/client/mysql.cc
index fe6af909a5a..ddc6441f08a 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -494,7 +494,7 @@ static struct my_option my_long_options[] =
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
- "Print results with a tab as separator, each row on new line. Doesn't use history file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Don't use history file. Disable interactive behavior. (Enables --silent)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -515,7 +515,7 @@ static struct my_option my_long_options[] =
(gptr*) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str,
(gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"execute", 'e', "Execute command and quit. (Output like with --batch).", 0,
+ {"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
(gptr*) &vertical, (gptr*) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
@@ -597,7 +597,7 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.",
(gptr*) &opt_reconnect, (gptr*) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"silent", 's', "Be more silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
+ {"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
@@ -755,10 +755,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'e':
status.batch= 1;
status.add_to_history= 0;
- batch_readline_end(status.line_buff); // If multiple -e
- if (!(status.line_buff= batch_readline_command(argument)))
+ if (!status.line_buff)
+ ignore_errors= 0; // do it for the first -e only
+ if (!(status.line_buff= batch_readline_command(status.line_buff, argument)))
return 1;
- ignore_errors= 0;
break;
case 'o':
if (argument == disabled_my_option)
@@ -798,12 +798,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
verbose++;
break;
case 'B':
- if (!status.batch)
- {
- status.batch= 1;
- status.add_to_history= 0;
- opt_silent++; // more silent
- }
+ status.batch= 1;
+ status.add_to_history= 0;
+ set_if_bigger(opt_silent,1); // more silent
break;
case 'W':
#ifdef __WIN__
@@ -1108,11 +1105,8 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
else
{
- int error= com_go(&buffer, 0);
- if (error)
- {
- return error < 0 ? 0 : 1; // < 0 is not fatal
- }
+ if (com_go(&buffer, 0) > 0) // < 0 is not fatal
+ return 1;
}
buffer.length(0);
out= line;
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 1a0ef713ec7..20792f8c025 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -241,10 +241,10 @@ static struct my_option my_long_options[] =
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
- "'SET NAMES charset_name' will not be put in the output. Deprecated, use --set-charset or --skip-set-charset to enable/disable charset settings instead",
+ "Deprecated, use --set-charset or --skip-set-charset to enable/disable charset settings instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
- "'SET NAMES charset_name' will be put in the output",
+ "'SET CHARACTER_SET_CLIENT=default_character_set' will be put in the output",
(gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"set-variable", 'O',
diff --git a/client/readline.cc b/client/readline.cc
index f5fbfd8cd0c..52ecb4e5c68 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -31,7 +31,8 @@ static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
{
LINE_BUFFER *line_buff;
- if (!(line_buff=(LINE_BUFFER*) my_malloc(sizeof(*line_buff),MYF(MY_WME))))
+ if (!(line_buff=(LINE_BUFFER*)
+ my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
return 0;
if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size))
{
@@ -67,11 +68,12 @@ void batch_readline_end(LINE_BUFFER *line_buff)
}
-LINE_BUFFER *batch_readline_command(my_string str)
+LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str)
{
- LINE_BUFFER *line_buff;
- if (!(line_buff=(LINE_BUFFER*) my_malloc(sizeof(*line_buff),MYF(MY_WME))))
- return 0;
+ if (!line_buff)
+ if (!(line_buff=(LINE_BUFFER*)
+ my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL))))
+ return 0;
if (init_line_buffer_from_string(line_buff,str))
{
my_free((char*) line_buff,MYF(0));
@@ -88,7 +90,6 @@ LINE_BUFFER *batch_readline_command(my_string str)
static bool
init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
{
- bzero((char*) buffer,sizeof(buffer[0]));
buffer->file=file;
buffer->bufread=size;
buffer->max_size=max_buffer;
@@ -100,19 +101,26 @@ init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer)
return 0;
}
-
+/*
+ init_line_buffer_from_string can be called on the same buffer
+ several times. the resulting buffer will contain a
+ concatenation of all strings separated by spaces
+*/
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
{
- uint length;
- bzero((char*) buffer,sizeof(buffer[0]));
- length=(uint) strlen(str);
- if (!(buffer->buffer=buffer->start_of_line=buffer->end_of_line=
- (char*)my_malloc(length+2,MYF(MY_FAE))))
+ uint old_length=buffer->end - buffer->buffer;
+ uint length= (uint) strlen(str);
+ if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line=
+ (char*)my_realloc(buffer->buffer, old_length+length+2,
+ MYF(MY_FAE|MY_ALLOW_ZERO_PTR))))
return 1;
- memcpy(buffer->buffer,str,length);
- buffer->buffer[length]='\n';
- buffer->buffer[length+1]=0;
- buffer->end=buffer->buffer+length+1;
+ buffer->end= buffer->buffer + old_length;
+ if (old_length)
+ buffer->end[-1]=' ';
+ memcpy(buffer->end, str, length);
+ buffer->end[length]= '\n';
+ buffer->end[length+1]= 0;
+ buffer->end+= length+1;
buffer->eof=1;
buffer->max_size=1;
return 0;
diff --git a/extra/Makefile.am b/extra/Makefile.am
index 0276355ef65..df29a3a6ab7 100644
--- a/extra/Makefile.am
+++ b/extra/Makefile.am
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
+INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include @ndbcluster_includes@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
diff --git a/extra/perror.c b/extra/perror.c
index 10b2442de20..1d3d7c70fac 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -23,15 +23,27 @@
#include <m_string.h>
#include <errno.h>
#include <my_getopt.h>
+#ifdef HAVE_NDBCLUSTER_DB
+#include "../ndb/src/ndbapi/ndberror.c"
+#endif
static my_bool verbose, print_all_codes;
+#ifdef HAVE_NDBCLUSTER_DB
+static my_bool ndb_code;
+static char ndb_string[1024];
+#endif
+
static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef HAVE_NDBCLUSTER_DB
+ {"ndb", 0, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code,
+ (gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+#endif
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
(gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
@@ -199,7 +211,17 @@ int main(int argc,char *argv[])
{
found=0;
code=atoi(*argv);
- msg = strerror(code);
+#ifdef HAVE_NDBCLUSTER_DB
+ if (ndb_code)
+ {
+ if (ndb_error_string(code, ndb_string, 1024) < 0)
+ msg= 0;
+ else
+ msg= ndb_string;
+ }
+ else
+#endif
+ msg = strerror(code);
if (msg)
{
found=1;
diff --git a/heap/heapdef.h b/heap/heapdef.h
index 63109badb05..083765334ab 100644
--- a/heap/heapdef.h
+++ b/heap/heapdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -97,6 +97,7 @@ extern uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key);
extern my_bool hp_if_null_in_key(HP_KEYDEF *keyinfo, const byte *record);
extern int hp_close(register HP_INFO *info);
extern void hp_clear(HP_SHARE *info);
+extern void hp_clear_keys(HP_SHARE *info);
extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
uint k_len);
#ifdef THREAD
diff --git a/heap/hp_clear.c b/heap/hp_clear.c
index e65d3a172c3..4440344f990 100644
--- a/heap/hp_clear.c
+++ b/heap/hp_clear.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,13 +29,60 @@ void heap_clear(HP_INFO *info)
void hp_clear(HP_SHARE *info)
{
- uint key;
DBUG_ENTER("hp_clear");
if (info->block.levels)
VOID(hp_free_level(&info->block,info->block.levels,info->block.root,
(byte*) 0));
info->block.levels=0;
+ hp_clear_keys(info);
+ info->records=info->deleted=info->data_length=0;
+ info->blength=1;
+ info->changed=0;
+ info->del_link=0;
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ Clear all keys.
+
+ SYNOPSIS
+ heap_clear_keys()
+ info A pointer to the heap storage engine HP_INFO struct.
+
+ DESCRIPTION
+ Delete all trees of all indexes and leave them empty.
+
+ RETURN
+ void
+*/
+
+void heap_clear_keys(HP_INFO *info)
+{
+ hp_clear(info->s);
+}
+
+
+/*
+ Clear all keys.
+
+ SYNOPSIS
+ hp_clear_keys()
+ info A pointer to the heap storage engine HP_SHARE struct.
+
+ DESCRIPTION
+ Delete all trees of all indexes and leave them empty.
+
+ RETURN
+ void
+*/
+
+void hp_clear_keys(HP_SHARE *info)
+{
+ uint key;
+ DBUG_ENTER("hp_clear_keys");
+
for (key=0 ; key < info->keys ; key++)
{
HP_KEYDEF *keyinfo = info->keydef + key;
@@ -52,9 +99,95 @@ void hp_clear(HP_SHARE *info)
block->last_allocated=0;
}
}
- info->records=info->deleted=info->data_length=info->index_length=0;
- info->blength=1;
- info->changed=0;
- info->del_link=0;
+ info->index_length=0;
DBUG_VOID_RETURN;
}
+
+
+/*
+ Disable all indexes.
+
+ SYNOPSIS
+ heap_disable_indexes()
+ info A pointer to the heap storage engine HP_INFO struct.
+
+ DESCRIPTION
+ Disable and clear (remove contents of) all indexes.
+
+ RETURN
+ 0 ok
+*/
+
+int heap_disable_indexes(HP_INFO *info)
+{
+ HP_SHARE *share= info->s;
+
+ if (share->keys)
+ {
+ hp_clear_keys(share);
+ share->currently_disabled_keys= share->keys;
+ share->keys= 0;
+ }
+ return 0;
+}
+
+
+/*
+ Enable all indexes
+
+ SYNOPSIS
+ heap_enable_indexes()
+ info A pointer to the heap storage engine HP_INFO struct.
+
+ DESCRIPTION
+ Enable all indexes. The indexes might have been disabled
+ by heap_disable_index() before.
+ The function works only if both data and indexes are empty,
+ since the heap storage engine cannot repair the indexes.
+ To be sure, call handler::delete_all_rows() before.
+
+ RETURN
+ 0 ok
+ HA_ERR_CRASHED data or index is non-empty.
+*/
+
+int heap_enable_indexes(HP_INFO *info)
+{
+ int error= 0;
+ HP_SHARE *share= info->s;
+
+ if (share->data_length || share->index_length)
+ error= HA_ERR_CRASHED;
+ else
+ if (share->currently_disabled_keys)
+ {
+ share->keys= share->currently_disabled_keys;
+ share->currently_disabled_keys= 0;
+ }
+ return error;
+}
+
+
+/*
+ Test if indexes are disabled.
+
+ SYNOPSIS
+ heap_indexes_are_disabled()
+ info A pointer to the heap storage engine HP_INFO struct.
+
+ DESCRIPTION
+ Test if indexes are disabled.
+
+ RETURN
+ 0 indexes are not disabled
+ 1 all indexes are disabled
+ [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+*/
+
+int heap_indexes_are_disabled(HP_INFO *info)
+{
+ HP_SHARE *share= info->s;
+
+ return (! share->keys && share->currently_disabled_keys);
+}
+
diff --git a/include/heap.h b/include/heap.h
index c5f2be81fb7..b536937c8c0 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2000,2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -107,6 +107,7 @@ typedef struct st_heap_share
uint reclength; /* Length of one record */
uint changed;
uint keys,max_key_length;
+ uint currently_disabled_keys; /* saved value from "keys" when disabled */
uint open_count;
byte *del_link; /* Link to next block with del. rec */
my_string name; /* Name of "memory-file" */
@@ -176,6 +177,10 @@ extern int heap_rprev(HP_INFO *info,byte *record);
extern int heap_rfirst(HP_INFO *info,byte *record,int inx);
extern int heap_rlast(HP_INFO *info,byte *record,int inx);
extern void heap_clear(HP_INFO *info);
+extern void heap_clear_keys(HP_INFO *info);
+extern int heap_disable_indexes(HP_INFO *info);
+extern int heap_enable_indexes(HP_INFO *info);
+extern int heap_indexes_are_disabled(HP_INFO *info);
extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
uint start_key_len,
diff --git a/include/my_base.h b/include/my_base.h
index 54c739bde23..4a2f3f85083 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -191,7 +191,7 @@ enum ha_base_keytype {
#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */
#define HA_SPATIAL 1024 /* For spatial search */
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
-
+#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
/* Automatic bits in key-flag */
diff --git a/include/mysql.h b/include/mysql.h
index 537467336f8..51540a7d89f 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -188,10 +188,11 @@ struct st_mysql_options {
my_bool secure_auth;
/* function pointers for local infile support */
- int (*local_infile_init)(void **, const char *);
+ int (*local_infile_init)(void **, const char *, void *);
int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
+ void *local_infile_userdata;
};
enum mysql_status
@@ -397,12 +398,14 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
void
mysql_set_local_infile_handler(MYSQL *mysql,
- int (*local_infile_init)(void **, const char *),
+ int (*local_infile_init)(void **, const char *,
+ void *),
int (*local_infile_read)(void *, char *,
unsigned int),
void (*local_infile_end)(void *),
int (*local_infile_error)(void *, char*,
- unsigned int));
+ unsigned int),
+ void *);
void
mysql_set_local_infile_default(MYSQL *mysql);
diff --git a/include/violite.h b/include/violite.h
index e8f30288d34..b4b9f724d89 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -55,14 +55,8 @@ int vio_close_pipe(Vio * vio);
void vio_delete(Vio* vio);
int vio_close(Vio* vio);
-
-#ifdef EMBEDDED_LIBRARY
-void vio_reset(Vio *vio);
-#else
-void vio_reset(Vio* vio, enum enum_vio_type type,
- my_socket sd, HANDLE hPipe, my_bool localhost);
-#endif
-
+void vio_reset(Vio* vio, enum enum_vio_type type,
+ my_socket sd, HANDLE hPipe, my_bool localhost);
int vio_read(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index e67d1d76113..5829cc2c406 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -399,7 +399,7 @@ btr_cur_search_to_nth_level(
retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
if (page == NULL) {
/* This must be a search to perform an insert;
@@ -580,7 +580,7 @@ btr_cur_open_at_index_side(
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
btr_page_get_index_id(page)));
@@ -689,7 +689,7 @@ btr_cur_open_at_rnd_pos(
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
btr_page_get_index_id(page)));
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index f2b03f9f348..9384168df88 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -764,7 +764,7 @@ btr_search_guess_on_hash(
success = buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
rw_lock_s_unlock(&btr_search_latch);
@@ -1048,7 +1048,7 @@ btr_search_drop_page_hash_when_freed(
having to fear a deadlock. */
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
- BUF_GET_IF_IN_POOL, IB__FILE__, __LINE__,
+ BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 7a5ef3c5e14..4d83fb4c9f2 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1048,7 +1048,7 @@ buf_page_get_gen(
buf_frame_t* guess, /* in: guessed frame or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH, BUF_GET_NOWAIT */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1257,7 +1257,7 @@ buf_page_optimistic_get_func(
frames */
dulint modify_clock,/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1382,7 +1382,7 @@ buf_page_get_known_nowait(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_frame_t* guess, /* in: the known page frame */
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1742,7 +1742,7 @@ buf_page_create(
buf_LRU_add_block(block, FALSE);
#ifdef UNIV_SYNC_DEBUG
- buf_block_buf_fix_inc_debug(block, IB__FILE__, __LINE__);
+ buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
#else
buf_block_buf_fix_inc(block);
#endif
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index ecdcf08e4c6..7dc0bd98001 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -3042,7 +3042,7 @@ loop:
if (page) {
ibool success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
ut_a(success);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 6b8da886045..9590fea1276 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -132,7 +132,7 @@ to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
in LA! */
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET, IB__FILE__, __LINE__, MTR)
+ BUF_GET, __FILE__, __LINE__, MTR)
/******************************************************************
Use these macros to bufferfix a page with no latching. Remember not to
read the contents of the page unless you know it is safe. Do not modify
@@ -141,19 +141,19 @@ error-prone programming not to set a latch, and it should be used
with care. */
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\
- BUF_GET_NO_LATCH, IB__FILE__, __LINE__, MTR)
+ BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of buf_page_get_gen, to
improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET_NOWAIT, IB__FILE__, __LINE__, MTR)
+ BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\
- LA, BL, G, MC, IB__FILE__, __LINE__, MTR)
+ LA, BL, G, MC, __FILE__, __LINE__, MTR)
/************************************************************************
This is the general function used to get optimistic access to a database
page. */
@@ -168,7 +168,7 @@ buf_page_optimistic_get_func(
frames */
dulint modify_clock,/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
@@ -201,7 +201,7 @@ buf_page_get_known_nowait(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_frame_t* guess, /* in: the known page frame */
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
@@ -217,7 +217,7 @@ buf_page_get_gen(
buf_frame_t* guess, /* in: guessed frame or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index b644afcbdff..4d1173a0d7f 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -585,7 +585,7 @@ buf_page_get_release_on_io(
frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
if (frame != NULL) {
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index 89e2a337c99..18bffe5732e 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -64,14 +64,14 @@ heap creation. */
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
@@ -79,7 +79,7 @@ heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for fast
memory heap creation. An initial block of memory B is given by the
@@ -88,14 +88,14 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap freeing. */
#define mem_heap_free(heap) mem_heap_free_func(\
- (heap), IB__FILE__, __LINE__)
+ (heap), __FILE__, __LINE__)
/*********************************************************************
NOTE: Use the corresponding macros instead of this function. Creates a
memory heap which allocates memory from dynamic space. For debugging
@@ -105,26 +105,27 @@ UNIV_INLINE
mem_heap_t*
mem_heap_create_func(
/*=================*/
- /* out, own: memory heap */
- ulint n, /* in: desired start block size,
- this means that a single user buffer
- of size n will fit in the block,
- 0 creates a default size block;
- if init_block is not NULL, n tells
- its size in bytes */
- void* init_block, /* in: if very fast creation is
- wanted, the caller can reserve some
- memory from its stack, for example,
- and pass it as the the initial block
- to the heap: then no OS call of malloc
- is needed at the creation. CAUTION:
- the caller must make sure the initial
- block is not unintentionally erased
- (if allocated in the stack), before
- the memory heap is explicitly freed. */
- ulint type, /* in: MEM_HEAP_DYNAMIC or MEM_HEAP_BUFFER */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: memory heap */
+ ulint n, /* in: desired start block size,
+ this means that a single user buffer
+ of size n will fit in the block,
+ 0 creates a default size block;
+ if init_block is not NULL, n tells
+ its size in bytes */
+ void* init_block, /* in: if very fast creation is
+ wanted, the caller can reserve some
+ memory from its stack, for example,
+ and pass it as the the initial block
+ to the heap: then no OS call of malloc
+ is needed at the creation. CAUTION:
+ the caller must make sure the initial
+ block is not unintentionally erased
+ (if allocated in the stack), before
+ the memory heap is explicitly freed. */
+ ulint type, /* in: MEM_HEAP_DYNAMIC
+ or MEM_HEAP_BUFFER */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*********************************************************************
NOTE: Use the corresponding macro instead of this function. Frees the space
@@ -135,7 +136,7 @@ void
mem_heap_free_func(
/*===============*/
mem_heap_t* heap, /* in, own: heap to be freed */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where freed */
ulint line __attribute__((unused)));
/* in: line where freed */
@@ -206,13 +207,13 @@ mem_heap_get_size(
Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
-#define mem_alloc(N) mem_alloc_func((N), IB__FILE__, __LINE__)
+#define mem_alloc(N) mem_alloc_func((N), __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#define mem_alloc_noninline(N) mem_alloc_func_noninline(\
- (N), IB__FILE__, __LINE__)
+ (N), __FILE__, __LINE__)
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
Allocates a single buffer of memory from the dynamic memory of
@@ -222,11 +223,11 @@ UNIV_INLINE
void*
mem_alloc_func(
/*===========*/
- /* out, own: free storage, NULL
- if did not succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage, NULL
+ if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
@@ -237,17 +238,17 @@ with mem_free. */
void*
mem_alloc_func_noninline(
/*=====================*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/******************************************************************
Use this macro instead of the corresponding function!
Macro for memory buffer freeing */
-#define mem_free(PTR) mem_free_func((PTR), IB__FILE__, __LINE__)
+#define mem_free(PTR) mem_free_func((PTR), __FILE__, __LINE__)
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
Frees a single buffer of storage from
@@ -256,9 +257,9 @@ UNIV_INLINE
void
mem_free_func(
/*==========*/
- void* ptr, /* in, own: buffer to be freed */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ void* ptr, /* in, own: buffer to be freed */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*******************************************************************
Implements realloc. */
@@ -266,11 +267,12 @@ UNIV_INLINE
void*
mem_realloc(
/*========*/
- /* out, own: free storage, NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- char* file_name,/* in: file name where called */
- ulint line); /* in: line where called */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ void* buf, /* in: pointer to an old buffer */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where called */
+ ulint line); /* in: line where called */
/**************************************************************************
Duplicates a NUL-terminated string. */
diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic
index c250e6948ec..df3dbf9b576 100644
--- a/innobase/include/mem0mem.ic
+++ b/innobase/include/mem0mem.ic
@@ -16,18 +16,18 @@ Creates a memory heap block where data can be allocated. */
mem_block_t*
mem_heap_create_block(
/*==================*/
- /* out, own: memory heap block, NULL if did not
- succeed */
- mem_heap_t* heap,/* in: memory heap or NULL if first block should
- be created */
- ulint n, /* in: number of bytes needed for user data, or
- if init_block is not NULL, its size in bytes */
- void* init_block, /* in: init block in fast create, type must be
- MEM_HEAP_DYNAMIC */
- ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
- MEM_HEAP_BUFFER */
- char* file_name,/* in: file name where created */
- ulint line); /* in: line where created */
+ /* out, own: memory heap block,
+ NULL if did not succeed */
+ mem_heap_t* heap, /* in: memory heap or NULL if first block
+ should be created */
+ ulint n, /* in: number of bytes needed for user data, or
+ if init_block is not NULL, its size in bytes */
+ void* init_block, /* in: init block in fast create,
+ type must be MEM_HEAP_DYNAMIC */
+ ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
+ MEM_HEAP_BUFFER */
+ const char* file_name,/* in: file name where created */
+ ulint line); /* in: line where created */
/**********************************************************************
Frees a block from a memory heap. */
@@ -377,27 +377,27 @@ UNIV_INLINE
mem_heap_t*
mem_heap_create_func(
/*=================*/
- /* out, own: memory heap */
- ulint n, /* in: desired start block size,
- this means that a single user buffer
- of size n will fit in the block,
- 0 creates a default size block;
- if init_block is not NULL, n tells
- its size in bytes */
- void* init_block, /* in: if very fast creation is
- wanted, the caller can reserve some
- memory from its stack, for example,
- and pass it as the the initial block
- to the heap: then no OS call of malloc
- is needed at the creation. CAUTION:
- the caller must make sure the initial
- block is not unintentionally erased
- (if allocated in the stack), before
- the memory heap is explicitly freed. */
- ulint type, /* in: MEM_HEAP_DYNAMIC, or MEM_HEAP_BUFFER
- possibly ORed to MEM_HEAP_BTR_SEARCH */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: memory heap */
+ ulint n, /* in: desired start block size,
+ this means that a single user buffer
+ of size n will fit in the block,
+ 0 creates a default size block;
+ if init_block is not NULL, n tells
+ its size in bytes */
+ void* init_block, /* in: if very fast creation is
+ wanted, the caller can reserve some
+ memory from its stack, for example,
+ and pass it as the the initial block
+ to the heap: then no OS call of malloc
+ is needed at the creation. CAUTION:
+ the caller must make sure the initial
+ block is not unintentionally erased
+ (if allocated in the stack), before
+ the memory heap is explicitly freed. */
+ ulint type, /* in: MEM_HEAP_DYNAMIC
+ or MEM_HEAP_BUFFER */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_block_t* block;
@@ -440,10 +440,9 @@ void
mem_heap_free_func(
/*===============*/
mem_heap_t* heap, /* in, own: heap to be freed */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where freed */
ulint line __attribute__((unused)))
- /* in: line where freed */
{
mem_block_t* block;
mem_block_t* prev_block;
@@ -486,11 +485,11 @@ UNIV_INLINE
void*
mem_alloc_func(
/*===========*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage, NULL
+ if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_heap_t* heap;
@@ -523,9 +522,9 @@ UNIV_INLINE
void
mem_free_func(
/*==========*/
- void* ptr, /* in, own: buffer to be freed */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ void* ptr, /* in, own: buffer to be freed */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_heap_t* heap;
@@ -569,11 +568,12 @@ UNIV_INLINE
void*
mem_realloc(
/*========*/
- /* out, own: free storage, NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- char* file_name,/* in: file name where called */
- ulint line) /* in: line where called */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ void* buf, /* in: pointer to an old buffer */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where called */
+ ulint line) /* in: line where called */
{
mem_free(buf);
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 73338977b9c..f6dfe23bc41 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -198,11 +198,11 @@ mtr_read_dulint(
mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************************
This macro locks an rw-lock in s-mode. */
-#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), IB__FILE__, __LINE__,\
+#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), __FILE__, __LINE__,\
(MTR))
/*************************************************************************
This macro locks an rw-lock in x-mode. */
-#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), IB__FILE__, __LINE__,\
+#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), __FILE__, __LINE__,\
(MTR))
/*************************************************************************
NOTE! Use the macro above!
@@ -212,7 +212,7 @@ void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr); /* in: mtr */
/*************************************************************************
@@ -223,7 +223,7 @@ void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr); /* in: mtr */
diff --git a/innobase/include/mtr0mtr.ic b/innobase/include/mtr0mtr.ic
index 51112fc0d14..4fc6dd2f6a9 100644
--- a/innobase/include/mtr0mtr.ic
+++ b/innobase/include/mtr0mtr.ic
@@ -217,7 +217,7 @@ void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr) /* in: mtr */
{
@@ -236,7 +236,7 @@ void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr) /* in: mtr */
{
diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h
index 2e86a7e5534..c260557c424 100644
--- a/innobase/include/pars0pars.h
+++ b/innobase/include/pars0pars.h
@@ -92,7 +92,7 @@ Called by yyparse on error. */
void
yyerror(
/*====*/
- char* s); /* in: error message string */
+ const char* s); /* in: error message string */
/*************************************************************************
Parses a variable declaration. */
diff --git a/innobase/include/sync0arr.h b/innobase/include/sync0arr.h
index 383d0c69fb2..e7d511f8137 100644
--- a/innobase/include/sync0arr.h
+++ b/innobase/include/sync0arr.h
@@ -51,7 +51,7 @@ sync_array_reserve_cell(
sync_array_t* arr, /* in: wait array */
void* object, /* in: pointer to the object to wait for */
ulint type, /* in: lock request type */
- char* file, /* in: file where requested */
+ const char* file, /* in: file where requested */
ulint line, /* in: line where requested */
ulint* index); /* out: index of the reserved cell */
/**********************************************************************
diff --git a/innobase/include/sync0ipm.ic b/innobase/include/sync0ipm.ic
index b8aa87ba6d6..126aceae1eb 100644
--- a/innobase/include/sync0ipm.ic
+++ b/innobase/include/sync0ipm.ic
@@ -92,7 +92,7 @@ loop:
loop_count++;
ut_ad(loop_count < 15);
- if (mutex_enter_nowait(mutex, IB__FILE__, __LINE__) == 0) {
+ if (mutex_enter_nowait(mutex, __FILE__, __LINE__) == 0) {
/* Succeeded! */
return(0);
@@ -105,7 +105,7 @@ loop:
/* Order is important here: FIRST reset event, then set waiters */
ip_mutex_set_waiters(ip_mutex, 1);
- if (mutex_enter_nowait(mutex, IB__FILE__, __LINE__) == 0) {
+ if (mutex_enter_nowait(mutex, __FILE__, __LINE__) == 0) {
/* Succeeded! */
return(0);
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 82123a529a3..63b01ffac80 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -62,7 +62,7 @@ location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
-#define rw_lock_create(L) rw_lock_create_func((L), IB__FILE__, __LINE__)
+#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__)
/*=====================*/
/**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory
@@ -74,7 +74,7 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline); /* in: file line where created */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
@@ -100,19 +100,19 @@ NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock(M) rw_lock_s_lock_func(\
- (M), 0, IB__FILE__, __LINE__)
+ (M), 0, __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
- (M), (P), IB__FILE__, __LINE__)
+ (M), (P), __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\
- (M), IB__FILE__, __LINE__)
+ (M), __FILE__, __LINE__)
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function, except if
you supply the file name and line number. Lock an rw-lock in shared mode
@@ -127,7 +127,7 @@ rw_lock_s_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function, except if
@@ -139,7 +139,7 @@ rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function! Lock an
@@ -151,7 +151,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
Releases a shared mode lock. */
@@ -186,19 +186,19 @@ NOTE! The following macro should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock(M) rw_lock_x_lock_func(\
- (M), 0, IB__FILE__, __LINE__)
+ (M), 0, __FILE__, __LINE__)
/******************************************************************
NOTE! The following macro should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
- (M), (P), IB__FILE__, __LINE__)
+ (M), (P), __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
- (M), IB__FILE__, __LINE__)
+ (M), __FILE__, __LINE__)
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function! Lock an
rw-lock in exclusive mode for the current thread. If the rw-lock is locked
@@ -215,7 +215,7 @@ rw_lock_x_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
Releases an exclusive mode lock. */
@@ -253,9 +253,9 @@ UNIV_INLINE
void
rw_lock_s_lock_direct(
/*==================*/
- rw_lock_t* lock /* in: pointer to rw-lock */
- ,char* file_name, /* in: file name where lock requested */
- ulint line /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line /* in: line where lock requested */
);
/**********************************************************************
Low-level function which locks an rw-lock in x-mode when we know that it
@@ -265,9 +265,9 @@ UNIV_INLINE
void
rw_lock_x_lock_direct(
/*==================*/
- rw_lock_t* lock /* in: pointer to rw-lock */
- ,char* file_name, /* in: file name where lock requested */
- ulint line /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line /* in: line where lock requested */
);
/**********************************************************************
This function is used in the insert buffer to move the ownership of an
@@ -451,10 +451,10 @@ struct rw_lock_struct {
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
- char* cfile_name; /* File name where lock created */
+ const char* cfile_name;/* File name where lock created */
ulint cline; /* Line where created */
- char* last_s_file_name;/* File name where last time s-locked */
- char* last_x_file_name;/* File name where last time x-locked */
+ const char* last_s_file_name;/* File name where last s-locked */
+ const char* last_x_file_name;/* File name where last x-locked */
ulint last_s_line; /* Line number where last time s-locked */
ulint last_x_line; /* Line number where last time x-locked */
ulint magic_n;
@@ -471,7 +471,7 @@ struct rw_lock_debug_struct {
ulint pass; /* Pass value given in the lock operation */
ulint lock_type; /* Type of the lock: RW_LOCK_EX,
RW_LOCK_SHARED, RW_LOCK_WAIT_EX */
- char* file_name; /* File name where the lock was obtained */
+ const char* file_name;/* File name where the lock was obtained */
ulint line; /* Line where the rw-lock was locked */
UT_LIST_NODE_T(rw_lock_debug_t) list;
/* Debug structs are linked in a two-way
diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic
index 8fc93f4a9da..655bd7f6517 100644
--- a/innobase/include/sync0rw.ic
+++ b/innobase/include/sync0rw.ic
@@ -18,7 +18,7 @@ rw_lock_s_lock_spin(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -130,7 +130,7 @@ rw_lock_s_lock_low(
ulint pass __attribute__((unused)),
/* in: pass value; != 0, if the lock will be
passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
@@ -163,9 +163,9 @@ UNIV_INLINE
void
rw_lock_s_lock_direct(
/*==================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
- ulint line) /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line) /* in: line where lock requested */
{
ut_ad(lock->writer == RW_LOCK_NOT_LOCKED);
ut_ad(rw_lock_get_reader_count(lock) == 0);
@@ -189,9 +189,9 @@ UNIV_INLINE
void
rw_lock_x_lock_direct(
/*==================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name, /* in: file name where lock requested */
- ulint line) /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line) /* in: line where lock requested */
{
ut_ad(rw_lock_validate(lock));
ut_ad(rw_lock_get_reader_count(lock) == 0);
@@ -223,7 +223,7 @@ rw_lock_s_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
/* NOTE: As we do not know the thread ids for threads which have
@@ -267,7 +267,7 @@ rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ibool success = FALSE;
@@ -304,7 +304,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ibool success = FALSE;
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 0cc48d5f299..4307ca5ba0c 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -36,7 +36,7 @@ in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
-#define mutex_create(M) mutex_create_func((M), IB__FILE__, __LINE__)
+#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__)
/*===================*/
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
@@ -48,7 +48,7 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline); /* in: file line where created */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
@@ -64,7 +64,7 @@ mutex_free(
NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
-#define mutex_enter(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
/**********************************************************************
A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled
inlining of InnoDB functions, and no inlined functions should be called from
@@ -80,7 +80,7 @@ corresponding function. */
/* NOTE! currently same as mutex_enter! */
-#define mutex_enter_fast(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
#define mutex_enter_fast_func mutex_enter_func;
/**********************************************************************
NOTE! Use the corresponding macro in the header file, not this function
@@ -92,7 +92,7 @@ void
mutex_enter_func(
/*=============*/
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where locked */
+ const char* file_name, /* in: file name where locked */
ulint line); /* in: line where locked */
/************************************************************************
Tries to lock the mutex for the current thread. If the lock is not acquired
@@ -103,9 +103,9 @@ mutex_enter_nowait(
/*===============*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where mutex
+ const char* file_name, /* in: file name where mutex
requested */
- ulint line); /* in: line where requested */
+ ulint line); /* in: line where requested */
/**********************************************************************
Unlocks a mutex owned by the current thread. */
UNIV_INLINE
@@ -470,7 +470,7 @@ struct mutex_struct {
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
- char* cfile_name; /* File name where mutex created */
+ const char* cfile_name;/* File name where mutex created */
ulint cline; /* Line where created */
ulint magic_n;
};
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index 758c8524f66..ecb498918e2 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -23,7 +23,7 @@ void
mutex_spin_wait(
/*============*/
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name,/* in: file name where mutex requested */
+ const char* file_name,/* in: file name where mutex requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -241,9 +241,9 @@ UNIV_INLINE
void
mutex_enter_func(
/*=============*/
- mutex_t* mutex, /* in: pointer to mutex */
- char* file_name,/* in: file name where locked */
- ulint line) /* in: line where locked */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where locked */
+ ulint line) /* in: line where locked */
{
ut_ad(mutex_validate(mutex));
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index cd471a89607..be71d4211b3 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -242,11 +242,6 @@ contains the sum of the following flag and the locally stored len. */
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
-/* The following definition of __FILE__ removes compiler warnings
-associated with const char* / char* mismatches with __FILE__ */
-
-#define IB__FILE__ ((char*)__FILE__)
-
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index 085b4811a73..a155f68bd12 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -27,7 +27,7 @@ extern const char* ut_dbg_msg_stop;
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__,\
(ulint)__LINE__);\
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
fputs(ut_dbg_msg_trap, stderr);\
@@ -36,7 +36,7 @@ extern const char* ut_dbg_msg_stop;
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr, ut_dbg_msg_stop,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
} while (0)
@@ -44,7 +44,7 @@ extern const char* ut_dbg_msg_stop;
#define ut_error do {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
fprintf(stderr, ut_dbg_msg_trap);\
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h
index b208fac8691..85b99efff68 100644
--- a/innobase/include/ut0mem.h
+++ b/innobase/include/ut0mem.h
@@ -18,15 +18,15 @@ extern ulint ut_total_allocated_memory;
UNIV_INLINE
void*
-ut_memcpy(void* dest, void* sour, ulint n);
+ut_memcpy(void* dest, const void* sour, ulint n);
UNIV_INLINE
void*
-ut_memmove(void* dest, void* sour, ulint n);
+ut_memmove(void* dest, const void* sour, ulint n);
UNIV_INLINE
int
-ut_memcmp(void* str1, void* str2, ulint n);
+ut_memcmp(const void* str1, const void* str2, ulint n);
/**************************************************************************
@@ -75,7 +75,7 @@ ut_free_all_mem(void);
UNIV_INLINE
char*
-ut_strcpy(char* dest, char* sour);
+ut_strcpy(char* dest, const char* sour);
UNIV_INLINE
ulint
@@ -83,7 +83,7 @@ ut_strlen(const char* str);
UNIV_INLINE
int
-ut_strcmp(void* str1, void* str2);
+ut_strcmp(const void* str1, const void* str2);
/**************************************************************************
Determine the length of a string when it is quoted with ut_strcpyq(). */
@@ -118,27 +118,6 @@ ut_memcpyq(
const char* src, /* in: string to be quoted */
ulint len); /* in: length of src */
-/**************************************************************************
-Catenates two strings into newly allocated memory. The memory must be freed
-using mem_free. */
-
-char*
-ut_str_catenate(
-/*============*/
- /* out, own: catenated null-terminated string */
- char* str1, /* in: null-terminated string */
- char* str2); /* in: null-terminated string */
-
-/**************************************************************************
-Return a copy of the given string. The returned string must be freed
-using mem_free. */
-
-char*
-ut_strdup(
-/*======*/
- /* out, own: cnull-terminated string */
- char* str); /* in: null-terminated string */
-
#ifndef UNIV_NONINL
#include "ut0mem.ic"
#endif
diff --git a/innobase/include/ut0mem.ic b/innobase/include/ut0mem.ic
index 951d9538424..3bb30a80f22 100644
--- a/innobase/include/ut0mem.ic
+++ b/innobase/include/ut0mem.ic
@@ -8,28 +8,28 @@ Created 5/30/1994 Heikki Tuuri
UNIV_INLINE
void*
-ut_memcpy(void* dest, void* sour, ulint n)
+ut_memcpy(void* dest, const void* sour, ulint n)
{
return(memcpy(dest, sour, n));
}
UNIV_INLINE
void*
-ut_memmove(void* dest, void* sour, ulint n)
+ut_memmove(void* dest, const void* sour, ulint n)
{
return(memmove(dest, sour, n));
}
UNIV_INLINE
int
-ut_memcmp(void* str1, void* str2, ulint n)
+ut_memcmp(const void* str1, const void* str2, ulint n)
{
return(memcmp(str1, str2, n));
}
UNIV_INLINE
char*
-ut_strcpy(char* dest, char* sour)
+ut_strcpy(char* dest, const char* sour)
{
return(strcpy(dest, sour));
}
@@ -43,9 +43,9 @@ ut_strlen(const char* str)
UNIV_INLINE
int
-ut_strcmp(void* str1, void* str2)
+ut_strcmp(const void* str1, const void* str2)
{
- return(strcmp((char*)str1, (char*)str2));
+ return(strcmp((const char*)str1, (const char*)str2));
}
/**************************************************************************
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 8805a22bb57..056d502e858 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -3889,7 +3889,7 @@ lock_rec_print(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr);
if (page) {
page = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr);
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index 4f4220962f0..65fb3466ad5 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -1080,7 +1080,7 @@ recv_recover_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
ut_a(success);
@@ -1664,7 +1664,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
if (frame) {
#ifdef UNIV_SYNC_DEBUG
@@ -1679,7 +1679,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
if (frame) {
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/mem/mem0mem.c b/innobase/mem/mem0mem.c
index e1b9a762381..c090b25a632 100644
--- a/innobase/mem/mem0mem.c
+++ b/innobase/mem/mem0mem.c
@@ -92,11 +92,11 @@ with mem_free. */
void*
mem_alloc_func_noninline(
/*=====================*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
return(mem_alloc_func(n, file_name, line));
@@ -108,18 +108,18 @@ Creates a memory heap block where data can be allocated. */
mem_block_t*
mem_heap_create_block(
/*==================*/
- /* out, own: memory heap block, NULL if did not
- succeed */
- mem_heap_t* heap,/* in: memory heap or NULL if first block should
- be created */
- ulint n, /* in: number of bytes needed for user data, or
- if init_block is not NULL, its size in bytes */
- void* init_block, /* in: init block in fast create, type must be
- MEM_HEAP_DYNAMIC */
- ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC, or
- MEM_HEAP_BUFFER possibly ORed to MEM_HEAP_BTR_SEARCH */
- char* file_name,/* in: file name where created */
- ulint line) /* in: line where created */
+ /* out, own: memory heap block,
+ NULL if did not succeed */
+ mem_heap_t* heap, /* in: memory heap or NULL if first block
+ should be created */
+ ulint n, /* in: number of bytes needed for user data, or
+ if init_block is not NULL, its size in bytes */
+ void* init_block, /* in: init block in fast create,
+ type must be MEM_HEAP_DYNAMIC */
+ ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
+ MEM_HEAP_BUFFER */
+ const char* file_name,/* in: file name where created */
+ ulint line) /* in: line where created */
{
mem_block_t* block;
ulint len;
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 3f14a2158ed..79185c30f79 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -369,7 +369,16 @@ os_file_handle_error(
return(FALSE);
}
-#if !defined(__WIN__) && !defined(UNIV_HOTBACKUP)
+#undef USE_FILE_LOCK
+#define USE_FILE_LOCK
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__)
+/* InnoDB Hot Backup does not lock the data files.
+ * On Windows, mandatory locking is used.
+ * On FreeBSD with LinuxThreads, advisory locking does not work properly.
+ */
+# undef USE_FILE_LOCK
+#endif
+#ifdef USE_FILE_LOCK
/********************************************************************
Obtain an exclusive lock on a file. */
static
@@ -393,7 +402,7 @@ os_file_lock(
}
return 0;
}
-#endif /* !defined(__WIN__) && !defined(UNIV_HOTBACKUP) */
+#endif /* USE_FILE_LOCK */
/********************************************************************
Does error handling when a file operation fails. */
@@ -852,7 +861,7 @@ try_again:
if (retry) {
goto try_again;
}
-#ifndef UNIV_HOTBACKUP
+#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name)) {
*success = FALSE;
file = -1;
@@ -961,7 +970,7 @@ os_file_create_simple_no_error_handling(
if (file == -1) {
*success = FALSE;
-#ifndef UNIV_HOTBACKUP
+#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name)) {
*success = FALSE;
file = -1;
@@ -1172,7 +1181,7 @@ try_again:
if (retry) {
goto try_again;
}
-#ifndef UNIV_HOTBACKUP
+#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name)) {
*success = FALSE;
file = -1;
@@ -2314,18 +2323,18 @@ os_file_dirname(
if (last_slash < 0) {
/* no slash in the path, return "." */
- return(ut_strdup((char*)"."));
+ return(mem_strdup("."));
}
/* ok, there is a slash */
if (last_slash == 0) {
/* last slash is the first char of the path */
- return(ut_strdup((char*)"/"));
+ return(mem_strdup("/"));
}
/* non-trivial directory component */
- dir = ut_strdup(path);
+ dir = mem_strdup(path);
dir[last_slash] = 0;
return(dir);
diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c
index a4124672df0..7e835d9ada1 100644
--- a/innobase/pars/pars0pars.c
+++ b/innobase/pars/pars0pars.c
@@ -1713,7 +1713,8 @@ Called by yyparse on error. */
void
yyerror(
/*====*/
- char* s __attribute__((unused))) /* in: error message string */
+ const char* s __attribute__((unused)))
+ /* in: error message string */
{
ut_ad(s);
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 426d7ff9f92..02a9771be35 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -53,7 +53,7 @@ struct sync_cell_struct {
rw_lock_t* old_wait_rw_lock;/* the latest wait rw-lock in cell */
ulint request_type; /* lock type requested on the
object */
- char* file; /* in debug version file where
+ const char* file; /* in debug version file where
requested */
ulint line; /* in debug version line where
requested */
@@ -329,7 +329,7 @@ sync_array_reserve_cell(
sync_array_t* arr, /* in: wait array */
void* object, /* in: pointer to the object to wait for */
ulint type, /* in: lock request type */
- char* file, /* in: file where requested */
+ const char* file, /* in: file where requested */
ulint line, /* in: line where requested */
ulint* index) /* out: index of the reserved cell */
{
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 43f8d646eaa..769eb326ce2 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -89,7 +89,7 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */
{
/* If this is the very first time a synchronization
@@ -213,7 +213,7 @@ rw_lock_s_lock_spin(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock
will be passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -324,7 +324,7 @@ rw_lock_x_lock_low(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
@@ -429,7 +429,7 @@ rw_lock_x_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -551,7 +551,7 @@ rw_lock_debug_mutex_enter(void)
{
loop:
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- IB__FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
@@ -560,7 +560,7 @@ loop:
rw_lock_debug_waiters = TRUE;
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- IB__FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index c1fb31bc966..31f287b6341 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -201,7 +201,7 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */
{
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
@@ -294,10 +294,10 @@ mutex_enter_nowait(
/*===============*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where mutex
requested */
- ulint line __attribute__((unused)))
+ ulint line __attribute__((unused)))
/* in: line where requested */
{
ut_ad(mutex_validate(mutex));
@@ -357,9 +357,10 @@ for the mutex before suspending the thread. */
void
mutex_spin_wait(
/*============*/
- mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where mutex requested */
- ulint line) /* in: line where requested */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where
+ mutex requested */
+ ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */
diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c
index 7963bec7f33..16f9f3d093d 100644
--- a/innobase/trx/trx0rec.c
+++ b/innobase/trx/trx0rec.c
@@ -1067,7 +1067,7 @@ trx_undo_report_row_operation(
undo_page = buf_page_get_gen(undo->space, page_no,
RW_X_LATCH, undo->guess_page,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c
index 9d0e63e6099..47b612d757e 100644
--- a/innobase/ut/ut0mem.c
+++ b/innobase/ut/ut0mem.c
@@ -273,53 +273,3 @@ ut_memcpyq(
return(dest);
}
-
-/**************************************************************************
-Catenates two strings into newly allocated memory. The memory must be freed
-using mem_free. */
-
-char*
-ut_str_catenate(
-/*============*/
- /* out, own: catenated null-terminated string */
- char* str1, /* in: null-terminated string */
- char* str2) /* in: null-terminated string */
-{
- ulint len1;
- ulint len2;
- char* str;
-
- len1 = ut_strlen(str1);
- len2 = ut_strlen(str2);
-
- str = mem_alloc(len1 + len2 + 1);
-
- ut_memcpy(str, str1, len1);
- ut_memcpy(str + len1, str2, len2 + 1);
-
- return(str);
-}
-
-/**************************************************************************
-Return a copy of the given string. The returned string must be freed
-using mem_free. */
-
-char*
-ut_strdup(
-/*======*/
- /* out, own: cnull-terminated string */
- char* str) /* in: null-terminated string */
-{
- ulint len;
- char* copy;
-
- len = ut_strlen(str);
-
- copy = mem_alloc(len + 1);
-
- ut_memcpy(copy, str, len);
-
- copy[len] = 0;
-
- return(copy);
-}
diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h
index 1c1ff9bac10..1d4f45b729f 100644
--- a/libmysql/client_settings.h
+++ b/libmysql/client_settings.h
@@ -42,7 +42,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
-MYSQL *
+MYSQL * STDCALL
cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag);
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 4ecc1bd0584..a467b7fc9fd 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -831,7 +831,8 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
}
/* initialize local infile (open file, usually) */
- if ((*options->local_infile_init)(&li_ptr, net_filename))
+ if ((*options->local_infile_init)(&li_ptr, net_filename,
+ options->local_infile_userdata))
{
my_net_write(net,"",0); /* Server needs one packet */
net_flush(net);
@@ -915,7 +916,8 @@ typedef struct st_default_local_infile
1 error
*/
-static int default_local_infile_init(void **ptr, const char *filename)
+static int default_local_infile_init(void **ptr, const char *filename,
+ void *userdata __attribute__ ((unused)))
{
default_local_infile_data *data;
char tmp_name[FN_REFLEN];
@@ -1025,15 +1027,18 @@ default_local_infile_error(void *ptr, char *error_msg, uint error_msg_len)
void
mysql_set_local_infile_handler(MYSQL *mysql,
- int (*local_infile_init)(void **, const char *),
+ int (*local_infile_init)(void **, const char *,
+ void *),
int (*local_infile_read)(void *, char *, uint),
void (*local_infile_end)(void *),
- int (*local_infile_error)(void *, char *, uint))
+ int (*local_infile_error)(void *, char *, uint),
+ void *userdata)
{
mysql->options.local_infile_init= local_infile_init;
mysql->options.local_infile_read= local_infile_read;
mysql->options.local_infile_end= local_infile_end;
mysql->options.local_infile_error= local_infile_error;
+ mysql->options.local_infile_userdata = userdata;
}
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index 0b6416632b7..7d83023abd5 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -295,7 +295,7 @@ uint emb_count_querycache_size(THD *thd)
cur_row= thd->data->data;
n_rows= thd->data->rows;
}
- result= 4+8 + (42 + 4*n_rows)*mysql->field_count;
+ result= (uint) (4+8 + (42 + 4*n_rows)*mysql->field_count);
for(; field < field_end; field++)
{
@@ -414,8 +414,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
goto err;
thd->data= data;
init_alloc_root(&data->alloc, 8192,0);
- row= (MYSQL_ROWS *)alloc_root(&data->alloc, rows * sizeof(MYSQL_ROWS) +
- rows * (mysql->field_count+1)*sizeof(char*));
+ row= (MYSQL_ROWS *)alloc_root(&data->alloc, (uint) (rows * sizeof(MYSQL_ROWS) +
+ rows * (mysql->field_count+1)*sizeof(char*)));
end_row= row + rows;
columns= (MYSQL_ROW)end_row;
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index fe56926039d..b3db54d305a 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -1,11 +1,16 @@
-noinst_PROGRAMS = mysqltest mysql
+noinst_PROGRAMS = mysqltest mysql client_test
client_sources = $(mysqltest_SOURCES) $(mysql_SOURCES)
+tests_sources= $(client_test_SOURCES)
link_sources:
for f in $(client_sources); do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../../client/$$f $(srcdir)/$$f; \
done;
+ for f in $(tests_sources); do \
+ rm -f $(srcdir)/$$f; \
+ @LN_CP_F@ $(srcdir)/../../tests/$$f $(srcdir)/$$f; \
+ done;
DEFS = -DEMBEDDED_LIBRARY
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
@@ -21,8 +26,12 @@ mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
+client_test_LINK = $(CXXLINK)
+client_test_SOURCES = client_test.c
+
clean:
rm -f $(client_sources)
+ rm -f $(tests_sources)
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 2c4661c4d3e..53cf87b24b4 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1151,3 +1151,84 @@ int mi_open_keyfile(MYISAM_SHARE *share)
return 1;
return 0;
}
+
+
+/*
+ Disable all indexes.
+
+ SYNOPSIS
+ mi_disable_indexes()
+ info A pointer to the MyISAM storage engine MI_INFO struct.
+
+ DESCRIPTION
+ Disable all indexes.
+
+ RETURN
+ 0 ok
+*/
+
+int mi_disable_indexes(MI_INFO *info)
+{
+ MYISAM_SHARE *share= info->s;
+
+ share->state.key_map= 0;
+ return 0;
+}
+
+
+/*
+ Enable all indexes
+
+ SYNOPSIS
+ mi_enable_indexes()
+ info A pointer to the MyISAM storage engine MI_INFO struct.
+
+ DESCRIPTION
+ Enable all indexes. The indexes might have been disabled
+ by mi_disable_index() before.
+ The function works only if both data and indexes are empty,
+ otherwise a repair is required.
+ To be sure, call handler::delete_all_rows() before.
+
+ RETURN
+ 0 ok
+ HA_ERR_CRASHED data or index is non-empty.
+*/
+
+int mi_enable_indexes(MI_INFO *info)
+{
+ int error= 0;
+ MYISAM_SHARE *share= info->s;
+
+ if (share->state.state.data_file_length ||
+ (share->state.state.key_file_length != share->base.keystart))
+ error= HA_ERR_CRASHED;
+ else
+ share->state.key_map= ((ulonglong) 1L << share->base.keys) - 1;
+ return error;
+}
+
+
+/*
+ Test if indexes are disabled.
+
+ SYNOPSIS
+ mi_indexes_are_disabled()
+ info A pointer to the MyISAM storage engine MI_INFO struct.
+
+ DESCRIPTION
+ Test if indexes are disabled.
+
+ RETURN
+ 0 indexes are not disabled
+ 1 all indexes are disabled
+ [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+*/
+
+int mi_indexes_are_disabled(MI_INFO *info)
+{
+ MYISAM_SHARE *share= info->s;
+
+ return (! share->state.key_map && share->base.keys);
+}
+
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 0f43fe7fb61..1f100590049 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -684,6 +684,9 @@ uint mi_uniquedef_write(File file, MI_UNIQUEDEF *keydef);
char *mi_uniquedef_read(char *ptr, MI_UNIQUEDEF *keydef);
uint mi_recinfo_write(File file, MI_COLUMNDEF *recinfo);
char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo);
+extern int mi_disable_indexes(MI_INFO *info);
+extern int mi_enable_indexes(MI_INFO *info);
+extern int mi_indexes_are_disabled(MI_INFO *info);
ulong _my_calc_total_blob_length(MI_INFO *info, const byte *record);
ha_checksum mi_checksum(MI_INFO *info, const byte *buf);
ha_checksum mi_static_checksum(MI_INFO *info, const byte *buf);
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 9541fa6d355..66b24248cf9 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -142,7 +142,7 @@ explain extended select last_insert_id();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache last_insert_id() AS `last_insert_id()`
+Note 1003 select sql_no_cache last_insert_id() AS `last_insert_id()`
insert into t1 set i = 254;
ERROR 23000: Duplicate entry '254' for key 1
select last_insert_id();
diff --git a/mysql-test/r/bench_count_distinct.result b/mysql-test/r/bench_count_distinct.result
index 2b4701389db..fcc0c0948b3 100644
--- a/mysql-test/r/bench_count_distinct.result
+++ b/mysql-test/r/bench_count_distinct.result
@@ -7,5 +7,5 @@ explain extended select count(distinct n) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL n 4 NULL 200 Using index
Warnings:
-Note 1003 select high_priority count(distinct test.t1.n) AS `count(distinct n)` from test.t1
+Note 1003 select count(distinct test.t1.n) AS `count(distinct n)` from test.t1
drop table t1;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 14b1788ddd6..1aa838140fd 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -27,7 +27,7 @@ explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" E
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
+Note 1003 select (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
two
@@ -66,7 +66,7 @@ explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase,
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
Warnings:
-Note 1003 select high_priority (case test.t1.a when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from test.t1 group by (case test.t1.a when 1 then 2 when 2 then 3 else 0 end)
+Note 1003 select (case test.t1.a when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from test.t1 group by (case test.t1.a when 1 then 2 when 2 then 3 else 0 end)
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
fcase count(*)
nothing 2
@@ -141,7 +141,7 @@ COALESCE('a' COLLATE latin1_bin,'b');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
+Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index cdeb5b3dc21..6564a3e392b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -20,7 +20,7 @@ explain extended select ~5, cast(~5 as signed);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
+Note 1003 select ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
select cast(5 as unsigned) -6.0;
cast(5 as unsigned) -6.0
-1.0
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index 8f4ddedbfcf..d4a8beda185 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -519,7 +519,7 @@ explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
+Note 1003 select charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'collation_client';
Variable_name Value
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
new file mode 100644
index 00000000000..a8182438ac4
--- /dev/null
+++ b/mysql-test/r/ctype_latin1.result
@@ -0,0 +1,298 @@
+drop table if exists t1;
+SET NAMES latin1;
+CREATE TABLE t1 (a char(1) character set latin1);
+INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
+INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
+INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
+INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
+INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
+INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
+INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
+INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
+INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
+INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
+INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
+INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
+INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
+INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
+INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
+INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
+INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
+INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
+INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
+INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
+INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
+INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
+INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
+INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
+SELECT
+hex(a),
+hex(@u:=convert(a using utf8)),
+hex(@l:=convert(@u using latin1)),
+a=@l FROM t1;
+hex(a) hex(@u:=convert(a using utf8)) hex(@l:=convert(@u using latin1)) a=@l
+00 00 00 1
+01 01 01 1
+02 02 02 1
+03 03 03 1
+04 04 04 1
+05 05 05 1
+06 06 06 1
+07 07 07 1
+08 08 08 1
+09 09 09 1
+0A 0A 0A 1
+0B 0B 0B 1
+0C 0C 0C 1
+0D 0D 0D 1
+0E 0E 0E 1
+0F 0F 0F 1
+10 10 10 1
+11 11 11 1
+12 12 12 1
+13 13 13 1
+14 14 14 1
+15 15 15 1
+16 16 16 1
+17 17 17 1
+18 18 18 1
+19 19 19 1
+1A 1A 1A 1
+1B 1B 1B 1
+1C 1C 1C 1
+1D 1D 1D 1
+1E 1E 1E 1
+1F 1F 1F 1
+ 1
+21 21 21 1
+22 22 22 1
+23 23 23 1
+24 24 24 1
+25 25 25 1
+26 26 26 1
+27 27 27 1
+28 28 28 1
+29 29 29 1
+2A 2A 2A 1
+2B 2B 2B 1
+2C 2C 2C 1
+2D 2D 2D 1
+2E 2E 2E 1
+2F 2F 2F 1
+30 30 30 1
+31 31 31 1
+32 32 32 1
+33 33 33 1
+34 34 34 1
+35 35 35 1
+36 36 36 1
+37 37 37 1
+38 38 38 1
+39 39 39 1
+3A 3A 3A 1
+3B 3B 3B 1
+3C 3C 3C 1
+3D 3D 3D 1
+3E 3E 3E 1
+3F 3F 3F 1
+40 40 40 1
+41 41 41 1
+42 42 42 1
+43 43 43 1
+44 44 44 1
+45 45 45 1
+46 46 46 1
+47 47 47 1
+48 48 48 1
+49 49 49 1
+4A 4A 4A 1
+4B 4B 4B 1
+4C 4C 4C 1
+4D 4D 4D 1
+4E 4E 4E 1
+4F 4F 4F 1
+50 50 50 1
+51 51 51 1
+52 52 52 1
+53 53 53 1
+54 54 54 1
+55 55 55 1
+56 56 56 1
+57 57 57 1
+58 58 58 1
+59 59 59 1
+5A 5A 5A 1
+5B 5B 5B 1
+5C 5C 5C 1
+5D 5D 5D 1
+5E 5E 5E 1
+5F 5F 5F 1
+60 60 60 1
+61 61 61 1
+62 62 62 1
+63 63 63 1
+64 64 64 1
+65 65 65 1
+66 66 66 1
+67 67 67 1
+68 68 68 1
+69 69 69 1
+6A 6A 6A 1
+6B 6B 6B 1
+6C 6C 6C 1
+6D 6D 6D 1
+6E 6E 6E 1
+6F 6F 6F 1
+70 70 70 1
+71 71 71 1
+72 72 72 1
+73 73 73 1
+74 74 74 1
+75 75 75 1
+76 76 76 1
+77 77 77 1
+78 78 78 1
+79 79 79 1
+7A 7A 7A 1
+7B 7B 7B 1
+7C 7C 7C 1
+7D 7D 7D 1
+7E 7E 7E 1
+7F 7F 7F 1
+80 E282AC 80 1
+81 3F 3F 0
+82 E2809A 82 1
+83 C692 83 1
+84 E2809E 84 1
+85 E280A6 85 1
+86 E280A0 86 1
+87 E280A1 87 1
+88 CB86 88 1
+89 E280B0 89 1
+8A C5A0 8A 1
+8B E280B9 8B 1
+8C C592 8C 1
+8D 3F 3F 0
+8E C5BD 8E 1
+8F 3F 3F 0
+90 3F 3F 0
+91 E28098 91 1
+92 E28099 92 1
+93 E2809C 93 1
+94 E2809D 94 1
+95 E280A2 95 1
+96 E28093 96 1
+97 E28094 97 1
+98 CB9C 98 1
+99 E284A2 99 1
+9A C5A1 9A 1
+9B E280BA 9B 1
+9C C593 9C 1
+9D 3F 3F 0
+9E C5BE 9E 1
+9F C5B8 9F 1
+A0 C2A0 A0 1
+A1 C2A1 A1 1
+A2 C2A2 A2 1
+A3 C2A3 A3 1
+A4 C2A4 A4 1
+A5 C2A5 A5 1
+A6 C2A6 A6 1
+A7 C2A7 A7 1
+A8 C2A8 A8 1
+A9 C2A9 A9 1
+AA C2AA AA 1
+AB C2AB AB 1
+AC C2AC AC 1
+AD C2AD AD 1
+AE C2AE AE 1
+AF C2AF AF 1
+B0 C2B0 B0 1
+B1 C2B1 B1 1
+B2 C2B2 B2 1
+B3 C2B3 B3 1
+B4 C2B4 B4 1
+B5 C2B5 B5 1
+B6 C2B6 B6 1
+B7 C2B7 B7 1
+B8 C2B8 B8 1
+B9 C2B9 B9 1
+BA C2BA BA 1
+BB C2BB BB 1
+BC C2BC BC 1
+BD C2BD BD 1
+BE C2BE BE 1
+BF C2BF BF 1
+C0 C380 C0 1
+C1 C381 C1 1
+C2 C382 C2 1
+C3 C383 C3 1
+C4 C384 C4 1
+C5 C385 C5 1
+C6 C386 C6 1
+C7 C387 C7 1
+C8 C388 C8 1
+C9 C389 C9 1
+CA C38A CA 1
+CB C38B CB 1
+CC C38C CC 1
+CD C38D CD 1
+CE C38E CE 1
+CF C38F CF 1
+D0 C390 D0 1
+D1 C391 D1 1
+D2 C392 D2 1
+D3 C393 D3 1
+D4 C394 D4 1
+D5 C395 D5 1
+D6 C396 D6 1
+D7 C397 D7 1
+D8 C398 D8 1
+D9 C399 D9 1
+DA C39A DA 1
+DB C39B DB 1
+DC C39C DC 1
+DD C39D DD 1
+DE C39E DE 1
+DF C39F DF 1
+E0 C3A0 E0 1
+E1 C3A1 E1 1
+E2 C3A2 E2 1
+E3 C3A3 E3 1
+E4 C3A4 E4 1
+E5 C3A5 E5 1
+E6 C3A6 E6 1
+E7 C3A7 E7 1
+E8 C3A8 E8 1
+E9 C3A9 E9 1
+EA C3AA EA 1
+EB C3AB EB 1
+EC C3AC EC 1
+ED C3AD ED 1
+EE C3AE EE 1
+EF C3AF EF 1
+F0 C3B0 F0 1
+F1 C3B1 F1 1
+F2 C3B2 F2 1
+F3 C3B3 F3 1
+F4 C3B4 F4 1
+F5 C3B5 F5 1
+F6 C3B6 F6 1
+F7 C3B7 F7 1
+F8 C3B8 F8 1
+F9 C3B9 F9 1
+FA C3BA FA 1
+FB C3BB FB 1
+FC C3BC FC 1
+FD C3BD FD 1
+FE C3BE FE 1
+FF C3BF FF 1
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 7209c86bb31..ed59de87395 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -82,6 +82,13 @@ Field Type Null Key Default Extra
SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂÌÉÃÁ;
SET CHARACTER SET default;
+SET NAMES UTF8;
+CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
+INSERT INTO t1 (t) VALUES ('x');
+SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
+1
+1
+DROP TABLE t1;
SET CHARACTER SET koi8r;
CREATE DATABASE ÔÅÓÔ;
USE ÔÅÓÔ;
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index fba1d9f47e3..b73953823ca 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -331,7 +331,7 @@ explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM",
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
+Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
create table t1 (d date);
insert into t1 values ('2004-07-14'),('2005-07-14');
select date_format(d,"%d") from t1 order by 1;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 02e1ace71e1..d66dec741bd 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -44,3 +44,12 @@ explain select count(*) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1;
+set names koi8r;
+create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
+insert into ÔÁÂ (ËÏÌ0) values (1);
+insert into ÔÁÂ (ËÏÌ0) values (2);
+explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE ÔÁÂ ref ÉÎÄ0,ÉÎÄ01 ÉÎÄ0 5 const 1 Using where; Using index
+drop table ÔÁÂ;
+set names latin1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 02850e4d902..f93f7401081 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -17,7 +17,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Full-text indexes are called collections
@@ -78,7 +78,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'support -collections' in boolean mode))
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'support -collections' in boolean mode))
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
a b
MySQL has now support for full-text search
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 61aa1c0a497..ef03ec71c69 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -11,7 +11,7 @@ explain extended select uncompress(compress(@test_compress_string));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
+Note 1003 select sql_no_cache uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
@@ -19,7 +19,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
+Note 1003 select sql_no_cache (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 70ebcf216fb..2ee3e770a2e 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -91,4 +91,4 @@ explain extended select password('idkfa '), old_password('idkfa');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
+Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result
index fe3f5b9473a..2993d79a870 100644
--- a/mysql-test/r/func_default.result
+++ b/mysql-test/r/func_default.result
@@ -8,7 +8,7 @@ explain extended select default(str), default(strnull), default(intg), default(r
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 select high_priority default(test.t1.str) AS `default(str)`,default(test.t1.strnull) AS `default(strnull)`,default(test.t1.intg) AS `default(intg)`,default(test.t1.rel) AS `default(rel)` from test.t1
+Note 1003 select default(test.t1.str) AS `default(str)`,default(test.t1.strnull) AS `default(strnull)`,default(test.t1.intg) AS `default(intg)`,default(test.t1.rel) AS `default(rel)` from test.t1
select * from t1 where str <> default(str);
str strnull intg rel
0 0
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index dccd87e3d75..fdde8f766a9 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -18,7 +18,7 @@ explain extended select grp,group_concat(c) from t1 group by grp;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
-Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
+Note 1003 select test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
select grp,group_concat(a,c) from t1 group by grp;
grp group_concat(a,c)
1 1a
@@ -93,7 +93,7 @@ explain extended select grp,group_concat(distinct c order by c desc) from t1 gro
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
-Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
+Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
select grp,group_concat(c order by c separator ",") from t1 group by grp;
grp group_concat(c order by c separator ",")
1 a
@@ -113,7 +113,7 @@ explain extended select grp,group_concat(distinct c order by c separator ",") fr
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
Warnings:
-Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
+Note 1003 select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
grp group_concat(distinct c order by c desc separator ",")
1 a
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 57b109e1ee6..bd5646f4068 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -265,7 +265,7 @@ explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
Warnings:
-Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
+Note 1003 select sql_big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
drop table t1;
create table t1 (col int);
insert into t1 values (-1), (-2), (-3);
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 0a04585d77d..ce26a0bf30a 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
Warnings:
-Note 1003 select high_priority if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY'))
+Note 1003 select if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY'))
select nullif(u=0, 'test') from t1;
nullif(u=0, 'test')
NULL
@@ -57,7 +57,7 @@ explain extended select nullif(u=0, 'test') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7
Warnings:
-Note 1003 select high_priority nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
+Note 1003 select nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
drop table t1;
select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test");
NULLIF(NULL,NULL) NULLIF(NULL,1) NULLIF(NULL,1.0) NULLIF(NULL,"test")
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 04b6fc038b0..f66b3dea94b 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
drop table t1;
select '1.0' in (1,2);
'1.0' in (1,2)
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 9085849e582..12eef4aa881 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -5,7 +5,7 @@ explain extended select floor(5.5),floor(-5.5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
+Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
select ceiling(5.5),ceiling(-5.5);
ceiling(5.5) ceiling(-5.5)
6 -5
@@ -13,7 +13,7 @@ explain extended select ceiling(5.5),ceiling(-5.5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
+Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
52.6 52.64 50 0 -52.6 -50
@@ -21,7 +21,7 @@ explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),t
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
+Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
select round(5.5),round(-5.5);
round(5.5) round(-5.5)
6 -6
@@ -29,7 +29,7 @@ explain extended select round(5.5),round(-5.5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
+Note 1003 select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
5.6 5.64 10 0
@@ -40,7 +40,7 @@ explain extended select abs(-10), sign(-5), sign(5), sign(0);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
+Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
10.000000 10.000000 NULL NULL NULL 2.000000 NULL NULL
@@ -48,7 +48,7 @@ explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
+Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
10.000000 10.000000 NULL NULL NULL
@@ -56,7 +56,7 @@ explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
+Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3.000000 3.906891 NULL NULL NULL
@@ -64,7 +64,7 @@ explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
+Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2.000000 1.255273 NULL NULL NULL
@@ -72,7 +72,7 @@ explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
+Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
10.000000 16.000000
@@ -80,7 +80,7 @@ explain extended select pow(10,log10(10)),power(2,4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
+Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
rand(999999) rand()
@@ -89,7 +89,7 @@ explain extended select rand(999999),rand();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()`
+Note 1003 select sql_no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()`
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
@@ -97,7 +97,7 @@ explain extended select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority pi() AS `pi()`,sin((pi() / 2)) AS `sin(pi()/2)`,cos((pi() / 2)) AS `cos(pi()/2)`,abs(tan(pi())) AS `abs(tan(pi()))`,(1 / tan(1)) AS `cot(1)`,asin(1) AS `asin(1)`,acos(0) AS `acos(0)`,atan(1) AS `atan(1)`
+Note 1003 select pi() AS `pi()`,sin((pi() / 2)) AS `sin(pi()/2)`,cos((pi() / 2)) AS `cos(pi()/2)`,abs(tan(pi())) AS `abs(tan(pi()))`,(1 / tan(1)) AS `cot(1)`,asin(1) AS `asin(1)`,acos(0) AS `acos(0)`,atan(1) AS `atan(1)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.2831853071796
@@ -123,4 +123,4 @@ explain extended select degrees(pi()),radians(360);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
+Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index fb1e715ac3b..6cd975b0911 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -5,7 +5,7 @@ explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
+Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
select 1 | (1+1),5 & 3,bit_count(7) ;
1 | (1+1) 5 & 3 bit_count(7)
3 1 3
@@ -13,7 +13,7 @@ explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
+Note 1003 select (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
4294967296 9223372036854775808 0 1 0 8
diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result
index 323642cab8c..7f977e2782b 100644
--- a/mysql-test/r/func_regexp.result
+++ b/mysql-test/r/func_regexp.result
@@ -40,7 +40,7 @@ explain extended select * from t1 where xxx regexp('is a test of some long text
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 select high_priority test.t1.xxx AS `xxx` from test.t1 where (test.t1.xxx regexp _latin1'is a test of some long text to')
+Note 1003 select test.t1.xxx AS `xxx` from test.t1 where (test.t1.xxx regexp _latin1'is a test of some long text to')
select * from t1 where xxx regexp('is a test of some long text to ');
xxx
this is a test of some long text to see what happens
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index b101c18f505..4918617f85f 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
+Note 1003 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56)
1
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 216e2ed26f2..4e7df9edefa 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -622,7 +622,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
+Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#")
12345
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 338902e3f3a..671132428c5 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -41,7 +41,7 @@ explain extended select database(), user();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache database() AS `database()`,user() AS `user()`
+Note 1003 select sql_no_cache database() AS `database()`,user() AS `user()`
create table t1 (version char(40)) select database(), user(), version() as 'version';
show create table t1;
Table Create Table
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 3a945c0826f..c3fe1de15db 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -48,7 +48,7 @@ explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
+Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
@@ -62,7 +62,7 @@ explain extended select 10 % 7, 10 mod 7, 10 div 3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
+Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
@@ -70,7 +70,7 @@ explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
+Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
@@ -79,7 +79,7 @@ explain extended select * from t1 where 1 xor 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select high_priority test.t1.a AS `a` from test.t1 where (1 xor 1)
+Note 1003 select test.t1.a AS `a` from test.t1 where (1 xor 1)
select - a from t1;
- a
-1
@@ -87,7 +87,7 @@ explain extended select - a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 select high_priority -(test.t1.a) AS `- a` from test.t1
+Note 1003 select -(test.t1.a) AS `- a` from test.t1
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
@@ -108,7 +108,7 @@ explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
+Note 1003 select (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
0
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index b37df0aef2c..6f1b4af5d3c 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -584,7 +584,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
+Note 1003 select sql_no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
SET @TMP=NOW();
CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES (NOW());
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index be33c05c578..c2fd7855c85 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -228,7 +228,7 @@ explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelo
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21
Warnings:
-Note 1003 select high_priority dimension(test.gis_geometry.g) AS `Dimension(g)`,geometrytype(test.gis_geometry.g) AS `GeometryType(g)`,isempty(test.gis_geometry.g) AS `IsEmpty(g)`,astext(envelope(test.gis_geometry.g)) AS `AsText(Envelope(g))` from test.gis_geometry
+Note 1003 select dimension(test.gis_geometry.g) AS `Dimension(g)`,geometrytype(test.gis_geometry.g) AS `GeometryType(g)`,isempty(test.gis_geometry.g) AS `IsEmpty(g)`,astext(envelope(test.gis_geometry.g)) AS `AsText(Envelope(g))` from test.gis_geometry
SELECT fid, X(g) FROM gis_point;
fid X(g)
101 10
@@ -245,7 +245,7 @@ explain extended select X(g),Y(g) FROM gis_point;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4
Warnings:
-Note 1003 select high_priority x(test.gis_point.g) AS `X(g)`,y(test.gis_point.g) AS `Y(g)` from test.gis_point
+Note 1003 select x(test.gis_point.g) AS `X(g)`,y(test.gis_point.g) AS `Y(g)` from test.gis_point
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
fid AsText(StartPoint(g))
105 POINT(0 0)
@@ -280,7 +280,7 @@ explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),Num
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority astext(startpoint(test.gis_line.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.gis_line.g)) AS `AsText(EndPoint(g))`,glength(test.gis_line.g) AS `GLength(g)`,numpoints(test.gis_line.g) AS `NumPoints(g)`,astext(pointn(test.gis_line.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.gis_line.g) AS `IsClosed(g)` from test.gis_line
+Note 1003 select astext(startpoint(test.gis_line.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.gis_line.g)) AS `AsText(EndPoint(g))`,glength(test.gis_line.g) AS `GLength(g)`,numpoints(test.gis_line.g) AS `NumPoints(g)`,astext(pointn(test.gis_line.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.gis_line.g) AS `IsClosed(g)` from test.gis_line
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
fid AsText(Centroid(g))
108 POINT(15 15)
@@ -310,7 +310,7 @@ explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumI
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority astext(centroid(test.gis_polygon.g)) AS `AsText(Centroid(g))`,area(test.gis_polygon.g) AS `Area(g)`,astext(exteriorring(test.gis_polygon.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.gis_polygon.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.gis_polygon.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.gis_polygon
+Note 1003 select astext(centroid(test.gis_polygon.g)) AS `AsText(Centroid(g))`,area(test.gis_polygon.g) AS `Area(g)`,astext(exteriorring(test.gis_polygon.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.gis_polygon.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.gis_polygon.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.gis_polygon
SELECT fid, IsClosed(g) FROM gis_multi_line;
fid IsClosed(g)
114 0
@@ -349,7 +349,7 @@ explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority test.gis_multi_point.fid AS `fid`,numgeometries(test.gis_multi_point.g) AS `NumGeometries(g)` from test.gis_multi_point
+Note 1003 select test.gis_multi_point.fid AS `fid`,numgeometries(test.gis_multi_point.g) AS `NumGeometries(g)` from test.gis_multi_point
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
fid AsText(GeometryN(g, 2))
111 POINT(10 10)
@@ -377,7 +377,7 @@ explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority test.gis_multi_point.fid AS `fid`,astext(geometryn(test.gis_multi_point.g,2)) AS `AsText(GeometryN(g, 2))` from test.gis_multi_point
+Note 1003 select test.gis_multi_point.fid AS `fid`,astext(geometryn(test.gis_multi_point.g,2)) AS `AsText(GeometryN(g, 2))` from test.gis_multi_point
SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@@ -397,7 +397,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 2
Warnings:
-Note 1003 select high_priority test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gis_geometrycollection g1 join test.gis_geometrycollection g2 order by test.g1.fid,test.g2.fid
+Note 1003 select test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gis_geometrycollection g1 join test.gis_geometrycollection g2 order by test.g1.fid,test.g2.fid
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
gp point,
@@ -439,12 +439,12 @@ explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
+Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
+Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
@@ -452,12 +452,12 @@ explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
+Note 1003 select srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
+Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 8b3948e093f..c47530cdc46 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -204,3 +204,27 @@ show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
drop user mysqltest_1@localhost;
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index bbe3326fd34..9af7304c167 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -288,7 +288,7 @@ explain extended select sql_big_result spid,sum(userid) from t1 group by spid de
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
Warnings:
-Note 1003 select high_priority big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
+Note 1003 select sql_big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 7c88776579b..010e86273a2 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select high_priority count(test.t1.a) AS `b` from test.t1 where (test.t1.a = 0) having (count(test.t1.a) >= 0)
+Note 1003 select count(test.t1.a) AS `b` from test.t1 where (test.t1.a = 0) having (count(test.t1.a) >= 0)
drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 3c36571a8c2..60280715911 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1443,3 +1443,101 @@ drop table t1;
create table t1 (a int) engine=innodb;
create table t2 like t1;
drop table t1,t2;
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id2 on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ KEY `id2` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop index id2 on t2;
+drop index id on t2;
+Got one of the listed errors
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create unique index id on t2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
+ERROR HY000: Can't create table './test/t2.frm' (errno: 150)
+drop table t1;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 53867bf4546..303d7186015 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -60,12 +60,12 @@ explain extended SELECT *, VALUES(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
explain extended select * from t1 where values(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
+Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
DROP TABLE t1;
create table t1(a int primary key, b int);
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index cbd949d6e72..7391f4192bf 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -6,7 +6,7 @@ explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnu
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
+Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
1 | NULL 1 & NULL 1+NULL 1-NULL
NULL NULL NULL NULL
@@ -32,7 +32,7 @@ explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
+Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
NULL NULL NULL NULL NULL NULL
@@ -49,7 +49,7 @@ explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),ine
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
+Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
create table t1 (x int);
insert into t1 values (null);
select * from t1 where x != 0;
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result
index 37e68d8b13e..50048808c39 100644
--- a/mysql-test/r/olap.result
+++ b/mysql-test/r/olap.result
@@ -85,7 +85,7 @@ explain extended select product, country_id , year, sum(profit) from t1 group by
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
Warnings:
-Note 1003 select high_priority test.t1.product AS `product`,test.t1.country_id AS `country_id`,test.t1.year AS `year`,sum(test.t1.profit) AS `sum(profit)` from test.t1 group by test.t1.product,test.t1.country_id,test.t1.year with rollup
+Note 1003 select test.t1.product AS `product`,test.t1.country_id AS `country_id`,test.t1.year AS `year`,sum(test.t1.profit) AS `sum(profit)` from test.t1 group by test.t1.product,test.t1.country_id,test.t1.year with rollup
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
product country_id sum(profit)
TV 1 400
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 8d03a7bbcf0..185961c53ff 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -305,7 +305,7 @@ explain extended select benchmark(1,1) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
+Note 1003 select sql_no_cache benchmark(1,1) AS `benchmark(1,1)` from test.t1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index d1a5dd00370..290e72d3b55 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -249,18 +249,14 @@ explain select count(*) from t1 where x in (1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range x x 5 NULL 2 Using where; Using index
drop table t1;
-CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
+CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1));
INSERT INTO t1 VALUES (0),(0),(1),(1);
CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref j1 j1 4 const 1 Using where; Using index
-1 SIMPLE t1 ALL i1,i2 NULL NULL NULL 4 Range checked for each record (index map: 0x3)
-explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref j1 j1 4 const 1 Using where; Using index
-1 SIMPLE t1 ALL i2 NULL NULL NULL 4 Range checked for each record (index map: 0x2)
+1 SIMPLE t1 ALL i1 NULL NULL NULL 4 Range checked for each record (index map: 0x1)
DROP TABLE t1,t2;
CREATE TABLE t1 (
a int(11) default NULL,
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 37d4f1d9b26..76d6fa13766 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -44,7 +44,7 @@ explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,N
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
+Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
SELECT (1,2,3)=(0,NULL,3);
(1,2,3)=(0,NULL,3)
0
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
index b8071b16c2e..b60cad18c54 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl000001.result
@@ -44,7 +44,7 @@ explain extended select get_lock("hold_slave",10);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache get_lock(_latin1'hold_slave',10) AS `get_lock("hold_slave",10)`
+Note 1003 select sql_no_cache get_lock(_latin1'hold_slave',10) AS `get_lock("hold_slave",10)`
start slave;
select release_lock("hold_slave");
release_lock("hold_slave")
@@ -53,7 +53,7 @@ explain extended select release_lock("hold_slave");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache release_lock(_latin1'hold_slave') AS `release_lock("hold_slave")`
+Note 1003 select sql_no_cache release_lock(_latin1'hold_slave') AS `release_lock("hold_slave")`
unlock tables;
create table t2(id int);
insert into t2 values(connection_id());
diff --git a/mysql-test/r/rpl_get_lock.result b/mysql-test/r/rpl_get_lock.result
index 8e3e335b2d0..2c57069e91a 100644
--- a/mysql-test/r/rpl_get_lock.result
+++ b/mysql-test/r/rpl_get_lock.result
@@ -25,7 +25,7 @@ explain extended select is_free_lock("lock"), is_used_lock("lock");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
+Note 1003 select sql_no_cache is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
select is_free_lock("lock2");
is_free_lock("lock2")
1
diff --git a/mysql-test/r/rpl_master_pos_wait.result b/mysql-test/r/rpl_master_pos_wait.result
index ea917805560..e92d1ffa361 100644
--- a/mysql-test/r/rpl_master_pos_wait.result
+++ b/mysql-test/r/rpl_master_pos_wait.result
@@ -11,7 +11,7 @@ explain extended select master_pos_wait('master-bin.999999',0,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
+Note 1003 select sql_no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
select master_pos_wait('master-bin.999999',0);
stop slave sql_thread;
master_pos_wait('master-bin.999999',0)
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 43c41378f30..8c783445127 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1470,7 +1470,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
Warnings:
-Note 1003 select high_priority count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
+Note 1003 select count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index a2210fde222..8fe447c59fd 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7,7 +7,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority 2 AS `(select 2)`
+Note 1003 select 2 AS `(select 2)`
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
@@ -19,7 +19,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1249 Select 2 was reduced during optimisation
Note 1249 Select 4 was reduced during optimisation
-Note 1003 select high_priority 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
+Note 1003 select 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
SELECT (SELECT (SELECT 0 UNION SELECT 0));
(SELECT (SELECT 0 UNION SELECT 0))
0
@@ -30,7 +30,7 @@ id select_type table type possible_keys key key_len ref rows Extra
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
+Note 1003 select (select 0 AS `0` union select 0 AS `0`) AS `(SELECT (SELECT 0 UNION SELECT 0))`
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
ERROR 42S22: Reference 'a' not supported (forward reference in item list)
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
@@ -48,7 +48,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select high_priority 1 AS `1` from (select 1 AS `a`) b having ((select b.a AS `a`) = 1)
+Note 1003 select 1 AS `1` from (select 1 AS `a`) b having ((select b.a AS `a`) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -183,7 +183,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 UNION t4 ALL NULL NULL NULL NULL 3 Using where; Using filesort
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
Warnings:
-Note 1003 (select high_priority test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by test.t4.a)
+Note 1003 (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.b = (select test.t3.a AS `a` from test.t3 order by test.t3.a desc limit 1))) union (select test.t4.a AS `a`,test.t4.b AS `b` from test.t4 where (test.t4.b = (select (max(test.t2.a) * 4) AS `max(t2.a)*4` from test.t2)) order by test.t4.a)
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -199,7 +199,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
Warnings:
-Note 1003 select high_priority (select test.t3.a AS `a` from test.t3 where (test.t3.a < 8) order by test.t3.a desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,tt.a AS `a` from (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a > 1)) tt
+Note 1003 select (select test.t3.a AS `a` from test.t3 where (test.t3.a < 8) order by test.t3.a desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,tt.a AS `a` from (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a > 1)) tt
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a
2
@@ -220,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1276 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select high_priority test.t4.b AS `b`,(select avg((test.t2.a + (select min(test.t3.a) AS `min(t3.a)` from test.t3 where (test.t3.a >= test.t4.a)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from test.t2) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from test.t4
+Note 1003 select test.t4.b AS `b`,(select avg((test.t2.a + (select min(test.t3.a) AS `min(t3.a)` from test.t3 where (test.t3.a >= test.t4.a)))) AS `avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))` from test.t2) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from test.t4
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -266,7 +266,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2))
+Note 1003 select test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2))
select * from t3 where a >= all (select b from t2);
a
7
@@ -309,7 +309,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1276 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select high_priority (select test.t1.a AS `a` from test.t1 where (test.t1.a = test.t2.a) union select test.t5.a AS `a` from test.t5 where (test.t5.a = test.t2.a)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,test.t2.a AS `a` from test.t2
+Note 1003 select (select test.t1.a AS `a` from test.t1 where (test.t1.a = test.t2.a) union select test.t5.a AS `a` from test.t5 where (test.t5.a = test.t2.a)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,test.t2.a AS `a` from test.t2
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -327,7 +327,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1
Warnings:
Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select high_priority test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq))
+Note 1003 select test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column: 'a' in field list is ambiguous
drop table if exists t1,t2,t3;
@@ -362,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t8 const PRIMARY PRIMARY 35 const 1
3 SUBQUERY t8 const PRIMARY PRIMARY 35 1 Using index
Warnings:
-Note 1003 select high_priority test.t8.pseudo AS `pseudo`,(select test.t8.email AS `email` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))
+Note 1003 select test.t8.pseudo AS `pseudo`,(select test.t8.email AS `email` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
@@ -388,13 +388,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 41 NULL 2 Using where; Using index
Warnings:
-Note 1003 select high_priority distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)
+Note 1003 select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 41 NULL 2 Using where; Using index
Warnings:
-Note 1003 select high_priority (select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct test.t1.date AS `date` from test.t1 where (test.t1.date = 20020803)) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -414,7 +414,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority 1 AS `1` from test.t1
+Note 1003 select 1 AS `1` from test.t1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -534,13 +534,13 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select high_priority max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
+Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select high_priority test.t1.numreponse AS `numreponse` from test.t1 where ((test.t1.numeropost = _latin1'1') and (test.t1.numreponse = 3))
+Note 1003 select test.t1.numreponse AS `numreponse` from test.t1 where ((test.t1.numeropost = _latin1'1') and (test.t1.numreponse = 3))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -708,7 +708,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ref id id 5 const 1 Using where; Using index
Warnings:
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority test.t2.id AS `id` from test.t2 where (test.t2.id = 1)
+Note 1003 select test.t2.id AS `id` from test.t2 where (test.t2.id = 1)
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -721,14 +721,14 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1249 Select 3 was reduced during optimisation
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority test.t2.id AS `id` from test.t2 where (test.t2.id = (1 + 1))
+Note 1003 select test.t2.id AS `id` from test.t2 where (test.t2.id = (1 + 1))
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
+Note 1003 select test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -854,7 +854,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1276 Field or reference 'a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimisation
-Note 1003 select high_priority (test.t1.a + 1) AS `(select a+1)` from test.t1
+Note 1003 select (test.t1.a + 1) AS `(select a+1)` from test.t1
select (select a+1) from t1;
(select a+1)
2.5
@@ -876,7 +876,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(<index_lookup>(<cache>(test.t1.a) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1
+Note 1003 select test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(<index_lookup>(<cache>(test.t1.a) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1
CREATE TABLE t3 (a int(11) default '0');
INSERT INTO t3 VALUES (1),(2),(3);
SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
@@ -891,7 +891,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
Warnings:
-Note 1003 select high_priority test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
+Note 1003 select test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
drop table t1,t2,t3;
create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
@@ -1001,19 +1001,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache (select no_cache rand() AS `RAND()` from test.t1) AS `(SELECT RAND() FROM t1)` from test.t1
+Note 1003 select sql_no_cache (select sql_no_cache rand() AS `RAND()` from test.t1) AS `(SELECT RAND() FROM t1)` from test.t1
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache (select no_cache ecrypt(_latin1'test') AS `ENCRYPT('test')` from test.t1) AS `(SELECT ENCRYPT('test') FROM t1)` from test.t1
+Note 1003 select sql_no_cache (select sql_no_cache ecrypt(_latin1'test') AS `ENCRYPT('test')` from test.t1) AS `(SELECT ENCRYPT('test') FROM t1)` from test.t1
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority no_cache (select no_cache benchmark(1,1) AS `BENCHMARK(1,1)` from test.t1) AS `(SELECT BENCHMARK(1,1) FROM t1)` from test.t1
+Note 1003 select sql_no_cache (select sql_no_cache benchmark(1,1) AS `BENCHMARK(1,1)` from test.t1) AS `(SELECT BENCHMARK(1,1) FROM t1)` from test.t1
drop table t1;
CREATE TABLE `t1` (
`mot` varchar(30) character set latin1 NOT NULL default '',
@@ -1108,7 +1108,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select high_priority no_cache test.t1.a AS `a`,(select no_cache (select no_cache rand() AS `rand()` from test.t1 limit 1) AS `(select rand() from t1 limit 1)` from test.t1 limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from test.t1
+Note 1003 select sql_no_cache test.t1.a AS `a`,(select sql_no_cache (select sql_no_cache rand() AS `rand()` from test.t1 limit 1) AS `(select rand() from t1 limit 1)` from test.t1 limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from test.t1
drop table t1;
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
ERROR 42S02: Table 'test.t1' doesn't exist
@@ -1162,7 +1162,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1172,7 +1172,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1216,7 +1216,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref salary salary 5 const 1 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select high_priority test.t1.id AS `id` from test.t1 where (test.t1.salary = (select max(test.t1.salary) AS `MAX(salary)` from test.t1))
+Note 1003 select test.t1.id AS `id` from test.t1 where (test.t1.salary = (select max(test.t1.salary) AS `MAX(salary)` from test.t1))
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1283,7 +1283,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY)))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1293,7 +1293,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY where (test.t1.b <> 30))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<primary_index_lookup>(<cache>(test.t2.a) in t1 on PRIMARY where (test.t1.b <> 30))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1304,7 +1304,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -1322,7 +1322,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a)))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1332,7 +1332,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1343,7 +1343,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1359,7 +1359,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
+Note 1003 select test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(<index_lookup>(<cache>(test.t2.a) in t1 on a where (test.t1.b <> 30))))
drop table t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1416,7 +1416,7 @@ explain extended (select * from t1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
-Note 1003 (select high_priority test.t1.s1 AS `s1` from test.t1)
+Note 1003 (select test.t1.s1 AS `s1` from test.t1)
(select * from t1);
s1
tttt
@@ -1450,25 +1450,25 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from test.t1
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from test.t1
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1
+Note 1003 select test.t1.s1 AS `s1`,not(<in_optimizer>(test.t1.s1,<exists>(<index_lookup>(<cache>(test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1
drop table t1,t2;
create table t2 (a int, b int);
create table t3 (a int);
@@ -1483,7 +1483,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
-Note 1003 select high_priority test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1494,7 +1494,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
Warnings:
-Note 1003 select high_priority test.t3.a AS `a` from test.t3 where <not>((test.t3.a <= <max>(select max(test.t2.b) AS `max(b)` from test.t2 group by test.t2.a)))
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a <= <max>(select max(test.t2.b) AS `max(b)` from test.t2 group by test.t2.a)))
drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
@@ -1659,14 +1659,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
Warnings:
-Note 1003 select high_priority test.t1.id AS `id`,test.t1.text AS `text` from test.t1 where not(<in_optimizer>(test.t1.id,<exists>(<primary_index_lookup>(<cache>(test.t1.id) in t1 on PRIMARY where (test.t1.id < 8)))))
+Note 1003 select test.t1.id AS `id`,test.t1.text AS `text` from test.t1 where not(<in_optimizer>(test.t1.id,<exists>(<primary_index_lookup>(<cache>(test.t1.id) in t1 on PRIMARY where (test.t1.id < 8)))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 7 Using where; Using index
Warnings:
Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select high_priority test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null)))
+Note 1003 select test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null)))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -1692,7 +1692,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 Using where
Warnings:
-Note 1003 select high_priority test.a.id AS `id`,test.a.text AS `text`,test.b.id AS `id`,test.b.text AS `text`,test.c.id AS `id`,test.c.text AS `text` from test.t1 a left join test.t2 b on(((test.a.id = test.b.id) or isnull(test.b.id))) join test.t1 c where (if(isnull(test.b.id),1000,test.b.id) = test.c.id)
+Note 1003 select test.a.id AS `id`,test.a.text AS `text`,test.b.id AS `id`,test.b.text AS `text`,test.c.id AS `id`,test.c.text AS `text` from test.t1 a left join test.t2 b on(((test.a.id = test.b.id) or isnull(test.b.id))) join test.t1 c where (if(isnull(test.b.id),1000,test.b.id) = test.c.id)
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -1719,3 +1719,92 @@ SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t
id c
1 1
2 0
+DROP TABLE t1,t2;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+DROP TABLE t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index e9861266b78..6792f2f4c2c 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -507,7 +507,7 @@ coercibility(load_file('../../std_data/words.dat'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
+Note 1003 select sql_no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
if(imagem is null, "ERROR", "OK") length(imagem)
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index a0c0e0f5503..71ac229601d 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -105,6 +105,18 @@ select min(a) from t1;
min(a)
-0.010
drop table t1;
+create table t1 (a float(200,100), b double(200,100));
+insert t1 values (1.0, 2.0);
+select * from t1;
+a b
+1.000000000000000000000000000000 2.000000000000000000000000000000
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` float(200,30) default NULL,
+ `b` double(200,30) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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/r/union.result b/mysql-test/r/union.result
index bf8b8df7c65..c85b59be38c 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
Warnings:
-Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
+Note 1003 (select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 limit 2) union all (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 order by test.t2.a limit 1) order by b desc
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
a b
1 a
@@ -476,7 +476,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
2 UNION t2 const PRIMARY PRIMARY 4 const 1
Warnings:
-Note 1003 (select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
+Note 1003 (select test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (test.t1.a = 1)) union (select test.t2.a AS `a`,test.t2.b AS `b` from test.t2 where (test.t2.a = 1))
(select * from t1 where a=5) union (select * from t2 where a=1);
a b
1 10
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index cf001158ae2..26ce91286da 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -15,7 +15,7 @@ explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const UNIQ UNIQ 8 const 1
Warnings:
-Note 1003 select high_priority test.t1.ID AS `ID`,test.t1.UNIQ AS `UNIQ` from test.t1 where (test.t1.UNIQ = 4084688022709641610)
+Note 1003 select test.t1.ID AS `ID`,test.t1.UNIQ AS `UNIQ` from test.t1 where (test.t1.UNIQ = 4084688022709641610)
drop table t1;
select x'hello';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index aaf977efe50..290b1fa41cf 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -26,7 +26,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
+Note 1003 select sql_no_cache (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
select @t5;
@t5
1.23456
@@ -85,7 +85,7 @@ explain extended select last_insert_id(345);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache last_insert_id(345) AS `last_insert_id(345)`
+Note 1003 select sql_no_cache last_insert_id(345) AS `last_insert_id(345)`
select @@IDENTITY,last_insert_id(), @@identity;
@@IDENTITY last_insert_id() @@identity
345 345 345
@@ -93,7 +93,7 @@ explain extended select @@IDENTITY,last_insert_id(), @@identity;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority no_cache 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
+Note 1003 select sql_no_cache 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
set global concurrent_insert=ON;
show variables like 'concurrent_insert';
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
new file mode 100644
index 00000000000..14062437428
--- /dev/null
+++ b/mysql-test/t/ctype_latin1.test
@@ -0,0 +1,55 @@
+#
+# Tests with the latin1 character set
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# WL 1494: Treat latin1 as cp1252 for unicode conversion
+#
+
+SET NAMES latin1;
+CREATE TABLE t1 (a char(1) character set latin1);
+INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
+INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
+INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
+INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
+INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
+INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
+INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
+INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
+INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
+INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
+INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
+INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
+INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
+INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
+INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
+INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
+INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
+INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
+INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
+INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
+INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
+INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
+INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
+INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
+
+#
+# 0x81 0x8D 0x8F 0x90 0x9D are undefined in cp1252
+#
+SELECT
+ hex(a),
+ hex(@u:=convert(a using utf8)),
+ hex(@l:=convert(@u using latin1)),
+ a=@l FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
index 40349da8aa9..8ac22e89c2d 100644
--- a/mysql-test/t/ctype_recoding.test
+++ b/mysql-test/t/ctype_recoding.test
@@ -56,6 +56,13 @@ SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂÌÉÃÁ;
SET CHARACTER SET default;
+# Test for Item_func_conv_charset::fix_fields (bug #3704)
+SET NAMES UTF8;
+CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
+INSERT INTO t1 (t) VALUES ('x');
+SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
+DROP TABLE t1;
+
SET CHARACTER SET koi8r;
CREATE DATABASE ÔÅÓÔ;
USE ÔÅÓÔ;
@@ -71,4 +78,3 @@ SET NAMES koi8r;
SELECT hex('ÔÅÓÔ');
SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');
-
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index ff1803368b9..050939e5ad2 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -30,3 +30,14 @@ explain select count(*) from t1;
insert into t1 values(1);
explain select count(*) from t1;
drop table t1;
+
+#
+# Bug #3403 Wrong encoding in EXPLAIN SELECT output
+#
+set names koi8r;
+create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
+insert into ÔÁÂ (ËÏÌ0) values (1);
+insert into ÔÁÂ (ËÏÌ0) values (2);
+explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
+drop table ÔÁÂ;
+set names latin1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 832541b0f86..6bd2fa0c703 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -148,3 +148,26 @@ grant usage on *.* to mysqltest_1@localhost identified by "password";
grant select, update, insert on test.* to mysqltest@localhost;
show grants for mysqltest_1@localhost;
drop user mysqltest_1@localhost;
+
+#
+# Bug #3403 Wrong encodin in SHOW GRANTS output
+#
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index e20be83b4b6..a260ab1263d 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1044,3 +1044,46 @@ drop table t1;
create table t1 (a int) engine=innodb;
create table t2 like t1;
drop table t1,t2;
+
+#
+# Test of automaticly created foreign keys
+#
+
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+show create table t2;
+create index id on t2 (id);
+show create table t2;
+create index id2 on t2 (id);
+show create table t2;
+drop index id2 on t2;
+--error 1025,1025
+drop index id on t2;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+create unique index id on t2 (id,id2);
+show create table t2;
+drop table t2;
+
+# Check foreign key columns created in different order than key columns
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+# Test error handling
+--error 1005
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
+
+drop table t1;
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
index b45df8eb58e..9d3125efa61 100644
--- a/mysql-test/t/key_cache.test
+++ b/mysql-test/t/key_cache.test
@@ -71,7 +71,7 @@ show status like 'key_blocks_used';
# Following results differs on 64 and 32 bit systems because of different
# pointer sizes, which takes up different amount of space in key cache
---replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
+--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
@@ -84,7 +84,7 @@ update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
show status like 'key_blocks_used';
---replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED
+--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
cache index t1 key (`primary`) in keycache1;
@@ -146,7 +146,7 @@ cache index t1,t2 in default;
drop table t1,t2,t3;
show status like 'key_blocks_used';
---replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
+--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED
show status like 'key_blocks_unused';
# Cleanup
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 51b1f34ee79..4665cd02ed8 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -197,12 +197,11 @@ drop table t1;
#
# bug #1172
#
-CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
+CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1));
INSERT INTO t1 VALUES (0),(0),(1),(1);
CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
-explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
DROP TABLE t1,t2;
#
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 1b5bb807b97..94389963ae6 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1125,4 +1125,36 @@ INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1);
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
-DROP TABLE t1,t2
+DROP TABLE t1,t2;
+
+#
+# ALL/ANY test
+#
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+DROP TABLE t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index caccf31b32a..7d3b90aabeb 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -54,6 +54,12 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;
+create table t1 (a float(200,100), b double(200,100));
+insert t1 values (1.0, 2.0);
+select * from t1;
+show create table t1;
+drop table t1;
+
# Errors
--error 1063
diff --git a/mysys/my_lock.c b/mysys/my_lock.c
index 5058c301adb..8f915d6003a 100644
--- a/mysys/my_lock.c
+++ b/mysys/my_lock.c
@@ -117,10 +117,12 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
#if defined(HAVE_FCNTL)
{
struct flock lock;
- lock.l_type= (short) locktype;
- lock.l_whence=0L;
- lock.l_start=(long) start;
- lock.l_len=(long) length;
+
+ lock.l_type= (short) locktype;
+ lock.l_whence= SEEK_SET;
+ lock.l_start= (off_t) start;
+ lock.l_len= (off_t) length;
+
if (MyFlags & MY_DONT_WAIT)
{
if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */
diff --git a/ndb/Defs.mk b/ndb/Defs.mk
index d5a21c64ca9..ac4507562fd 100644
--- a/ndb/Defs.mk
+++ b/ndb/Defs.mk
@@ -21,62 +21,42 @@ LIBPREFIX := lib
fixpath = $1
ar_rcs = $(AR_RCS) $1 $2
#check-odbc = $(findstring sqlext.h, $(wildcard /usr/include/sqlext.h) $(wildcard /usr/local/include/sqlext.h))
-CCFLAGS_TOP += -DHAVE_STRCASECMP
-
endif
ifeq ($(NDB_OS), WIN32)
-CCFLAGS_TOP += -DHAVE_STRDUP
-NDB_STRLCPY := Y
-NDB_STRLCAT := Y
SHLIBEXT := dll
endif
ifeq ($(NDB_OS), LINUX)
-CCFLAGS_TOP += -DHAVE_STRDUP
-NDB_STRLCAT := Y
-NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_OS), SOLARIS)
-CCFLAGS_TOP += -DHAVE_STRDUP
-NDB_STRLCAT := Y
-NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_OS), HPUX)
-CCFLAGS_TOP += -DHAVE_STRDUP
-NDB_STRLCAT := Y
-NDB_STRLCPY := Y
SHLIBEXT := sl
endif
ifeq ($(NDB_OS), MACOSX)
-CCFLAGS_TOP += -DHAVE_STRLCAT
-CCFLAGS_TOP += -DHAVE_STRLCAT
-CCFLAGS_TOP += -DHAVE_STRLCPY
-CCFLAGS_TOP += -DNDBOUT_UINTPTR
SHLIBEXT := dylib
endif
ifeq ($(NDB_OS), OSE)
-NDB_STRDUP := Y
-NDB_STRLCAT := Y
-NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_OS), SOFTOSE)
-NDB_STRDUP := Y
-NDB_STRLCAT := Y
-NDB_STRLCPY := Y
SHLIBEXT := so
endif
ifeq ($(NDB_SCI), Y)
-CCFLAGS_TOP += -DHAVE_SCI
+CCFLAGS_TOP += -DHAVE_NDB_SCI
+endif
+
+ifeq ($(NDB_SHM), Y)
+CCFLAGS_TOP += -DHAVE_NDB_SHM
endif
ifneq ($(findstring OSE, $(NDB_OS)),)
diff --git a/ndb/Epilogue.mk b/ndb/Epilogue.mk
index dc78a66a1f8..bcdc54a87f1 100644
--- a/ndb/Epilogue.mk
+++ b/ndb/Epilogue.mk
@@ -227,7 +227,7 @@ CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/util) \
BIN_TARGET_LIBS += logger general portlib
endif
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include)
+CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include) -I$(call fixpath,$(NDB_TOP)/../include)
ifeq ($(NDB_SCI), Y)
BIN_TARGET_LIBS += sisci
diff --git a/ndb/Makefile b/ndb/Makefile
index 586a430bb17..475914f6120 100644
--- a/ndb/Makefile
+++ b/ndb/Makefile
@@ -6,6 +6,13 @@ DIRS := src test tools examples
replace-targets := all clean
NDB_RELEASE := $(shell ../scripts/mysql_config --version)
+all:
+ $(MAKE) -C src
+ $(MAKE) -C test/src
+ $(MAKE) -C tools
+ $(MAKE) -C test/ndbapi/flexBench
+ $(MAKE) -C test/tools/waiter
+
include $(NDB_TOP)/Epilogue.mk
_libs_test : _bins_src
@@ -15,7 +22,7 @@ _bins_src : _libs_src
_bins_tools : _bins_src
# always release compile except for ndbapi static lib
-all:
+old-all:
$(MAKE) -C src/ndbapi libs
$(MAKE) libs NDB_VERSION=RELEASE
$(MAKE) bins NDB_VERSION=RELEASE
diff --git a/ndb/bin/regression.sh b/ndb/bin/regression.sh
index 5e3491af208..5d0531c7460 100644
--- a/ndb/bin/regression.sh
+++ b/ndb/bin/regression.sh
@@ -294,7 +294,7 @@ executeTest 'testScan -n ScanUpdate2' T6
executeTest 'drop_tab' T6
executeTest 'testScan -n ScanDelete'
-executeTest 'drop_all_tab'
+executeTest 'drop_all_tabs'
executeTest 'testScan -n ScanDelete2' T10
executeTest 'drop_tab' T10
diff --git a/ndb/config/Defs.LINUX.x86.GCC.mk b/ndb/config/Defs.LINUX.x86.GCC.mk
index 698b0eb8350..6167a30ff23 100644
--- a/ndb/config/Defs.LINUX.x86.GCC.mk
+++ b/ndb/config/Defs.LINUX.x86.GCC.mk
@@ -6,9 +6,11 @@ SHELL := /bin/sh
C++ := gcc$(GCC_VERSION)
CC := gcc$(GCC_VERSION)
AR_RCS := $(PURE) ar rcs
-SO := gcc$(GCC_VERSION) -shared -lpthread -o
+SO := gcc$(GCC_VERSION) -shared -lpthread -o
+#SO := gcc$(GCC_VERSION) -shared -o
MAKEDEPEND := gcc$(GCC_VERSION) -M
+#MAKEDEPEND := gcc$(GCC_VERSION) -M -nostdinc -nostdinc++
PIC := -fPIC
RPCGENFLAGS := -M -C -N
@@ -27,7 +29,8 @@ else
CCFLAGS_WARNINGS = -Wno-long-long -Wall
endif
# Add these for more warnings -Weffc++ -W
-CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
+CCFLAGS_TOP =
+#CCFLAGS_TOP = -DSAFE_MUTEX
CCFLAGS_TOP += -fno-rtti -fno-exceptions
ifeq (RELEASE, $(NDB_VERSION))
@@ -53,4 +56,5 @@ LINK.cc = $(PURE) $(CC) $(CCFLAGS) $(LDFLAGS)
LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS)
-LDFLAGS_LAST = -lpthread -lrt $(NDB_TOP)/src/common/portlib/gcc.cpp
+LDFLAGS_LAST = -lrt -lpthread $(NDB_TOP)/src/common/portlib/gcc.cpp
+#LDFLAGS_LAST = -lrt $(NDB_TOP)/src/common/portlib/gcc.cpp $(NDB_TOP)/../mysys/libmysys.a $(NDB_TOP)/../dbug/libdbug.a $(NDB_TOP)/../regex/libregex.a $(NDB_TOP)/../strings/libmystrings.a -lpthread
diff --git a/ndb/config/GuessConfig.sh b/ndb/config/GuessConfig.sh
index d2d8446c704..3caeeaae6d0 100755
--- a/ndb/config/GuessConfig.sh
+++ b/ndb/config/GuessConfig.sh
@@ -11,6 +11,11 @@ then
NDB_SCI=N
fi
+if [ -z "$NDB_SHM" ]
+then
+ NDB_SHM=N
+fi
+
os=`uname -s`
case $os in
Linux)
diff --git a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
index 685c853c5d5..7abebcc832d 100644
--- a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+++ b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
@@ -63,20 +63,12 @@
*/
+#include <ndb_global.h>
+
#include <NdbApi.hpp>
#include <NdbScanFilter.hpp>
#include <iostream> // Used for cout
-#ifdef SOLARIS
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#if defined LINUX || defined MACOSX
-#include <time.h>
-#include <unistd.h>
-#endif
-
/**
* Helper sleep function
*/
diff --git a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
index 186afdb9471..7c3a66326c6 100644
--- a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+++ b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
@@ -85,21 +85,13 @@
*/
+#include <ndb_global.h>
+
#include <NdbApi.hpp>
#include <NdbScanFilter.hpp>
// Used for cout
#include <iostream>
-#ifdef SOLARIS
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#if defined LINUX || defined MACOSX
-#include <time.h>
-#include <unistd.h>
-#endif
-
/**
* Helper sleep function
*/
diff --git a/ndb/include/debugger/SignalLoggerManager.hpp b/ndb/include/debugger/SignalLoggerManager.hpp
index 3d89b399f3b..742bf7d294e 100644
--- a/ndb/include/debugger/SignalLoggerManager.hpp
+++ b/ndb/include/debugger/SignalLoggerManager.hpp
@@ -24,7 +24,6 @@
#define SignalLoggerManager_H
-#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <TransporterDefinitions.hpp>
@@ -153,7 +152,7 @@ public:
private:
bool m_logDistributed;
- int m_ownNodeId;
+ Uint32 m_ownNodeId;
FILE * outputStream;
int log(int cmd, BlockNumber bno, LogMode logMode);
diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp
index 0902f3e488b..3363dc2befd 100644
--- a/ndb/include/kernel/LogLevel.hpp
+++ b/ndb/include/kernel/LogLevel.hpp
@@ -17,8 +17,7 @@
#ifndef _LOG_LEVEL_HPP
#define _LOG_LEVEL_HPP
-#include <ndb_types.h>
-#include <assert.h>
+#include <ndb_global.h>
/**
*
diff --git a/ndb/include/kernel/signaldata/BuildIndx.hpp b/ndb/include/kernel/signaldata/BuildIndx.hpp
index 9cf1123cc61..29dfaeb79a6 100644
--- a/ndb/include/kernel/signaldata/BuildIndx.hpp
+++ b/ndb/include/kernel/signaldata/BuildIndx.hpp
@@ -19,7 +19,6 @@
#include "SignalData.hpp"
#include <NodeBitmask.hpp>
-#include <NdbString.h>
#include <signaldata/DictTabInfo.hpp>
/**
diff --git a/ndb/include/kernel/signaldata/SignalData.hpp b/ndb/include/kernel/signaldata/SignalData.hpp
index 071bd9b9104..511e7d30c21 100644
--- a/ndb/include/kernel/signaldata/SignalData.hpp
+++ b/ndb/include/kernel/signaldata/SignalData.hpp
@@ -17,11 +17,9 @@
#ifndef SIGNAL_DATA_H
#define SIGNAL_DATA_H
+#include <ndb_global.h>
#include <ndb_limits.h>
#include <kernel_types.h>
-#include <NdbStdio.h>
-#include <NdbConstant.hpp>
-#include <stdlib.h>
#ifndef NDB_ASSERT
#ifdef VM_TRACE
diff --git a/ndb/include/kernel/signaldata/SignalDataPrint.hpp b/ndb/include/kernel/signaldata/SignalDataPrint.hpp
index 588e2893214..17ab07acd4e 100644
--- a/ndb/include/kernel/signaldata/SignalDataPrint.hpp
+++ b/ndb/include/kernel/signaldata/SignalDataPrint.hpp
@@ -17,8 +17,8 @@
#ifndef SIGNAL_DATA_PRINT_H
#define SIGNAL_DATA_PRINT_H
+#include <ndb_global.h>
#include <kernel_types.h>
-#include <NdbStdio.h>
/**
* Typedef for a Signal Data Print Function
diff --git a/ndb/include/logger/FileLogHandler.hpp b/ndb/include/logger/FileLogHandler.hpp
index ae69a2f5418..08e46c11844 100644
--- a/ndb/include/logger/FileLogHandler.hpp
+++ b/ndb/include/logger/FileLogHandler.hpp
@@ -19,7 +19,7 @@
#include "LogHandler.hpp"
-class File;
+class File_class;
/**
* Logs messages to a file. The log file will be archived depending on
@@ -104,7 +104,7 @@ private:
int m_maxNoFiles;
long m_maxFileSize;
unsigned int m_maxLogEntries;
- File* m_pLogFile;
+ File_class* m_pLogFile;
};
#endif
diff --git a/ndb/include/logger/LogHandler.hpp b/ndb/include/logger/LogHandler.hpp
index 8c5c9298f69..8f76783e6b0 100644
--- a/ndb/include/logger/LogHandler.hpp
+++ b/ndb/include/logger/LogHandler.hpp
@@ -19,7 +19,6 @@
#include "Logger.hpp"
-#include <NdbStdio.h> // Defines NULL
/**
* This class is the base class for all log handlers. A log handler is
diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp
index 2d12a5b8a6e..d4937c11744 100644
--- a/ndb/include/logger/Logger.hpp
+++ b/ndb/include/logger/Logger.hpp
@@ -17,8 +17,8 @@
#ifndef Logger_H
#define Logger_H
+#include <ndb_global.h>
#include <BaseString.hpp>
-#include <stdarg.h>
class LogHandler;
class LogHandlerList;
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
index c74a046b7e7..0ecb19eaa76 100644
--- a/ndb/include/mgmapi/mgmapi.h
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -80,13 +80,13 @@ extern "C" {
* NDB Cluster node types
*/
enum ndb_mgm_node_type {
- NDB_MGM_NODE_TYPE_UNKNOWN = -1, ///< Node type not known
- NDB_MGM_NODE_TYPE_API = 0, ///< An application node (API)
- NDB_MGM_NODE_TYPE_NDB = 1, ///< A database node (DB)
- NDB_MGM_NODE_TYPE_MGM = 2, ///< A management server node (MGM)
+ NDB_MGM_NODE_TYPE_UNKNOWN = -1, /*/< Node type not known*/
+ NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/
+ NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/
+ NDB_MGM_NODE_TYPE_MGM = 2, /*/< A management server node (MGM)*/
- NDB_MGM_NODE_TYPE_MIN = 0, ///< Min valid value
- NDB_MGM_NODE_TYPE_MAX = 2 ///< Max valid value
+ NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/
+ NDB_MGM_NODE_TYPE_MAX = 2 /*/< Max valid value*/
};
/**
diff --git a/ndb/include/mgmcommon/MgmtErrorReporter.hpp b/ndb/include/mgmcommon/MgmtErrorReporter.hpp
index acc44b14d8e..925d9e6407a 100644
--- a/ndb/include/mgmcommon/MgmtErrorReporter.hpp
+++ b/ndb/include/mgmcommon/MgmtErrorReporter.hpp
@@ -22,8 +22,8 @@
//******************************************************************************
+#include <ndb_global.h> // exit
#include <NdbOut.hpp>
-#include <stdlib.h> // exit
#define REPORT_WARNING(message) \
ndbout << "WARNING: " << message << endl
diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h
new file mode 100644
index 00000000000..5e03b972268
--- /dev/null
+++ b/ndb/include/ndb_global.h
@@ -0,0 +1,89 @@
+
+#ifndef NDBGLOBAL_H
+#define NDBGLOBAL_H
+
+#include <my_global.h>
+
+#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
+#define NDB_WIN32
+#else
+#undef NDB_WIN32
+#endif
+
+#include <m_string.h>
+#include <m_ctype.h>
+#include <ndb_types.h>
+#include <ctype.h>
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef TIME_WITH_SYS_TIME
+#include <time.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <sys/param.h>
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#include <sys/resource.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifdef NDB_WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
+#define DIR_SEPARATOR "\\"
+#define PATH_MAX 256
+
+#pragma warning(disable: 4503 4786)
+#else
+
+#define DIR_SEPARATOR "/"
+
+#endif
+
+#ifdef NDB_VC98
+#define STATIC_CONST(x) enum { x }
+#else
+#define STATIC_CONST(x) static const Uint32 x
+#endif
+
+#ifdef __cplusplus
+#include <new>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <assert.h>
+
+#ifndef HAVE_STRDUP
+extern char * strdup(const char *s);
+#endif
+
+#ifndef HAVE_STRLCPY
+extern size_t strlcpy (char *dst, const char *src, size_t dst_sz);
+#endif
+
+#ifndef HAVE_STRLCAT
+extern size_t strlcat (char *dst, const char *src, size_t dst_sz);
+#endif
+
+#ifndef HAVE_STRCASECMP
+extern int strcasecmp(const char *s1, const char *s2);
+extern int strncasecmp(const char *s1, const char *s2, size_t n);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/ndb_net.h b/ndb/include/ndb_net.h
new file mode 100644
index 00000000000..279beb471a7
--- /dev/null
+++ b/ndb/include/ndb_net.h
@@ -0,0 +1,7 @@
+
+#ifndef NDBNET_H
+#define NDBNET_H
+
+#include <my_net.h>
+
+#endif
diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h
index 40d73b0f230..5e7b952cfc5 100644
--- a/ndb/include/ndb_types.h
+++ b/ndb/include/ndb_types.h
@@ -18,11 +18,8 @@
* @file ndb_types.h
*/
-#ifndef SYS_TYPES_H
-#define SYS_TYPES_H
-
-#include <sys/types.h>
-#include <stddef.h>
+#ifndef NDB_TYPES_H
+#define NDB_TYPES_H
typedef char Int8;
typedef unsigned char Uint8;
@@ -36,7 +33,13 @@ typedef unsigned int UintR;
#ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ UintPtr;
#else
+#include <my_config.h>
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
typedef uintptr_t UintPtr;
#endif
diff --git a/ndb/include/ndb_version.h b/ndb/include/ndb_version.h
index 958dd339f74..9bb6af59590 100644
--- a/ndb/include/ndb_version.h
+++ b/ndb/include/ndb_version.h
@@ -17,9 +17,6 @@
#ifndef NDB_VERSION_H
#define NDB_VERSION_H
-#include <stdio.h>
-#include <string.h>
-
#include <version.h>
#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
@@ -47,7 +44,7 @@
* Used by transporter and when communicating with
* managment server
*/
-//#define NDB_VERSION_ID 0
+/*#define NDB_VERSION_ID 0*/
#endif
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp
index 59bdd212919..fd6e827ceb4 100644
--- a/ndb/include/ndbapi/Ndb.hpp
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -860,9 +860,9 @@
#include <ndb_types.h>
#include <ndbapi_limits.h>
-#include "AttrType.hpp"
+#include <AttrType.hpp>
#include <NdbError.hpp>
-#include "NdbDictionary.hpp"
+#include <NdbDictionary.hpp>
class NdbObjectIdMap;
class NdbOperation;
@@ -1673,7 +1673,7 @@ private:
*/
struct StartTransactionNodeSelectionData {
StartTransactionNodeSelectionData():
- fragment2PrimaryNodeMap(NULL) {};
+ fragment2PrimaryNodeMap(0) {};
Uint32 kValue;
Uint32 hashValueMask;
Uint32 hashpointerValue;
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index a1532bb2f0e..c775dd5e33d 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -18,9 +18,8 @@
#define NdbConnection_H
#include <ndb_types.h>
-#include "AttrType.hpp"
+#include <AttrType.hpp>
#include <NdbError.hpp>
-#include <stdlib.h>
class NdbConnection;
class NdbOperation;
diff --git a/ndb/include/ndbapi/NdbError.hpp b/ndb/include/ndbapi/NdbError.hpp
index b08dd1041b2..8cde2a8cf38 100644
--- a/ndb/include/ndbapi/NdbError.hpp
+++ b/ndb/include/ndbapi/NdbError.hpp
@@ -17,6 +17,8 @@
#ifndef NDB_ERROR_HPP
#define NDB_ERROR_HPP
+#include <ndberror.h>
+
/**
* @struct NdbError
* @brief Contains error information
@@ -51,7 +53,7 @@ struct NdbError {
* The error code indicate success<br>
* (Includes classification: NdbError::NoError)
*/
- Success = 0,
+ Success = ndberror_st_success,
/**
* The error code indicates a temporary error.
@@ -61,7 +63,7 @@ struct NdbError {
* NdbError::OverloadError, NdbError::NodeShutdown
* and NdbError::TimeoutExpired.)
*/
- TemporaryError = 1,
+ TemporaryError = ndberror_st_temporary,
/**
* The error code indicates a permanent error.<br>
@@ -71,14 +73,14 @@ struct NdbError {
* NdbError::UserDefinedError, NdbError::InternalError, and,
* NdbError::FunctionNotImplemented.)
*/
- PermanentError = 2,
+ PermanentError = ndberror_st_permanent,
/**
* The result/status is unknown.<br>
* (Includes classifications: NdbError::UnknownResultError, and
* NdbError::UnknownErrorCode.)
*/
- UnknownResult = 3
+ UnknownResult = ndberror_st_unknown
};
/**
@@ -88,85 +90,85 @@ struct NdbError {
/**
* Success. No error occurred.
*/
- NoError = 0,
+ NoError = ndberror_cl_none,
/**
* Error in application program.
*/
- ApplicationError = 1,
+ ApplicationError = ndberror_cl_application,
/**
* Read operation failed due to missing record.
*/
- NoDataFound = 2,
+ NoDataFound = ndberror_cl_no_data_found,
/**
* E.g. inserting a tuple with a primary key already existing
* in the table.
*/
- ConstraintViolation = 3,
+ ConstraintViolation = ndberror_cl_constraint_violation,
/**
* Error in creating table or usage of table.
*/
- SchemaError = 4,
+ SchemaError = ndberror_cl_schema_error,
/**
* Error occurred in interpreted program.
*/
- UserDefinedError = 5,
+ UserDefinedError = ndberror_cl_user_defined,
/**
* E.g. insufficient memory for data or indexes.
*/
- InsufficientSpace = 6,
+ InsufficientSpace = ndberror_cl_insufficient_space,
/**
* E.g. too many active transactions.
*/
- TemporaryResourceError = 7,
+ TemporaryResourceError = ndberror_cl_temporary_resource,
/**
* Temporary failures which are probably inflicted by a node
* recovery in progress. Examples: information sent between
* application and NDB lost, distribution change.
*/
- NodeRecoveryError = 8,
+ NodeRecoveryError = ndberror_cl_node_recovery,
/**
* E.g. out of log file space.
*/
- OverloadError = 9,
+ OverloadError = ndberror_cl_overload,
/**
* Timeouts, often inflicted by deadlocks in NDB.
*/
- TimeoutExpired = 10,
+ TimeoutExpired = ndberror_cl_timeout_expired,
/**
* Is is unknown whether the transaction was committed or not.
*/
- UnknownResultError = 11,
+ UnknownResultError = ndberror_cl_unknown_result,
/**
* A serious error in NDB has occurred.
*/
- InternalError = 12,
+ InternalError = ndberror_cl_internal_error,
/**
* A function used is not yet implemented.
*/
- FunctionNotImplemented = 13,
+ FunctionNotImplemented = ndberror_cl_function_not_implemented,
/**
* Error handler could not determine correct error code.
*/
- UnknownErrorCode = 14,
+ UnknownErrorCode = ndberror_cl_unknown_error_code,
/**
* Node shutdown
*/
- NodeShutdown = 15
+ NodeShutdown = ndberror_cl_node_shutdown
};
/**
@@ -204,6 +206,22 @@ struct NdbError {
message = 0;
details = 0;
}
+ NdbError(const ndberror_struct & ndberror){
+ status = (NdbError::Status) ndberror.status;
+ classification = (NdbError::Classification) ndberror.classification;
+ code = ndberror.code;
+ message = ndberror.message;
+ details = ndberror.details;
+ }
+ operator ndberror_struct() const {
+ ndberror_struct ndberror;
+ ndberror.status = (ndberror_status_enum) status;
+ ndberror.classification = (ndberror_classification_enum) classification;
+ ndberror.code = code;
+ ndberror.message = message;
+ ndberror.details = details;
+ return ndberror;
+ }
};
class NdbOut& operator <<(class NdbOut&, const NdbError &);
diff --git a/ndb/include/ndbapi/NdbEventOperation.hpp b/ndb/include/ndbapi/NdbEventOperation.hpp
index 911b00b02c4..056e9a58c74 100644
--- a/ndb/include/ndbapi/NdbEventOperation.hpp
+++ b/ndb/include/ndbapi/NdbEventOperation.hpp
@@ -157,8 +157,8 @@ public:
* the attribute, or a NULL pointer
* (indicating error).
*/
- NdbRecAttr *getValue(const char *anAttrName, char *aValue = NULL);
- NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = NULL);
+ NdbRecAttr *getValue(const char *anAttrName, char *aValue = 0);
+ NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = 0);
/**
* Retrieves event resultset if available, inserted into the NdbRecAttrs
@@ -172,7 +172,7 @@ public:
* overflow and *pOverRun will indicate the number of events that have
* overwritten.
*/
- int next(int *pOverRun=NULL);
+ int next(int *pOverRun=0);
/**
* In the current implementation a nodefailiure may cause loss of events,
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp
index 4f5f4597937..3c515fe84ef 100644
--- a/ndb/include/ndbapi/NdbOperation.hpp
+++ b/ndb/include/ndbapi/NdbOperation.hpp
@@ -17,14 +17,11 @@
#ifndef NdbOperation_H
#define NdbOperation_H
-#include <stdlib.h>
-#include <assert.h>
-
#include <ndb_types.h>
-#include "AttrType.hpp"
-#include "NdbError.hpp"
-#include "NdbReceiver.hpp"
-#include <stdlib.h>
+
+#include <AttrType.hpp>
+#include <NdbError.hpp>
+#include <NdbReceiver.hpp>
class Ndb;
class NdbApiSignal;
@@ -480,8 +477,8 @@ public:
* the attribute, or a NULL pointer
* (indicating error).
*/
- NdbRecAttr* getValue(const char* anAttrName, char* aValue = NULL);
- NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = NULL);
+ NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0);
+ NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0);
/**
* Define an attribute to set or update in query.
@@ -925,7 +922,7 @@ protected:
virtual int equal_impl(const NdbColumnImpl* anAttrObject,
const char* aValue,
Uint32 len);
- NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = NULL);
+ NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = 0);
int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp
index a5595096bf6..7eeff88671d 100644
--- a/ndb/include/ndbapi/NdbRecAttr.hpp
+++ b/ndb/include/ndbapi/NdbRecAttr.hpp
@@ -17,9 +17,6 @@
#ifndef NdbRecAttr_H
#define NdbRecAttr_H
-#include <stdlib.h>
-
-#include <ndb_types.h>
#include <NdbDictionary.hpp>
#include "AttrType.hpp"
@@ -427,9 +424,9 @@ inline
void
NdbRecAttr::release()
{
- if (theStorageX != NULL) {
+ if (theStorageX != 0) {
delete [] theStorageX;
- theStorageX = NULL;
+ theStorageX = 0;
}
}
@@ -437,10 +434,10 @@ inline
void
NdbRecAttr::init()
{
- theStorageX = NULL;
- theValue = NULL;
- theRef = NULL;
- theNext = NULL;
+ theStorageX = 0;
+ theValue = 0;
+ theRef = 0;
+ theNext = 0;
theAttrId = 0xFFFF;
theNULLind = -1;
}
@@ -470,7 +467,7 @@ inline
bool
NdbRecAttr::copyoutRequired() const
{
- return theRef != theValue && theValue != NULL;
+ return theRef != theValue && theValue != 0;
}
inline
diff --git a/ndb/include/ndbapi/NdbReceiver.hpp b/ndb/include/ndbapi/NdbReceiver.hpp
index 952803f8e70..bc11207a112 100644
--- a/ndb/include/ndbapi/NdbReceiver.hpp
+++ b/ndb/include/ndbapi/NdbReceiver.hpp
@@ -18,7 +18,7 @@
#define NdbReceiver_H
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface
-#include <stdlib.h>
+#include <ndb_types.h>
class Ndb;
class NdbReceiver
diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp
index e041c79d96f..f83669fb616 100644
--- a/ndb/include/ndbapi/NdbScanOperation.hpp
+++ b/ndb/include/ndbapi/NdbScanOperation.hpp
@@ -172,25 +172,6 @@ SetValueRec::SetValueRec() :
{
}
-inline
-SetValueRec::~SetValueRec()
-{
- if ((stype == SET_STRING_ATTR1) ||
- (stype == SET_INT32_ATTR1) ||
- (stype == SET_UINT32_ATTR1) ||
- (stype == SET_INT64_ATTR1) ||
- (stype == SET_UINT64_ATTR1) ||
- (stype == SET_FLOAT_ATTR1) ||
- (stype == SET_DOUBLE_ATTR1))
- free(anAttrName);
-
- if ((stype == SET_STRING_ATTR1) ||
- (stype == SET_STRING_ATTR2))
- free(stringStruct.aStringValue);
- if (next) delete next;
- next = 0;
-}
-
class SetValueRecList {
public:
SetValueRecList();
diff --git a/ndb/include/ndbapi/NdbSchemaOp.hpp b/ndb/include/ndbapi/NdbSchemaOp.hpp
index 90837bbc66b..c3a3827a6b4 100644
--- a/ndb/include/ndbapi/NdbSchemaOp.hpp
+++ b/ndb/include/ndbapi/NdbSchemaOp.hpp
@@ -18,11 +18,9 @@
#define NdbSchemaOp_H
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
-#include <ndb_types.h>
+#include "NdbDictionary.hpp"
#include "AttrType.hpp"
#include "NdbSchemaCon.hpp"
-#include <stdlib.h>
-#include "NdbDictionary.hpp"
class NdbApiSignal;
class Ndb;
diff --git a/ndb/include/ndbapi/ndberror.h b/ndb/include/ndbapi/ndberror.h
new file mode 100644
index 00000000000..5c2d85b82a6
--- /dev/null
+++ b/ndb/include/ndbapi/ndberror.h
@@ -0,0 +1,98 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NDBERROR_H
+#define NDBERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ ndberror_st_success = 0,
+ ndberror_st_temporary = 1,
+ ndberror_st_permanent = 2,
+ ndberror_st_unknown = 3
+} ndberror_status_enum;
+
+typedef enum
+{
+ ndberror_cl_none = 0,
+ ndberror_cl_application = 1,
+ ndberror_cl_no_data_found = 2,
+ ndberror_cl_constraint_violation = 3,
+ ndberror_cl_schema_error = 4,
+ ndberror_cl_user_defined = 5,
+ ndberror_cl_insufficient_space = 6,
+ ndberror_cl_temporary_resource = 7,
+ ndberror_cl_node_recovery = 8,
+ ndberror_cl_overload = 9,
+ ndberror_cl_timeout_expired = 10,
+ ndberror_cl_unknown_result = 11,
+ ndberror_cl_internal_error = 12,
+ ndberror_cl_function_not_implemented = 13,
+ ndberror_cl_unknown_error_code = 14,
+ ndberror_cl_node_shutdown = 15
+} ndberror_classification_enum;
+
+
+typedef struct {
+
+ /**
+ * Error status.
+ */
+ ndberror_status_enum status;
+
+ /**
+ * Error type
+ */
+ ndberror_classification_enum classification;
+
+ /**
+ * Error code
+ */
+ int code;
+
+ /**
+ * Error message
+ */
+ const char * message;
+
+ /**
+ * The detailed description. This is extra information regarding the
+ * error which is not included in the error message.
+ *
+ * @note Is NULL when no details specified
+ */
+ char * details;
+
+} ndberror_struct;
+
+
+typedef ndberror_status_enum ndberror_status;
+typedef ndberror_classification_enum ndberror_classification;
+
+const char *ndberror_status_message(ndberror_status);
+const char *ndberror_classification_message(ndberror_classification);
+void ndberror_update(ndberror_struct *);
+int ndb_error_string(int err_no, char *str, unsigned int size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/ndb/include/newtonapi/dba.h b/ndb/include/newtonapi/dba.h
index eb5b3f9b5c2..4cfc0ec8eb9 100644
--- a/ndb/include/newtonapi/dba.h
+++ b/ndb/include/newtonapi/dba.h
@@ -102,11 +102,9 @@
/* --- Include files ---- */
+#include <ndb_global.h>
#include <defs/pcn_types.h>
-#include <stdio.h>
-
-
/* --- Types and definitions --- */
/**
diff --git a/ndb/include/newtonapi/defs/pcn_types.h b/ndb/include/newtonapi/defs/pcn_types.h
index a823846d7be..eae6c67899d 100644
--- a/ndb/include/newtonapi/defs/pcn_types.h
+++ b/ndb/include/newtonapi/defs/pcn_types.h
@@ -17,16 +17,9 @@
#ifndef PCN_TYPES_H
#define PCN_TYPES_H
-#include <stddef.h>
-#include <NdbUnistd.h>
-
-#ifdef NDB_MACOSX
-typedef unsigned int Size_t;
-#elif defined(NDB_SPARC_64)
-typedef unsigned int Size_t;
-#else
+#include <ndb_global.h>
+
typedef size_t Size_t;
-#endif
typedef int Boolean_t;
diff --git a/ndb/include/portlib/NdbConstant.hpp b/ndb/include/portlib/NdbConstant.hpp
deleted file mode 100644
index bd45209d2b5..00000000000
--- a/ndb/include/portlib/NdbConstant.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifndef NDB_CONSTANT_HPP
-#define NDB_CONSTANT_HPP
-
-#include <ndb_types.h>
-
-#ifdef NDB_VC98
-#define STATIC_CONST(x) enum { x }
-#else
-#define STATIC_CONST(x) static const Uint32 x
-#endif
-
-#endif
diff --git a/ndb/include/portlib/NdbMem.h b/ndb/include/portlib/NdbMem.h
index 38ad3f60448..0f2de80200e 100644
--- a/ndb/include/portlib/NdbMem.h
+++ b/ndb/include/portlib/NdbMem.h
@@ -17,8 +17,7 @@
#ifndef NDB_MEM_H
#define NDB_MEM_H
-#include <stddef.h>
-
+#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {
diff --git a/ndb/include/portlib/NdbMutex.h b/ndb/include/portlib/NdbMutex.h
index d2cb6328b03..28adaacb8c4 100644
--- a/ndb/include/portlib/NdbMutex.h
+++ b/ndb/include/portlib/NdbMutex.h
@@ -17,10 +17,11 @@
#ifndef NDB_MUTEX_H
#define NDB_MUTEX_H
+#include <ndb_global.h>
+
#ifdef NDB_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
-#include <windows.h>
#endif
#ifdef __cplusplus
diff --git a/ndb/include/portlib/NdbTCP.h b/ndb/include/portlib/NdbTCP.h
index 6e2f18b61b2..42c34855c39 100644
--- a/ndb/include/portlib/NdbTCP.h
+++ b/ndb/include/portlib/NdbTCP.h
@@ -17,6 +17,9 @@
#ifndef NDB_TCP_H
#define NDB_TCP_H
+#include <ndb_global.h>
+#include <ndb_net.h>
+
#if defined NDB_OSE || defined NDB_SOFTOSE
/**
* Include files needed
@@ -24,7 +27,6 @@
#include "inet.h"
#include <netdb.h>
-#include <errno.h>
#define NDB_NONBLOCK FNDELAY
#define NDB_SOCKET_TYPE int
@@ -38,47 +40,26 @@ typedef int socklen_t;
#define InetErrno (* inet_errno())
-#endif
+#elif NDB_WIN32
-#if defined NDB_SOLARIS || defined NDB_HPUX || defined NDB_IBMAIX || defined NDB_TRU64X
/**
* Include files needed
*/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
-#include <netdb.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#define NDB_NONBLOCK O_NONBLOCK
-#define NDB_SOCKET_TYPE int
-#define NDB_INVALID_SOCKET -1
-#define NDB_CLOSE_SOCKET(x) close(x)
+#include <winsock2.h>
+#include <ws2tcpip.h>
-#define InetErrno errno
+#define InetErrno WSAGetLastError()
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define NDB_SOCKET_TYPE SOCKET
+#define NDB_INVALID_SOCKET INVALID_SOCKET
+#define NDB_CLOSE_SOCKET(x) closesocket(x)
-#endif
+#else
-#if defined NDB_LINUX || defined NDB_MACOSX
/**
* Include files needed
*/
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
#include <netdb.h>
-#include <errno.h>
-#include <fcntl.h>
#define NDB_NONBLOCK O_NONBLOCK
#define NDB_SOCKET_TYPE int
@@ -89,29 +70,7 @@ typedef int socklen_t;
#endif
-
-#ifdef NDB_WIN32
-/**
- * Include files needed
- */
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <errno.h>
-
-#define InetErrno WSAGetLastError()
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define NDB_SOCKET_TYPE SOCKET
-#define NDB_INVALID_SOCKET INVALID_SOCKET
-#define NDB_CLOSE_SOCKET(x) closesocket(x)
-
-#endif
-
-#ifndef NDB_MACOSX
-#define NDB_SOCKLEN_T socklen_t
-#else
-#define NDB_SOCKLEN_T int
-#endif
-
+#define NDB_SOCKLEN_T SOCKET_SIZE_TYPE
#ifdef __cplusplus
extern "C" {
diff --git a/ndb/include/portlib/NdbThread.h b/ndb/include/portlib/NdbThread.h
index 516022903e3..212f7de9384 100644
--- a/ndb/include/portlib/NdbThread.h
+++ b/ndb/include/portlib/NdbThread.h
@@ -17,8 +17,7 @@
#ifndef NDB_THREAD_H
#define NDB_THREAD_H
-#include <sys/types.h>
-
+#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {
diff --git a/ndb/include/portlib/NdbTick.h b/ndb/include/portlib/NdbTick.h
index 762f65331cc..9bd8eca22bd 100644
--- a/ndb/include/portlib/NdbTick.h
+++ b/ndb/include/portlib/NdbTick.h
@@ -42,7 +42,7 @@ NDB_TICKS NdbTick_CurrentMillisecond(void);
*/
int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros);
-//#define TIME_MEASUREMENT
+ /*#define TIME_MEASUREMENT*/
#ifdef TIME_MEASUREMENT
struct MicroSecondTimer {
diff --git a/ndb/include/portlib/NdbUnistd.h b/ndb/include/portlib/NdbUnistd.h
deleted file mode 100644
index 42f67e2aeb3..00000000000
--- a/ndb/include/portlib/NdbUnistd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifndef NDB_UNISTD_H
-#define NDB_UNISTD_H
-
-#ifdef NDB_WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windows.h>
-#include <limits.h>
-
-#define DIR_SEPARATOR "\\"
-#define PATH_MAX 256
-
-#pragma warning(disable: 4503 4786)
-
-#else
-#include <unistd.h>
-#include <limits.h>
-
-#define DIR_SEPARATOR "/"
-
-#endif
-
-#endif
diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp
index 5bbf7c79491..cb859e310db 100644
--- a/ndb/include/transporter/TransporterDefinitions.hpp
+++ b/ndb/include/transporter/TransporterDefinitions.hpp
@@ -17,8 +17,8 @@
#ifndef TransporterDefinitions_H
#define TransporterDefinitions_H
+#include <ndb_global.h>
#include <kernel_types.h>
-#include <string.h>
#include <NdbOut.hpp>
/**
diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp
index a88bd97ffc5..75a1c291594 100644
--- a/ndb/include/util/BaseString.hpp
+++ b/ndb/include/util/BaseString.hpp
@@ -17,9 +17,7 @@
#ifndef __UTIL_BASESTRING_HPP_INCLUDED__
#define __UTIL_BASESTRING_HPP_INCLUDED__
-#include <ctype.h>
-#include <stdlib.h>
-
+#include <ndb_global.h>
#include <Vector.hpp>
/**
diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp
index 1f95d62bcb6..ed981743512 100644
--- a/ndb/include/util/Bitmask.hpp
+++ b/ndb/include/util/Bitmask.hpp
@@ -17,12 +17,9 @@
#ifndef NDB_BITMASK_H
#define NDB_BITMASK_H
-#include <ndb_types.h>
-#include <NdbConstant.hpp>
+#include <ndb_global.h>
#ifndef NDB_ASSERT
-#include <stdio.h>
-#include <stdlib.h>
#define NDB_ASSERT(x, s) \
do { if (!(x)) { printf("%s\n", s); abort(); } } while (0)
#endif
diff --git a/ndb/include/util/File.hpp b/ndb/include/util/File.hpp
index fe3d2642b18..3ed0ad7a6f9 100644
--- a/ndb/include/util/File.hpp
+++ b/ndb/include/util/File.hpp
@@ -17,8 +17,7 @@
#ifndef FILE_H
#define FILE_H
-#include <NdbStdio.h>
-#include <NdbConstant.hpp>
+#include <ndb_global.h>
/**
* This class provides a file abstraction . It has operations
@@ -26,7 +25,7 @@
*
* @version #@ $Id: File.hpp,v 1.5 2002/04/26 13:15:38 ejonore Exp $
*/
-class File
+class File_class
{
public:
/**
@@ -65,7 +64,7 @@ public:
/**
* Default constructor.
*/
- File();
+ File_class();
/**
* Creates a new File with the specified filename and file mode.
@@ -76,12 +75,12 @@ public:
* @param aFileName a filename.
* @param mode the mode which the file should be opened/created with, default "r".
*/
- File(const char* aFileName, const char* mode = "r");
+ File_class(const char* aFileName, const char* mode = "r");
/**
* Destructor.
*/
- ~File();
+ ~File_class();
/**
* Opens/creates the file. If open() fails then 'errno' and perror()
@@ -198,9 +197,9 @@ private:
char m_fileName[MAX_FILE_NAME_SIZE];
const char* m_fileMode;
/* Prohibit */
- File(const File& aCopy);
- File operator = (const File&);
- bool operator == (const File&);
+ File_class (const File_class& aCopy);
+ File_class operator = (const File_class&);
+ bool operator == (const File_class&);
};
#endif
diff --git a/ndb/include/util/InputStream.hpp b/ndb/include/util/InputStream.hpp
index 6b4cf262db4..b2a56b1e433 100644
--- a/ndb/include/util/InputStream.hpp
+++ b/ndb/include/util/InputStream.hpp
@@ -17,7 +17,7 @@
#ifndef INPUT_STREAM_HPP
#define INPUT_STREAM_HPP
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbTCP.h>
/**
diff --git a/ndb/include/util/NdbAutoPtr.hpp b/ndb/include/util/NdbAutoPtr.hpp
index 2078714d98d..c01650ffc7e 100644
--- a/ndb/include/util/NdbAutoPtr.hpp
+++ b/ndb/include/util/NdbAutoPtr.hpp
@@ -17,7 +17,7 @@
#ifndef __NDB_AUTO_PTR_HPP
#define __NDB_AUTO_PTR_HPP
-#include <stdlib.h>
+#include <ndb_global.h>
template<typename T>
class NdbAutoPtr {
diff --git a/ndb/include/util/NdbString.h b/ndb/include/util/NdbString.h
deleted file mode 100644
index 97646f813ac..00000000000
--- a/ndb/include/util/NdbString.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-#ifndef __NDBSTRING_H_INCLUDED__
-#define __NDBSTRING_H_INCLUDED__
-
-#include <sys/types.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef HAVE_STRDUP
-extern char * strdup(const char *s);
-#endif
-
-#ifndef HAVE_STRLCPY
-extern size_t strlcpy (char *dst, const char *src, size_t dst_sz);
-#endif
-
-#ifndef HAVE_STRLCAT
-extern size_t strlcat (char *dst, const char *src, size_t dst_sz);
-#endif
-
-#ifndef HAVE_STRCASECMP
-extern int strcasecmp(const char *s1, const char *s2);
-extern int strncasecmp(const char *s1, const char *s2, size_t n);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !__NDBSTRING_H_INCLUDED__ */
diff --git a/ndb/include/util/OutputStream.hpp b/ndb/include/util/OutputStream.hpp
index 9d33ead7eb9..c7e009d4537 100644
--- a/ndb/include/util/OutputStream.hpp
+++ b/ndb/include/util/OutputStream.hpp
@@ -17,7 +17,7 @@
#ifndef OUTPUT_STREAM_HPP
#define OUTPUT_STREAM_HPP
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbTCP.h>
/**
diff --git a/ndb/include/util/Properties.hpp b/ndb/include/util/Properties.hpp
index dbdc5f2b480..ff5d1338c79 100644
--- a/ndb/include/util/Properties.hpp
+++ b/ndb/include/util/Properties.hpp
@@ -17,10 +17,7 @@
#ifndef PROPERTIES_HPP
#define PROPERTIES_HPP
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ndb_types.h>
+#include <ndb_global.h>
#include <BaseString.hpp>
#include <UtilBuffer.hpp>
diff --git a/ndb/include/util/SimpleProperties.hpp b/ndb/include/util/SimpleProperties.hpp
index 37e28ea91d8..d5ebb16bb09 100644
--- a/ndb/include/util/SimpleProperties.hpp
+++ b/ndb/include/util/SimpleProperties.hpp
@@ -17,8 +17,7 @@
#ifndef SIMPLE_PROPERTIES_HPP
#define SIMPLE_PROPERTIES_HPP
-#include <ndb_types.h>
-#include <stddef.h> // offsetof
+#include <ndb_global.h>
#include <NdbOut.hpp>
/**
diff --git a/ndb/include/util/UtilBuffer.hpp b/ndb/include/util/UtilBuffer.hpp
index 97821ee3f9b..b357fa0fdf2 100644
--- a/ndb/include/util/UtilBuffer.hpp
+++ b/ndb/include/util/UtilBuffer.hpp
@@ -17,9 +17,7 @@
#ifndef __BUFFER_HPP_INCLUDED__
#define __BUFFER_HPP_INCLUDED__
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <ndb_global.h>
/* This class represents a buffer of binary data, where you can append
* data at the end, and later read the entire bunch.
diff --git a/ndb/include/util/Vector.hpp b/ndb/include/util/Vector.hpp
index a717dfecd7e..f60817dab67 100644
--- a/ndb/include/util/Vector.hpp
+++ b/ndb/include/util/Vector.hpp
@@ -17,9 +17,8 @@
#ifndef NDB_VECTOR_HPP
#define NDB_VECTOR_HPP
-#include <stdlib.h>
+#include <ndb_global.h>
#include <NdbMutex.h>
-#include <string.h>
template<class T>
struct Vector {
diff --git a/ndb/include/util/getarg.h b/ndb/include/util/getarg.h
index 713cf6e4b32..03ed25f6828 100644
--- a/ndb/include/util/getarg.h
+++ b/ndb/include/util/getarg.h
@@ -52,7 +52,7 @@
#ifndef __GETARG_H__
#define __GETARG_H__
-#include <stddef.h>
+#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {
diff --git a/ndb/include/util/socket_io.h b/ndb/include/util/socket_io.h
index bbd1bf115ae..a0e6c4e369d 100644
--- a/ndb/include/util/socket_io.h
+++ b/ndb/include/util/socket_io.h
@@ -17,8 +17,9 @@
#ifndef _SOCKET_IO_H
#define _SOCKET_IO_H
+#include <ndb_global.h>
+
#include <NdbTCP.h>
-#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
diff --git a/ndb/include/util/uucode.h b/ndb/include/util/uucode.h
index 138a79fa3ae..f5569d033a5 100644
--- a/ndb/include/util/uucode.h
+++ b/ndb/include/util/uucode.h
@@ -17,7 +17,7 @@
#ifndef UUCODE_H
#define UUCODE_H
-#include <stdio.h>
+#include <ndb_global.h>
#ifdef __cplusplus
extern "C" {
diff --git a/ndb/src/client/odbc/common/Ctx.cpp b/ndb/src/client/odbc/common/Ctx.cpp
index 85edbd1a63f..44689657788 100644
--- a/ndb/src/client/odbc/common/Ctx.cpp
+++ b/ndb/src/client/odbc/common/Ctx.cpp
@@ -14,11 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbUnistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <NdbStdio.h>
-#include <stdarg.h>
+#include <ndb_global.h>
#include <NdbApi.hpp>
#include <common/common.hpp>
#include "DiagArea.hpp"
diff --git a/ndb/src/client/odbc/common/DataField.cpp b/ndb/src/client/odbc/common/DataField.cpp
index 5853f90c08f..dfd4137ffd9 100644
--- a/ndb/src/client/odbc/common/DataField.cpp
+++ b/ndb/src/client/odbc/common/DataField.cpp
@@ -14,14 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbUnistd.h>
-#include <NdbStdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <limits.h>
-#include <math.h>
+#include <ndb_global.h>
#include "DataField.hpp"
-#include <time.h>
#ifndef INT_MAX
#define INT_MAX (2147483647)
diff --git a/ndb/src/client/odbc/common/DataType.cpp b/ndb/src/client/odbc/common/DataType.cpp
index 62bd622b9b5..9c9629f1d24 100644
--- a/ndb/src/client/odbc/common/DataType.cpp
+++ b/ndb/src/client/odbc/common/DataType.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "DataType.hpp"
-#include <NdbStdio.h>
// SqlType
diff --git a/ndb/src/client/odbc/common/OdbcData.cpp b/ndb/src/client/odbc/common/OdbcData.cpp
index d2402c7e0ab..2e1bd768aec 100644
--- a/ndb/src/client/odbc/common/OdbcData.cpp
+++ b/ndb/src/client/odbc/common/OdbcData.cpp
@@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <new>
-#include <string.h>
-#include <NdbStdio.h>
+#include <ndb_global.h>
#include "OdbcData.hpp"
OdbcData::OdbcData() :
diff --git a/ndb/src/common/debugger/DebuggerNames.cpp b/ndb/src/common/debugger/DebuggerNames.cpp
index fdee978ab54..ebe94a6059f 100644
--- a/ndb/src/common/debugger/DebuggerNames.cpp
+++ b/ndb/src/common/debugger/DebuggerNames.cpp
@@ -14,16 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "DebuggerNames.hpp"
#include <BlockNumbers.h>
#include <GlobalSignalNumbers.h>
#include <signaldata/SignalDataPrint.hpp>
-#include <NdbStdio.h>
-#include <stdlib.h>
-#include <string.h>
-
static const char * localSignalNames[MAX_GSN+1];
static SignalDataPrintFunction localPrintFunctions[MAX_GSN+1];
static const char * localBlockNames[NO_OF_BLOCKS];
diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp
index 12f01890c54..dd957d67383 100644
--- a/ndb/src/common/debugger/EventLogger.cpp
+++ b/ndb/src/common/debugger/EventLogger.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "EventLogger.hpp"
#include <NdbConfig.h>
@@ -22,10 +24,6 @@
#include <GrepEvent.hpp>
#include <NodeState.hpp>
#include <version.h>
-#include <NdbStdio.h>
-
-#include <string.h>
-#include <ctype.h>
//
// PUBLIC
diff --git a/ndb/src/common/debugger/SignalLoggerManager.cpp b/ndb/src/common/debugger/SignalLoggerManager.cpp
index ae6edd5ed71..3839a348222 100644
--- a/ndb/src/common/debugger/SignalLoggerManager.cpp
+++ b/ndb/src/common/debugger/SignalLoggerManager.cpp
@@ -14,15 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SignalLoggerManager.hpp"
#include <LongSignal.hpp>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <NdbString.h>
-
#include <DebuggerNames.hpp>
SignalLoggerManager::SignalLoggerManager()
diff --git a/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp b/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp
index 11ee0948c17..84410a2b2db 100644
--- a/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp
+++ b/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/CloseComReqConf.hpp>
diff --git a/ndb/src/common/debugger/signaldata/ContinueB.cpp b/ndb/src/common/debugger/signaldata/ContinueB.cpp
index 054909d961e..1be6da86cb1 100644
--- a/ndb/src/common/debugger/signaldata/ContinueB.cpp
+++ b/ndb/src/common/debugger/signaldata/ContinueB.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/DihContinueB.hpp>
diff --git a/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp b/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp
index 6685345f17a..027f743b5ea 100644
--- a/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp
+++ b/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp
@@ -26,7 +26,7 @@ printCREATE_FRAGMENTATION_REQ(FILE * output, const Uint32 * theData,
fprintf(output, " noOfFragments: %x\n", sig->noOfFragments);
fprintf(output, " fragmentNode: %x\n", sig->fragmentNode);
if (sig->primaryTableId == RNIL)
- fprintf(output, " primaryTableId: none\n", sig->primaryTableId);
+ fprintf(output, " primaryTableId: none\n");
else
fprintf(output, " primaryTableId: %x\n", sig->primaryTableId);
return true;
diff --git a/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp b/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp
index f3b4b97f0fd..2e900de8f70 100644
--- a/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp
+++ b/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/PrepFailReqRef.hpp>
diff --git a/ndb/src/common/debugger/signaldata/SystemError.cpp b/ndb/src/common/debugger/signaldata/SystemError.cpp
index 5ed7dc6b18d..549c34710a0 100644
--- a/ndb/src/common/debugger/signaldata/SystemError.cpp
+++ b/ndb/src/common/debugger/signaldata/SystemError.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
#include <kernel_types.h>
#include <BlockNumbers.h>
#include <signaldata/SystemError.hpp>
diff --git a/ndb/src/common/editline/editline.c b/ndb/src/common/editline/editline.c
index 0529d18b952..1e4c1ecba76 100644
--- a/ndb/src/common/editline/editline.c
+++ b/ndb/src/common/editline/editline.c
@@ -19,10 +19,10 @@
**
** Main editing routines for editline library.
*/
+#include <ndb_global.h>
+
#include "editline_internal.h"
#include <signal.h>
-#include <ctype.h>
-#include <unistd.h>
/*
** Manifest constants.
diff --git a/ndb/src/common/editline/editline_internal.h b/ndb/src/common/editline/editline_internal.h
index 93c13e55edc..5ed2b32a873 100644
--- a/ndb/src/common/editline/editline_internal.h
+++ b/ndb/src/common/editline/editline_internal.h
@@ -19,9 +19,8 @@
** Internal header file for editline library.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ndb_global.h>
+
#if defined(SYS_UNIX)
#include "unix.h"
#endif /* defined(SYS_UNIX) */
diff --git a/ndb/src/common/editline/editline_win32.c b/ndb/src/common/editline/editline_win32.c
index feef0108523..5083edb7fae 100644
--- a/ndb/src/common/editline/editline_win32.c
+++ b/ndb/src/common/editline/editline_win32.c
@@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <malloc.h>
+#include <ndb_global.h>
char* readline(const char* prompt)
diff --git a/ndb/src/common/editline/test/testit.c b/ndb/src/common/editline/test/testit.c
index 9a7dfb7bbdf..4058f8ae660 100644
--- a/ndb/src/common/editline/test/testit.c
+++ b/ndb/src/common/editline/test/testit.c
@@ -20,11 +20,7 @@
** A "micro-shell" to test editline library.
** If given any arguments, commands aren't executed.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <NdbString.h>
+#include <ndb_global.h>
#include <editline/editline.h>
int
diff --git a/ndb/src/common/editline/unix.h b/ndb/src/common/editline/unix.h
index 582c4888856..37f461b471d 100644
--- a/ndb/src/common/editline/unix.h
+++ b/ndb/src/common/editline/unix.h
@@ -21,6 +21,5 @@
#define CRLF "\r\n"
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <ndb_global.h>
#include <dirent.h>
diff --git a/ndb/src/common/logger/FileLogHandler.cpp b/ndb/src/common/logger/FileLogHandler.cpp
index f3d547b4fe7..d13dd7b2a78 100644
--- a/ndb/src/common/logger/FileLogHandler.cpp
+++ b/ndb/src/common/logger/FileLogHandler.cpp
@@ -14,16 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "FileLogHandler.hpp"
+#include <FileLogHandler.hpp>
#include <File.hpp>
-#include <NdbStdio.h>
-#include <sys/param.h>
-
-#include <errno.h>
-#include <string.h>
-
//
// PUBLIC
//
@@ -35,7 +29,7 @@ FileLogHandler::FileLogHandler() :
m_maxLogEntries(MAX_LOG_ENTRIES)
{
- m_pLogFile = new File("logger.log", "a+");
+ m_pLogFile = new File_class("logger.log", "a+");
}
FileLogHandler::FileLogHandler(const char* aFileName,
@@ -47,7 +41,7 @@ FileLogHandler::FileLogHandler(const char* aFileName,
m_maxFileSize(maxFileSize),
m_maxLogEntries(maxLogEntries)
{
- m_pLogFile = new File(aFileName, "a+");
+ m_pLogFile = new File_class(aFileName, "a+");
}
FileLogHandler::~FileLogHandler()
@@ -166,10 +160,10 @@ FileLogHandler::createNewFile()
::snprintf(newName, sizeof(newName),
"%s.%d", m_pLogFile->getName(), fileNo++);
- } while (File::exists(newName));
+ } while (File_class::exists(newName));
m_pLogFile->close();
- if (!File::rename(m_pLogFile->getName(), newName))
+ if (!File_class::rename(m_pLogFile->getName(), newName))
{
setErrorCode(errno);
rc = false;
@@ -201,7 +195,7 @@ FileLogHandler::setFilename(const BaseString &filename) {
close();
if(m_pLogFile)
delete m_pLogFile;
- m_pLogFile = new File(filename.c_str(), "a+");
+ m_pLogFile = new File_class(filename.c_str(), "a+");
open();
return true;
};
diff --git a/ndb/src/common/logger/LogHandler.cpp b/ndb/src/common/logger/LogHandler.cpp
index d1445555e87..83d479c82fd 100644
--- a/ndb/src/common/logger/LogHandler.cpp
+++ b/ndb/src/common/logger/LogHandler.cpp
@@ -17,9 +17,6 @@
#include "LogHandler.hpp"
#include <NdbTick.h>
-#include <NdbString.h>
-
-#include <time.h>
//
// PUBLIC
diff --git a/ndb/src/common/logger/LogHandlerList.cpp b/ndb/src/common/logger/LogHandlerList.cpp
index f020ad23e56..62495d7566b 100644
--- a/ndb/src/common/logger/LogHandlerList.cpp
+++ b/ndb/src/common/logger/LogHandlerList.cpp
@@ -17,8 +17,6 @@
#include "LogHandlerList.hpp"
#include <LogHandler.hpp>
-#include <NdbStdio.h>
-#include <ndb_types.h>
//
// PUBLIC
diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp
index 6eaafd91854..9c9f1eece18 100644
--- a/ndb/src/common/logger/Logger.cpp
+++ b/ndb/src/common/logger/Logger.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdarg.h>
+#include <ndb_global.h>
#include "Logger.hpp"
@@ -27,12 +27,6 @@
#include <SysLogHandler.hpp>
#endif
-#include <NdbStdio.h>
-#include <ndb_types.h>
-#include <NdbString.h>
-
-#include <assert.h>
-
//
// PUBLIC
//
diff --git a/ndb/src/common/logger/SysLogHandler.cpp b/ndb/src/common/logger/SysLogHandler.cpp
index f3511bf5638..a300c487eb9 100644
--- a/ndb/src/common/logger/SysLogHandler.cpp
+++ b/ndb/src/common/logger/SysLogHandler.cpp
@@ -17,7 +17,6 @@
#include "SysLogHandler.hpp"
#include <syslog.h>
-#include <NdbString.h>
//
// PUBLIC
diff --git a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp
index 22f67d15659..44ee11717b4 100644
--- a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp
+++ b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "LogHandlerListUnitTest.hpp"
#include <ConsoleLogHandler.hpp>
@@ -22,9 +24,6 @@
#include <NdbOut.hpp>
-#include <stdio.h>
-#include <assert.h>
-
typedef bool (*TESTFUNC)(const char*);
typedef struct
{
diff --git a/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp b/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp
index 4b0241a0b03..017dcb79c1f 100644
--- a/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp
+++ b/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp
@@ -25,12 +25,8 @@
#endif
#include <NdbOut.hpp>
-#include <NdbStdio.h>
#include <NdbMain.h>
-#include <string.h>
-#include <assert.h>
-
typedef bool (*TESTFUNC)(const char*);
typedef struct
{
diff --git a/ndb/src/common/mgmcommon/Config.hpp b/ndb/src/common/mgmcommon/Config.hpp
index 1314abe004a..284256d9ed6 100644
--- a/ndb/src/common/mgmcommon/Config.hpp
+++ b/ndb/src/common/mgmcommon/Config.hpp
@@ -23,9 +23,7 @@
#include <kernel_types.h>
#include <NdbOut.hpp>
-#include <NdbStdio.h>
#include <ndb_limits.h>
-#include <NdbConstant.hpp>
#include <Properties.hpp>
/**
diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
index a3f26454df6..04dc5466bbc 100644
--- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp
+++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
@@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+#include <ndb_version.h>
+
#include <ConfigRetriever.hpp>
#include "LocalConfig.hpp"
@@ -21,21 +24,15 @@
#include <NdbOut.hpp>
#include <NdbTCP.h>
-#include <string.h>
-#include <NdbStdio.h>
#include <NdbEnv.h>
#include "MgmtErrorReporter.hpp"
#include <uucode.h>
#include <Properties.hpp>
-#include <stdio.h>
-#include <NdbString.h>
-#include <sys/stat.h>
#include <socket_io.h>
#include <NdbConfig.h>
-#include <ndb_version.h>
//****************************************************************************
//****************************************************************************
diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
index 33652fa472c..62c4bd28857 100644
--- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
+++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp
@@ -14,16 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "InitConfigFileParser.hpp"
-#include <string.h>
-#include <errno.h>
#include "Config.hpp"
#include "MgmtErrorReporter.hpp"
#include <NdbOut.hpp>
#include "ConfigInfo.hpp"
-#include <stdarg.h>
-#include <ctype.h>
-#include <NdbString.h>
const int MAX_LINE_LENGTH = 120; // Max length of line of text in config file
static void trim(char *);
diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp b/ndb/src/common/mgmcommon/InitConfigFileParser.hpp
index 1e85067396c..f4f27abb055 100644
--- a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp
+++ b/ndb/src/common/mgmcommon/InitConfigFileParser.hpp
@@ -17,7 +17,8 @@
#ifndef InitConfigFileParser_H
#define InitConfigFileParser_H
-#include <stdio.h>
+#include <ndb_global.h>
+
#include <Properties.hpp>
class Config;
diff --git a/ndb/src/common/mgmcommon/LocalConfig.hpp b/ndb/src/common/mgmcommon/LocalConfig.hpp
index ec7b572e92d..eb676bf9bed 100644
--- a/ndb/src/common/mgmcommon/LocalConfig.hpp
+++ b/ndb/src/common/mgmcommon/LocalConfig.hpp
@@ -17,10 +17,8 @@
#ifndef LocalConfig_H
#define LocalConfig_H
-#include <stdlib.h>
-#include <string.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
-#include <NdbStdio.h>
//****************************************************************************
// Description: The class LocalConfig corresponds to the information possible
diff --git a/ndb/src/common/mgmcommon/NdbConfig.c b/ndb/src/common/mgmcommon/NdbConfig.c
index b12d9fcfaf9..827ef34a840 100644
--- a/ndb/src/common/mgmcommon/NdbConfig.c
+++ b/ndb/src/common/mgmcommon/NdbConfig.c
@@ -14,10 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <NdbConfig.h>
#include <NdbEnv.h>
-#include <stdlib.h>
-#include <string.h>
const char*
NdbConfig_HomePath(char* buf, int buflen){
diff --git a/ndb/src/common/mgmcommon/printConfig/printConfig.cpp b/ndb/src/common/mgmcommon/printConfig/printConfig.cpp
index 7260a84ce7a..daa287cc44d 100644
--- a/ndb/src/common/mgmcommon/printConfig/printConfig.cpp
+++ b/ndb/src/common/mgmcommon/printConfig/printConfig.cpp
@@ -15,10 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <ConfigRetriever.hpp>
#include <Properties.hpp>
-#include <stdlib.h>
#include <NdbOut.hpp>
void usage(const char * prg){
diff --git a/ndb/src/common/portlib/Makefile b/ndb/src/common/portlib/Makefile
index a928fc1e6d7..48f4929a839 100644
--- a/ndb/src/common/portlib/Makefile
+++ b/ndb/src/common/portlib/Makefile
@@ -4,38 +4,16 @@ DIRS :=
ifeq ($(NDB_OS), SOFTOSE)
DIRS += ose
-endif
-
+else
ifeq ($(NDB_OS), OSE)
DIRS += ose
-endif
-
-ifeq ($(NDB_OS), SIMCELLO)
-DIRS += ose
-endif
-
-ifeq ($(NDB_OS), LINUX)
-DIRS += unix
-endif
-
-ifeq ($(NDB_OS), MACOSX)
-DIRS += unix
-endif
-
-ifeq ($(NDB_OS), SOLARIS)
+else
+ifeq ($(NDB_OS), WIN32)
+DIRS += win32
+else
DIRS += unix
endif
-
-ifeq ($(NDB_OS), SOLARIS6)
-DIRS += unix
endif
-
-ifeq ($(NDB_OS), HPUX)
-DIRS += unix
-endif
-
-ifeq ($(NDB_OS), WIN32)
-DIRS += win32
endif
diff --git a/ndb/src/common/portlib/memtest/memtest.c b/ndb/src/common/portlib/memtest/memtest.c
index d23235b7aa2..059a4ec025e 100644
--- a/ndb/src/common/portlib/memtest/memtest.c
+++ b/ndb/src/common/portlib/memtest/memtest.c
@@ -16,10 +16,8 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/mman.h>
+#include <ndb_global.h>
+
long long getMilli();
long long getMicro();
void malloctest(int loopcount, int memsize, int touch);
diff --git a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp b/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp
index 9e396cd98ee..b1d84131810 100644
--- a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp
+++ b/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp
@@ -17,6 +17,8 @@
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbThread.h>
#include <NdbMutex.h>
@@ -27,13 +29,6 @@
#include <NdbHost.h>
#include <NdbMain.h>
#include <getarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-
struct ThreadData
{
diff --git a/ndb/src/common/portlib/mmstest/mmslist.cpp b/ndb/src/common/portlib/mmstest/mmslist.cpp
index bd00211445c..05538785293 100644
--- a/ndb/src/common/portlib/mmstest/mmslist.cpp
+++ b/ndb/src/common/portlib/mmstest/mmslist.cpp
@@ -14,14 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_common.h>
+
#include <NdbOut.hpp>
#include <NdbMain.h>
#include <ose.h>
#include <mms.sig>
#include <mms_err.h>
-#include <string.h>
-#include <stdio.h>
#include <NdbOut.hpp>
/**
diff --git a/ndb/src/common/portlib/mmstest/mmstest.cpp b/ndb/src/common/portlib/mmstest/mmstest.cpp
index 6ebb5064aaf..9cc7d810985 100644
--- a/ndb/src/common/portlib/mmstest/mmstest.cpp
+++ b/ndb/src/common/portlib/mmstest/mmstest.cpp
@@ -14,13 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include "NdbThread.h"
#include <NdbMem.h>
#include <NdbMain.h>
-#include <stdlib.h>
-
NDB_COMMAND(ndbmem, "ndbmem", "ndbmem", "Test the ndbmem functionality", 4096){
ndbout << "Starting test of NdbMem" << endl;
diff --git a/ndb/src/common/portlib/ose/NdbCondition.c b/ndb/src/common/portlib/ose/NdbCondition.c
index 2ab6e49006b..73a2dbc5d66 100644
--- a/ndb/src/common/portlib/ose/NdbCondition.c
+++ b/ndb/src/common/portlib/ose/NdbCondition.c
@@ -17,7 +17,6 @@
#include "NdbCondition.h"
#include <pthread.h>
-#include <assert.h>
#include <sys/types.h>
#include <malloc.h>
diff --git a/ndb/src/common/portlib/ose/NdbMem.c b/ndb/src/common/portlib/ose/NdbMem.c
index 6d922e4c073..0e38024bbb4 100644
--- a/ndb/src/common/portlib/ose/NdbMem.c
+++ b/ndb/src/common/portlib/ose/NdbMem.c
@@ -17,7 +17,6 @@
#include "NdbMem.h"
-#include <assert.h>
#if defined NDB_OSE
#include <ose.h>
@@ -134,7 +133,6 @@ int NdbMem_MemUnlockAll(){
}
#else
-#include <assert.h>
#include <stdlib.h>
diff --git a/ndb/src/common/portlib/ose/NdbMutex.c b/ndb/src/common/portlib/ose/NdbMutex.c
index 859ddefd536..253c0e412ff 100644
--- a/ndb/src/common/portlib/ose/NdbMutex.c
+++ b/ndb/src/common/portlib/ose/NdbMutex.c
@@ -19,7 +19,6 @@
#include <pthread.h>
#include <stdlib.h>
-#include <assert.h>
NdbMutex* NdbMutex_Create(void)
diff --git a/ndb/src/common/portlib/ose/NdbOut.cpp b/ndb/src/common/portlib/ose/NdbOut.cpp
index 0ee12249ff5..eb81bc9d971 100644
--- a/ndb/src/common/portlib/ose/NdbOut.cpp
+++ b/ndb/src/common/portlib/ose/NdbOut.cpp
@@ -14,12 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbOut.hpp"
-#include <NdbStdio.h>
-#include <stdarg.h>
-#include <NdbUnistd.h>
-#include <string.h>
+#include <ndb_global.h>
+#include "NdbOut.hpp"
#if defined NDB_SOFTOSE
#include <dbgprintf.h>
diff --git a/ndb/src/common/portlib/ose/NdbThread.c b/ndb/src/common/portlib/ose/NdbThread.c
index 41a5f181c40..e46903a5cce 100644
--- a/ndb/src/common/portlib/ose/NdbThread.c
+++ b/ndb/src/common/portlib/ose/NdbThread.c
@@ -18,7 +18,6 @@
#include "NdbThread.h"
#include <pthread.h>
#include <malloc.h>
-#include <assert.h>
#include <string.h>
#include <NdbOut.hpp>
diff --git a/ndb/src/common/portlib/test/NdbPortLibTest.cpp b/ndb/src/common/portlib/test/NdbPortLibTest.cpp
index 8a5c8f4a878..55b9ccec5f2 100644
--- a/ndb/src/common/portlib/test/NdbPortLibTest.cpp
+++ b/ndb/src/common/portlib/test/NdbPortLibTest.cpp
@@ -20,7 +20,7 @@
* TODO - Add tests for NdbMem
*/
-
+#include <ndb_global.h>
#include "NdbOut.hpp"
#include "NdbThread.h"
@@ -32,11 +32,6 @@
#include "NdbHost.h"
#include "NdbMain.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
int TestHasFailed;
int verbose = 0;
diff --git a/ndb/src/common/portlib/unix/NdbCondition.c b/ndb/src/common/portlib/unix/NdbCondition.c
index 35b80821052..1d229bdcdef 100644
--- a/ndb/src/common/portlib/unix/NdbCondition.c
+++ b/ndb/src/common/portlib/unix/NdbCondition.c
@@ -15,16 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbCondition.h>
-#include <pthread.h>
-#include <assert.h>
-#include <sys/types.h>
-#if defined NDB_MACOSX
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif
+#include <ndb_global.h>
+#include <NdbCondition.h>
+#include <NdbThread.h>
#include <NdbMutex.h>
struct NdbCondition
@@ -67,8 +61,6 @@ NdbCondition_Wait(struct NdbCondition* p_cond,
return result;
}
-#if defined NDB_SOLARIS || defined NDB_HPUX
-#include <time.h>
int
NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
NdbMutex* p_mutex,
@@ -80,7 +72,16 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
if (p_cond == NULL || p_mutex == NULL)
return 1;
+#ifdef HAVE_CLOCK_GETTIME
clock_gettime(CLOCK_REALTIME, &abstime);
+#else
+ {
+ struct timeval tick_time;
+ gettimeofday(&tick_time, 0);
+ abstime.tv_sec = tick_time.tv_sec;
+ abstime.tv_nsec = tick_time.tv_usec * 1000;
+ }
+#endif
if(msecs >= 1000){
secs = msecs / 1000;
@@ -98,45 +99,6 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
return result;
}
-#endif
-
-#if defined NDB_LINUX || defined NDB_MACOSX
-#include <unistd.h>
-#include <sys/time.h>
-
-int
-NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
- NdbMutex* p_mutex,
- int msecs){
- int result;
- struct timespec abstime;
- struct timeval tick_time;
- int secs = 0;
-
- if (p_cond == NULL || p_mutex == NULL)
- return 1;
-
- gettimeofday(&tick_time, 0);
-
- if(msecs >= 1000){
- secs = msecs / 1000;
- msecs = msecs % 1000;
- }
-
-
- abstime.tv_sec = tick_time.tv_sec + secs;
- abstime.tv_nsec = tick_time.tv_usec * 1000 + msecs * 1000000;
- if (abstime.tv_nsec >= 1000000000) {
- abstime.tv_sec += 1;
- abstime.tv_nsec -= 1000000000;
- }
-
- result = pthread_cond_timedwait(&p_cond->cond, p_mutex, &abstime);
-
- return result;
-}
-#endif
-
int
NdbCondition_Signal(struct NdbCondition* p_cond){
diff --git a/ndb/src/common/portlib/unix/NdbDaemon.c b/ndb/src/common/portlib/unix/NdbDaemon.c
index fc114266c9d..186331a4dab 100644
--- a/ndb/src/common/portlib/unix/NdbDaemon.c
+++ b/ndb/src/common/portlib/unix/NdbDaemon.c
@@ -14,40 +14,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "NdbDaemon.h"
-#include <assert.h>
-
-#ifdef NDB_LINUX
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#endif
-
-#ifdef NDB_SOLARIS
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#endif
#define NdbDaemon_ErrorSize 500
-#if defined(NDB_LINUX) || defined(NDB_SOLARIS)
long NdbDaemon_DaemonPid;
int NdbDaemon_ErrorCode;
char NdbDaemon_ErrorText[NdbDaemon_ErrorSize];
-#endif
+
int
NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
{
- /* XXX fix other unixes */
-#if defined(NDB_LINUX) || defined(NDB_SOLARIS)
int lockfd = -1, logfd = -1, n;
char buf[64];
@@ -149,11 +126,21 @@ NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
dup2(logfd, 2);
close(logfd);
}
-#endif
/* Success */
return 0;
}
+#if 0
+int
+NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
+{
+ /* Fail */
+ snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ "Daemon mode not implemented");
+ return -1;
+}
+#endif
+
#ifdef NDB_DAEMON_TEST
int
diff --git a/ndb/src/common/portlib/unix/NdbEnv.c b/ndb/src/common/portlib/unix/NdbEnv.c
index b01e3b239ca..d294e0b52ca 100644
--- a/ndb/src/common/portlib/unix/NdbEnv.c
+++ b/ndb/src/common/portlib/unix/NdbEnv.c
@@ -15,9 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbEnv.h"
-#include <string.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
+#include <NdbEnv.h>
const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen)
{
diff --git a/ndb/src/common/portlib/unix/NdbHost.c b/ndb/src/common/portlib/unix/NdbHost.c
index 8d2a23fccda..4749bb39ea7 100644
--- a/ndb/src/common/portlib/unix/NdbHost.c
+++ b/ndb/src/common/portlib/unix/NdbHost.c
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "NdbHost.h"
-#include <unistd.h>
int NdbHost_GetHostName(char* buf)
{
diff --git a/ndb/src/common/portlib/unix/NdbMem.c b/ndb/src/common/portlib/unix/NdbMem.c
index 3b47494967f..0b06e5b23f1 100644
--- a/ndb/src/common/portlib/unix/NdbMem.c
+++ b/ndb/src/common/portlib/unix/NdbMem.c
@@ -15,14 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbMem.h"
+#include <ndb_global.h>
-#include <assert.h>
-#include <assert.h>
-#include <stdlib.h>
-#ifndef NDB_MACOSX
-#include <sys/mman.h>
-#endif
+#include <NdbMem.h>
void NdbMem_Create()
{
@@ -59,19 +54,18 @@ void NdbMem_Free(void* ptr)
int NdbMem_MemLockAll(){
-#if defined NDB_MACOSX
- return 0;
-#else
- //return mlockall(MCL_CURRENT | MCL_FUTURE);
+#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
return mlockall(MCL_CURRENT);
+#else
+ return -1;
#endif
}
int NdbMem_MemUnlockAll(){
-#if defined NDB_MACOSX
- return 0;
-#else
+#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
return munlockall();
+#else
+ return -1;
#endif
}
diff --git a/ndb/src/common/portlib/unix/NdbMutex.c b/ndb/src/common/portlib/unix/NdbMutex.c
index 3cadc0667e7..50f314d2683 100644
--- a/ndb/src/common/portlib/unix/NdbMutex.c
+++ b/ndb/src/common/portlib/unix/NdbMutex.c
@@ -15,11 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbMutex.h"
+#include <ndb_global.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <assert.h>
+#include <NdbThread.h>
+#include <NdbMutex.h>
NdbMutex* NdbMutex_Create(void)
{
diff --git a/ndb/src/common/portlib/unix/NdbSleep.c b/ndb/src/common/portlib/unix/NdbSleep.c
index 35132d7f9c7..8702a25d1b1 100644
--- a/ndb/src/common/portlib/unix/NdbSleep.c
+++ b/ndb/src/common/portlib/unix/NdbSleep.c
@@ -15,19 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "NdbSleep.h"
-
-#ifdef NDB_SOLARIS
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX
-#include <time.h>
-#include <unistd.h>
-#endif
-
int
NdbSleep_MilliSleep(int milliseconds){
int result = 0;
diff --git a/ndb/src/common/portlib/unix/NdbTCP.c b/ndb/src/common/portlib/unix/NdbTCP.c
index c2613c211c5..287dc6c2ecd 100644
--- a/ndb/src/common/portlib/unix/NdbTCP.c
+++ b/ndb/src/common/portlib/unix/NdbTCP.c
@@ -15,20 +15,26 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <NdbMutex.h>
#include "NdbTCP.h"
+#ifdef NDB_WIN32
+static NdbMutex & LOCK_gethostbyname = * NdbMutex_Create();
+#else
+static NdbMutex LOCK_gethostbyname = NDB_MUTEX_INITIALIZER;
+#endif
-#ifdef NDB_SOLARIS
int
Ndb_getInAddr(struct in_addr * dst, const char *address) {
- struct hostent host, * hostPtr;
- char buf[1024];
- int h_errno;
- hostPtr = gethostbyname_r(address, &host, &buf[0], 1024, &h_errno);
+ struct hostent * hostPtr;
+ NdbMutex_Lock(&LOCK_gethostbyname);
+ hostPtr = gethostbyname(address);
if (hostPtr != NULL) {
dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr;
+ NdbMutex_Unlock(&LOCK_gethostbyname);
return 0;
}
+ NdbMutex_Unlock(&LOCK_gethostbyname);
/* Try it as aaa.bbb.ccc.ddd. */
dst->s_addr = inet_addr(address);
@@ -37,13 +43,14 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
}
return -1;
}
-#endif
-#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX
+#if 0
int
Ndb_getInAddr(struct in_addr * dst, const char *address) {
- struct hostent * hostPtr;
- hostPtr = gethostbyname(address);
+ struct hostent host, * hostPtr;
+ char buf[1024];
+ int h_errno;
+ hostPtr = gethostbyname_r(address, &host, &buf[0], 1024, &h_errno);
if (hostPtr != NULL) {
dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr;
return 0;
@@ -57,4 +64,3 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
return -1;
}
#endif
-
diff --git a/ndb/src/common/portlib/unix/NdbThread.c b/ndb/src/common/portlib/unix/NdbThread.c
index 3665c4c9159..a5c42f79be8 100644
--- a/ndb/src/common/portlib/unix/NdbThread.c
+++ b/ndb/src/common/portlib/unix/NdbThread.c
@@ -15,16 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbThread.h"
+#include <ndb_global.h>
+#include <NdbThread.h>
#include <pthread.h>
-#ifdef NDB_MACOSX
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif
-#include <assert.h>
-#include <string.h>
-#include <NdbStdio.h>
#define MAX_THREAD_NAME 16
@@ -94,7 +87,7 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
if (p_wait_thread == NULL)
return 0;
- if (p_wait_thread->thread == NULL)
+ if (p_wait_thread->thread == 0)
return 0;
result = pthread_join(p_wait_thread->thread, status);
diff --git a/ndb/src/common/portlib/unix/NdbTick.c b/ndb/src/common/portlib/unix/NdbTick.c
index 5adb4ec80c2..d8f0b6ec27a 100644
--- a/ndb/src/common/portlib/unix/NdbTick.c
+++ b/ndb/src/common/portlib/unix/NdbTick.c
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "NdbTick.h"
-#include <time.h>
#define NANOSEC_PER_SEC 1000000000
#define MICROSEC_PER_SEC 1000000
@@ -25,7 +25,7 @@
#define MILLISEC_PER_NANOSEC 1000000
-#if defined NDB_SOLARIS || NDB_HPUX
+#ifdef HAVE_CLOCK_GETTIME
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
struct timespec tick_time;
@@ -44,11 +44,7 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){
* micros = t.tv_nsec / 1000;
return res;
}
-#endif
-
-#if defined NDB_LINUX || NDB_MACOSX
-#include <unistd.h>
-#include <sys/time.h>
+#else
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
struct timeval tick_time;
@@ -99,12 +95,12 @@ NdbTick_getMicrosPassed(struct MicroSecondTimer start,
ret_value = ((NDB_TICKS)MICROSEC_PER_SEC) * sec_passed;
} else if (start.seconds > stop.seconds) {
return ret_value;
- }//if
+ }
if (start.micro_seconds < stop.micro_seconds) {
ret_value += (stop.micro_seconds - start.micro_seconds);
} else if (ret_value != (NDB_TICKS)0) {
ret_value -= (start.micro_seconds - stop.micro_seconds);
- }//if
+ }
return ret_value;
}
#endif
diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/win32/NdbCondition.c
index 12b508cf33b..77869b673de 100644
--- a/ndb/src/common/portlib/win32/NdbCondition.c
+++ b/ndb/src/common/portlib/win32/NdbCondition.c
@@ -18,7 +18,6 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
-#include <assert.h>
#include <sys/types.h>
#include "NdbCondition.h"
diff --git a/ndb/src/common/portlib/win32/NdbDaemon.c b/ndb/src/common/portlib/win32/NdbDaemon.c
index b96d4c20260..972fb1b88d8 100644
--- a/ndb/src/common/portlib/win32/NdbDaemon.c
+++ b/ndb/src/common/portlib/win32/NdbDaemon.c
@@ -14,6 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "NdbDaemon.h"
#define NdbDaemon_ErrorSize 500
@@ -24,8 +25,10 @@ char NdbDaemon_ErrorText[NdbDaemon_ErrorSize];
int
NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
{
- // XXX do something
- return 0;
+ /* Fail */
+ snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ "Daemon mode not implemented");
+ return -1;
}
#ifdef NDB_DAEMON_TEST
diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/win32/NdbMem.c
index 274dc31353f..ab7123b0a29 100644
--- a/ndb/src/common/portlib/win32/NdbMem.c
+++ b/ndb/src/common/portlib/win32/NdbMem.c
@@ -16,8 +16,6 @@
#include <windows.h>
-#include <assert.h>
-#include <NdbStdio.h>
#include "NdbMem.h"
diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/win32/NdbMutex.c
index c93384d91db..e797024d5bb 100644
--- a/ndb/src/common/portlib/win32/NdbMutex.c
+++ b/ndb/src/common/portlib/win32/NdbMutex.c
@@ -19,7 +19,6 @@
#include <ws2tcpip.h>
#include <windows.h>
#include <time.h>
-#include <assert.h>
#include "NdbMutex.h"
diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/win32/NdbThread.c
index ae3c74be70d..1f052f034e8 100644
--- a/ndb/src/common/portlib/win32/NdbThread.c
+++ b/ndb/src/common/portlib/win32/NdbThread.c
@@ -17,7 +17,6 @@
#include <windows.h>
#include <process.h>
-#include <assert.h>
#include "NdbThread.h"
diff --git a/ndb/src/common/transporter/Makefile b/ndb/src/common/transporter/Makefile
index 3bd23b627d3..372bf640566 100644
--- a/ndb/src/common/transporter/Makefile
+++ b/ndb/src/common/transporter/Makefile
@@ -10,7 +10,6 @@ DIRS := basictest perftest
SOURCES = \
Transporter.cpp \
SendBuffer.cpp \
- SHM_Transporter.cpp \
TCP_Transporter.cpp \
TransporterRegistry.cpp \
Packer.cpp
@@ -20,37 +19,19 @@ DIRS := basictest perftest
CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/kernel) \
-I$(call fixpath,$(NDB_TOP)/include/transporter)
+
+ifeq ($(NDB_SHM), Y)
+SOURCES += SHM_Transporter.cpp
ifeq ($(NDB_OS), WIN32)
SOURCES += SHM_Transporter.win32.cpp
-endif
-
-ifeq ($(NDB_OS), SOLARIS)
+else
SOURCES += SHM_Transporter.unix.cpp
endif
-
-ifeq ($(NDB_OS), HPUX)
-SOURCES += SHM_Transporter.unix.cpp
endif
-ifeq ($(NDB_OS), MACOSX)
-SOURCES += SHM_Transporter.unix.cpp
-endif
-
-ifeq ($(NDB_OS), IBMAIX)
-SOURCES += SHM_Transporter.unix.cpp
-endif
-
-ifeq ($(NDB_OS), TRU64X)
-SOURCES += SHM_Transporter.unix.cpp
-endif
-
-ifeq ($(NDB_OS), LINUX)
-SOURCES += SHM_Transporter.unix.cpp
ifeq ($(NDB_SCI), Y)
SOURCES += SCI_Transporter.cpp
endif
-endif
-
ifneq ($(findstring OSE, $(NDB_OS)),)
SOURCES += OSE_Transporter.cpp
diff --git a/ndb/src/common/transporter/OSE_Receiver.cpp b/ndb/src/common/transporter/OSE_Receiver.cpp
index 558dee92d8d..b7d47b2f88c 100644
--- a/ndb/src/common/transporter/OSE_Receiver.cpp
+++ b/ndb/src/common/transporter/OSE_Receiver.cpp
@@ -20,7 +20,6 @@
#include "TransporterCallback.hpp"
#include <TransporterRegistry.hpp>
#include "TransporterInternalDefinitions.hpp"
-#include <NdbStdio.h>
OSE_Receiver::OSE_Receiver(TransporterRegistry * tr,
int _recBufSize,
diff --git a/ndb/src/common/transporter/OSE_Transporter.cpp b/ndb/src/common/transporter/OSE_Transporter.cpp
index a7a5ed81ce2..c9b0f777319 100644
--- a/ndb/src/common/transporter/OSE_Transporter.cpp
+++ b/ndb/src/common/transporter/OSE_Transporter.cpp
@@ -23,11 +23,9 @@
#include <NdbMutex.h>
-#include <NdbStdio.h>
#include <NdbHost.h>
#include <NdbOut.hpp>
#include <time.h>
-#include <assert.h>
OSE_Transporter::OSE_Transporter(int _prioASignalSize,
int _prioBSignalSize,
diff --git a/ndb/src/common/transporter/Packer.cpp b/ndb/src/common/transporter/Packer.cpp
index 77bd66d1ba9..fa72af12dac 100644
--- a/ndb/src/common/transporter/Packer.cpp
+++ b/ndb/src/common/transporter/Packer.cpp
@@ -14,13 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "Packer.hpp"
#include <TransporterRegistry.hpp>
#include <TransporterCallback.hpp>
#include <RefConvert.hpp>
-#include <stdio.h>
-
Uint32
TransporterRegistry::unpack(Uint32 * readPtr,
Uint32 sizeOfData,
diff --git a/ndb/src/common/transporter/SCI_Transporter.cpp b/ndb/src/common/transporter/SCI_Transporter.cpp
index 2be857e8115..c52c8a9d8c0 100644
--- a/ndb/src/common/transporter/SCI_Transporter.cpp
+++ b/ndb/src/common/transporter/SCI_Transporter.cpp
@@ -14,17 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SCI_Transporter.hpp"
-#include <NdbStdio.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <NdbTick.h>
-#include <stdlib.h>
#include <NdbTick.h>
-#if 0
-#include <malloc.h>
-#include <sys/time.h>
-#endif
+
#include "TransporterInternalDefinitions.hpp"
#include <TransporterCallback.hpp>
diff --git a/ndb/src/common/transporter/SHM_Buffer.hpp b/ndb/src/common/transporter/SHM_Buffer.hpp
index 43250853fee..32e59dd57a2 100644
--- a/ndb/src/common/transporter/SHM_Buffer.hpp
+++ b/ndb/src/common/transporter/SHM_Buffer.hpp
@@ -17,10 +17,9 @@
#ifndef SHM_BUFFER_HPP
#define SHM_BUFFER_HPP
-#include <stdio.h>
-#include <ndb_types.h>
+#include <ndb_global.h>
+
#include <NdbSleep.h>
-#include <assert.h>
/**
* These classes implement a circular buffer
diff --git a/ndb/src/common/transporter/SHM_Transporter.cpp b/ndb/src/common/transporter/SHM_Transporter.cpp
index f18b775efa4..7c673f93c22 100644
--- a/ndb/src/common/transporter/SHM_Transporter.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.cpp
@@ -15,18 +15,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SHM_Transporter.hpp"
#include "TransporterInternalDefinitions.hpp"
#include <TransporterCallback.hpp>
#include <NdbSleep.h>
#include <NdbOut.hpp>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef NDB_WIN32
-#include <windows.h>
-#else
+#ifndef NDB_WIN32
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
diff --git a/ndb/src/common/transporter/SHM_Transporter.unix.cpp b/ndb/src/common/transporter/SHM_Transporter.unix.cpp
index 975c1191aea..afbf124432e 100644
--- a/ndb/src/common/transporter/SHM_Transporter.unix.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.unix.cpp
@@ -15,15 +15,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SHM_Transporter.hpp"
#include "TransporterInternalDefinitions.hpp"
#include <TransporterCallback.hpp>
#include <NdbSleep.h>
#include <NdbOut.hpp>
-#include <stdio.h>
-
-
#include <sys/ipc.h>
#include <sys/shm.h>
diff --git a/ndb/src/common/transporter/SHM_Transporter.win32.cpp b/ndb/src/common/transporter/SHM_Transporter.win32.cpp
index 4ba52c9179d..c289a85da0e 100644
--- a/ndb/src/common/transporter/SHM_Transporter.win32.cpp
+++ b/ndb/src/common/transporter/SHM_Transporter.win32.cpp
@@ -15,14 +15,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SHM_Transporter.hpp"
#include "TransporterInternalDefinitions.hpp"
#include <TransporterCallback.hpp>
#include <NdbSleep.h>
#include <NdbOut.hpp>
-#include <stdio.h>
-
#include <windows.h>
diff --git a/ndb/src/common/transporter/SendBuffer.hpp b/ndb/src/common/transporter/SendBuffer.hpp
index 75ef0708e83..63a01f3de24 100644
--- a/ndb/src/common/transporter/SendBuffer.hpp
+++ b/ndb/src/common/transporter/SendBuffer.hpp
@@ -33,10 +33,9 @@
#include "TransporterDefinitions.hpp"
#include <TransporterCallback.hpp>
-#include <stdlib.h>
#ifdef DEBUG_TRANSPORTER
-#include <stdio.h>
+#include <ndb_global.h>
#endif
class SendBuffer {
diff --git a/ndb/src/common/transporter/TCP_Transporter.cpp b/ndb/src/common/transporter/TCP_Transporter.cpp
index 8a7d1741636..99b6a137797 100644
--- a/ndb/src/common/transporter/TCP_Transporter.cpp
+++ b/ndb/src/common/transporter/TCP_Transporter.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbTCP.h>
#include "TCP_Transporter.hpp"
#include <NdbOut.hpp>
@@ -23,13 +25,9 @@
#if defined NDB_OSE || defined NDB_SOFTOSE
#define inet_send inet_send
#else
-#include <NdbStdio.h>
#define inet_send send
#endif
-#include <stdlib.h>
-
-
#ifdef NDB_WIN32
class ndbstrerror
{
diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp
index 1e19a8375ba..5ca523d5185 100644
--- a/ndb/src/common/transporter/Transporter.cpp
+++ b/ndb/src/common/transporter/Transporter.cpp
@@ -17,7 +17,6 @@
#include "Transporter.hpp"
#include "TransporterInternalDefinitions.hpp"
-#include <NdbStdio.h>
#include <NdbSleep.h>
Transporter::Transporter(NodeId lNodeId, NodeId rNodeId,
diff --git a/ndb/src/common/transporter/TransporterInternalDefinitions.hpp b/ndb/src/common/transporter/TransporterInternalDefinitions.hpp
index 18d54ca1e89..624b495422f 100644
--- a/ndb/src/common/transporter/TransporterInternalDefinitions.hpp
+++ b/ndb/src/common/transporter/TransporterInternalDefinitions.hpp
@@ -21,39 +21,18 @@
#include <NdbOut.hpp>
#endif
-#ifdef NDB_SOLARIS
-#define NDB_TCP_TRANSPORTER
-//#define NDB_SCI_TRANSPORTER
-#define NDB_SHM_TRANSPORTER
-#elif defined NDB_OSE || defined NDB_SOFTOSE
-#define NDB_TCP_TRANSPORTER
-#define NDB_OSE_TRANSPORTER
-#elif defined NDB_LINUX
-#define NDB_TCP_TRANSPORTER
-#define NDB_SCI_TRANSPORTER
-#define NDB_SHM_TRANSPORTER
-#elif defined NDB_WIN32
-#define NDB_TCP_TRANSPORTER
-#elif defined NDB_HPUX
-#define NDB_TCP_TRANSPORTER
-#define NDB_SHM_TRANSPORTER
-#elif defined NDB_MACOSX
-#define NDB_TCP_TRANSPORTER
-#define NDB_SHM_TRANSPORTER
-#elif defined NDB_IBMAIX
-#define NDB_TCP_TRANSPORTER
-#define NDB_SHM_TRANSPORTER
-#elif defined NDB_TRU64X
#define NDB_TCP_TRANSPORTER
+
+#ifdef HAVE_NDB_SHM
#define NDB_SHM_TRANSPORTER
-#else
-#error unsupported platform
#endif
-#ifndef HAVE_SCI
-#ifdef NDB_SCI_TRANSPORTER
-#undef NDB_SCI_TRANSPORTER
+#ifdef HAVE_NDB_SCI
+#define NDB_SCI_TRANSPORTER
#endif
+
+#ifdef HAVE_NDB_OSE
+#define NDB_OSE_TRANSPORTER
#endif
#ifdef DEBUG_TRANSPORTER
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index dcd957f40ce..3f98eeed89e 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -14,14 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "TransporterRegistry.hpp"
#include "TransporterInternalDefinitions.hpp"
#include "Transporter.hpp"
-#include <assert.h>
-#include <stdlib.h>
-
#ifdef NDB_TCP_TRANSPORTER
#include "TCP_Transporter.hpp"
#endif
diff --git a/ndb/src/common/transporter/basictest/basicTransporterTest.cpp b/ndb/src/common/transporter/basictest/basicTransporterTest.cpp
index 5d8186badb8..c0a437c4907 100644
--- a/ndb/src/common/transporter/basictest/basicTransporterTest.cpp
+++ b/ndb/src/common/transporter/basictest/basicTransporterTest.cpp
@@ -14,18 +14,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "TransporterRegistry.hpp"
#include "TransporterDefinitions.hpp"
#include "TransporterCallback.hpp"
#include <RefConvert.hpp>
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbString.h>
int basePortTCP = 17000;
diff --git a/ndb/src/common/transporter/buddy.cpp b/ndb/src/common/transporter/buddy.cpp
index c65aad1df2c..dc25e2dc66c 100644
--- a/ndb/src/common/transporter/buddy.cpp
+++ b/ndb/src/common/transporter/buddy.cpp
@@ -15,9 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "buddy.hpp"
-#include <stdlib.h>
-#include <math.h>
-
void Chunk256::setFree(bool free){
// Bit 0 of allocationTimeStamp represents if the segment is free or not
diff --git a/ndb/src/common/transporter/buddy.hpp b/ndb/src/common/transporter/buddy.hpp
index 7272ac884ec..f720e9e61a1 100644
--- a/ndb/src/common/transporter/buddy.hpp
+++ b/ndb/src/common/transporter/buddy.hpp
@@ -17,8 +17,7 @@
#ifndef BUDDY_H
#define BUDDY_H
-#include <stdlib.h>
-#include <stdio.h>
+#include <ndb_global.h>
typedef unsigned int Uint32;
typedef unsigned short Uint16;
diff --git a/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp b/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp
index 03ce7ea6df3..803029ee565 100644
--- a/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp
+++ b/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp
@@ -14,17 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include "sisci_types.h"
#include "sisci_api.h"
#include "sisci_error.h"
//#include "sisci_demolib.h"
-#include <strings.h>
-#include <ndb_types.h>
#include <NdbTick.h>
-#include "NdbSleep.h"
+#include <NdbSleep.h>
#define NO_CALLBACK NULL
#define NO_FLAGS 0
#define DATA_TRANSFER_READY 8
diff --git a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp
index 6d7f7083a48..d33221c2835 100644
--- a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp
+++ b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp
@@ -14,18 +14,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "TransporterRegistry.hpp"
#include "TransporterDefinitions.hpp"
#include "TransporterCallback.hpp"
#include <RefConvert.hpp>
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbString.h>
int basePortTCP = 17000;
diff --git a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp
index 919cc9d7511..0fce6aaad39 100644
--- a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp
+++ b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "TransporterRegistry.hpp"
#include "TransporterDefinitions.hpp"
#include "TransporterCallback.hpp"
@@ -21,8 +23,6 @@
#include "prioTransporterTest.hpp"
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
diff --git a/ndb/src/common/util/Base64.cpp b/ndb/src/common/util/Base64.cpp
index 5f4bbc8645a..482d0b10ad2 100644
--- a/ndb/src/common/util/Base64.cpp
+++ b/ndb/src/common/util/Base64.cpp
@@ -14,8 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <string.h>
+#include <ndb_global.h>
#include <Base64.hpp>
static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
diff --git a/ndb/src/common/util/BaseString.cpp b/ndb/src/common/util/BaseString.cpp
index 1b0eaa1b83c..d15249adf72 100644
--- a/ndb/src/common/util/BaseString.cpp
+++ b/ndb/src/common/util/BaseString.cpp
@@ -15,11 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* -*- c-basic-offset: 4; -*- */
-#include <string.h>
-#include <NdbStdio.h>
-#include <stdarg.h>
-#include "BaseString.hpp"
-#include <stdlib.h>
+#include <ndb_global.h>
+#include <BaseString.hpp>
BaseString::BaseString()
{
@@ -340,7 +337,6 @@ BaseString::trim(char * str, const char * delim){
#ifdef TEST_BASE_STRING
-#include <assert.h>
/*
g++ -g -Wall -o tbs -DTEST_BASE_STRING -I$NDB_TOP/include/util \
diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp
index ad72b41835d..22d262a0d27 100644
--- a/ndb/src/common/util/File.cpp
+++ b/ndb/src/common/util/File.cpp
@@ -14,15 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <File.hpp>
-
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
+#include <ndb_global.h>
-#if defined NDB_OSE || defined NDB_SOFTOSE
-#include <unistd.h>
-#endif
+#include <File.hpp>
#include <NdbOut.hpp>
@@ -31,7 +25,7 @@
//
bool
-File::exists(const char* aFileName)
+File_class::exists(const char* aFileName)
{
bool rc = true;
@@ -56,7 +50,7 @@ File::exists(const char* aFileName)
}
long
-File::size(FILE* f)
+File_class::size(FILE* f)
{
long cur_pos = 0, length = 0;
@@ -69,23 +63,23 @@ File::size(FILE* f)
}
bool
-File::rename(const char* currFileName, const char* newFileName)
+File_class::rename(const char* currFileName, const char* newFileName)
{
return ::rename(currFileName, newFileName) == 0 ? true : false;
}
bool
-File::remove(const char* aFileName)
+File_class::remove(const char* aFileName)
{
return ::remove(aFileName) == 0 ? true : false;
}
-File::File() :
+File_class::File_class() :
m_file(NULL),
m_fileMode("r")
{
}
-File::File(const char* aFileName, const char* mode) :
+File_class::File_class(const char* aFileName, const char* mode) :
m_file(NULL),
m_fileMode(mode)
{
@@ -93,13 +87,13 @@ File::File(const char* aFileName, const char* mode) :
}
bool
-File::open()
+File_class::open()
{
return open(m_fileName, m_fileMode);
}
bool
-File::open(const char* aFileName, const char* mode)
+File_class::open(const char* aFileName, const char* mode)
{
if(m_fileName != aFileName){
/**
@@ -116,21 +110,21 @@ File::open(const char* aFileName, const char* mode)
return rc;
}
-File::~File()
+File_class::~File_class()
{
close();
}
bool
-File::remove()
+File_class::remove()
{
// Close the file first!
close();
- return File::remove(m_fileName);
+ return File_class::remove(m_fileName);
}
bool
-File::close()
+File_class::close()
{
bool rc = true;
if (m_file != NULL)
@@ -144,55 +138,55 @@ File::close()
}
int
-File::read(void* buf, size_t itemSize, size_t nitems) const
+File_class::read(void* buf, size_t itemSize, size_t nitems) const
{
return ::fread(buf, itemSize, nitems, m_file);
}
int
-File::readChar(char* buf, long start, long length) const
+File_class::readChar(char* buf, long start, long length) const
{
return ::fread((void*)&buf[start], 1, length, m_file);
}
int
-File::readChar(char* buf)
+File_class::readChar(char* buf)
{
return readChar(buf, 0, strlen(buf));
}
int
-File::write(const void* buf, size_t size, size_t nitems)
+File_class::write(const void* buf, size_t size, size_t nitems)
{
return ::fwrite(buf, size, nitems, m_file);
}
int
-File::writeChar(const char* buf, long start, long length)
+File_class::writeChar(const char* buf, long start, long length)
{
return ::fwrite((const void*)&buf[start], sizeof(char), length, m_file);
}
int
-File::writeChar(const char* buf)
+File_class::writeChar(const char* buf)
{
return writeChar(buf, 0, ::strlen(buf));
}
long
-File::size() const
+File_class::size() const
{
- return File::size(m_file);
+ return File_class::size(m_file);
}
const char*
-File::getName() const
+File_class::getName() const
{
return m_fileName;
}
int
-File::flush() const
+File_class::flush() const
{
#if defined NDB_OSE || defined NDB_SOFTOSE
::fflush(m_file);
diff --git a/ndb/src/common/util/InputStream.cpp b/ndb/src/common/util/InputStream.cpp
index c52b594225d..410e9a70e9c 100644
--- a/ndb/src/common/util/InputStream.cpp
+++ b/ndb/src/common/util/InputStream.cpp
@@ -15,10 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "InputStream.hpp"
#include <socket_io.h>
-#include <assert.h>
-#include <string.h>
FileInputStream Stdin(stdin);
diff --git a/ndb/src/common/util/Makefile b/ndb/src/common/util/Makefile
index b3e33704266..e8ca2b87c20 100644
--- a/ndb/src/common/util/Makefile
+++ b/ndb/src/common/util/Makefile
@@ -18,15 +18,7 @@ endif
ifeq ($(NDB_OS), OSE)
SOURCES += NdbErrHnd.cpp
endif
-ifdef NDB_STRDUP
- SOURCES.c += strdup.c
-endif
-ifdef NDB_STRLCAT
- SOURCES.c += strlcat.c
-endif
-ifdef NDB_STRLCPY
- SOURCES.c += strlcpy.c
-endif
+ SOURCES.c += strdup.c strlcat.c strlcpy.c
DIRS := testSimpleProperties
diff --git a/ndb/src/common/util/NdbErrHnd.cpp b/ndb/src/common/util/NdbErrHnd.cpp
index 53df5d702ca..f1c28a7bbdd 100644
--- a/ndb/src/common/util/NdbErrHnd.cpp
+++ b/ndb/src/common/util/NdbErrHnd.cpp
@@ -18,7 +18,6 @@
#if defined NDB_OSE || defined NDB_SOFTOSE
#include <NdbOut.hpp>
-#include <NdbStdio.h>
#include <ndb_types.h>
#include "ose.h"
diff --git a/ndb/src/common/util/NdbOut.cpp b/ndb/src/common/util/NdbOut.cpp
index 2624bfa04bd..6d76cf22402 100644
--- a/ndb/src/common/util/NdbOut.cpp
+++ b/ndb/src/common/util/NdbOut.cpp
@@ -14,11 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbOut.hpp"
-#include <NdbStdio.h>
-#include <stdarg.h>
-#include <NdbUnistd.h>
-#include <string.h>
+#include <ndb_global.h>
+
+#include <NdbOut.hpp>
#include <OutputStream.hpp>
static FileOutputStream ndbouts_fileoutputstream(stdout);
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index dba7012cc0f..e91ade374cf 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -286,7 +286,6 @@ NdbSqlUtil::cmpTimespec(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32
#ifdef NDB_SQL_UTIL_TEST
-#include <assert.h>
#include <NdbTick.h>
#include <NdbOut.hpp>
diff --git a/ndb/src/common/util/OutputStream.cpp b/ndb/src/common/util/OutputStream.cpp
index 1143fe00fd1..bf3599dbac9 100644
--- a/ndb/src/common/util/OutputStream.cpp
+++ b/ndb/src/common/util/OutputStream.cpp
@@ -15,8 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <OutputStream.hpp>
-#include <stdarg.h>
#include <socket_io.h>
FileOutputStream::FileOutputStream(FILE * file){
diff --git a/ndb/src/common/util/Parser.cpp b/ndb/src/common/util/Parser.cpp
index d5c23fe14c1..2e8120f88ce 100644
--- a/ndb/src/common/util/Parser.cpp
+++ b/ndb/src/common/util/Parser.cpp
@@ -15,14 +15,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "Parser.hpp"
-#include <stdio.h>
#include <NdbOut.hpp>
-#include <string.h>
#include <Properties.hpp>
-#include <assert.h>
#include <Base64.hpp>
+#undef DEBUG
#define DEBUG(x) ndbout << x << endl;
static void trim(char * str);
diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp
index 4841d6e5e9e..2ab008142ba 100644
--- a/ndb/src/common/util/Properties.cpp
+++ b/ndb/src/common/util/Properties.cpp
@@ -14,14 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <Properties.hpp>
#include <NdbTCP.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <NdbString.h>
-
#include <NdbOut.hpp>
/**
diff --git a/ndb/src/common/util/SimpleProperties.cpp b/ndb/src/common/util/SimpleProperties.cpp
index a118478ba6c..c3980f03c4d 100644
--- a/ndb/src/common/util/SimpleProperties.cpp
+++ b/ndb/src/common/util/SimpleProperties.cpp
@@ -14,12 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <SimpleProperties.hpp>
-#include <stdlib.h>
-#include <NdbString.h>
#include <NdbOut.hpp>
#include <NdbTCP.h>
-#include <assert.h>
#include <UtilBuffer.hpp>
bool
diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp
index 39f46eceed9..a0ec0aaa676 100644
--- a/ndb/src/common/util/SocketServer.cpp
+++ b/ndb/src/common/util/SocketServer.cpp
@@ -15,17 +15,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SocketServer.hpp"
#include <NdbTCP.h>
-#include <string.h>
#include <NdbOut.hpp>
#include <NdbThread.h>
#include <NdbSleep.h>
-#include <stdio.h>
-#include <assert.h>
-
#define DEBUG(x) ndbout << x << endl;
SocketServer::SocketServer(int maxSessions) :
diff --git a/ndb/src/common/util/filetest/FileUnitTest.cpp b/ndb/src/common/util/filetest/FileUnitTest.cpp
index ebcca26d3d2..b6e7b7e8ec0 100644
--- a/ndb/src/common/util/filetest/FileUnitTest.cpp
+++ b/ndb/src/common/util/filetest/FileUnitTest.cpp
@@ -18,7 +18,6 @@
#include <File.hpp>
#include <NdbOut.hpp>
-#include <assert.h>
typedef bool (*TESTFUNC)(const char*);
diff --git a/ndb/src/common/util/getarg.c b/ndb/src/common/util/getarg.c
index 5f792437a65..ae016746987 100644
--- a/ndb/src/common/util/getarg.c
+++ b/ndb/src/common/util/getarg.c
@@ -32,18 +32,8 @@
* SUCH DAMAGE.
*/
-#include <ndb_types.h>
+#include <ndb_global.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-RCSID("$KTH: getarg.c,v 1.23 2000/09/01 21:25:54 lha Exp $");
-#endif
-
-#include <NdbStdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
#include "getarg.h"
#define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag)
@@ -407,12 +397,12 @@ arg_match_long(struct getargs *args, size_t num_args,
}
case arg_string:
{
- *(char**)current->value = optarg + 1;
+ *(char**)current->value = (char*)optarg + 1;
return 0;
}
case arg_strings:
{
- add_string((getarg_strings*)current->value, optarg + 1);
+ add_string((getarg_strings*)current->value, (char*)optarg + 1);
return 0;
}
case arg_flag:
diff --git a/ndb/src/common/util/new.cpp b/ndb/src/common/util/new.cpp
index a0709a3fa13..889e83edf6f 100644
--- a/ndb/src/common/util/new.cpp
+++ b/ndb/src/common/util/new.cpp
@@ -1,6 +1,5 @@
-#include <malloc.h>
-#include <stdlib.h>
+#include <ndb_global.h>
extern "C" {
void (* ndb_new_handler)() = 0;
diff --git a/ndb/src/common/util/random.c b/ndb/src/common/util/random.c
index 91da19572e2..286ab093a26 100644
--- a/ndb/src/common/util/random.c
+++ b/ndb/src/common/util/random.c
@@ -18,16 +18,8 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <sys/types.h>
+#include <ndb_global.h>
-#ifndef NDB_WIN32
-#include <sys/time.h>
-#endif
-
-#include <ndb_types.h>
#include <NdbOut.hpp>
#include <random.h>
diff --git a/ndb/src/common/util/socket_io.cpp b/ndb/src/common/util/socket_io.cpp
index 878a9059512..8def7ebe91b 100644
--- a/ndb/src/common/util/socket_io.cpp
+++ b/ndb/src/common/util/socket_io.cpp
@@ -14,13 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbTCP.h>
#include <socket_io.h>
-#include <stdarg.h>
-#include <string.h>
-#include <NdbStdio.h>
#include <NdbOut.hpp>
-#include <NdbString.h>
extern "C"
int
diff --git a/ndb/src/common/util/strdup.c b/ndb/src/common/util/strdup.c
index 5291be86b0f..afe2306427e 100644
--- a/ndb/src/common/util/strdup.c
+++ b/ndb/src/common/util/strdup.c
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdlib.h>
+#include <ndb_global.h>
#ifndef HAVE_STRDUP
char *
diff --git a/ndb/src/common/util/strlcat.c b/ndb/src/common/util/strlcat.c
index ccff15da27f..aa282abe48d 100644
--- a/ndb/src/common/util/strlcat.c
+++ b/ndb/src/common/util/strlcat.c
@@ -31,17 +31,13 @@
* SUCH DAMAGE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <ndb_types.h>
+#include <ndb_global.h>
/* RCSID("$KTH: strlcat.c,v 1.1 2000/08/16 01:23:47 lha Exp $"); */
-//#include <NdbString.h>
#ifndef HAVE_STRLCAT
+
size_t
strlcat (char *dst, const char *src, size_t dst_sz)
{
diff --git a/ndb/src/common/util/strlcpy.c b/ndb/src/common/util/strlcpy.c
index 9a3048081ca..97cff177d48 100644
--- a/ndb/src/common/util/strlcpy.c
+++ b/ndb/src/common/util/strlcpy.c
@@ -31,20 +31,12 @@
* SUCH DAMAGE.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <ndb_types.h>
+#include <ndb_global.h>
/* RCSID("$KTH: strlcpy.c,v 1.1 2000/08/16 01:23:48 lha Exp $"); */
#ifndef HAVE_STRLCPY
-#ifdef NDB_WIN32
-#include <string.h>
-#endif
-
size_t
strlcpy (char *dst, const char *src, size_t dst_sz)
{
diff --git a/ndb/src/common/util/testProperties/testProperties.cpp b/ndb/src/common/util/testProperties/testProperties.cpp
index 4a2999b89c1..3aa2af92c5b 100644
--- a/ndb/src/common/util/testProperties/testProperties.cpp
+++ b/ndb/src/common/util/testProperties/testProperties.cpp
@@ -14,10 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "Properties.hpp"
#include <NdbOut.hpp>
-#include <stdlib.h>
-#include <string.h>
#include "uucode.h"
diff --git a/ndb/src/common/util/testSimpleProperties/sp_test.cpp b/ndb/src/common/util/testSimpleProperties/sp_test.cpp
index d6dbe2a1502..d4052b64132 100644
--- a/ndb/src/common/util/testSimpleProperties/sp_test.cpp
+++ b/ndb/src/common/util/testSimpleProperties/sp_test.cpp
@@ -14,10 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SimpleProperties.hpp"
#include <NdbOut.hpp>
-#include <assert.h>
-#include <stdio.h>
Uint32 page[8192];
diff --git a/ndb/src/common/util/uucode.c b/ndb/src/common/util/uucode.c
index f862d982204..da34d565153 100644
--- a/ndb/src/common/util/uucode.c
+++ b/ndb/src/common/util/uucode.c
@@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <string.h>
+#include <ndb_global.h>
/* ENC is the basic 1 character encoding function to make a char printing */
/* DEC is single character decode */
diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c
index 2ff10f51932..10f621d5db8 100644
--- a/ndb/src/common/util/version.c
+++ b/ndb/src/common/util/version.c
@@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <string.h>
-#include <ndb_types.h>
+#include <ndb_global.h>
#include <ndb_version.h>
#include <version.h>
@@ -61,7 +59,7 @@ struct NdbUpGradeCompatible {
UG_MatchType matchType;
};
-//#define TEST_VERSION
+/*#define TEST_VERSION*/
#ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
@@ -74,7 +72,7 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
void ndbSetOwnVersion() {}
-#else // testing purposes
+#else /* testing purposes */
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(4,1,5), MAKE_VERSION(4,1,0), UG_Range },
@@ -122,7 +120,7 @@ ndbGetOwnVersion()
{
#ifndef TEST_VERSION
return NDB_VERSION_D;
-#else // testing purposes
+#else /* testing purposes */
if (ndbOwnVersionTesting == 0)
return NDB_VERSION_D;
else
diff --git a/ndb/src/cw/cpcc-win32/C++/StdAfx.h b/ndb/src/cw/cpcc-win32/C++/StdAfx.h
index d84b5811f8d..370d04fb466 100644
--- a/ndb/src/cw/cpcc-win32/C++/StdAfx.h
+++ b/ndb/src/cw/cpcc-win32/C++/StdAfx.h
@@ -48,15 +48,12 @@
#include <afxtempl.h>
// C RunTime Header Files
-#include <stdlib.h>
-#include <malloc.h>
+#include <ndb_global.h>
#include <memory.h>
#include <tchar.h>
#include <commctrl.h>
#include <shlwapi.h>
#include <crtdbg.h>
-#include <string.h>
-#include <stdio.h>
// Local Header Files
#include "resource.h"
diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp
index 9cf17addcc2..caf19ddba0e 100644
--- a/ndb/src/cw/cpcd/APIService.cpp
+++ b/ndb/src/cw/cpcd/APIService.cpp
@@ -23,7 +23,6 @@
#include "APIService.hpp"
#include "CPCD.hpp"
#include <NdbMutex.h>
-#include <NdbStdio.h>
#include <OutputStream.hpp>
/**
diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp
index 8864ccf6e4e..f2878b7dea1 100644
--- a/ndb/src/cw/cpcd/CPCD.cpp
+++ b/ndb/src/cw/cpcd/CPCD.cpp
@@ -15,11 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <string.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
-#include <NdbUnistd.h>
-#include <NdbStdio.h>
-#include <errno.h>
#include "APIService.hpp"
#include "CPCD.hpp"
diff --git a/ndb/src/cw/cpcd/Monitor.cpp b/ndb/src/cw/cpcd/Monitor.cpp
index a96f3509ee8..2935cd0a648 100644
--- a/ndb/src/cw/cpcd/Monitor.cpp
+++ b/ndb/src/cw/cpcd/Monitor.cpp
@@ -14,9 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbThread.h>
#include <NdbOut.hpp>
-#include <NdbUnistd.h>
#include <NdbSleep.h>
#include "CPCD.hpp"
diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp
index a54c6b8e475..74426306a88 100644
--- a/ndb/src/cw/cpcd/Process.cpp
+++ b/ndb/src/cw/cpcd/Process.cpp
@@ -14,13 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <sys/types.h>
+#include <ndb_global.h>
#include <signal.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <NdbUnistd.h>
#include <BaseString.hpp>
#include <InputStream.hpp>
@@ -28,10 +25,9 @@
#include "CPCD.hpp"
#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
+#ifdef HAVE_GETRLIMIT
#include <sys/resource.h>
+#endif
void
CPCD::Process::print(FILE * f){
@@ -108,12 +104,12 @@ bool
CPCD::Process::isRunning() {
if(m_pid <= 1){
- logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid);
+ //logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid);
return false;
}
/* Check if there actually exists a process with such a pid */
errno = 0;
- int s = kill((pid_t) m_pid, 0); /* Sending "signal" 0 to a process only
+ int s = kill((pid_t)-m_pid, 0); /* Sending "signal" 0 to a process only
* checkes if the process actually exists */
if(s != 0) {
switch(errno) {
@@ -130,7 +126,6 @@ CPCD::Process::isRunning() {
}
return false;
}
-
return true;
}
@@ -152,7 +147,6 @@ CPCD::Process::readPid() {
f = fopen(filename, "r");
if(f == NULL){
- logger.debug("readPid - %s not found", filename);
return -1; /* File didn't exist */
}
@@ -213,6 +207,7 @@ setup_environment(const char *env) {
static
int
set_ulimit(const BaseString & pair){
+#ifdef HAVE_GETRLIMIT
errno = 0;
do {
Vector<BaseString> list;
@@ -220,42 +215,43 @@ set_ulimit(const BaseString & pair){
if(list.size() != 2){
break;
}
-
- int resource = 0;
+
+ int res;
rlim_t value = RLIM_INFINITY;
if(!(list[1].trim() == "unlimited")){
value = atoi(list[1].c_str());
}
+
+ struct rlimit rlp;
+#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }}
+
if(list[0].trim() == "c"){
- resource = RLIMIT_CORE;
+ _RLIMIT_FIX(RLIMIT_CORE);
} else if(list[0] == "d"){
- resource = RLIMIT_DATA;
+ _RLIMIT_FIX(RLIMIT_DATA);
} else if(list[0] == "f"){
- resource = RLIMIT_FSIZE;
+ _RLIMIT_FIX(RLIMIT_FSIZE);
} else if(list[0] == "n"){
- resource = RLIMIT_NOFILE;
+ _RLIMIT_FIX(RLIMIT_NOFILE);
} else if(list[0] == "s"){
- resource = RLIMIT_STACK;
+ _RLIMIT_FIX(RLIMIT_STACK);
} else if(list[0] == "t"){
- resource = RLIMIT_CPU;
+ _RLIMIT_FIX(RLIMIT_CPU);
} else {
errno = EINVAL;
break;
}
- struct rlimit rlp;
- if(getrlimit(resource, &rlp) != 0){
+ if(!res)
break;
- }
-
- rlp.rlim_cur = value;
- if(setrlimit(resource, &rlp) != 0){
- break;
- }
+
return 0;
} while(false);
logger.error("Unable to process ulimit: %s(%s)",
pair.c_str(), strerror(errno));
return -1;
+#else
+ return 0; // Maybe it's ok anyway...
+#endif
}
void
@@ -360,8 +356,8 @@ CPCD::Process::start() {
*/
switch(pid = fork()) {
case 0: /* Child */
-
- writePid(getpid());
+ setsid();
+ writePid(getpgrp());
if(runas(m_runas.c_str()) == 0){
do_exec();
}
@@ -386,14 +382,13 @@ CPCD::Process::start() {
switch(fork()) {
case 0: /* Child */
signal(SIGCHLD, SIG_IGN);
- pid_t pid;
switch(pid = fork()) {
case 0: /* Child */
- writePid(getpid());
+ setsid();
+ writePid(getpgrp());
if(runas(m_runas.c_str()) != 0){
_exit(1);
}
- setsid();
do_exec();
_exit(1);
/* NOTREACHED */
@@ -424,15 +419,18 @@ CPCD::Process::start() {
logger.critical("Unknown process type");
return -1;
}
-
+
while(readPid() < 0){
sched_yield();
}
-
- if(pid != -1 && pid != m_pid){
- logger.error("pid and m_pid don't match: %d %d", pid, m_pid);
+
+ errno = 0;
+ pid_t pgid = getpgid(pid);
+
+ if(pgid != -1 && pgid != m_pid){
+ logger.error("pgid and m_pid don't match: %d %d (%d)", pgid, m_pid, pid);
}
-
+
if(isRunning()){
m_status = RUNNING;
return 0;
@@ -449,33 +447,36 @@ CPCD::Process::stop() {
unlink(filename);
if(m_pid <= 1){
- logger.critical("Stopping process with bogus pid: %d", m_pid);
+ logger.critical("Stopping process with bogus pid: %d id: %d",
+ m_pid, m_id);
return;
}
m_status = STOPPING;
-
- int ret = kill((pid_t)m_pid, SIGTERM);
+
+ errno = 0;
+ int ret = kill(-m_pid, SIGTERM);
switch(ret) {
case 0:
- logger.debug("Sent SIGTERM to pid %d", (int)m_pid);
+ logger.debug("Sent SIGTERM to pid %d", (int)-m_pid);
break;
default:
- logger.debug("kill pid: %d : %s", (int)m_pid, strerror(errno));
+ logger.debug("kill pid: %d : %s", (int)-m_pid, strerror(errno));
break;
}
-
+
if(isRunning()){
- ret = kill((pid_t)m_pid, SIGKILL);
+ errno = 0;
+ ret = kill(-m_pid, SIGKILL);
switch(ret) {
case 0:
- logger.debug("Sent SIGKILL to pid %d", (int)m_pid);
+ logger.debug("Sent SIGKILL to pid %d", (int)-m_pid);
break;
default:
- logger.debug("kill pid: %d : %s\n", (int)m_pid, strerror(errno));
+ logger.debug("kill pid: %d : %s\n", (int)-m_pid, strerror(errno));
break;
}
- }
-
+ }
+
m_pid = -1;
m_status = STOPPED;
}
diff --git a/ndb/src/cw/cpcd/common.cpp b/ndb/src/cw/cpcd/common.cpp
index 731866b22fd..cb1c0c37183 100644
--- a/ndb/src/cw/cpcd/common.cpp
+++ b/ndb/src/cw/cpcd/common.cpp
@@ -14,11 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "common.hpp"
#include <logger/Logger.hpp>
#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
#include <Properties.hpp>
#include <BaseString.hpp>
@@ -152,7 +152,10 @@ parse_config_file(struct getargs args[], int num_arg, const Properties& p){
break;
}
}
- if(!found)
+ if(!found) {
printf("Unknown parameter: %s\n", name);
+ return 1;
+ }
}
+ return 0;
}
diff --git a/ndb/src/cw/cpcd/common.hpp b/ndb/src/cw/cpcd/common.hpp
index 65fcce05f66..c3d87b8b9f5 100644
--- a/ndb/src/cw/cpcd/common.hpp
+++ b/ndb/src/cw/cpcd/common.hpp
@@ -17,7 +17,7 @@
#ifndef __CPCD_COMMON_HPP_INCLUDED__
#define __CPCD_COMMON_HPP_INCLUDED__
-#include <stdio.h>
+#include <ndb_global.h>
#include <logger/Logger.hpp>
#include <getarg.h>
diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp
index 8dd4f2b4608..11f6238d5f7 100644
--- a/ndb/src/cw/cpcd/main.cpp
+++ b/ndb/src/cw/cpcd/main.cpp
@@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <sys/types.h> /* Needed for mkdir(2) */
-#include <sys/stat.h> /* Needed for mkdir(2) */
-#include <errno.h>
+#include <ndb_global.h> /* Needed for mkdir(2) */
#include <signal.h>
#include "CPCD.hpp"
diff --git a/ndb/src/cw/test/socketclient/socketClientTest.cpp b/ndb/src/cw/test/socketclient/socketClientTest.cpp
index a4a0ed1e933..423c196aa43 100644
--- a/ndb/src/cw/test/socketclient/socketClientTest.cpp
+++ b/ndb/src/cw/test/socketclient/socketClientTest.cpp
@@ -15,11 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <Properties.hpp>
#include <socket_io.h>
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbSleep.h>
diff --git a/ndb/src/cw/util/ClientInterface.hpp b/ndb/src/cw/util/ClientInterface.hpp
index 764705afacd..66ecfe05197 100644
--- a/ndb/src/cw/util/ClientInterface.hpp
+++ b/ndb/src/cw/util/ClientInterface.hpp
@@ -16,6 +16,7 @@
#ifndef CLIENT_IF_HPP
#define CLIENT_IF_HPP
+#include <ndb_global.h>
#include <Parser.hpp>
#include <InputStream.hpp>
#include <Parser.hpp>
@@ -23,9 +24,6 @@
#include <Properties.hpp>
#include "SocketRegistry.hpp"
#include "SocketService.hpp"
-#include "string.h"
-#include <stdio.h>
-#include <stdlib.h>
class ClientInterface {
private:
diff --git a/ndb/src/kernel/blocks/backup/FsBuffer.hpp b/ndb/src/kernel/blocks/backup/FsBuffer.hpp
index 4b5d95a19a5..2f3c7daae43 100644
--- a/ndb/src/kernel/blocks/backup/FsBuffer.hpp
+++ b/ndb/src/kernel/blocks/backup/FsBuffer.hpp
@@ -17,10 +17,7 @@
#ifndef FS_BUFFER_HPP
#define FS_BUFFER_HPP
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ndb_types.h>
+#include <ndb_global.h>
#define DEBUG(x)
diff --git a/ndb/src/kernel/blocks/backup/read.cpp b/ndb/src/kernel/blocks/backup/read.cpp
index 8300c74ab43..921c352ea13 100644
--- a/ndb/src/kernel/blocks/backup/read.cpp
+++ b/ndb/src/kernel/blocks/backup/read.cpp
@@ -15,9 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ndb_global.h>
#include <NdbTCP.h>
#include <NdbOut.hpp>
diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile b/ndb/src/kernel/blocks/backup/restore/Makefile
index f99e3e3da0d..4c884525d73 100644
--- a/ndb/src/kernel/blocks/backup/restore/Makefile
+++ b/ndb/src/kernel/blocks/backup/restore/Makefile
@@ -1,12 +1,12 @@
include .defs.mk
-TYPE := ndbapi ndbapiclient
+TYPE := *
BIN_TARGET := restore
BIN_TARGET_LIBS :=
-BIN_TARGET_ARCHIVES := NDB_API general
+BIN_TARGET_ARCHIVES := NDB_API
-CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi
+CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi -I$(NDB_TOP)/include/ndbapi -I$(NDB_TOP)/include/util -I$(NDB_TOP)/include/portlib -I$(NDB_TOP)/include/kernel
#ifneq ($(MYSQLCLUSTER_TOP),)
#CCFLAGS_LOC +=-I$(MYSQLCLUSTER_TOP)/include -D USE_MYSQL
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp
index 50eb0df7c56..2c3c1c8df7b 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp
@@ -14,11 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "Restore.hpp"
#include "BackupFormat.hpp"
#include <NdbTCP.h>
-#include <NdbStdio.h>
#include <OutputStream.hpp>
#include <Bitmask.hpp>
@@ -514,7 +512,8 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data,
NdbDictionary::Column::Type type;
if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X) {
tableImpl->setName(tableName);
- for(Uint32 i = 0 ; i < tableImpl->getNoOfColumns(); i++) {
+ Uint32 noOfColumns = tableImpl->getNoOfColumns();
+ for(Uint32 i = 0 ; i < noOfColumns; i++) {
type = convertToV3x(tableImpl->getColumn(i)->m_extType,
columnTypeMapping,
-1);
@@ -562,7 +561,7 @@ bool
TupleS::prepareRecord(const TableS & tab){
m_currentTable = &tab;
for(int i = 0; i<allAttributes.size(); i++) {
- if(!allAttributes[i] == NULL)
+ if(allAttributes[i] != NULL)
delete allAttributes[i];
}
allAttributes.clear();
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
index f1a73bb18b9..0c075e18933 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
@@ -17,16 +17,13 @@
#ifndef RESTORE_H
#define RESTORE_H
-#include <stddef.h>
+#include <ndb_global.h>
#include <BackupFormat.hpp>
#include <NdbApi.hpp>
#include <AttrType.hpp>
#include <NdbOut.hpp>
#include "myVector.hpp"
-#include <NdbStdio.h>
-#include <NdbUnistd.h>
-#include <NdbString.h>
#include <ndb_version.h>
#include <version.h>
diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp
index b38f6ab751b..4c15785d5c2 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/main.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "Restore.hpp"
#include <getarg.h>
#include <NdbSleep.h>
diff --git a/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp b/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp
index b16990bda6c..bf721a0b30a 100644
--- a/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp
+++ b/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp
@@ -15,13 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <SchemaFile.hpp>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
void
usage(const char * prg){
diff --git a/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp b/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp
index 4c55425bdd7..efa4b9c92c5 100644
--- a/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp
+++ b/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp
@@ -15,13 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <Sysfile.hpp>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
void
usage(const char * prg){
diff --git a/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp b/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp
index d2d166fa03e..540df7b507e 100644
--- a/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp
+++ b/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp
@@ -25,11 +25,10 @@
//----------------------------------------------------------------
+#include <ndb_global.h>
+
#include "records.hpp"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
+
#define RETURN_ERROR 1
#define RETURN_OK 0
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
index 887f82308d6..54cb93e9736 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
@@ -49,7 +49,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
Uint32 noOfAttributes = signal->theData[4];
Uint32 fragId = signal->theData[5];
Uint32 noOfNullAttr = signal->theData[7];
- Uint32 schemaVersion = signal->theData[8];
+ /* Uint32 schemaVersion = signal->theData[8];*/
Uint32 noOfKeyAttr = signal->theData[9];
Uint32 noOfNewAttr = signal->theData[10];
diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
index c56e455a42a..4737c8422c4 100644
--- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
@@ -83,6 +83,9 @@
#define jamEntry() jamEntryLine(90000 + __LINE__)
#endif
+#undef max
+#undef min
+
class Configuration;
class Dbtux : public SimulatedBlock {
diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
index 2cb129bc591..92410e1a784 100644
--- a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
+++ b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
@@ -14,10 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "DbUtil.hpp"
-#include <new>
-#include <stddef.h>
#include <ndb_version.h>
#include <signaldata/WaitGCP.hpp>
@@ -1303,26 +1303,6 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr)
TcKeyReq::setAIInTcKeyReq(requestInfo, 0); // Attrinfo sent separately
prepOpPtr.p->tckey.requestInfo = requestInfo;
- if (operationType == UtilPrepareReq::Read) {
- // ResultSet
- AttrMappingBuffer::ConstDataBufferIterator tmpIt;
-#if 0 //def EVENT_DEBUG
- ResultSetBuffer & rs = prepOpPtr.p->rsInfo;
- ResultSetInfoBuffer::DataBufferIterator it;
- rs.first(it);
- for (prepOpPtr.p->attrMapping.first(tmpIt);
- tmpIt.curr.i != RNIL;
- prepOpPtr.p->attrMapping.next(tmpIt)) {
- AttributeHeader* ah = (AttributeHeader *) tmpIt.data;
- ah->print(stdout);
- AttributeHeader* rsah = (AttributeHeader *) it.data;
- rsah->print(stdout);
- rs.next(it,1);
- printf("%d\n",it.data);
- }
-#endif
- }
-
/****************************
* Confirm completed prepare
****************************/
@@ -1914,7 +1894,6 @@ DbUtil::runOperation(Signal* signal, TransactionPtr & transPtr,
Operation * op = opPtr.p;
const PreparedOperation * pop = op->prepOp;
- Uint32 lastFlag = 0;
if(!transPtr.p->operations.next(opPtr)){
TcKeyReq::setCommitFlag(start, 1); // Last operation
TcKeyReq::setExecuteFlag(start, 1);
@@ -2127,43 +2106,11 @@ DbUtil::execTRANSID_AI(Signal* signal){
/**
* Save result
*/
- Uint32 srcSz = dataLen;
const Uint32 *src = &signal->theData[3];
- const Uint32 segSize = opP->rs.getSegmentSize();
-
-#if 0 //def EVENT_DEBUG
- printf("rsRecv %u, dataLen %u, rsExpect %u\n",
- opP->rsRecv, dataLen, opP->rsExpect);
-#endif
-
ResultSetBuffer::DataBufferIterator rs = opP->rsIterator;
-#if 0 //def EVENT_DEBUG
- for(int i = 0; i < dataLen; i++)
- printf("H'%.8x ", src[i]);
-#endif
-
ndbrequire(opP->rs.import(rs,src,dataLen));
opP->rs.next(rs, dataLen);
-
-#if 0 // replaced this section with import() above
- while(srcSz > segSize){
- ndbrequire(rs.curr.i != RNIL);
- memcpy(rs.data, src, segSize << 2);
- opP->rs.next(rs, segSize);
- srcSz -= segSize;
- // src += segSize * 4; // Bug?
- src += segSize;
- }
-
- if(srcSz > 0){
- jam();
- memcpy(rs.data, src, srcSz << 2);
- rs.curr.i = RNIL;
- rs.data = 0;
- }
-#endif
-
opP->rsIterator = rs;
if(!opP->complete()){
@@ -2171,20 +2118,12 @@ DbUtil::execTRANSID_AI(Signal* signal){
return;
}
-#if 0 //def EVENT_DEBUG
- printf("op complete\n");
-#endif
-
transPtr.p->recv++;
if(!transPtr.p->complete()){
jam();
return;
}
-#if 0 //def EVENT_DEBUG
- printf("trans complete\n");
-#endif
-
finishTransaction(signal, transPtr);
}
diff --git a/ndb/src/kernel/blocks/grep/Grep.cpp b/ndb/src/kernel/blocks/grep/Grep.cpp
index 093e9a225e6..ee506ce922a 100644
--- a/ndb/src/kernel/blocks/grep/Grep.cpp
+++ b/ndb/src/kernel/blocks/grep/Grep.cpp
@@ -1294,7 +1294,7 @@ Grep::PSPart::execSUB_REMOVE_REF(Signal* signal)
jamEntry();
SubRemoveRef * const ref = (SubRemoveRef *)signal->getDataPtr();
Uint32 subData = ref->subscriberData;
- GrepError::Code err = (GrepError::Code)ref->err;
+ /* GrepError::Code err = (GrepError::Code)ref->err;*/
SubscriptionPtr subPtr;
c_subscriptions.getPtr(subPtr, subData);
diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index 0e2aa4c6903..f73c1ec5ee7 100644
--- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -23,20 +23,17 @@
#endif
#endif
+#include <ndb_global.h>
+
#include "Error.hpp"
#include "AsyncFile.hpp"
#include <ErrorHandlingMacros.hpp>
#include <kernel_types.h>
-#include <string.h>
#include <NdbMem.h>
#include <NdbThread.h>
#include <signaldata/FsOpenReq.hpp>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
#ifdef NDB_LINUX
// This is for pread and pwrite
#ifndef __USE_UNIX98
@@ -44,9 +41,7 @@
#endif
#endif
-#include <NdbUnistd.h>
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE
-#include <NdbStdio.h>
#else
// For readv and writev
#include <sys/uio.h>
@@ -566,9 +561,8 @@ AsyncFile::writeReq( Request * request)
if (((i + 1) < request->par.readWrite.numberOfPages)) {
// There are more pages to write
// Check that offsets are consequtive
- if ((page_offset + request->par.readWrite.pages[i].size)
- !=
- request->par.readWrite.pages[i+1].offset) {
+ off_t tmp = page_offset + request->par.readWrite.pages[i].size;
+ if (tmp != request->par.readWrite.pages[i+1].offset) {
// Next page is not aligned with previous, not allowed
DEBUG(ndbout_c("Page offsets are not aligned"));
request->error = EINVAL;
diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp
index b9954ba130f..004752c9543 100644
--- a/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp
@@ -16,10 +16,8 @@
//#define TESTDEBUG 1
-#include <sys/stat.h>
-#include <fcntl.h>
+#include <ndb_global.h>
-#include <string.h>
#include <kernel_types.h>
#include <Pool.hpp>
#include "AsyncFile.hpp"
diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.cpp b/ndb/src/kernel/blocks/ndbfs/Filename.cpp
index c0bc52b4501..494c9c74eb9 100644
--- a/ndb/src/kernel/blocks/ndbfs/Filename.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/Filename.cpp
@@ -14,10 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdlib.h>
-#include <string.h>
-#include <NdbStdio.h>
-#include <NdbUnistd.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include "Filename.hpp"
diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.hpp b/ndb/src/kernel/blocks/ndbfs/Filename.hpp
index 4c3569b5485..29aba79c9dc 100644
--- a/ndb/src/kernel/blocks/ndbfs/Filename.hpp
+++ b/ndb/src/kernel/blocks/ndbfs/Filename.hpp
@@ -52,8 +52,8 @@
//
//===========================================================================
+#include <ndb_global.h>
#include <kernel_types.h>
-#include <NdbUnistd.h>
class Filename
{
diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp
index 6e0c2721ca0..435a6a6b208 100644
--- a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp
+++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp
@@ -76,7 +76,6 @@
#include "NdbCondition.h"
#include <NdbOut.hpp>
-#include <assert.h>
template <class T>
class MemoryChannel
diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp
index 9f70efcadf7..ca90bc60153 100644
--- a/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp
+++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp
@@ -65,7 +65,6 @@
#include "NdbMutex.h"
#include "NdbCondition.h"
-#include <assert.h>
diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
index 8992a2104e9..36322ffad1e 100644
--- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
@@ -14,8 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <limits.h>
-#include <errno.h>
+#include <ndb_global.h>
#include "Ndbfs.hpp"
#include "AsyncFile.hpp"
@@ -855,7 +854,7 @@ int Ndbfs::translateErrno(int aErrno)
//no space left on device
case ENFILE:
case EDQUOT:
-#ifndef NDB_MACOSX
+#ifdef ENOSR
case ENOSR:
#endif
case ENOSPC:
@@ -873,12 +872,16 @@ int Ndbfs::translateErrno(int aErrno)
return FsRef::fsErrInvalidParameters;
//environment error
case ELOOP:
-#ifndef NDB_MACOSX
+#ifdef ENOLINK
case ENOLINK:
+#endif
+#ifdef EMULTIHOP
case EMULTIHOP:
#endif
-#ifndef NDB_LINUX
+#ifdef EOPNOTSUPP
case EOPNOTSUPP:
+#endif
+#ifdef ESPIPE
case ESPIPE:
#endif
case EPIPE:
diff --git a/ndb/src/kernel/blocks/suma/SumaInit.cpp b/ndb/src/kernel/blocks/suma/SumaInit.cpp
index e9fba5e789c..9f0659942a2 100644
--- a/ndb/src/kernel/blocks/suma/SumaInit.cpp
+++ b/ndb/src/kernel/blocks/suma/SumaInit.cpp
@@ -132,9 +132,9 @@ SumaParticipant::~SumaParticipant()
Suma::Suma(const Configuration & conf) :
SumaParticipant(conf),
+ Restart(*this),
c_nodes(c_nodePool),
- c_runningSubscriptions(c_subCoordinatorPool),
- Restart(*this)
+ c_runningSubscriptions(c_subCoordinatorPool)
{
c_nodePool.setSize(MAX_NDB_NODES);
diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp
index 1aa937f4675..56627cba46f 100644
--- a/ndb/src/kernel/error/ErrorReporter.cpp
+++ b/ndb/src/kernel/error/ErrorReporter.cpp
@@ -15,17 +15,16 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "Error.hpp"
#include "ErrorReporter.hpp"
#include "ErrorMessages.hpp"
#include <FastScheduler.hpp>
#include <DebuggerNames.hpp>
-#include <NdbUnistd.h>
-#include <NdbStdio.h>
#include <NdbHost.h>
#include <NdbConfig.h>
-#include <string.h>
#include <Configuration.hpp>
#define MESSAGE_LENGTH 400
diff --git a/ndb/src/kernel/error/ErrorReporter.hpp b/ndb/src/kernel/error/ErrorReporter.hpp
index f1428821ab0..20340a9602f 100644
--- a/ndb/src/kernel/error/ErrorReporter.hpp
+++ b/ndb/src/kernel/error/ErrorReporter.hpp
@@ -17,9 +17,10 @@
#ifndef ERRORREPORTER_H
#define ERRORREPORTER_H
+#include <ndb_global.h>
+
#include "TimeModule.hpp"
#include "Error.hpp"
-#include <stdio.h>
#include <Emulator.hpp>
diff --git a/ndb/src/kernel/error/TimeModule.cpp b/ndb/src/kernel/error/TimeModule.cpp
index c0f4e40858f..4bd8e3daf99 100644
--- a/ndb/src/kernel/error/TimeModule.cpp
+++ b/ndb/src/kernel/error/TimeModule.cpp
@@ -16,8 +16,8 @@
+#include <ndb_global.h>
#include "TimeModule.hpp"
-#include <time.h>
static const char* cMonth[] = { "x", "January", "February", "Mars", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
diff --git a/ndb/src/kernel/ndb-main/Main.cpp b/ndb/src/kernel/ndb-main/Main.cpp
index 88fd9d177de..ef33802cab6 100644
--- a/ndb/src/kernel/ndb-main/Main.cpp
+++ b/ndb/src/kernel/ndb-main/Main.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <ndb_version.h>
#include "Configuration.hpp"
#include <TransporterRegistry.hpp>
@@ -32,7 +34,6 @@
#include <NodeState.hpp>
#if defined NDB_SOLARIS
-#include <sys/types.h> // For system information
#include <sys/processor.h> // For system informatio
#endif
@@ -41,10 +42,6 @@
#endif
extern EventLogger g_eventLogger;
-#if defined (NDB_LINUX) || defined (NDB_SOLARIS)
-#include <sys/types.h>
-#include <sys/wait.h>
-#endif
void catchsigs(bool ignore); // for process signal handling
extern "C" void handler(int signo); // for process signal handling
@@ -81,10 +78,6 @@ NDB_MAIN(ndb_kernel){
char homePath[255];
NdbConfig_HomePath(homePath, 255);
-#if defined (NDB_LINUX) || defined (NDB_SOLARIS)
- /**
- * This has only been tested with linux & solaris
- */
if (theConfig->getDaemonMode()) {
// Become a daemon
char lockfile[255], logfile[255];
@@ -137,7 +130,6 @@ NDB_MAIN(ndb_kernel){
}
g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid());
-#endif
systemInfo(* theConfig,
theConfig->clusterConfigurationData().SizeAltData.logLevel);
@@ -188,9 +180,9 @@ NDB_MAIN(ndb_kernel){
void
systemInfo(const Configuration & config, const LogLevel & logLevel){
+#ifdef NDB_WIN32
int processors = 0;
int speed;
-#ifdef NDB_WIN32
SYSTEM_INFO sinfo;
GetSystemInfo(&sinfo);
processors = sinfo.dwNumberOfProcessors;
@@ -260,8 +252,10 @@ handler(int sig){
case SIGINT: /* 2 - Interrupt */
case SIGQUIT: /* 3 - Quit */
case SIGTERM: /* 15 - Terminate */
-#ifndef NDB_MACOSX
+#ifdef SIGPWR
case SIGPWR: /* 19 - Power fail */
+#endif
+#ifdef SIGPOLL
case SIGPOLL: /* 22 */
#endif
case SIGSTOP: /* 23 */
diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp
index 4a84047b614..284d29dcefa 100644
--- a/ndb/src/kernel/vm/ArrayPool.hpp
+++ b/ndb/src/kernel/vm/ArrayPool.hpp
@@ -17,12 +17,12 @@
#ifndef ARRAY_POOL_HPP
#define ARRAY_POOL_HPP
+#include <ndb_global.h>
+
#include <pc.hpp>
#include <ErrorReporter.hpp>
#include <NdbMem.h>
#include <Bitmask.hpp>
-#include <assert.h>
-#include <stddef.h>
template <class T> class Array;
template <class T> class SLList;
diff --git a/ndb/src/kernel/vm/ClusterConfiguration.cpp b/ndb/src/kernel/vm/ClusterConfiguration.cpp
index f04081ee3c1..3a6478380d1 100644
--- a/ndb/src/kernel/vm/ClusterConfiguration.cpp
+++ b/ndb/src/kernel/vm/ClusterConfiguration.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "ClusterConfiguration.hpp"
#include <ErrorHandlingMacros.hpp>
@@ -27,9 +29,6 @@
#include <signaldata/TupSizeAltReq.hpp>
#include <signaldata/TuxSizeAltReq.hpp>
-#include <string.h>
-#include <assert.h>
-
ClusterConfiguration::ClusterConfiguration()
{
for (unsigned i= 0; i< MAX_SIZEALT_BLOCKS; i++) // initialize
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 03495449787..706d75509f2 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -24,7 +24,6 @@
#include <NdbMem.h>
#include <NdbOut.hpp>
#include <WatchDog.hpp>
-#include <NdbString.h>
#include <getarg.h>
diff --git a/ndb/src/kernel/vm/DLHashTable.hpp b/ndb/src/kernel/vm/DLHashTable.hpp
index f7cd7ae5228..13a9632f8da 100644
--- a/ndb/src/kernel/vm/DLHashTable.hpp
+++ b/ndb/src/kernel/vm/DLHashTable.hpp
@@ -17,9 +17,8 @@
#ifndef DL_HASHTABLE_HPP
#define DL_HASHTABLE_HPP
+#include <ndb_global.h>
#include "ArrayList.hpp"
-#include <assert.h>
-#include <stddef.h>
/**
* DLHashTable implements a hashtable using chaining
diff --git a/ndb/src/kernel/vm/DLHashTable2.hpp b/ndb/src/kernel/vm/DLHashTable2.hpp
index 8386790b0a6..6b166331631 100644
--- a/ndb/src/kernel/vm/DLHashTable2.hpp
+++ b/ndb/src/kernel/vm/DLHashTable2.hpp
@@ -17,10 +17,9 @@
#ifndef DL_HASHTABLE2_HPP
#define DL_HASHTABLE2_HPP
+#include <ndb_global.h>
+
#include "ArrayList.hpp"
-#include <assert.h>
-#include <stddef.h>
-#include <new>
/**
* DLHashTable2 is a DLHashTable variant meant for cases where different
diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp
index a852e045c6e..0d6d3f55acb 100644
--- a/ndb/src/kernel/vm/Emulator.cpp
+++ b/ndb/src/kernel/vm/Emulator.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "Emulator.hpp"
#include <FastScheduler.hpp>
#include <SignalLoggerManager.hpp>
@@ -31,19 +33,12 @@
#include <NdbOut.hpp>
#include <NdbMutex.h>
#include <NdbSleep.h>
-#include <stdlib.h>
#include <new>
extern "C" {
extern void (* ndb_new_handler)();
}
-
-#if defined (NDB_LINUX) || defined (NDB_SOLARIS)
-#include <sys/types.h>
-#include <sys/wait.h>
-#endif
-
/**
* Declare the global variables
*/
diff --git a/ndb/src/kernel/vm/GlobalData.hpp b/ndb/src/kernel/vm/GlobalData.hpp
index ca7dd467750..99b65727374 100644
--- a/ndb/src/kernel/vm/GlobalData.hpp
+++ b/ndb/src/kernel/vm/GlobalData.hpp
@@ -17,11 +17,10 @@
#ifndef GLOBAL_DATA_H
#define GLOBAL_DATA_H
+#include <ndb_global.h>
#include <kernel_types.h>
#include "Prio.hpp"
#include "VMSignal.hpp"
-#include <stdlib.h>
-#include <assert.h>
#include <BlockNumbers.h>
#include <NodeState.hpp>
diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp
index f36b3e43d42..e3f087d7d74 100644
--- a/ndb/src/kernel/vm/SimulatedBlock.cpp
+++ b/ndb/src/kernel/vm/SimulatedBlock.cpp
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "SimulatedBlock.hpp"
#include <NdbOut.hpp>
#include <GlobalData.hpp>
@@ -24,8 +26,6 @@
#include <SignalLoggerManager.hpp>
#include <FastScheduler.hpp>
#include <NdbMem.h>
-#include <NdbStdio.h>
-#include <stdarg.h>
#include <signaldata/EventReport.hpp>
#include <signaldata/ContinueFragmented.hpp>
#include <signaldata/NodeStateSignalData.hpp>
diff --git a/ndb/src/kernel/vm/TransporterCallback.cpp b/ndb/src/kernel/vm/TransporterCallback.cpp
index 1fec4ea86bd..3798e4040c8 100644
--- a/ndb/src/kernel/vm/TransporterCallback.cpp
+++ b/ndb/src/kernel/vm/TransporterCallback.cpp
@@ -14,12 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <TransporterCallback.hpp>
#include <TransporterRegistry.hpp>
#include <FastScheduler.hpp>
#include <Emulator.hpp>
#include <ErrorHandlingMacros.hpp>
-#include <stdio.h>
#include "LongSignal.hpp"
diff --git a/ndb/src/kernel/vm/VMSignal.hpp b/ndb/src/kernel/vm/VMSignal.hpp
index d436143c055..45e731f2079 100644
--- a/ndb/src/kernel/vm/VMSignal.hpp
+++ b/ndb/src/kernel/vm/VMSignal.hpp
@@ -17,14 +17,15 @@
#ifndef VMSignal_H
#define VMSignal_H
+#include <ndb_global.h>
+#include <ndb_limits.h>
+#include <kernel_types.h>
+
#include <ErrorReporter.hpp>
#include <NodeBitmask.hpp>
-#include <ndb_limits.h>
-#include <kernel_types.h>
#include <RefConvert.hpp>
#include <TransporterDefinitions.hpp>
-#include <stdlib.h>
/**
* Struct used when sending to multiple blocks
diff --git a/ndb/src/kernel/vm/al_test/arrayListTest.cpp b/ndb/src/kernel/vm/al_test/arrayListTest.cpp
index 39d8170cfc5..bb320106653 100644
--- a/ndb/src/kernel/vm/al_test/arrayListTest.cpp
+++ b/ndb/src/kernel/vm/al_test/arrayListTest.cpp
@@ -16,11 +16,11 @@
+#include <ndb_global.hpp>
+
#include <ArrayList.hpp>
-#include <stdlib.h>
#include <NdbOut.hpp>
#include <NdbTick.h>
-#include <assert.h>
struct A_Listable_Object {
Uint32 next;
diff --git a/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp b/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp
index 8b554d5bb41..e80905121e1 100644
--- a/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp
+++ b/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp
@@ -16,12 +16,11 @@
+#include <ndb_global.h>
+
#include <ArrayList.hpp>
-#include <stdlib.h>
#include <NdbOut.hpp>
#include <NdbTick.h>
-#include <assert.h>
-#include <string.h>
struct A_Poolable_Object {
Uint32 next;
diff --git a/ndb/src/kernel/vm/al_test/main.cpp b/ndb/src/kernel/vm/al_test/main.cpp
index 42c36173b56..23193b50725 100644
--- a/ndb/src/kernel/vm/al_test/main.cpp
+++ b/ndb/src/kernel/vm/al_test/main.cpp
@@ -14,11 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <ArrayList.hpp>
-#include <stdlib.h>
#include <NdbOut.hpp>
#include <NdbTick.h>
-#include <assert.h>
#include <NdbMain.h>
#include "arrayListTest.cpp"
diff --git a/ndb/src/kernel/vm/testCopy/rr.cpp b/ndb/src/kernel/vm/testCopy/rr.cpp
index 2da8383f523..1e8305dfe4c 100644
--- a/ndb/src/kernel/vm/testCopy/rr.cpp
+++ b/ndb/src/kernel/vm/testCopy/rr.cpp
@@ -15,10 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <sched.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
int
main(int argc, char * const argv[]){
diff --git a/ndb/src/kernel/vm/testCopy/testCopy.cpp b/ndb/src/kernel/vm/testCopy/testCopy.cpp
index 1b4b24f5934..78a1dab2619 100644
--- a/ndb/src/kernel/vm/testCopy/testCopy.cpp
+++ b/ndb/src/kernel/vm/testCopy/testCopy.cpp
@@ -15,11 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbTick.h>
-#include <ndb_types.h>
-#include <string.h>
-#include <stdlib.h>
#ifdef __NDB_FORTE6
#define HAND
diff --git a/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp b/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp
index def8387e343..5ba59418223 100644
--- a/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp
+++ b/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp
@@ -14,10 +14,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
#include <NdbTick.h>
#include <DataBuffer.hpp>
-#include <stdlib.h>
-#include <string.h>
+
+#undef test
struct Buffer {
Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;}
diff --git a/ndb/src/kernel/vm/testLongSig/testLongSig.cpp b/ndb/src/kernel/vm/testLongSig/testLongSig.cpp
index 6d421268a0a..af4e2ca6e24 100644
--- a/ndb/src/kernel/vm/testLongSig/testLongSig.cpp
+++ b/ndb/src/kernel/vm/testLongSig/testLongSig.cpp
@@ -15,10 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <editline/editline.h>
#include <SignalSender.hpp>
-#include <assert.h>
-#include <stdlib.h>
void
print_help(){
diff --git a/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp b/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp
index 20a5d5230fb..e16870edf11 100644
--- a/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp
+++ b/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp
@@ -14,12 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <NdbTick.h>
#include <TransporterDefinitions.hpp>
#include <SimpleProperties.hpp>
#include <LongSignal.hpp>
-#include <stdlib.h>
-#include <string.h>
+
+#undef test
struct Buffer {
Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;}
diff --git a/ndb/src/mgmapi/Makefile b/ndb/src/mgmapi/Makefile
index fac852dbba8..9e7ba4f5ac7 100644
--- a/ndb/src/mgmapi/Makefile
+++ b/ndb/src/mgmapi/Makefile
@@ -9,7 +9,7 @@ A_LIB := Y
SO_LIB := Y
PIC_LIB := Y
-DIRS := test
+#DIRS := test
LIB_TARGET := MGM_API
LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) general portlib
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 4c1355e8e46..fcdfe943fb1 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -14,17 +14,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbTCP.h>
#include "mgmapi.h"
#include "mgmapi_debug.h"
#include <socket_io.h>
-#include <stdlib.h>
-
-#include <string.h>
-#include <NdbStdio.h>
-#include <NdbString.h>
-#include <errno.h>
#include <NdbOut.hpp>
#include <SocketServer.hpp>
#include <Parser.hpp>
diff --git a/ndb/src/mgmapi/test/keso.c b/ndb/src/mgmapi/test/keso.c
index f4b192e3db8..d5086b20b6a 100644
--- a/ndb/src/mgmapi/test/keso.c
+++ b/ndb/src/mgmapi/test/keso.c
@@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <mgmapi.h>
#ifdef VM_TRACE
@@ -22,9 +24,6 @@
#endif
#include <NdbOut.hpp>
-#include <NdbStdio.h>
-
-#include <stdlib.h>
static int testConnect(NdbMgmHandle h, struct ndb_mgm_reply* reply);
static int testDisconnect(NdbMgmHandle h, struct ndb_mgm_reply* reply);
@@ -60,8 +59,8 @@ struct test_case test_connect_disconnect[] = {
struct test_case tests[] = {
{ "testStatus", &testStatus },
{ "testFilterClusterLog", &testFilterClusterLog },
- //{ "testSetLogLevelClusterLog", &testSetLogLevelClusterLog },
- //{ "testSetLogLevelNode", &testSetLogLevelNode },
+ /*{ "testSetLogLevelClusterLog", &testSetLogLevelClusterLog },*/
+ /*{ "testSetLogLevelNode", &testSetLogLevelNode },*/
{ "testRestartNode", &testRestartNode },
{ "testGetStatPort", &testGetStatPort },
#ifdef VM_TRACE
diff --git a/ndb/src/mgmapi/test/mgmSrvApi.cpp b/ndb/src/mgmapi/test/mgmSrvApi.cpp
index e93c54ae5a7..4a8e38c9ba5 100644
--- a/ndb/src/mgmapi/test/mgmSrvApi.cpp
+++ b/ndb/src/mgmapi/test/mgmSrvApi.cpp
@@ -25,11 +25,9 @@
* Server API" document
*
*****************************************************/
+#include <ndb_global.h>
#include "mgmapi.h"
#include "mgmapi_commands.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index 29d25ebf7d3..fba5fda32dd 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -14,13 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <errno.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#include <ndb_version.h>
+#include "CommandInterpreter.hpp"
#include <mgmapi.h>
#include <mgmapi_debug.h>
@@ -34,7 +28,6 @@
#endif // HAVE_GLOBAL_REPLICATION
#include "MgmtErrorReporter.hpp"
-#include "CommandInterpreter.hpp"
#include "CpcClient.hpp"
#ifdef NDB_SOLARIS // XXX fix me
diff --git a/ndb/src/mgmclient/CommandInterpreter.hpp b/ndb/src/mgmclient/CommandInterpreter.hpp
index 9049ef39915..796a4e4838e 100644
--- a/ndb/src/mgmclient/CommandInterpreter.hpp
+++ b/ndb/src/mgmclient/CommandInterpreter.hpp
@@ -22,9 +22,7 @@
// Author: Peter Lind
//*****************************************************************************
-#include <NdbStdio.h>
-#include <ndb_types.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <Vector.hpp>
#include <editline/editline.h>
diff --git a/ndb/src/mgmclient/CpcClient.cpp b/ndb/src/mgmclient/CpcClient.cpp
index 24eab7194e9..74fa1a828ed 100644
--- a/ndb/src/mgmclient/CpcClient.cpp
+++ b/ndb/src/mgmclient/CpcClient.cpp
@@ -14,14 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <ndb_types.h>
+#include <ndb_global.h>
#include <editline/editline.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
#include <netdb.h>
-#include <errno.h>
#include <NdbOut.hpp>
#include <NdbTCP.h>
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index bbadaeb5206..2dcadf9369d 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/param.h>
+#include <ndb_global.h>
#include <NdbMain.h>
#include <NdbHost.h>
diff --git a/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp b/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp
index 6b6dc9f1077..32f0adbcf26 100644
--- a/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp
+++ b/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp
@@ -15,10 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "../CpcClient.hpp"
#include <Vector.hpp>
-#include <assert.h>
-#include <stdlib.h>
SimpleCpcClient g_client("localhost", 1234);
Vector<SimpleCpcClient::Process> g_procs;
@@ -89,10 +88,16 @@ void define(){
//proc.m_proc.m_stdout = "log.out";
//proc.m_proc.m_stderr = "2>&1";
//proc.m_proc.m_runas = proc.m_host->m_user;
- //proc.m_proc.m_ulimit = "c:unlimited";
- m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "test");
- m_proc.m_path.assign("/bin/sleep");
- m_proc.m_args = "600";
+ m_proc.m_ulimit = "c:unlimited";
+ if((rand() & 15) >= 0){
+ m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "sleep");
+ m_proc.m_path.assign("/bin/sleep");
+ m_proc.m_args = "600";
+ } else {
+ m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "test.sh");
+ m_proc.m_path.assign("/home/jonas/run/cpcd/test.sh");
+ m_proc.m_args = "600";
+ }
g_procs.push_back(m_proc);
Properties reply;
@@ -136,7 +141,7 @@ void list(){
ABORT();
}
- for(int i = 0; i<procs.size(); i++){
+ for(Uint32 i = 0; i<procs.size(); i++){
SimpleCpcClient::Process * p = find(procs[i].m_id);
if(p != 0){
p->m_status = procs[i].m_status;
@@ -144,7 +149,7 @@ void list(){
}
}
SimpleCpcClient::Process* find(int id){
- for(int i = 0; i<g_procs.size(); i++){
+ for(Uint32 i = 0; i<g_procs.size(); i++){
if(g_procs[i].m_id == id)
return &g_procs[i];
}
diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp
index 1e608c05042..8a7293b8434 100644
--- a/ndb/src/mgmsrv/CommandInterpreter.cpp
+++ b/ndb/src/mgmsrv/CommandInterpreter.cpp
@@ -645,6 +645,8 @@ versionCallback(int nodeId, int version, void * anyData, int errCode){
}
break;
+ case NDB_MGM_NODE_TYPE_UNKNOWN:
+ abort();
};
} else {
diff --git a/ndb/src/mgmsrv/CommandInterpreter.hpp b/ndb/src/mgmsrv/CommandInterpreter.hpp
index e68aa7da084..3466ee76226 100644
--- a/ndb/src/mgmsrv/CommandInterpreter.hpp
+++ b/ndb/src/mgmsrv/CommandInterpreter.hpp
@@ -21,9 +21,7 @@
// Author: Peter Lind
//*****************************************************************************
-#include <NdbStdio.h>
-#include <ndb_types.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <Vector.hpp>
#include <editline/editline.h>
#include <BaseString.hpp>
diff --git a/ndb/src/mgmsrv/Makefile b/ndb/src/mgmsrv/Makefile
index ebf50ecb76e..b10bdb64d30 100644
--- a/ndb/src/mgmsrv/Makefile
+++ b/ndb/src/mgmsrv/Makefile
@@ -6,8 +6,6 @@ BIN_TARGET := mgmtsrvr
BIN_TARGET_LIBS :=
BIN_TARGET_ARCHIVES := mgmapi NDB_API mgmsrvcommon
-LDFLAGS_LOC = -lpthread
-
ifneq ($(USE_EDITLINE), N)
BIN_TARGET_ARCHIVES += editline
DIRS := mkconfig
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 23ceeb15947..7c2d94c6b7f 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -14,10 +14,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+#include <pthread.h>
+
#include "MgmtSrvr.hpp"
#include "MgmtErrorReporter.hpp"
-#include <ctype.h>
#include <NdbOut.hpp>
#include <AttrType.hpp>
#include <NdbApiSignal.hpp>
@@ -42,15 +44,11 @@
#include <EventLogger.hpp>
#include <DebuggerNames.hpp>
#include <ndb_version.h>
-#include <string.h>
#include "SocketServer.hpp"
#include "NodeLogLevel.hpp"
#include <NdbConfig.h>
-#include <time.h>
-#include <pthread.h>
-
//#define MGM_SRV_DEBUG
#ifdef MGM_SRV_DEBUG
#define DEBUG(x) do ndbout << x << endl; while(0)
diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp
index 4fdf3c99d43..ce8765d6c73 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -20,7 +20,6 @@
#include <kernel_types.h>
#include "Config.hpp"
#include <NdbCondition.h>
-#include <NdbConstant.hpp>
#include <mgmapi.h>
diff --git a/ndb/src/mgmsrv/NodeLogLevel.hpp b/ndb/src/mgmsrv/NodeLogLevel.hpp
index 3e631e57901..3ad758cde99 100644
--- a/ndb/src/mgmsrv/NodeLogLevel.hpp
+++ b/ndb/src/mgmsrv/NodeLogLevel.hpp
@@ -17,7 +17,8 @@
#ifndef NODELOGLEVEL_H
#define NODELOGLEVEL_H
-#include <portlib/NdbConstant.hpp>
+#include <ndb_global.h>
+
#include <signaldata/SetLogLevelOrd.hpp>
/**
diff --git a/ndb/src/mgmsrv/NodeLogLevelList.cpp b/ndb/src/mgmsrv/NodeLogLevelList.cpp
index 7cf6dcc4b7e..6c7c091c1a8 100644
--- a/ndb/src/mgmsrv/NodeLogLevelList.cpp
+++ b/ndb/src/mgmsrv/NodeLogLevelList.cpp
@@ -14,10 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NodeLogLevelList.hpp"
+#include <ndb_global.h>
+#include "NodeLogLevelList.hpp"
#include "NodeLogLevel.hpp"
-#include "NdbStdio.h"
//
// PUBLIC
diff --git a/ndb/src/mgmsrv/convertStrToInt.cpp b/ndb/src/mgmsrv/convertStrToInt.cpp
index 82bdb8e4f2f..e5216047d10 100644
--- a/ndb/src/mgmsrv/convertStrToInt.cpp
+++ b/ndb/src/mgmsrv/convertStrToInt.cpp
@@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ndb_global.h>
bool convert(const char* s, int& val) {
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index d10ad8e0f4e..91b443f61a2 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -14,8 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <signal.h>
-#include <sys/ioctl.h>
#include "MgmtSrvr.hpp"
#include "EventLogger.hpp"
@@ -41,6 +42,7 @@
#include "CommandInterpreter.hpp"
#endif
+#undef DEBUG
#define DEBUG(x) ndbout << x << endl;
const char progname[] = "mgmtsrvr";
@@ -197,7 +199,6 @@ NDB_MAIN(mgmsrv){
goto error_end;
}
-#if defined (NDB_LINUX) || defined (NDB_SOLARIS)
if (glob.daemon) {
// Become a daemon
char homePath[255],lockfile[255], logfile[255];
@@ -209,7 +210,6 @@ NDB_MAIN(mgmsrv){
return 1;
}
}
-#endif
if(!glob.mgmObject->start()){
ndbout_c("Unable to start management server.");
diff --git a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp
index 0e9397e43c0..224c82aa8a1 100644
--- a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp
+++ b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp
@@ -14,15 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+#include <ndb_version.h>
+
#include <NdbMain.h>
#include <Properties.hpp>
-#include <stdlib.h>
#include "InitConfigFileParser.hpp"
-#include "Config.hpp"
-#include <assert.h>
-#include <NdbUnistd.h>
-#include <ndb_version.h>
+#include <Config.hpp>
void usage(const char * prg){
ndbout << "Usage " << prg << ": <Init config> <Binary file>" << endl;
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index 93fb0109669..1b536b6d741 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -14,6 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+#include <ndb_limits.h>
+#include <ndb_version.h>
+
#include "TransporterFacade.hpp"
#include "ClusterMgr.hpp"
#include <IPCConfig.hpp>
@@ -23,12 +27,8 @@
#include <NdbSleep.h>
#include <NdbOut.hpp>
#include <NdbTick.h>
-#include <ndb_limits.h>
-#include <stdio.h>
-#include <assert.h>
-#include <ndb_version.h>
#include <signaldata/NodeFailRep.hpp>
#include <signaldata/NFCompleteRep.hpp>
#include <signaldata/ApiRegSignalData.hpp>
diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp
index 36fbc85a875..f6f2106f2aa 100644
--- a/ndb/src/ndbapi/DictCache.cpp
+++ b/ndb/src/ndbapi/DictCache.cpp
@@ -14,12 +14,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "DictCache.hpp"
#include "NdbDictionaryImpl.hpp"
#include <NdbTick.h>
#include <NdbCondition.h>
#include <NdbSleep.h>
-#include <stdlib.h>
LocalDictCache::LocalDictCache(){
m_tableHash.createHashTable();
diff --git a/ndb/src/ndbapi/Makefile b/ndb/src/ndbapi/Makefile
index 932fbd844d2..f4c82e5d6ba 100644
--- a/ndb/src/ndbapi/Makefile
+++ b/ndb/src/ndbapi/Makefile
@@ -31,7 +31,9 @@ SOURCES = \
Ndblist.cpp \
Ndbif.cpp \
Ndbinit.cpp \
- Ndberror.cpp \
+ Ndberr.cpp \
+ ndberror.c \
+ NdbErrorOut.cpp \
NdbConnection.cpp \
NdbConnectionScan.cpp \
NdbOperation.cpp \
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index d7930f32d72..448a29ca485 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -21,14 +21,17 @@
Name: Ndb.cpp
******************************************************************************/
+#include <ndb_global.h>
+#include <pthread.h>
+
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
#include "NdbSchemaOp.hpp"
#include "NdbSchemaCon.hpp"
-#include "NdbOperation.hpp"
-#include "NdbConnection.hpp"
-#include "NdbEventOperation.hpp"
-#include "NdbRecAttr.hpp"
+#include <NdbOperation.hpp>
+#include <NdbConnection.hpp>
+#include <NdbEventOperation.hpp>
+#include <NdbRecAttr.hpp>
#include <md5_hash.hpp>
#include <NdbSleep.h>
#include <NdbOut.hpp>
@@ -1221,7 +1224,6 @@ Ndb::pollEvents(int aMillisecondNumber)
#ifdef VM_TRACE
#include <NdbMutex.h>
-#include <stdarg.h>
static NdbMutex print_state_mutex = NDB_MUTEX_INITIALIZER;
static bool
checkdups(NdbConnection** list, unsigned no)
@@ -1243,7 +1245,7 @@ Ndb::printState(const char* fmt, ...)
NdbMutex_Lock(&print_state_mutex);
bool dups = false;
ndbout << buf << " ndb=" << hex << this << dec;
-#ifdef NDB_LINUX
+#ifndef NDB_WIN32
ndbout << " thread=" << (int)pthread_self();
#endif
ndbout << endl;
diff --git a/ndb/src/ndbapi/NdbConnectionScan.cpp b/ndb/src/ndbapi/NdbConnectionScan.cpp
index 67f07d2a8c0..962acc0bdac 100644
--- a/ndb/src/ndbapi/NdbConnectionScan.cpp
+++ b/ndb/src/ndbapi/NdbConnectionScan.cpp
@@ -27,10 +27,12 @@
* Documentation:
* Adjust: 2000-06-12 UABRONM First version.
****************************************************************************/
-#include "Ndb.hpp"
-#include "NdbConnection.hpp"
-#include "NdbOperation.hpp"
-#include "NdbScanOperation.hpp"
+#include <ndb_global.h>
+
+#include <Ndb.hpp>
+#include <NdbConnection.hpp>
+#include <NdbOperation.hpp>
+#include <NdbScanOperation.hpp>
#include "NdbScanReceiver.hpp"
#include "NdbApiSignal.hpp"
#include "TransporterFacade.hpp"
@@ -41,7 +43,6 @@
#include <signaldata/ScanTab.hpp>
#include <NdbOut.hpp>
-#include <assert.h>
// time out for next scan result (-1 is infinite)
// XXX should change default only if non-trivial interpreted program is used
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index ec9a56cda62..b068ea6460f 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -646,7 +646,6 @@ NdbDictionary::Dictionary::Dictionary(NdbDictionaryImpl & impl)
: m_impl(impl)
{
}
-#include <assert.h>
NdbDictionary::Dictionary::~Dictionary(){
NdbDictionaryImpl * tmp = &m_impl;
if(this != tmp){
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index bd94ba9b080..02e3ee23f9c 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -35,7 +35,6 @@
#include <AttributeList.hpp>
#include <NdbEventOperation.hpp>
#include "NdbEventOperationImpl.hpp"
-#include <assert.h>
#define DEBUG_PRINT 0
#define INCOMPATIBLE_VERSION -2
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
index f6b0644ea15..3263a636a79 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
@@ -33,7 +33,7 @@
class NdbDictObjectImpl {
public:
- int m_version;
+ Uint32 m_version;
NdbDictionary::Object::Status m_status;
bool change();
diff --git a/ndb/include/portlib/NdbStdio.h b/ndb/src/ndbapi/NdbErrorOut.cpp
index 163b7eeef6f..07e0b2fe6e8 100644
--- a/ndb/include/portlib/NdbStdio.h
+++ b/ndb/src/ndbapi/NdbErrorOut.cpp
@@ -14,23 +14,32 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/*
- * NdbStdio.h - stdio.h for ndb
- *
- *
- */
+#include <ndb_global.h>
-#if defined NDB_OSE || defined NDB_SOFTOSE
-/* On OSE Delta the snprintf is declare in outfmt.h */
-#include <outfmt.h>
-#endif
+#include <NdbOut.hpp>
-#include <stdio.h>
+#include <NdbError.hpp>
-#ifdef NDB_WIN32
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define strtok_r(s1, s2, l) strtok(s1, s2)
-#endif
+/**
+ * operators
+ */
+NdbOut &
+operator<<(NdbOut & out, const NdbError & error){
+ if(error.message != 0)
+ out << error.code << ": " << error.message;
+ else
+ out << error.code << ": ";
+ return out;
+}
+
+NdbOut &
+operator<<(NdbOut & out, const NdbError::Status & status){
+ return out << ndberror_status_message((ndberror_status)status);
+}
+
+NdbOut &
+operator<<(NdbOut & out, const NdbError::Classification & classification){
+ return out << ndberror_classification_message((ndberror_classification)classification);
+}
diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp
index d167b8205a2..acc726e28c5 100644
--- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp
+++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-
+#include <ndb_global.h>
+#include <kernel_types.h>
#include "NdbDictionaryImpl.hpp"
#include "API.hpp"
@@ -24,21 +24,12 @@
#include <AttrType.hpp>
#include "NdbApiSignal.hpp"
#include "TransporterFacade.hpp"
-#include <signaldata/GetTabInfo.hpp>
-#include <signaldata/DictTabInfo.hpp>
-#include <signaldata/CreateTable.hpp>
-#include <signaldata/CreateIndx.hpp>
#include <signaldata/CreateEvnt.hpp>
#include <signaldata/SumaImpl.hpp>
-#include <signaldata/DropTable.hpp>
-#include <signaldata/DropIndx.hpp>
-#include <signaldata/ListTables.hpp>
#include <SimpleProperties.hpp>
#include <Bitmask.hpp>
#include <AttributeHeader.hpp>
#include <AttributeList.hpp>
-#include <ndb_types.h>
-#include <kernel_types.h>
#include <NdbError.hpp>
#include <BaseString.hpp>
#include <UtilBuffer.hpp>
diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp
index eaa2b35965b..ccbfa767542 100644
--- a/ndb/src/ndbapi/NdbOperation.cpp
+++ b/ndb/src/ndbapi/NdbOperation.cpp
@@ -37,7 +37,6 @@
#include "API.hpp"
#include <NdbOut.hpp>
-#include <assert.h>
/******************************************************************************
diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp
index a1ce25f19d1..18f8b79d12e 100644
--- a/ndb/src/ndbapi/NdbOperationDefine.cpp
+++ b/ndb/src/ndbapi/NdbOperationDefine.cpp
@@ -164,7 +164,6 @@ NdbOperation::readTupleExclusive()
int
NdbOperation::simpleRead()
{
- NdbConnection* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
@@ -193,7 +192,6 @@ NdbOperation::dirtyRead()
int
NdbOperation::committedRead()
{
- NdbConnection* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp
index 1b0ad68b1eb..b2a6f99880c 100644
--- a/ndb/src/ndbapi/NdbOperationExec.cpp
+++ b/ndb/src/ndbapi/NdbOperationExec.cpp
@@ -25,11 +25,12 @@ Version: 1.2
Description:
Documentation:
***************************************************************************/
-#include "NdbOperation.hpp"
-#include "NdbConnection.hpp"
+
+#include <NdbOperation.hpp>
+#include <NdbConnection.hpp>
#include "NdbApiSignal.hpp"
-#include "Ndb.hpp"
-#include "NdbRecAttr.hpp"
+#include <Ndb.hpp>
+#include <NdbRecAttr.hpp>
#include "NdbUtil.hpp"
#include "Interpreter.hpp"
diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp
index 42f2b1d10d8..e1d5e823077 100644
--- a/ndb/src/ndbapi/NdbOperationSearch.cpp
+++ b/ndb/src/ndbapi/NdbOperationSearch.cpp
@@ -319,7 +319,7 @@ NdbOperation::setTupleId()
return 0;
}
Uint64 tTupleId = theNdb->getTupleIdFromNdb(m_currentTable->m_tableId);
- if (tTupleId == ~0){
+ if (tTupleId == ~(Uint64)0){
setErrorCodeAbort(theNdb->theError.code);
return 0;
}
diff --git a/ndb/src/ndbapi/NdbPoolImpl.cpp b/ndb/src/ndbapi/NdbPoolImpl.cpp
index 08252d26d79..131edc74246 100644
--- a/ndb/src/ndbapi/NdbPoolImpl.cpp
+++ b/ndb/src/ndbapi/NdbPoolImpl.cpp
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "NdbPoolImpl.hpp"
-#include <assert.h>
-#include <string.h>
NdbMutex *NdbPool::pool_mutex = NULL;
NdbPool *the_pool = NULL;
diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp
index 11f36fbd2c4..0f7baeac4f5 100644
--- a/ndb/src/ndbapi/NdbRecAttr.cpp
+++ b/ndb/src/ndbapi/NdbRecAttr.cpp
@@ -26,8 +26,8 @@ Description: Interface between TIS and NDB
Documentation:
Adjust: 971206 UABRONM First version
************************************************************************************************/
+#include <ndb_global.h>
#include "NdbRecAttr.hpp"
-#include <stdlib.h>
#include "NdbDictionaryImpl.hpp"
NdbRecAttr::NdbRecAttr() :
diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index f753d2f6b34..4db0f30f56c 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -26,6 +26,7 @@
* Adjust: 2002-04-01 UABMASD First version.
****************************************************************************/
+#include <ndb_global.h>
#include <Ndb.hpp>
#include <NdbScanOperation.hpp>
#include <NdbConnection.hpp>
@@ -33,12 +34,6 @@
#include "NdbApiSignal.hpp"
#include <NdbOut.hpp>
#include "NdbDictionaryImpl.hpp"
-#include <NdbString.h>
-#ifndef NDB_MACOSX
-#include <malloc.h>
-#else
-#include <stdlib.h>
-#endif
NdbScanOperation::NdbScanOperation(Ndb* aNdb) :
NdbCursorOperation(aNdb),
@@ -637,6 +632,24 @@ SetValueRecList::callSetValueFn(SetValueRec& aSetValueRec, NdbOperation& oper)
}
}
+SetValueRec::~SetValueRec()
+{
+ if ((stype == SET_STRING_ATTR1) ||
+ (stype == SET_INT32_ATTR1) ||
+ (stype == SET_UINT32_ATTR1) ||
+ (stype == SET_INT64_ATTR1) ||
+ (stype == SET_UINT64_ATTR1) ||
+ (stype == SET_FLOAT_ATTR1) ||
+ (stype == SET_DOUBLE_ATTR1))
+ free(anAttrName);
+
+ if ((stype == SET_STRING_ATTR1) ||
+ (stype == SET_STRING_ATTR2))
+ free(stringStruct.aStringValue);
+ if (next) delete next;
+ next = 0;
+}
+
int
NdbScanOperation::equal_impl(const NdbColumnImpl* anAttrObject,
const char* aValue,
diff --git a/ndb/src/ndbapi/NdbScanReceiver.hpp b/ndb/src/ndbapi/NdbScanReceiver.hpp
index 5e316719194..72f9e48f02c 100644
--- a/ndb/src/ndbapi/NdbScanReceiver.hpp
+++ b/ndb/src/ndbapi/NdbScanReceiver.hpp
@@ -24,7 +24,6 @@
#include "NdbReceiver.hpp"
#include <NdbOut.hpp>
-#include <assert.h>
class NdbScanReceiver
{
diff --git a/ndb/src/ndbapi/NdbSchemaOp.cpp b/ndb/src/ndbapi/NdbSchemaOp.cpp
index 9f4d7fbcfd4..9e495229661 100644
--- a/ndb/src/ndbapi/NdbSchemaOp.cpp
+++ b/ndb/src/ndbapi/NdbSchemaOp.cpp
@@ -29,6 +29,7 @@ Documentation: Handles createTable and createAttribute calls
Adjust: 980125 UABMNST First version.
020826 EMIKRON New version for new DICT
*****************************************************************************/
+#include <assert.h>
#include "NdbSchemaOp.hpp"
#include "NdbSchemaCon.hpp"
#include "API.hpp"
@@ -139,6 +140,8 @@ NdbSchemaOp::createAttribute( const char* anAttrName,
case String:
col.setType(NdbDictionary::Column::Char);
break;
+ case NoAttrTypeDef:
+ abort();
}
col.setLength(anArraySize);
col.setNullable(nullable);
diff --git a/ndb/src/ndbapi/NdbUtil.hpp b/ndb/src/ndbapi/NdbUtil.hpp
index eeee087d548..6a82af85987 100644
--- a/ndb/src/ndbapi/NdbUtil.hpp
+++ b/ndb/src/ndbapi/NdbUtil.hpp
@@ -29,8 +29,7 @@ Comment:
#ifndef NdbUtil_H
#define NdbUtil_H
-#include <stdlib.h>
-#include <ndb_types.h>
+#include <ndb_global.h>
#include "AttrType.hpp"
class NdbApiSignal;
diff --git a/ndb/src/ndbapi/Ndberr.cpp b/ndb/src/ndbapi/Ndberr.cpp
new file mode 100644
index 00000000000..faa2f00cfce
--- /dev/null
+++ b/ndb/src/ndbapi/Ndberr.cpp
@@ -0,0 +1,75 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include <NdbError.hpp>
+#include "NdbImpl.hpp"
+#include "NdbDictionaryImpl.hpp"
+#include <NdbSchemaCon.hpp>
+#include <NdbOperation.hpp>
+#include <NdbConnection.hpp>
+
+
+static void
+update(const NdbError & _err){
+ NdbError & error = (NdbError &) _err;
+ ndberror_struct ndberror = (ndberror_struct)error;
+ ndberror_update(&ndberror);
+ error = NdbError(ndberror);
+}
+
+const
+NdbError &
+Ndb::getNdbError(int code){
+ theError.code = code;
+ update(theError);
+ return theError;
+}
+
+const
+NdbError &
+Ndb::getNdbError() const {
+ update(theError);
+ return theError;
+}
+
+const
+NdbError &
+NdbDictionaryImpl::getNdbError() const {
+ update(m_error);
+ return m_error;
+}
+
+const
+NdbError &
+NdbConnection::getNdbError() const {
+ update(theError);
+ return theError;
+}
+
+const
+NdbError &
+NdbOperation::getNdbError() const {
+ update(theError);
+ return theError;
+}
+
+const
+NdbError &
+NdbSchemaCon::getNdbError() const {
+ update(theError);
+ return theError;
+}
diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp
index e334c1bcc39..696dfe68e40 100644
--- a/ndb/src/ndbapi/Ndbif.cpp
+++ b/ndb/src/ndbapi/Ndbif.cpp
@@ -40,7 +40,6 @@
#include <NdbOut.hpp>
#include <NdbTick.h>
-#include <assert.h>
/******************************************************************************
* int init( int aNrOfCon, int aNrOfOp );
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index 9afbbf0df1f..be7acc48d7a 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -55,6 +55,7 @@ Parameters: aDataBase : Name of the database.
Remark: Connect to the database.
***************************************************************************/
Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
+ theNdbObjectIdMap(0),
thePreparedTransactionsArray(NULL),
theSentTransactionsArray(NULL),
theCompletedTransactionsArray(NULL),
@@ -89,8 +90,7 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
theFirstTransId(0),
theRestartGCI(0),
theNdbBlockNumber(-1),
- theInitState(NotConstructed),
- theNdbObjectIdMap(0)
+ theInitState(NotConstructed)
{
cgetSignals =0;
cfreeSignals = 0;
diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp
index a2a8d00b48f..4abb54b5081 100644
--- a/ndb/src/ndbapi/ObjectMap.hpp
+++ b/ndb/src/ndbapi/ObjectMap.hpp
@@ -17,10 +17,8 @@
#ifndef NDB_OBJECT_ID_MAP_HPP
#define NDB_OBJECT_ID_MAP_HPP
-#include <ndb_types.h>
+#include <ndb_global.h>
//#include <NdbMutex.h>
-#include <stdlib.h>
-#include <string.h>
#include <NdbOut.hpp>
//#define DEBUG_OBJECTMAP
diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp
index 746ab169b41..f4a3ae3e87d 100644
--- a/ndb/src/ndbapi/TransporterFacade.cpp
+++ b/ndb/src/ndbapi/TransporterFacade.cpp
@@ -14,8 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <ndb_limits.h>
-#include "AttrType.hpp"
+#include <AttrType.hpp>
#include "TransporterFacade.hpp"
#include "ClusterMgr.hpp"
#include <IPCConfig.hpp>
@@ -25,14 +26,12 @@
#include <NdbOut.hpp>
#include <NdbEnv.h>
#include <NdbSleep.h>
-#include <assert.h>
#include "API.hpp"
#include <ConfigRetriever.hpp>
#include <NdbConfig.h>
#include <ndb_version.h>
#include <SignalLoggerManager.hpp>
-#include <stdlib.h>
#if !defined NDB_OSE && !defined NDB_SOFTOSE
#include <signal.h>
diff --git a/ndb/src/ndbapi/Ndberror.cpp b/ndb/src/ndbapi/ndberror.c
index ee668605f0d..ea7cf4de426 100644
--- a/ndb/src/ndbapi/Ndberror.cpp
+++ b/ndb/src/ndbapi/ndberror.c
@@ -15,40 +15,46 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbError.hpp>
-#include <NdbStdio.h>
-#include <stdarg.h>
+#include <ndb_global.h>
-#include <assert.h>
+#include <ndberror.h>
-struct ErrorBundle {
+typedef struct ErrorBundle {
int code;
- NdbError::Classification classification;
+ ndberror_classification classification;
const char * message;
-};
+} ErrorBundle;
/**
* Shorter names in table below
*/
-static const NdbError::Classification NE = NdbError::NoError;
-static const NdbError::Classification AE = NdbError::ApplicationError;
-static const NdbError::Classification ND = NdbError::NoDataFound;
-static const NdbError::Classification CV = NdbError::ConstraintViolation;
-static const NdbError::Classification SE = NdbError::SchemaError;
-static const NdbError::Classification UD = NdbError::UserDefinedError;
-
-static const NdbError::Classification IS = NdbError::InsufficientSpace;
-static const NdbError::Classification TR = NdbError::TemporaryResourceError;
-static const NdbError::Classification NR = NdbError::NodeRecoveryError;
-static const NdbError::Classification OL = NdbError::OverloadError;
-static const NdbError::Classification TO = NdbError::TimeoutExpired;
-static const NdbError::Classification NS = NdbError::NodeShutdown;
-
-static const NdbError::Classification UR = NdbError::UnknownResultError;
-
-static const NdbError::Classification IE = NdbError::InternalError;
-static const NdbError::Classification NI = NdbError::FunctionNotImplemented;
-static const NdbError::Classification UE = NdbError::UnknownErrorCode;
+
+#define ST_S ndberror_st_success
+#define ST_P ndberror_st_permanent
+#define ST_T ndberror_st_temporary
+#define ST_U ndberror_st_unknown
+
+#define NE ndberror_cl_none
+#define AE ndberror_cl_application
+#define ND ndberror_cl_no_data_found
+#define CV ndberror_cl_constraint_violation
+#define SE ndberror_cl_schema_error
+#define UD ndberror_cl_user_defined
+
+#define IS ndberror_cl_insufficient_space
+#define TR ndberror_cl_temporary_resource
+#define NR ndberror_cl_node_recovery
+#define OL ndberror_cl_overload
+#define TO ndberror_cl_timeout_expired
+#define NS ndberror_cl_node_shutdown
+
+#define UR ndberror_cl_unknown_result
+
+#define IE ndberror_cl_internal_error
+#define NI ndberror_cl_function_not_implemented
+#define UE ndberror_cl_unknown_error_code
+
+static const char* empty_string = "";
static
const
@@ -90,7 +96,7 @@ ErrorBundle ErrorCodes[] = {
* Node shutdown
*/
{ 280, NS, "Transaction aborted due to node shutdown" },
- // This scan trans had an active fragment scan in a LQH which have crashed
+ /* This scan trans had an active fragment scan in a LQH which have crashed */
{ 270, NS, "Transaction aborted due to node shutdown" },
{ 1223, NS, "Read operation aborted due to node shutdown" },
{ 4023, NS, "Transaction aborted due to node shutdown" },
@@ -152,9 +158,9 @@ ErrorBundle ErrorCodes[] = {
* TimeoutExpired
*/
{ 266, TO, "Time-out in NDB, probably caused by deadlock" },
- { 274, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout
- { 296, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout
- { 297, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout, temporary!!
+ { 274, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */
+ { 296, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */
+ { 297, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout, temporary!! */
{ 237, TO, "Transaction had timed out when trying to commit it" },
@@ -420,41 +426,60 @@ static
const
int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle);
-struct ErrorStatusClassification {
- NdbError::Status status;
- NdbError::Classification classification;
-};
+typedef struct ErrorStatusMessage {
+ ndberror_status status;
+ const char * message;
+} ErrorStatusMessage;
+
+typedef struct ErrorStatusClassification {
+ ndberror_status status;
+ ndberror_classification classification;
+ const char * message;
+} ErrorStatusClassification;
/**
* Mapping between classification and status
*/
static
const
+ErrorStatusMessage StatusMessageMapping[] = {
+ { ST_S, "Success"},
+ { ST_P, "Permanent error"},
+ { ST_T, "Temporary error"},
+ { ST_U ,"Unknown result"}
+};
+
+static
+const
+int NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage);
+
+static
+const
ErrorStatusClassification StatusClassificationMapping[] = {
- { NdbError::Success, NdbError::NoError },
- { NdbError::PermanentError, NdbError::ApplicationError },
- { NdbError::PermanentError, NdbError::NoDataFound },
- { NdbError::PermanentError, NdbError::ConstraintViolation },
- { NdbError::PermanentError, NdbError::SchemaError },
- { NdbError::PermanentError, NdbError::UserDefinedError },
- { NdbError::PermanentError, NdbError::InsufficientSpace },
+ { ST_S, NE, "No error"},
+ { ST_P, AE, "Application error"},
+ { ST_P, ND, "No data found"},
+ { ST_P, CV, "Constraint violation"},
+ { ST_P, SE, "Schema error"},
+ { ST_P, UD, "User defined error"},
+ { ST_P, IS, "Insufficient space"},
- { NdbError::TemporaryError, NdbError::TemporaryResourceError },
- { NdbError::TemporaryError, NdbError::NodeRecoveryError },
- { NdbError::TemporaryError, NdbError::OverloadError },
- { NdbError::TemporaryError, NdbError::TimeoutExpired },
- { NdbError::TemporaryError, NdbError::NodeShutdown },
+ { ST_T, TR, "Temporary Resource error"},
+ { ST_T, NR, "Node Recovery error"},
+ { ST_T, OL, "Overload error"},
+ { ST_T, TO, "Timeout expired"},
+ { ST_T, NS, "Node shutdown"},
- { NdbError::UnknownResult , NdbError::UnknownResultError },
- { NdbError::UnknownResult , NdbError::UnknownErrorCode },
+ { ST_U , UR, "Unknown result error"},
+ { ST_U , UE, "Unknown error code"},
- { NdbError::PermanentError, NdbError::InternalError },
- { NdbError::PermanentError, NdbError::FunctionNotImplemented }
+ { ST_P, IE, "Internal error"},
+ { ST_P, NI, "Function not implemented"}
};
static
const
-int Nb = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification);
+int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification);
/**
* Complete all fields of an NdbError given the error code
@@ -462,64 +487,67 @@ int Nb = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification);
*/
static
void
-set(NdbError & error, int code, const char * details, ...){
- error.code = code;
-
- va_list ap;
- va_start(ap, details);
- vsnprintf(error.details, sizeof(error.details), details, ap);
- va_end(ap);
+set(ndberror_struct * error, int code, const char * details, ...){
+ error->code = code;
+ {
+ va_list ap;
+ va_start(ap, details);
+ vsnprintf(error->details, sizeof(error->details), details, ap);
+ va_end(ap);
+ }
}
-static
+
void
-update(const NdbError & _err){
- NdbError & error = (NdbError &) _err;
-
- bool found = false;
- for(int i = 0; i<NbErrorCodes; i++){
- if(ErrorCodes[i].code == error.code){
- error.classification = ErrorCodes[i].classification;
- error.message = ErrorCodes[i].message;
- found = true;
+ndberror_update(ndberror_struct * error){
+
+ int found = 0;
+ int i;
+
+ for(i = 0; i<NbErrorCodes; i++){
+ if(ErrorCodes[i].code == error->code){
+ error->classification = ErrorCodes[i].classification;
+ error->message = ErrorCodes[i].message;
+ found = 1;
break;
}
}
if(!found){
- error.classification = NdbError::UnknownErrorCode;
- error.message = "Unknown error code";
+ error->classification = UE;
+ error->message = "Unknown error code";
}
- found = false;
- for(int i = 0; i<Nb; i++){
- if(StatusClassificationMapping[i].classification == error.classification){
- error.status = StatusClassificationMapping[i].status;
- found = true;
+ found = 0;
+ for(i = 0; i<NbClassification; i++){
+ if(StatusClassificationMapping[i].classification == error->classification){
+ error->status = StatusClassificationMapping[i].status;
+ found = 1;
break;
}
}
if(!found){
- error.status = NdbError::UnknownResult;
+ error->status = ST_U;
}
- error.details = 0;
+ error->details = 0;
}
-bool
+int
checkErrorCodes(){
- for(int i = 0; i<NbErrorCodes; i++)
- for(int j = i+1; j<NbErrorCodes; j++)
+ int i, j;
+ for(i = 0; i<NbErrorCodes; i++)
+ for(j = i+1; j<NbErrorCodes; j++)
if(ErrorCodes[i].code == ErrorCodes[j].code){
printf("ErrorCode %d is defined multiple times!!\n",
ErrorCodes[i].code);
assert(0);
}
- return true;
+ return 1;
}
-static const bool a = checkErrorCodes();
+/*static const int a = checkErrorCodes();*/
#if CHECK_ERRORCODES
int main(void){
@@ -528,108 +556,35 @@ int main(void){
}
#endif
-#include <NdbOut.hpp>
-
-/**
- * operators
- */
-NdbOut &
-operator<<(NdbOut & out, const NdbError & error){
- if(error.message != 0)
- out << error.code << ": " << error.message;
- else
- out << error.code << ": ";
- return out;
+const char *ndberror_status_message(ndberror_status status)
+{
+ int i;
+ for (i= 0; i < NbStatus; i++)
+ if (StatusMessageMapping[i].status == status)
+ return StatusMessageMapping[i].message;
+ return empty_string;
}
-NdbOut &
-operator<<(NdbOut & out, const NdbError::Status & status){
- switch(status) {
- case NdbError::Success: out << "Success"; break;
- case NdbError::TemporaryError: out << "Temporary error"; break;
- case NdbError::PermanentError: out << "Permanent error"; break;
- case NdbError::UnknownResult: out << "Unknown result"; break;
- }
- return out;
+const char *ndberror_classification_message(ndberror_classification classification)
+{
+ int i;
+ for (i= 0; i < NbClassification; i++)
+ if (StatusClassificationMapping[i].classification == classification)
+ return StatusClassificationMapping[i].message;
+ return empty_string;
}
-NdbOut &
-operator<<(NdbOut & out, const NdbError::Classification & classification){
- switch(classification) {
- case NdbError::NoError: out << "No error"; break;
- case NdbError::ApplicationError: out << "Application error"; break;
- case NdbError::NoDataFound: out << "No data found"; break;
- case NdbError::ConstraintViolation: out << "Constraint violation"; break;
- case NdbError::SchemaError: out << "Schema error"; break;
- case NdbError::UserDefinedError: out << "User defined error"; break;
- case NdbError::InsufficientSpace: out << "Insufficient space"; break;
- case NdbError::TemporaryResourceError: out << "Temporary Resource error";
- break;
- case NdbError::NodeRecoveryError: out << "Node Recovery error"; break;
- case NdbError::OverloadError: out << "Overload error"; break;
- case NdbError::TimeoutExpired: out << "Timeout expired"; break;
- case NdbError::UnknownResultError: out << "Unknown result error"; break;
- case NdbError::InternalError: out << "Internal error"; break;
- case NdbError::FunctionNotImplemented: out << "Function not implemented";
- break;
- case NdbError::UnknownErrorCode: out << "Unknown error code"; break;
- case NdbError::NodeShutdown: out << "Node shutdown"; break;
- }
- return out;
-}
+int ndb_error_string(int err_no, char *str, unsigned int size)
+{
+ ndberror_struct error;
+ unsigned int len;
-/******************************************************
- *
- */
-#include "NdbImpl.hpp"
-#include "NdbDictionaryImpl.hpp"
-#include <NdbSchemaCon.hpp>
-#include <NdbOperation.hpp>
-#include <NdbConnection.hpp>
+ error.code = err_no;
+ ndberror_update(&error);
+ len = snprintf(str, size-1, "%s: %s: %s", error.message,
+ ndberror_status_message(error.status), ndberror_classification_message(error.classification));
+ str[size-1]= '\0';
-const
-NdbError &
-Ndb::getNdbError(int code){
- theError.code = code;
- update(theError);
- return theError;
-}
-
-const
-NdbError &
-Ndb::getNdbError() const {
- update(theError);
- return theError;
-}
-
-const
-NdbError &
-NdbDictionaryImpl::getNdbError() const {
- update(m_error);
- return m_error;
+ return len;
}
-
-const
-NdbError &
-NdbConnection::getNdbError() const {
- update(theError);
- return theError;
-}
-
-const
-NdbError &
-NdbOperation::getNdbError() const {
- update(theError);
- return theError;
-}
-
-const
-NdbError &
-NdbSchemaCon::getNdbError() const {
- update(theError);
- return theError;
-}
-
-
-
diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.cpp b/ndb/src/ndbapi/signal-sender/SignalSender.cpp
index d60f6240a9c..e642848dcee 100644
--- a/ndb/src/ndbapi/signal-sender/SignalSender.cpp
+++ b/ndb/src/ndbapi/signal-sender/SignalSender.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "SignalSender.hpp"
#include "ConfigRetriever.hpp"
#include <NdbSleep.h>
diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.hpp b/ndb/src/ndbapi/signal-sender/SignalSender.hpp
index fffe027dbdd..e4e6c1931d2 100644
--- a/ndb/src/ndbapi/signal-sender/SignalSender.hpp
+++ b/ndb/src/ndbapi/signal-sender/SignalSender.hpp
@@ -17,11 +17,11 @@
#ifndef SIGNAL_SENDER_HPP
#define SIGNAL_SENDER_HPP
+#include <ndb_global.h>
#include <TransporterDefinitions.hpp>
#include <TransporterFacade.hpp>
#include <ClusterMgr.hpp>
#include <Vector.hpp>
-#include <stdio.h>
struct SimpleSignal {
public:
diff --git a/ndb/src/newtonapi/dba_binding.cpp b/ndb/src/newtonapi/dba_binding.cpp
index 724f54c0e4b..63e48110b1d 100644
--- a/ndb/src/newtonapi/dba_binding.cpp
+++ b/ndb/src/newtonapi/dba_binding.cpp
@@ -367,6 +367,12 @@ matchSize(NdbDictionary::Column::Type t, unsigned b, Size_t s) {
case NdbDictionary::Column::Datetime:
case NdbDictionary::Column::Timespec:
case NdbDictionary::Column::Blob:
+ case NdbDictionary::Column::Tinyint:
+ case NdbDictionary::Column::Tinyunsigned:
+ case NdbDictionary::Column::Smallint:
+ case NdbDictionary::Column::Smallunsigned:
+ case NdbDictionary::Column::Mediumint:
+ case NdbDictionary::Column::Mediumunsigned:
case NdbDictionary::Column::Undefined:
return false;
}
diff --git a/ndb/src/newtonapi/dba_error.cpp b/ndb/src/newtonapi/dba_error.cpp
index 0a154ac1314..f05446522b0 100644
--- a/ndb/src/newtonapi/dba_error.cpp
+++ b/ndb/src/newtonapi/dba_error.cpp
@@ -15,9 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "dba_internal.hpp"
-#include <NdbStdio.h>
-#include <stdarg.h>
static DBA_Error_t latestError = DBA_NO_ERROR;
static DBA_ErrorCode_t latestNdbError = 0;
diff --git a/ndb/src/newtonapi/dba_internal.hpp b/ndb/src/newtonapi/dba_internal.hpp
index a021db40a7d..84ae7ba222b 100644
--- a/ndb/src/newtonapi/dba_internal.hpp
+++ b/ndb/src/newtonapi/dba_internal.hpp
@@ -17,17 +17,16 @@
#ifndef DBA_INTERNAL_HPP
#define DBA_INTERNAL_HPP
+#include <ndb_global.h>
+
extern "C" {
#include "dba.h"
}
#include <NdbApi.hpp>
#include <NdbMutex.h>
-#include <string.h>
#include <NdbOut.hpp>
-#include <stdlib.h>
-
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
diff --git a/ndb/src/rep/Makefile b/ndb/src/rep/Makefile
index 29482b72687..9688a68ec74 100644
--- a/ndb/src/rep/Makefile
+++ b/ndb/src/rep/Makefile
@@ -12,8 +12,6 @@ BIN_TARGET := ndb_rep
BIN_TARGET_LIBS :=
BIN_TARGET_ARCHIVES += editline repstorage repadapters reprequestor reptransfer mgmapi NDB_API mgmsrvcommon
-LDFLAGS_LOC = -lpthread
-
SOURCES = \
RepMain.cpp \
Requestor.cpp \
diff --git a/ndb/src/rep/RepApiService.cpp b/ndb/src/rep/RepApiService.cpp
index f5d51f7990e..d07f7a59375 100644
--- a/ndb/src/rep/RepApiService.cpp
+++ b/ndb/src/rep/RepApiService.cpp
@@ -23,10 +23,8 @@
#include "RepApiInterpreter.hpp"
#include "repapi/repapi.h"
#include <NdbMutex.h>
-#include <NdbStdio.h>
#include <OutputStream.hpp>
-#include <NdbString.h>
/**
const char * name;
const char * realName;
diff --git a/ndb/src/rep/RepComponents.hpp b/ndb/src/rep/RepComponents.hpp
index 8b24858271b..ff0f29e2128 100644
--- a/ndb/src/rep/RepComponents.hpp
+++ b/ndb/src/rep/RepComponents.hpp
@@ -26,7 +26,6 @@
#include <rep/rep_version.hpp>
-
/**
* Connection data
*/
diff --git a/ndb/src/rep/RepMain.cpp b/ndb/src/rep/RepMain.cpp
index e00f6c0040c..d9f057be9a1 100644
--- a/ndb/src/rep/RepMain.cpp
+++ b/ndb/src/rep/RepMain.cpp
@@ -14,8 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <NdbApiSignal.hpp>
#include <getarg.h>
diff --git a/ndb/src/rep/Requestor.cpp b/ndb/src/rep/Requestor.cpp
index af16fc33844..3c93a6394a4 100644
--- a/ndb/src/rep/Requestor.cpp
+++ b/ndb/src/rep/Requestor.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "Requestor.hpp"
#include "ConfigRetriever.hpp"
diff --git a/ndb/src/rep/Requestor.hpp b/ndb/src/rep/Requestor.hpp
index ba753be60f2..735d2094bde 100644
--- a/ndb/src/rep/Requestor.hpp
+++ b/ndb/src/rep/Requestor.hpp
@@ -17,12 +17,13 @@
#ifndef REQUESTOR_HPP
#define REQUESTOR_HPP
+#include <ndb_global.h>
+
#include <TransporterDefinitions.hpp>
#include <TransporterFacade.hpp>
#include <ClusterMgr.hpp>
#include <API.hpp>
#include <Vector.hpp>
-#include <stdio.h>
#include <GrepError.hpp>
#include <rep/storage/GCIContainer.hpp>
diff --git a/ndb/src/rep/adapters/AppNDB.hpp b/ndb/src/rep/adapters/AppNDB.hpp
index c24774d4ed3..9563a1e41ab 100644
--- a/ndb/src/rep/adapters/AppNDB.hpp
+++ b/ndb/src/rep/adapters/AppNDB.hpp
@@ -18,13 +18,9 @@
#define APPNDB_HPP
#include "NdbApi.hpp"
-#include <string.h>
-#include <assert.h>
-
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbThread.h>
diff --git a/ndb/src/rep/adapters/ExtNDB.cpp b/ndb/src/rep/adapters/ExtNDB.cpp
index 5ba6bfbbe6e..eb541cdced9 100644
--- a/ndb/src/rep/adapters/ExtNDB.cpp
+++ b/ndb/src/rep/adapters/ExtNDB.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "ExtNDB.hpp"
#include "ConfigRetriever.hpp"
#include <NdbSleep.h>
diff --git a/ndb/src/rep/adapters/ExtNDB.hpp b/ndb/src/rep/adapters/ExtNDB.hpp
index c69f94d9a7e..bcbf51393aa 100644
--- a/ndb/src/rep/adapters/ExtNDB.hpp
+++ b/ndb/src/rep/adapters/ExtNDB.hpp
@@ -17,12 +17,13 @@
#ifndef EXTNDB_HPP
#define EXTNDB_HPP
+#include <ndb_global.h>
+
#include <TransporterDefinitions.hpp>
#include <TransporterFacade.hpp>
#include <ClusterMgr.hpp>
#include <API.hpp>
#include <Vector.hpp>
-#include <stdio.h>
#include <signaldata/RepImpl.hpp>
#include <signaldata/GrepImpl.hpp>
diff --git a/ndb/src/rep/dbug_hack.cpp b/ndb/src/rep/dbug_hack.cpp
index 364325b55ae..74e5f080777 100644
--- a/ndb/src/rep/dbug_hack.cpp
+++ b/ndb/src/rep/dbug_hack.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdarg.h>
-#include <string.h>
+#include <ndb_global.h>
+
#include <OutputStream.hpp>
#include "NdbOut.hpp"
#include "rep_version.hpp"
@@ -25,6 +25,7 @@ int replogEnabled;
/**
* @todo This should be implemented using MySQLs dbug library
*/
+#if 0
extern "C"
void
DBUG_PRINT(const char * fmt, ...)
@@ -40,6 +41,7 @@ DBUG_PRINT(const char * fmt, ...)
va_end(ap);
#endif
}
+#endif
extern "C"
void
diff --git a/ndb/src/rep/rep_version.hpp b/ndb/src/rep/rep_version.hpp
index 0182f080730..3830f9c351c 100644
--- a/ndb/src/rep/rep_version.hpp
+++ b/ndb/src/rep/rep_version.hpp
@@ -29,7 +29,7 @@
extern "C"
void
-DBUG_PRINT(const char * fmt, ...);
+DBUG_PRINT__(const char * fmt, ...);
extern "C"
void
diff --git a/ndb/src/rep/repapi/repapi.cpp b/ndb/src/rep/repapi/repapi.cpp
index 80274896004..d34ab098c9c 100644
--- a/ndb/src/rep/repapi/repapi.cpp
+++ b/ndb/src/rep/repapi/repapi.cpp
@@ -14,17 +14,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include <NdbTCP.h>
#include "repapi.h"
//#include "mgmapi_debug.h"
#include <socket_io.h>
-#include <stdlib.h>
-
-#include <string.h>
-#include <NdbStdio.h>
-#include <NdbString.h>
-#include <errno.h>
#include <NdbOut.hpp>
#include <SocketServer.hpp>
#include <Parser.hpp>
diff --git a/ndb/src/rep/state/Interval.cpp b/ndb/src/rep/state/Interval.cpp
index 75697fa7548..8266f19c58d 100644
--- a/ndb/src/rep/state/Interval.cpp
+++ b/ndb/src/rep/state/Interval.cpp
@@ -16,6 +16,8 @@
#include "Interval.hpp"
+#undef min
+#undef max
Uint32 max(Uint32 a, Uint32 b) { return a > b ? a : b; }
Uint32 min(Uint32 a, Uint32 b) { return a < b ? a : b; }
diff --git a/ndb/src/rep/state/RepState.cpp b/ndb/src/rep/state/RepState.cpp
index a34bff25d7f..d8a50961a3c 100644
--- a/ndb/src/rep/state/RepState.cpp
+++ b/ndb/src/rep/state/RepState.cpp
@@ -681,7 +681,7 @@ Properties * RepState::query(QueryCounter counter, Uint32 replicationId)
if(prop == NULL)
return NULL;
NdbMutex_Lock(m_mutex);
- if(counter != (Uint32)-1)
+ if(counter != ~(Uint32)0)
getEpochState((Channel::Position)counter, prop );
prop->put("no_of_nodegroups", m_channel.getNoOfNodeGroups());
prop->put("subid", m_channel.getNoOfNodeGroups());
@@ -714,9 +714,13 @@ RepState::getEpochState(Channel::Position pos, Properties * p)
*/
pos_first--;
pos_last--;
+ first_buf[pos_first]= '\0';
+ last_buf[pos_last]= '\0';
+#if 0
sprintf(first_buf+pos_first,"","");
sprintf(last_buf + pos_last,"","");
-
+#endif
+
p->put("first", first_buf);
p->put("last", last_buf);
diff --git a/ndb/src/rep/storage/GCIBuffer.cpp b/ndb/src/rep/storage/GCIBuffer.cpp
index 5049e47ea66..013600b30a5 100644
--- a/ndb/src/rep/storage/GCIBuffer.cpp
+++ b/ndb/src/rep/storage/GCIBuffer.cpp
@@ -14,9 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "GCIBuffer.hpp"
-#include <stdlib.h>
-#include <assert.h>
/*****************************************************************************
* Constructor / Destructor
diff --git a/ndb/src/rep/storage/GCIBuffer.hpp b/ndb/src/rep/storage/GCIBuffer.hpp
index 5a07b149f81..8a8473d1d49 100644
--- a/ndb/src/rep/storage/GCIBuffer.hpp
+++ b/ndb/src/rep/storage/GCIBuffer.hpp
@@ -18,7 +18,7 @@
#define GCI_BUFFER_HPP
#include "GCIPage.hpp"
-#include "Vector.hpp"
+#include <Vector.hpp>
#include <TransporterDefinitions.hpp>
#include <signaldata/RepImpl.hpp>
diff --git a/ndb/src/rep/storage/GCIContainer.hpp b/ndb/src/rep/storage/GCIContainer.hpp
index 173bb790a57..48cbc66bfbd 100644
--- a/ndb/src/rep/storage/GCIContainer.hpp
+++ b/ndb/src/rep/storage/GCIContainer.hpp
@@ -22,6 +22,7 @@
#include "LogRecord.hpp"
#include "GCIBuffer.hpp"
+#undef swap
#include <list>
#include <iterator>
diff --git a/ndb/src/rep/storage/LogRecord.hpp b/ndb/src/rep/storage/LogRecord.hpp
index ba2632e23c7..a0bf3d52372 100644
--- a/ndb/src/rep/storage/LogRecord.hpp
+++ b/ndb/src/rep/storage/LogRecord.hpp
@@ -17,8 +17,7 @@
#ifndef LOG_RECORD_HPP
#define LOG_RECORD_HPP
-#include <ndb_types.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <portlib/NdbMem.h>
/**
diff --git a/ndb/src/rep/storage/NodeGroupInfo.hpp b/ndb/src/rep/storage/NodeGroupInfo.hpp
index 605ccf76a38..3d0499d4425 100644
--- a/ndb/src/rep/storage/NodeGroupInfo.hpp
+++ b/ndb/src/rep/storage/NodeGroupInfo.hpp
@@ -18,12 +18,10 @@
#define NODE_GROUPINFO_HPP
#include <Vector.hpp>
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
//#include <NdbSleep.h>
-#include <NdbString.h>
#include "NodeGroup.hpp"
#include <rep/rep_version.hpp>
diff --git a/ndb/src/rep/transfer/TransPS.cpp b/ndb/src/rep/transfer/TransPS.cpp
index 7af53f24415..1f65e95850d 100644
--- a/ndb/src/rep/transfer/TransPS.cpp
+++ b/ndb/src/rep/transfer/TransPS.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "ConfigRetriever.hpp"
#include <NdbSleep.h>
diff --git a/ndb/src/rep/transfer/TransPS.hpp b/ndb/src/rep/transfer/TransPS.hpp
index 35823f1eb19..b47f1acfca2 100644
--- a/ndb/src/rep/transfer/TransPS.hpp
+++ b/ndb/src/rep/transfer/TransPS.hpp
@@ -17,12 +17,10 @@
#ifndef TransPS_HPP
#define TransPS_HPP
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbString.h>
#include <TransporterDefinitions.hpp>
#include <TransporterFacade.hpp>
diff --git a/ndb/src/rep/transfer/TransSS.cpp b/ndb/src/rep/transfer/TransSS.cpp
index 5399bfb4e3f..83f4b570330 100644
--- a/ndb/src/rep/transfer/TransSS.cpp
+++ b/ndb/src/rep/transfer/TransSS.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
#include "ConfigRetriever.hpp"
diff --git a/ndb/src/rep/transfer/TransSS.hpp b/ndb/src/rep/transfer/TransSS.hpp
index 90f320a079e..6f2089e46ac 100644
--- a/ndb/src/rep/transfer/TransSS.hpp
+++ b/ndb/src/rep/transfer/TransSS.hpp
@@ -17,12 +17,10 @@
#ifndef TransSS_HPP
#define TransSS_HPP
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbString.h>
#include <TransporterDefinitions.hpp>
#include <TransporterFacade.hpp>
diff --git a/ndb/test/include/NDBT_Stats.hpp b/ndb/test/include/NDBT_Stats.hpp
index 15a125dea86..28212bdba17 100644
--- a/ndb/test/include/NDBT_Stats.hpp
+++ b/ndb/test/include/NDBT_Stats.hpp
@@ -17,9 +17,7 @@
#ifndef NDBT_STATS_HPP
#define NDBT_STATS_HPP
-#include <math.h>
-#include <float.h>
-#include <assert.h>
+#include <ndb_global.h>
class NDBT_Stats {
public:
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp
index a4482fa8084..950c1f15ff7 100644
--- a/ndb/test/include/NDBT_Table.hpp
+++ b/ndb/test/include/NDBT_Table.hpp
@@ -17,11 +17,11 @@
#ifndef NDBT_TABLE_HPP
#define NDBT_TABLE_HPP
+#include <ndb_global.h>
+
#include <NdbApi.hpp>
#include <NdbOut.hpp>
-#include <string.h>
-
class NDBT_Attribute : public NdbDictionary::Column {
friend class NdbOut& operator <<(class NdbOut&, const NDBT_Attribute &);
public:
diff --git a/ndb/test/include/NDBT_Test.hpp b/ndb/test/include/NDBT_Test.hpp
index 41332bb570c..7a5d14689bc 100644
--- a/ndb/test/include/NDBT_Test.hpp
+++ b/ndb/test/include/NDBT_Test.hpp
@@ -24,7 +24,6 @@
#include <NdbSleep.h>
#include <NdbCondition.h>
#include <NdbTimer.hpp>
-#include <assert.h>
#include <Vector.hpp>
#include <NdbDictionary.hpp>
diff --git a/ndb/test/include/NdbTimer.hpp b/ndb/test/include/NdbTimer.hpp
index 8d9a088b7b5..b0d500b5c2c 100644
--- a/ndb/test/include/NdbTimer.hpp
+++ b/ndb/test/include/NdbTimer.hpp
@@ -17,7 +17,6 @@
#ifndef NDBTIMER_H
#define NDBTIMER_H
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbOut.hpp>
diff --git a/ndb/test/ndbapi/acid2/acid2.cpp b/ndb/test/ndbapi/acid2/acid2.cpp
index 5835b76453e..434a0450daa 100644
--- a/ndb/test/ndbapi/acid2/acid2.cpp
+++ b/ndb/test/ndbapi/acid2/acid2.cpp
@@ -17,7 +17,6 @@
#include <NdbApi.hpp>
#include <NdbOut.hpp>
-#include <NdbStdio.h>
#include <NdbThread.h>
#include <NdbSleep.h>
#include <NdbMutex.h>
diff --git a/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp b/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp
index ee724236855..d84818baf24 100644
--- a/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp
+++ b/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp
@@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp b/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp
index 0b6fc9c1f97..55e9081a598 100644
--- a/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp
+++ b/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp
@@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp b/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp
index 7071de9f63e..ab3e862e8d2 100644
--- a/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp
+++ b/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp
@@ -15,8 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp b/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp
index cfb2c93e4ad..ba8de9e4af1 100644
--- a/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp
+++ b/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp b/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp
index 155a35998bb..0c7d5d72473 100644
--- a/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp
+++ b/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp b/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp
index cc8e2792cbf..13136755de8 100644
--- a/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp
+++ b/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp b/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp
index f2b28d8b057..18881cae216 100644
--- a/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp
+++ b/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp
@@ -14,7 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp b/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp
index eaa99e8a79d..55d04888144 100644
--- a/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp
+++ b/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/create_tab/create_tab.cpp b/ndb/test/ndbapi/create_tab/create_tab.cpp
index 2f2911b4ef4..8bb1e7a9572 100644
--- a/ndb/test/ndbapi/create_tab/create_tab.cpp
+++ b/ndb/test/ndbapi/create_tab/create_tab.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp b/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp
index 8e67493c003..59c57396acd 100644
--- a/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp
+++ b/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
index 3938cd21f78..0822f3ee999 100644
--- a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
@@ -24,8 +24,6 @@
#include <NdbTick.h>
#include <NdbOut.hpp>
#include <NdbTimer.hpp>
-#include <string.h>
-#include <NdbStdio.h>
#include <NDBT_Error.hpp>
#include <NdbTest.hpp>
diff --git a/ndb/test/ndbapi/flexBench/flexBench.cpp b/ndb/test/ndbapi/flexBench/flexBench.cpp
index 17d9be73925..809d11086bf 100644
--- a/ndb/test/ndbapi/flexBench/flexBench.cpp
+++ b/ndb/test/ndbapi/flexBench/flexBench.cpp
@@ -51,13 +51,9 @@ Arguments:
#include "NdbApi.hpp"
-#include <string.h>
-#include <assert.h>
-
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbTimer.hpp>
#include <NdbThread.h>
@@ -296,7 +292,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
if(useLongKeys){
longKeyAttrName = (char **) malloc(sizeof(char*) * tNoOfLongPK);
- for (int i = 0; i < tNoOfLongPK; i++) {
+ for (Uint32 i = 0; i < tNoOfLongPK; i++) {
longKeyAttrName[i] = (char *) malloc(strlen("KEYATTR ") + 1);
memset(longKeyAttrName[i], 0, strlen("KEYATTR ") + 1);
sprintf(longKeyAttrName[i], "KEYATTR%i", i);
@@ -535,7 +531,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
waitForThreads(pThreadsData);
void * tmp;
- for(int i = 0; i<tNoOfThreads; i++){
+ for(Uint32 i = 0; i<tNoOfThreads; i++){
NdbThread_WaitFor(pThreadsData[i].threadLife, &tmp);
NdbThread_Destroy(&pThreadsData[i].threadLife);
}
@@ -544,7 +540,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
if (useLongKeys == true) {
// Only free these areas if they have been allocated
// Otherwise cores will happen
- for (int i = 0; i < tNoOfLongPK; i++)
+ for (Uint32 i = 0; i < tNoOfLongPK; i++)
free(longKeyAttrName[i]);
free(longKeyAttrName);
} // if
@@ -633,13 +629,13 @@ static void* flexBenchThread(void* pArg)
if(useLongKeys){
// Allocate and populate the longkey array.
longKeyAttrValue = (unsigned ***) malloc(sizeof(unsigned**) * tNoOfOperations );
- for (int n = 0; n < tNoOfOperations; n++)
+ for (Uint32 n = 0; n < tNoOfOperations; n++)
longKeyAttrValue[n] = (unsigned **) malloc(sizeof(unsigned*) * tNoOfLongPK );
- for (int n = 0; n < tNoOfOperations; n++){
- for (int i = 0; i < tNoOfLongPK ; i++) {
+ for (Uint32 n = 0; n < tNoOfOperations; n++){
+ for (Uint32 i = 0; i < tNoOfLongPK ; i++) {
longKeyAttrValue[n][i] = (unsigned *) malloc(sizeof(unsigned) * tSizeOfLongPK);
memset(longKeyAttrValue[n][i], 0, sizeof(unsigned) * tSizeOfLongPK);
- for(int j = 0; j < tSizeOfLongPK; j++) {
+ for(Uint32 j = 0; j < tSizeOfLongPK; j++) {
// Repeat the unique value to fill up the long key.
longKeyAttrValue[n][i][j] = threadBase + n;
}
@@ -649,10 +645,10 @@ static void* flexBenchThread(void* pArg)
int nRefOpOffset = 0 ;
//Assign reference attribute values to memory
- for(int ops = 1 ; ops < tNoOfOperations ; ops++){
+ for(Uint32 ops = 1 ; ops < tNoOfOperations ; ops++){
// Calculate offset value before going into the next loop
nRefOpOffset = tAttributeSize*tNoOfAttributes*(ops-1) ;
- for(int a = 0 ; a < tNoOfAttributes ; a++){
+ for(Uint32 a = 0 ; a < tNoOfAttributes ; a++){
*(int*)&attrRefValue[nRefOpOffset + tAttributeSize*a] =
(int)(threadBase + ops + a) ;
}
@@ -761,7 +757,7 @@ static void* flexBenchThread(void* pArg)
if(useLongKeys){
// Loop the equal call so the complete key is send to the kernel.
- for(int i = 0; i < tNoOfLongPK; i++)
+ for(Uint32 i = 0; i < tNoOfLongPK; i++)
pOps[countTables]->equal(longKeyAttrName[i],
(char *)longKeyAttrValue[count - 1][i], tSizeOfLongPK*4);
}
@@ -927,8 +923,8 @@ static void* flexBenchThread(void* pArg)
if (useLongKeys == true) {
// Only free these areas if they have been allocated
// Otherwise cores will occur
- for (int n = 0; n < tNoOfOperations; n++){
- for (int i = 0; i < tNoOfLongPK; i++) {
+ for (Uint32 n = 0; n < tNoOfOperations; n++){
+ for (Uint32 i = 0; i < tNoOfLongPK; i++) {
free(longKeyAttrValue[n][i]);
}
free(longKeyAttrValue[n]);
@@ -1068,13 +1064,13 @@ static void sleepBeforeStartingTest(int seconds){
static int
createTables(Ndb* pMyNdb){
- for (int i = 0; i < tNoOfAttributes; i++){
+ for (Uint32 i = 0; i < tNoOfAttributes; i++){
snprintf(attrName[i], MAXSTRLEN, "COL%d", i);
}
// Note! Uses only uppercase letters in table name's
// so that we can look at the tables with SQL
- for (int i = 0; i < tNoOfTables; i++){
+ for (Uint32 i = 0; i < tNoOfTables; i++){
if (theStdTableNameFlag == 0){
snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i,
(int)(NdbTick_CurrentMillisecond() / 1000));
@@ -1091,7 +1087,7 @@ createTables(Ndb* pMyNdb){
tmpTable.setStoredTable(!theTempTable);
if(useLongKeys){
- for(int i = 0; i < tNoOfLongPK; i++) {
+ for(Uint32 i = 0; i < tNoOfLongPK; i++) {
NdbDictionary::Column col(longKeyAttrName[i]);
col.setType(NdbDictionary::Column::Unsigned);
col.setLength(tSizeOfLongPK);
diff --git a/ndb/test/ndbapi/flexHammer/flexHammer.cpp b/ndb/test/ndbapi/flexHammer/flexHammer.cpp
index f8a519f021a..057efb31e74 100644
--- a/ndb/test/ndbapi/flexHammer/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer/flexHammer.cpp
@@ -57,8 +57,6 @@ Revision history:
#include <NdbTimer.hpp>
#include <NdbTick.h>
#include <NdbTest.hpp>
-#include <string.h>
-#include <assert.h>
#include <NDBT_Error.hpp>
ErrorData * flexHammerErrorData;
diff --git a/ndb/test/ndbapi/flexScan/flexScan.cpp b/ndb/test/ndbapi/flexScan/flexScan.cpp
index 55163a99fbe..19fb6dc5ab0 100644
--- a/ndb/test/ndbapi/flexScan/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan/flexScan.cpp
@@ -59,12 +59,9 @@
#include <NdbTick.h>
#include <NdbOut.hpp>
#include <NdbTimer.hpp>
-#include <string.h>
-#include <assert.h>
#include <NdbMain.h>
#include <NdbTest.hpp>
#include <NDBT_Error.hpp>
-#include <NdbStdio.h>
#define PKSIZE 1
#define FOREVER 1
diff --git a/ndb/test/ndbapi/flexTT/flexTT.cpp b/ndb/test/ndbapi/flexTT/flexTT.cpp
index 1705f20b706..c45cbd95762 100644
--- a/ndb/test/ndbapi/flexTT/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT/flexTT.cpp
@@ -15,7 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NdbApi.hpp"
+#include <ndb_global.h>
+
+#include <NdbApi.hpp>
#include <NdbMain.h>
#include <md5_hash.hpp>
@@ -24,9 +26,6 @@
#include <NdbTick.h>
#include <NdbOut.hpp>
#include <NdbTimer.hpp>
-#include <string.h>
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbTest.hpp>
#include <NDBT_Error.hpp>
diff --git a/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp
index 6a00463339b..7cc883ab3e6 100644
--- a/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp
+++ b/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp
@@ -57,13 +57,9 @@ Arguments:
#include "NdbApi.hpp"
-#include <string.h>
-#include <assert.h>
-
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
-#include <NdbStdio.h>
#include <NdbTick.h>
#include <NdbTimer.hpp>
#include <NdbThread.h>
diff --git a/ndb/test/ndbapi/indexTest/index.cpp b/ndb/test/ndbapi/indexTest/index.cpp
index d0eb490e1a0..508186de529 100644
--- a/ndb/test/ndbapi/indexTest/index.cpp
+++ b/ndb/test/ndbapi/indexTest/index.cpp
@@ -37,9 +37,8 @@
1 - Invalid arguments
* *************************************************** */
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbApi.hpp>
#include <NdbOut.hpp>
#include <NdbTick.h>
diff --git a/ndb/test/ndbapi/indexTest2/index2.cpp b/ndb/test/ndbapi/indexTest2/index2.cpp
index 5a3674f0bbf..e49113d2f1b 100644
--- a/ndb/test/ndbapi/indexTest2/index2.cpp
+++ b/ndb/test/ndbapi/indexTest2/index2.cpp
@@ -37,9 +37,8 @@
1 - Invalid arguments
* *************************************************** */
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbApi.hpp>
#include <NdbOut.hpp>
#include <NdbTick.h>
diff --git a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
index b9d1eca1cc9..a2352edf707 100644
--- a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
+++ b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
@@ -54,9 +54,6 @@
* *************************************************** */
-#include <NdbStdio.h>
-#include <string.h>
-#include <assert.h>
#include <NdbOut.hpp>
#include <NdbThread.h>
#include <NdbMutex.h>
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp b/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp
index 25eb1830de9..84a93414712 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp
+++ b/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp
@@ -18,8 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <string.h>
+#include <ndb_global.h>
#include "dbGenerator.h"
#include <NdbApi.hpp>
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp b/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp
index d7506c9dd2c..f613c66d07b 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp
+++ b/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp
@@ -14,10 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <NdbUnistd.h>
+#include <ndb_global.h>
#include <NdbHost.h>
#include <NdbSleep.h>
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h b/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h
index c049cdbad33..22b7f564490 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h
+++ b/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h
@@ -17,8 +17,7 @@
#ifndef MACROS_H
#define MACROS_H
-#include <stdlib.h>
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#define ERROR(x) {ndbout_c((x));}
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp b/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp
index 91a061c7cf4..9e6c5e55e73 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp
+++ b/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp
@@ -17,7 +17,7 @@
#ifndef NDB_ERROR_H
#define NDB_ERROR_H
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include "userInterface.h"
#include <NdbError.hpp>
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp b/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp
index ece82628ba7..fdbc229cc98 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp
+++ b/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp
@@ -18,9 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
+#include <ndb_global.h>
#include <time.h>
#include "ndb_schema.hpp"
@@ -31,7 +29,6 @@
#include <NdbTick.h>
#include <NdbApi.hpp>
#include <NdbOut.hpp>
-#include <NdbStdio.h>
/***************************************************************
* L O C A L C O N S T A N T S *
diff --git a/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h b/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h
index c6ad11016b2..2f4aeb30975 100644
--- a/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h
+++ b/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h
@@ -23,12 +23,6 @@
#include <ndb_types.h>
-/***************************************************************
-* M A C R O S *
-***************************************************************/
-
-typedef Uint32 uint32;
-
/***************************************************************/
/* C O N S T A N T S */
/***************************************************************/
@@ -62,14 +56,14 @@ typedef char GroupName[GROUP_NAME_LENGTH];
typedef char ChangedBy[CHANGED_BY_LENGTH];
typedef char ChangedTime[CHANGED_TIME_LENGTH];
typedef char SessionDetails[SESSION_DETAILS_LENGTH];
-typedef uint32 ServerId;
-typedef uint32 ServerBit;
-typedef uint32 GroupId;
-typedef uint32 Location;
-typedef uint32 Permission;
-
-typedef uint32 Counter;
-typedef uint32 ActiveSessions;
+typedef Uint32 ServerId;
+typedef Uint32 ServerBit;
+typedef Uint32 GroupId;
+typedef Uint32 Location;
+typedef Uint32 Permission;
+
+typedef Uint32 Counter;
+typedef Uint32 ActiveSessions;
typedef unsigned int BranchExecuted;
typedef unsigned int DoRollback;
diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c b/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c
index eedcd914d85..7484c7647f5 100644
--- a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c
+++ b/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c
@@ -18,8 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <string.h>
+#include <ndb_global.h>
#include "dbGenerator.h"
/***************************************************************
diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c b/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c
index 6ddf0a47775..4a31db0b4e9 100644
--- a/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c
+++ b/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c
@@ -14,11 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
+#include <ndb_global.h>
#include <NdbHost.h>
#include <NdbSleep.h>
diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c b/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c
index 9f8629ec1f0..42fbb52f3b2 100644
--- a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c
+++ b/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c
@@ -18,9 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ndb_global.h>
#include "userInterface.h"
diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c b/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c
index 9dde902d006..838ac8a7196 100644
--- a/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c
+++ b/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c
@@ -14,9 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <ndb_global.h>
#include "userInterface.h"
#include "dbPopulate.h"
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c b/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c
index ca8a64ab59c..dd100507016 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c
+++ b/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c
@@ -18,7 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
+#include <ndb_global.h>
#include "userInterface.h"
#include "userHandle.h"
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/macros.h b/ndb/test/ndbapi/lmc-bench/src/user/macros.h
index beb4352c269..363f247b93f 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/macros.h
+++ b/ndb/test/ndbapi/lmc-bench/src/user/macros.h
@@ -17,8 +17,7 @@
#ifndef MACROS_H
#define MACROS_H
-#include <stdlib.h>
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#define ERROR(x) {ndbout_c((x)); }
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp b/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp
index 5f792342ed9..b3aaeac822e 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp
+++ b/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp
@@ -17,7 +17,6 @@
#ifndef NDB_ERROR_H
#define NDB_ERROR_H
-#include <stdio.h>
#include <NdbOut.hpp>
#define error_handler(x,y, z) { \
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp b/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp
index 6a35bccd064..ce3a76cdd59 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp
+++ b/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp
@@ -19,7 +19,7 @@ extern "C" {
#include "user_populate.h"
}
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbApi.hpp>
#include "ndb_schema.hpp"
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c b/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c
index c68f287f5dd..bacf1861dde 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c
+++ b/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c
@@ -18,10 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/time.h>
+#include <ndb_global.h>
#include "userInterface.h"
#include "userHandle.h"
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c b/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c
index 17069b0a042..a2f4787bb0c 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c
+++ b/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c
@@ -18,8 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <string.h>
+#include <ndb_global.h>
#include <time.h>
#include "sql.h"
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
index fc3f6955a47..67c4e037215 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
+++ b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
@@ -18,9 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <NdbStdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
+#include <ndb_global.h>
#ifndef NDB_WIN32
#include <sys/time.h>
#endif
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c b/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c
index 17069b0a042..a2f4787bb0c 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c
+++ b/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c
@@ -18,8 +18,7 @@
* I N C L U D E D F I L E S *
***************************************************************/
-#include <stdio.h>
-#include <string.h>
+#include <ndb_global.h>
#include <time.h>
#include "sql.h"
diff --git a/ndb/test/ndbapi/restarter/restarter.cpp b/ndb/test/ndbapi/restarter/restarter.cpp
index ad3507df98a..9a522f5dcac 100644
--- a/ndb/test/ndbapi/restarter/restarter.cpp
+++ b/ndb/test/ndbapi/restarter/restarter.cpp
@@ -26,8 +26,6 @@
#include <NdbRestarter.hpp>
#include <NdbRestarts.hpp>
#include <NDBT.hpp>
-#include <assert.h>
-#include <NdbStdio.h>
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/restarter2/restarter2.cpp b/ndb/test/ndbapi/restarter2/restarter2.cpp
index 71eaf1a9b0f..f2bcf6f8e7b 100644
--- a/ndb/test/ndbapi/restarter2/restarter2.cpp
+++ b/ndb/test/ndbapi/restarter2/restarter2.cpp
@@ -24,8 +24,6 @@
#include <NdbRestarter.hpp>
#include <NDBT.hpp>
-#include <assert.h>
-#include <NdbStdio.h>
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/restarts/restarts.cpp b/ndb/test/ndbapi/restarts/restarts.cpp
index 2f9bab3b233..0ec2883d53c 100644
--- a/ndb/test/ndbapi/restarts/restarts.cpp
+++ b/ndb/test/ndbapi/restarts/restarts.cpp
@@ -25,8 +25,6 @@
#include <NdbRestarts.hpp>
#include <NDBT.hpp>
-#include <assert.h>
-#include <NdbStdio.h>
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp b/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp
index 71fa286a21b..ce0aee35e8f 100644
--- a/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp
+++ b/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp
@@ -26,6 +26,8 @@
* *************************************************** */
+#include <ndb_global.h>
+
#include <NdbApi.hpp>
#include <NdbTest.hpp>
#include <NdbOut.hpp>
@@ -36,11 +38,6 @@
#include <NdbTick.h>
#include <random.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
#define MAX_TIMERS 4
#define MAXSTRLEN 16
#define MAXATTR 64
diff --git a/ndb/test/ndbapi/telco/msa.cpp b/ndb/test/ndbapi/telco/msa.cpp
index f074733dce4..39ddaac2019 100644
--- a/ndb/test/ndbapi/telco/msa.cpp
+++ b/ndb/test/ndbapi/telco/msa.cpp
@@ -14,17 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <assert.h>
-#include <math.h>
+#include <ndb_global.h>
#include <NdbApi.hpp>
#include <NdbCondition.h>
#include <NdbMutex.h>
#include <NdbSleep.h>
-#include <NdbStdio.h>
#include <NdbThread.h>
#include <NdbTick.h>
-#include <NdbString.h>
const char* const c_szDatabaseName = "TEST_DB";
diff --git a/ndb/test/ndbapi/testBlobs/testBlobs.cpp b/ndb/test/ndbapi/testBlobs/testBlobs.cpp
index b8fe51dc1e4..9f959702402 100644
--- a/ndb/test/ndbapi/testBlobs/testBlobs.cpp
+++ b/ndb/test/ndbapi/testBlobs/testBlobs.cpp
@@ -18,13 +18,8 @@
* testBlobs
*/
-#include <new>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <NdbUnistd.h>
-#include <NdbString.h>
-#include <NdbStdio.h>
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbThread.h>
diff --git a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
index fd6570fad0a..b8e0fef6cef 100644
--- a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
+++ b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
@@ -28,14 +28,12 @@
* Creates tables TB00 to TB15
*/
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NdbTest.hpp>
-#include <NdbStdio.h>
// limits
static int const MaxAttr = 64;
diff --git a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp b/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
index 056aa9bf173..7fd2c19d9f7 100644
--- a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
+++ b/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
@@ -31,8 +31,6 @@
#include <UtilTransactions.hpp>
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
-#include <assert.h>
-#include <NdbStdio.h>
#define CHECK(b) if (!(b)) { \
diff --git a/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp
index 68fa6ec5474..a47d9d2099e 100644
--- a/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp
@@ -18,17 +18,12 @@
* testOIBasic - ordered index test
*/
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <new>
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NdbTest.hpp>
-#include <NdbStdio.h>
#include <NdbMutex.h>
#include <NdbCondition.h>
#include <NdbThread.h>
diff --git a/ndb/test/ndbapi/vw_test/bcd.h b/ndb/test/ndbapi/vw_test/bcd.h
index ce1309693c8..d0aaffbd8b7 100644
--- a/ndb/test/ndbapi/vw_test/bcd.h
+++ b/ndb/test/ndbapi/vw_test/bcd.h
@@ -14,8 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <math.h>
-#include <stdio.h>
+#include <ndb_global.h>
struct bcdtab {
char tab[3];
diff --git a/ndb/test/ndbapi/vw_test/cdrserver.cpp b/ndb/test/ndbapi/vw_test/cdrserver.cpp
index 3c3f32e8886..8354d28f53f 100644
--- a/ndb/test/ndbapi/vw_test/cdrserver.cpp
+++ b/ndb/test/ndbapi/vw_test/cdrserver.cpp
@@ -31,28 +31,22 @@
/* must also have the same entry (same port number) in its */
/* ./etc/services file. */
/* **************************************************************** */
+
+#include <ndb_global.h>
+
/******** NDB INCLUDE ******/
#include <NdbApi.hpp>
/***************************/
/*#include <sys/shm.h>*/
-#include <unistd.h>
-#include <stdlib.h>
-#include <strings.h>
#include <pthread.h>
#include <sys/sem.h>
-#include <sys/types.h>
#include <sys/shm.h>
-#include <sys/socket.h>
-#include <errno.h>
#include <netinet/in.h>
#include <signal.h>
-#include <stdio.h>
#include <netdb.h>
#include <time.h>
#include <synch.h>
#include <sched.h>
-#include <limits.h>
-#include <math.h>
extern "C" {
#include "utv.h"
diff --git a/ndb/test/ndbapi/vw_test/size.cpp b/ndb/test/ndbapi/vw_test/size.cpp
index 397cc02f4f6..c506771ebde 100644
--- a/ndb/test/ndbapi/vw_test/size.cpp
+++ b/ndb/test/ndbapi/vw_test/size.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include "utv.h"
int main(void)
diff --git a/ndb/test/newtonapi/basic_test/basic/basic.cpp b/ndb/test/newtonapi/basic_test/basic/basic.cpp
index 90f5bf14acf..bc33400078d 100644
--- a/ndb/test/newtonapi/basic_test/basic/basic.cpp
+++ b/ndb/test/newtonapi/basic_test/basic/basic.cpp
@@ -26,7 +26,6 @@ extern "C" {
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <NdbMain.h>
-#include <assert.h>
static const
DBA_ColumnDesc_t EmpColDesc[] = {
diff --git a/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp b/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp
index fb26abc65aa..4120cfba864 100644
--- a/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp
+++ b/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp
@@ -26,7 +26,6 @@ extern "C" {
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <NdbMain.h>
-#include <assert.h>
static const
DBA_ColumnDesc_t EmpColDesc[] = {
diff --git a/ndb/test/newtonapi/basic_test/common.cpp b/ndb/test/newtonapi/basic_test/common.cpp
index 6fd63730832..d4c4e6a74a7 100644
--- a/ndb/test/newtonapi/basic_test/common.cpp
+++ b/ndb/test/newtonapi/basic_test/common.cpp
@@ -16,10 +16,6 @@
#include "common.hpp"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
NdbOut &
operator << (NdbOut & out, const Employee_t & emp){
diff --git a/ndb/test/newtonapi/basic_test/common.hpp b/ndb/test/newtonapi/basic_test/common.hpp
index e081df723ef..0df8f7e078d 100644
--- a/ndb/test/newtonapi/basic_test/common.hpp
+++ b/ndb/test/newtonapi/basic_test/common.hpp
@@ -17,12 +17,13 @@
#ifndef COMMON_H
#define COMMON_H
+#include <ndb_global.h>
+
extern "C" {
#include <dba.h>
}
#include <NdbOut.hpp>
-#include <stdlib.h>
typedef struct Employee {
UInt32_t EmpNo;
diff --git a/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp b/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp
index fc6dfc40372..2c9cee5be87 100644
--- a/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp
+++ b/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp
@@ -26,7 +26,6 @@ extern "C" {
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <NdbMain.h>
-#include <assert.h>
static const
DBA_ColumnDesc_t ColDesc[] = {
diff --git a/ndb/test/newtonapi/basic_test/too_basic.cpp b/ndb/test/newtonapi/basic_test/too_basic.cpp
index 9099f0d9154..883aacf8841 100644
--- a/ndb/test/newtonapi/basic_test/too_basic.cpp
+++ b/ndb/test/newtonapi/basic_test/too_basic.cpp
@@ -18,6 +18,9 @@
/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/
+#include <ndb_global.h>
+#include <NdbOut.hpp>
+
//#include <cfg/cfg_db.h>
//#include <init/init_start_restart.h>
//#include "pcn_types.h"
@@ -27,13 +30,6 @@ extern "C" {
#include <cfg_db.h>
}
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <NdbOut.hpp>
-
-
-
typedef struct Employee {
UInt32_t EmpNo;
diff --git a/ndb/test/newtonapi/perf_test/perf.cpp b/ndb/test/newtonapi/perf_test/perf.cpp
index 81d4cc5fd08..7b818e93a2a 100644
--- a/ndb/test/newtonapi/perf_test/perf.cpp
+++ b/ndb/test/newtonapi/perf_test/perf.cpp
@@ -15,14 +15,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
extern "C" {
#include <dba.h>
}
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <NdbTimer.hpp>
@@ -31,6 +29,9 @@ extern "C" {
#include <NdbMain.h>
#include <time.h>
+#undef min
+#undef max
+
static const int NP_Insert = 0;
static const int NP_Update = 1;
static const int NP_WriteUpdate = 2;
diff --git a/ndb/test/odbc/driver/testOdbcDriver.cpp b/ndb/test/odbc/driver/testOdbcDriver.cpp
index 9731c00eeaf..b856b6a21f2 100644
--- a/ndb/test/odbc/driver/testOdbcDriver.cpp
+++ b/ndb/test/odbc/driver/testOdbcDriver.cpp
@@ -36,12 +36,7 @@
* Test of ODBC and SQL using a fixed set of tables.
*/
-#include <new>
-#include <NdbUnistd.h>
-#include <stdlib.h>
-#include <NdbString.h>
-#include <stdarg.h>
-#include <NdbStdio.h>
+#include <ndb_global.h>
#include <ndb_version.h>
#include <kernel/ndb_limits.h>
#include <Bitmask.hpp>
@@ -49,9 +44,7 @@
#ifdef ndbODBC
#include <NdbApi.hpp>
#endif
-#include <math.h>
#include <sqlext.h>
-#include <assert.h>
#undef BOOL
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp
index 1ce9124431c..eb8a626dc2b 100644
--- a/ndb/test/run-test/main.cpp
+++ b/ndb/test/run-test/main.cpp
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <getarg.h>
#include <BaseString.hpp>
#include <Parser.hpp>
diff --git a/ndb/test/run-test/run-test.hpp b/ndb/test/run-test/run-test.hpp
index 8387f8638ed..8d00a7b6a55 100644
--- a/ndb/test/run-test/run-test.hpp
+++ b/ndb/test/run-test/run-test.hpp
@@ -24,6 +24,8 @@
#include <mgmapi.h>
#include <CpcClient.hpp>
+#undef MYSQL_CLIENT
+
enum ErrorCodes {
ERR_OK = 0,
ERR_NDB_FAILED = 101,
diff --git a/ndb/test/src/HugoAsynchTransactions.cpp b/ndb/test/src/HugoAsynchTransactions.cpp
index d045032d455..2af22b5f48d 100644
--- a/ndb/test/src/HugoAsynchTransactions.cpp
+++ b/ndb/test/src/HugoAsynchTransactions.cpp
@@ -473,6 +473,10 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb,
}
}
break;
+ case NO_INSERT:
+ case NO_UPDATE:
+ case NO_DELETE:
+ abort();
}
// Close all transactions
diff --git a/ndb/test/src/HugoCalculator.cpp b/ndb/test/src/HugoCalculator.cpp
index 9e2ba9f143e..55aa96a4909 100644
--- a/ndb/test/src/HugoCalculator.cpp
+++ b/ndb/test/src/HugoCalculator.cpp
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "HugoCalculator.hpp"
-#include <assert.h>
-#include <NdbStdio.h>
#include <NDBT.hpp>
/* *************************************************************
@@ -159,7 +157,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
<< ", NdbDict::Column::getLength(): " << attr->getLength()
<< endl;
const char* buf2 = pRow->attributeStore(i)->aRef();
- for (int j = 0; j < pRow->attributeStore(i)->arraySize(); j++)
+ for (Uint32 j = 0; j < pRow->attributeStore(i)->arraySize(); j++)
{
g_err << j << ":" << buf[j] << "[" << buf2[j] << "]";
if (buf[j] != buf2[j])
diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp
index edcec460ba0..91263aa29b4 100644
--- a/ndb/test/src/HugoOperations.cpp
+++ b/ndb/test/src/HugoOperations.cpp
@@ -652,7 +652,7 @@ void HugoOperations::deallocRows(){
int HugoOperations::saveCopyOfRecord(int numRecords ){
- if (numRecords > rows.size())
+ if (numRecords > (int)rows.size())
return NDBT_FAILED;
for (int i = 0; i < numRecords; i++){
@@ -662,7 +662,7 @@ int HugoOperations::saveCopyOfRecord(int numRecords ){
}
BaseString HugoOperations::getRecordStr(int recordNum){
- if (recordNum > rows.size())
+ if (recordNum > (int)rows.size())
return NULL;
return rows[recordNum]->c_str();
}
@@ -673,7 +673,7 @@ int HugoOperations::getRecordGci(int recordNum){
int HugoOperations::compareRecordToCopy(int numRecords ){
- if (numRecords > rows.size())
+ if (numRecords > (int)rows.size())
return NDBT_FAILED;
if ((unsigned)numRecords > savedRecords.size())
return NDBT_FAILED;
diff --git a/ndb/test/src/HugoTransactions.cpp b/ndb/test/src/HugoTransactions.cpp
index 1293d395974..7f12484ddc8 100644
--- a/ndb/test/src/HugoTransactions.cpp
+++ b/ndb/test/src/HugoTransactions.cpp
@@ -1253,9 +1253,11 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats,
g_info << " UPDATE: ";
recEvent = recUpdateEvent;
break;
+ case NdbDictionary::Event::TE_ALL:
+ abort();
}
- if (pk < records) {
+ if ((int)pk < records) {
recEvent[pk].pk = pk;
recEvent[pk].count++;
}
@@ -1304,7 +1306,7 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats,
if (stats.n_updates > 0) {
stats.n_consecutive++;
}
- for (Uint32 i = 0; i < records/3; i++) {
+ for (Uint32 i = 0; i < (Uint32)records/3; i++) {
if (recInsertEvent[i].pk != i) {
stats.n_consecutive ++;
ndbout << "missing insert pk " << i << endl;
diff --git a/ndb/test/src/NDBT_Error.cpp b/ndb/test/src/NDBT_Error.cpp
index 92c0b2e5c1f..ffacb3eb928 100644
--- a/ndb/test/src/NDBT_Error.cpp
+++ b/ndb/test/src/NDBT_Error.cpp
@@ -17,11 +17,9 @@
/* NDBT_Error.cpp */
/* This program deals with error handling */
-#include <string.h>
-#include <assert.h>
+#include <ndb_global.h>
#include <NdbMain.h>
#include <NdbOut.hpp>
-#include <NdbStdio.h>
#include <NdbTest.hpp>
#include <NDBT_Error.hpp>
#include <NdbSleep.h>
diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp
index 098e4cfb796..ba46be203e1 100644
--- a/ndb/test/src/NDBT_ResultRow.cpp
+++ b/ndb/test/src/NDBT_ResultRow.cpp
@@ -14,10 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
#include "NDBT_ResultRow.hpp"
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
#include <NdbOut.hpp>
NDBT_ResultRow::NDBT_ResultRow(const NdbDictionary::Table& tab,
@@ -68,6 +66,7 @@ NDBT_ResultRow::attributeStore(const char* name){
return data[i];
}
assert(false);
+ return 0;
}
NdbOut &
@@ -191,7 +190,8 @@ NDBT_ResultRow::clone () const {
NDBT_ResultRow * row = new NDBT_ResultRow(m_table, ad[0]);
row->m_ownData = true;
- for(Uint32 i = 0; i<m_table.getNoOfColumns(); i++){
+ Uint32 noOfColumns = m_table.getNoOfColumns();
+ for(Uint32 i = 0; i < noOfColumns; i++){
row->data[i] = data[i]->clone();
}
diff --git a/ndb/test/src/NDBT_ReturnCodes.cpp b/ndb/test/src/NDBT_ReturnCodes.cpp
index 542547c7a48..5bffc00177f 100644
--- a/ndb/test/src/NDBT_ReturnCodes.cpp
+++ b/ndb/test/src/NDBT_ReturnCodes.cpp
@@ -14,14 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* System include files */
+#include <ndb_global.h>
+
#include "NDBT_ReturnCodes.h"
/* Ndb include files */
#include <NdbOut.hpp>
-/* System include files */
-#include <stdlib.h>
-
const char* rcodeToChar(int rcode){
switch (rcode){
case NDBT_OK:
diff --git a/ndb/test/src/NDBT_Table.cpp b/ndb/test/src/NDBT_Table.cpp
index 2bd2c265f10..c520b01c990 100644
--- a/ndb/test/src/NDBT_Table.cpp
+++ b/ndb/test/src/NDBT_Table.cpp
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "NDBT_Table.hpp"
-#include <NdbString.h>
-#include <assert.h>
#include <NdbTimer.hpp>
#include <NDBT.hpp>
diff --git a/ndb/test/src/NDBT_Tables.cpp b/ndb/test/src/NDBT_Tables.cpp
index 41a38e4fe44..548e755a3fb 100644
--- a/ndb/test/src/NDBT_Tables.cpp
+++ b/ndb/test/src/NDBT_Tables.cpp
@@ -18,7 +18,6 @@
#include <NDBT_Table.hpp>
#include <NDBT_Tables.hpp>
-#include <assert.h>
/* ******************************************************* */
// Define Ndb standard tables
//
diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp
index 689aae64c81..6cbb69508f5 100644
--- a/ndb/test/src/NdbBackup.cpp
+++ b/ndb/test/src/NdbBackup.cpp
@@ -18,7 +18,6 @@
#include <NdbBackup.hpp>
#include <NdbOut.hpp>
#include <NDBT_Output.hpp>
-#include <assert.h>
#include <NdbConfig.h>
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
@@ -67,7 +66,6 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
/**
* Fetch configuration from management server
*/
- char buf[255];
ConfigRetriever cr;
diff --git a/ndb/test/src/NdbConfig.cpp b/ndb/test/src/NdbConfig.cpp
index d61b74cf62b..3a254bc1577 100644
--- a/ndb/test/src/NdbConfig.cpp
+++ b/ndb/test/src/NdbConfig.cpp
@@ -17,7 +17,6 @@
#include "NdbConfig.hpp"
#include <NdbOut.hpp>
#include <NDBT_Output.hpp>
-#include <assert.h>
#include <NdbConfig.h>
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
@@ -32,7 +31,6 @@ NdbConfig::getPropsForNode(unsigned int node_id,
/**
* Fetch configuration from management server
*/
- char buf[255];
ConfigRetriever cr;
@@ -112,7 +110,6 @@ NdbConfig::getHostName(unsigned int node_id,
/**
* Fetch configuration from management server
*/
- char buf[255];
ConfigRetriever cr;
diff --git a/ndb/test/src/NdbGrep.cpp b/ndb/test/src/NdbGrep.cpp
index 747c62d5bc6..8b7442b0e77 100644
--- a/ndb/test/src/NdbGrep.cpp
+++ b/ndb/test/src/NdbGrep.cpp
@@ -18,7 +18,6 @@
#include <NdbGrep.hpp>
#include <NdbOut.hpp>
#include <NDBT_Output.hpp>
-#include <assert.h>
#include <NdbConfig.h>
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp
index 1df214572c7..cc2fab46cc5 100644
--- a/ndb/test/src/NdbRestarter.cpp
+++ b/ndb/test/src/NdbRestarter.cpp
@@ -24,7 +24,6 @@
#include <random.h>
#include <kernel/ndb_limits.h>
#include <ndb_version.h>
-#include <assert.h>
#define MGMERR(h) \
ndbout << "latest_error="<<ndb_mgm_get_latest_error(h) \
@@ -168,7 +167,7 @@ NdbRestarter::getRandomNotMasterNodeId(int rand){
if(master == -1)
return -1;
- int counter = 0;
+ Uint32 counter = 0;
rand = rand % ndbNodes.size();
while(counter++ < ndbNodes.size() && ndbNodes[rand].node_id == master)
rand = (rand + 1) % ndbNodes.size();
@@ -197,7 +196,7 @@ NdbRestarter::getRandomNodeOtherNodeGroup(int nodeId, int rand){
return -1;
}
- int counter = 0;
+ Uint32 counter = 0;
rand = rand % ndbNodes.size();
while(counter++ < ndbNodes.size() && ndbNodes[rand].node_group == node_group)
rand = (rand + 1) % ndbNodes.size();
diff --git a/ndb/test/tools/hugoCalculator/hugoCalculator.cpp b/ndb/test/tools/hugoCalculator/hugoCalculator.cpp
index 4cb801d3d73..7f2751be2ba 100644
--- a/ndb/test/tools/hugoCalculator/hugoCalculator.cpp
+++ b/ndb/test/tools/hugoCalculator/hugoCalculator.cpp
@@ -14,8 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
-#include <stdlib.h>
#include <NdbSleep.h>
#include <NDBT_Tables.hpp>
#include <getarg.h>
diff --git a/ndb/test/tools/hugoFill/hugoFill.cpp b/ndb/test/tools/hugoFill/hugoFill.cpp
index 748623cb253..dee6ce2e6c8 100644
--- a/ndb/test/tools/hugoFill/hugoFill.cpp
+++ b/ndb/test/tools/hugoFill/hugoFill.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp b/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp
index 90c08649ec2..e2c2cd13f00 100644
--- a/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp
+++ b/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp b/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp
index f77dc21bd0b..1855f19796f 100644
--- a/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp
+++ b/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/hugoPkRead/hugoPkRead.cpp b/ndb/test/tools/hugoPkRead/hugoPkRead.cpp
index 2e9c2c35260..50351f08195 100644
--- a/ndb/test/tools/hugoPkRead/hugoPkRead.cpp
+++ b/ndb/test/tools/hugoPkRead/hugoPkRead.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp b/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp
index 6335c391bc3..ac17ffffee8 100644
--- a/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp
+++ b/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp
@@ -14,8 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
-#include <stdlib.h>
#include <NdbSleep.h>
#include <NDBT_Tables.hpp>
#include <getarg.h>
diff --git a/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp b/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp
index 141d01e3aee..e7edc3a991d 100644
--- a/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp
+++ b/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/hugoScanRead/hugoScanRead.cpp b/ndb/test/tools/hugoScanRead/hugoScanRead.cpp
index 2376280d004..47ea8f4a8a7 100644
--- a/ndb/test/tools/hugoScanRead/hugoScanRead.cpp
+++ b/ndb/test/tools/hugoScanRead/hugoScanRead.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp b/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp
index 56cd3b8c969..3e2255ca0f3 100644
--- a/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp
+++ b/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp
@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/test/tools/restart/restart.cpp b/ndb/test/tools/restart/restart.cpp
index f391aecabe1..88cfb231a72 100644
--- a/ndb/test/tools/restart/restart.cpp
+++ b/ndb/test/tools/restart/restart.cpp
@@ -15,7 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <string.h>
+#include <ndb_global.h>
+
#include <NdbMain.h>
#include <OutputStream.hpp>
#include <NdbOut.hpp>
@@ -24,8 +25,6 @@
#include <NdbRestarter.hpp>
#include <NDBT.hpp>
-#include <assert.h>
-#include <NdbStdio.h>
int main(int argc, const char** argv){
diff --git a/ndb/test/tools/waiter/waiter.cpp b/ndb/test/tools/waiter/waiter.cpp
index 14803fec71d..d57daff3aea 100644
--- a/ndb/test/tools/waiter/waiter.cpp
+++ b/ndb/test/tools/waiter/waiter.cpp
@@ -25,7 +25,6 @@
#include <NdbRestarter.hpp>
#include <NDBT.hpp>
-#include <assert.h>
int main(int argc, const char** argv){
diff --git a/ndb/tools/copy_tab/copy_tab.cpp b/ndb/tools/copy_tab/copy_tab.cpp
index 32cfb0b35ff..33ce8e01d9a 100644
--- a/ndb/tools/copy_tab/copy_tab.cpp
+++ b/ndb/tools/copy_tab/copy_tab.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/cpcc/cpcc.cpp b/ndb/tools/cpcc/cpcc.cpp
index 5a826f250c0..e768d707bbc 100644
--- a/ndb/tools/cpcc/cpcc.cpp
+++ b/ndb/tools/cpcc/cpcc.cpp
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdarg.h>
+#include <ndb_global.h>
#include <getarg.h>
#include "CpcClient.hpp"
#include <NdbEnv.h>
@@ -116,7 +116,7 @@ public:
}
virtual bool evaluate(SimpleCpcClient* c,const SimpleCpcClient::Process & p){
- return p.m_id == id && c == host;
+ return p.m_id == (int)id && c == host;
}
};
diff --git a/ndb/tools/create_index/create_index.cpp b/ndb/tools/create_index/create_index.cpp
index 32da39a5208..dc9e6c606d6 100644
--- a/ndb/tools/create_index/create_index.cpp
+++ b/ndb/tools/create_index/create_index.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/delete_all/delete_all.cpp b/ndb/tools/delete_all/delete_all.cpp
index e78ad4a2e1e..9cbba503e68 100644
--- a/ndb/tools/delete_all/delete_all.cpp
+++ b/ndb/tools/delete_all/delete_all.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/drop_index/drop_index.cpp b/ndb/tools/drop_index/drop_index.cpp
index 146f01113b2..327f15741c9 100644
--- a/ndb/tools/drop_index/drop_index.cpp
+++ b/ndb/tools/drop_index/drop_index.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/drop_tab/drop_tab.cpp b/ndb/tools/drop_tab/drop_tab.cpp
index 5946ada5956..70e5d85aabe 100644
--- a/ndb/tools/drop_tab/drop_tab.cpp
+++ b/ndb/tools/drop_tab/drop_tab.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdio.h>
+#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/list_tables/listTables.cpp b/ndb/tools/list_tables/listTables.cpp
index c14808050c6..41433862304 100644
--- a/ndb/tools/list_tables/listTables.cpp
+++ b/ndb/tools/list_tables/listTables.cpp
@@ -21,8 +21,9 @@
*
*/
-#include <stdarg.h>
+#include <ndb_global.h>
#include <getarg.h>
+
#include <NdbApi.hpp>
#include <NDBT.hpp>
diff --git a/ndb/tools/select_all/select_all.cpp b/ndb/tools/select_all/select_all.cpp
index 32e9d1c6872..34f63a095bb 100644
--- a/ndb/tools/select_all/select_all.cpp
+++ b/ndb/tools/select_all/select_all.cpp
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/select_count/select_count.cpp b/ndb/tools/select_count/select_count.cpp
index 4d281b9bdd5..b1513ad4135 100644
--- a/ndb/tools/select_count/select_count.cpp
+++ b/ndb/tools/select_count/select_count.cpp
@@ -15,8 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <NdbStdio.h>
-#include <stdlib.h>
+#include <ndb_global.h>
+
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/ndb/tools/transproxy/transproxy.cpp b/ndb/tools/transproxy/transproxy.cpp
index 4c1308e63e7..384a8a34f03 100644
--- a/ndb/tools/transproxy/transproxy.cpp
+++ b/ndb/tools/transproxy/transproxy.cpp
@@ -14,14 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <ndb_global.h>
#include <NdbTCP.h>
#include <NdbOut.hpp>
diff --git a/ndb/tools/verify_index/verify_index.cpp b/ndb/tools/verify_index/verify_index.cpp
index 324bb11cfe4..1295b657e9b 100644
--- a/ndb/tools/verify_index/verify_index.cpp
+++ b/ndb/tools/verify_index/verify_index.cpp
@@ -14,9 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
-#include <NdbStdio.h>
-#include <stdlib.h>
#include <NdbOut.hpp>
#include <NdbApi.hpp>
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 61d173aac05..abde6ecbe73 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -10,6 +10,8 @@
in_rpm=0
windows=0
defaults=""
+tmp_file=/tmp/mysql_install_db.$$
+
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
defaults="$1"; shift
@@ -212,9 +214,11 @@ then
then
echo "Fill help tables"
fi
- if ! (echo "use mysql;
- "
- cat $fill_help_tables) | eval "$mysqld_install_cmd_line"
+ echo "use mysql;" > $tmp_file
+ cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line"
+ res=$?
+ rm $tmp_file
+ if test $res != 0
then
echo ""
echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index e2463761e67..b8ae5967475 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -14,6 +14,55 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/*
+ ha_example is a stubbed storage engine. It does nothing at this point. It
+ will let you create/open/delete tables but that is all. You can enable it
+ in your buld by doing the following during your build process:
+ ./configure --with-example-storage-engine
+
+ Once this is done mysql will let you create tables with:
+ CREATE TABLE A (...) ENGINE=EXAMPLE;
+
+ The example is setup to use table locks. It implements an example "SHARE"
+ that is inserted into a hash by table name. You can use this to store
+ information of state that any example handler object will be able to see
+ if it is using the same table.
+
+ Please read the object definition in ha_example.h before reading the rest
+ if this file.
+
+ To get an idea of what occurs here is an example select that would do a
+ scan of an entire table:
+ ha_example::store_lock
+ ha_example::external_lock
+ ha_example::info
+ ha_example::rnd_init
+ ha_example::extra
+ ENUM HA_EXTRA_CACHE Cash record in HA_rrnd()
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::rnd_next
+ ha_example::extra
+ ENUM HA_EXTRA_NO_CACHE End cacheing of records (def)
+ ha_example::external_lock
+ ha_example::extra
+ ENUM HA_EXTRA_RESET Reset database to after open
+
+ In the above example has 9 row called before rnd_next signalled that it was
+ at the end of its data. In the above example the table was already opened
+ (or you would have seen a call to ha_example::open(). Calls to
+ ha_example::extra() are hints as to what will be occuring to the request.
+
+ Happy coding!
+ -Brian
+*/
+
#ifdef __GNUC__
#pragma implementation // gcc: Class implementation
#endif
@@ -24,10 +73,14 @@
#include "ha_example.h"
/* Variables for example share methods */
-pthread_mutex_t example_mutex;
-static HASH example_open_tables;
-static int example_init= 0;
+static HASH example_open_tables; // Hash used to track open tables
+pthread_mutex_t example_mutex; // This is the mutex we use to init the hash
+static int example_init= 0; // Variable for checking the init state of hash
+
+/*
+ Function we use in the creation of our hash to get key.
+*/
static byte* example_get_key(EXAMPLE_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)))
{
@@ -37,7 +90,9 @@ static byte* example_get_key(EXAMPLE_SHARE *share,uint *length,
/*
- Example of simple lock controls.
+ Example of simple lock controls. The "share" it creates is structure we will
+ pass to each example handler. Do you have to have one of these? Well, you have
+ pieces that are used for locking, and they are needed to function.
*/
static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
{
@@ -45,6 +100,12 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
uint length;
char *tmp_name;
+ /*
+ So why does this exist? There is no way currently to init a storage engine.
+ Innodb and BDB both have modifications to the server to allow them to
+ do this. Since you will not want to do this, this is probably the next
+ best method.
+ */
if (!example_init)
{
/* Hijack a mutex for init'ing the storage engine */
@@ -101,7 +162,8 @@ error:
/*
- Free lock controls.
+ Free lock controls. We call this whenever we close a table. If the table had
+ the last reference to the share then we free memory associated with it.
*/
static int free_share(EXAMPLE_SHARE *share)
{
@@ -119,10 +181,24 @@ static int free_share(EXAMPLE_SHARE *share)
}
+/*
+ If frm_error() is called then we will use this to to find out what file extentions
+ exist for the storage engine. This is also used by the default rename_table and
+ delete_table method in handler.cc.
+*/
const char **ha_example::bas_ext() const
{ static const char *ext[]= { NullS }; return ext; }
+/*
+ Used for opening tables. The name will be the name of the file.
+ A table is opened when it needs to be opened. For instance
+ when a request comes in for a select on the table (tables are not
+ open and closed for each request, they are cached).
+
+ Called from handler.cc by handler::ha_open(). The server opens all tables by
+ calling ha_open() which then calls the handler specific open().
+*/
int ha_example::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_example::open");
@@ -134,18 +210,66 @@ int ha_example::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(0);
}
+
+/*
+ Closes a table. We call the free_share() function to free any resources
+ that we have allocated in the "shared" structure.
+
+ Called from sql_base.cc, sql_select.cc, and table.cc.
+ In sql_select.cc it is only used to close up temporary tables or during
+ the process where a temporary table is converted over to being a
+ myisam table.
+ For sql_base.cc look at close_data_tables().
+*/
int ha_example::close(void)
{
DBUG_ENTER("ha_example::close");
DBUG_RETURN(free_share(share));
}
+
+/*
+ write_row() inserts a row. No extra() hint is given currently if a bulk load
+ is happeneding. buf() is a byte array of data. You can use the field
+ information to extract the data from the native byte array type.
+ Example of this would be:
+ for (Field **field=table->field ; *field ; field++)
+ {
+ ...
+ }
+
+ See ha_tina.cc for an example of extracting all of the data as strings.
+ ha_berekly.cc has an example of how to store it intact by "packing" it
+ for ha_berkeley's own native storage type.
+
+ See the note for update_row() on auto_increments and timestamps. This
+ case also applied to write_row().
+
+ Called from item_sum.cc, item_sum.cc, sql_acl.cc, sql_insert.cc,
+ sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc, and sql_update.cc.
+*/
int ha_example::write_row(byte * buf)
{
DBUG_ENTER("ha_example::write_row");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ Yes, update_row() does what you expect, it updates a row. old_data will have
+ the previous row record in it, while new_data will have the newest data in
+ it.
+ Keep in mind that the server can do updates based on ordering if an ORDER BY
+ clause was used. Consecutive ordering is not guarenteed.
+ Currently new_data will not have an updated auto_increament record, or
+ and updated timestamp field. You can do these for example by doing these:
+ if (table->timestamp_on_update_now)
+ update_timestamp(new_row+table->timestamp_on_update_now-1);
+ if (table->next_number_field && record == table->record[0])
+ update_auto_increment();
+
+ Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc.
+*/
int ha_example::update_row(const byte * old_data, byte * new_data)
{
@@ -153,12 +277,32 @@ int ha_example::update_row(const byte * old_data, byte * new_data)
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ This will delete a row. buf will contain a copy of the row to be deleted.
+ The server will call this right after the current row has been called (from
+ either a previous rnd_nexT() or index call).
+ If you keep a pointer to the last row or can access a primary key it will
+ make doing the deletion quite a bit easier.
+ Keep in mind that the server does no guarentee consecutive deletions. ORDER BY
+ clauses can be used.
+
+ Called in sql_acl.cc and sql_udf.cc to manage internal table information.
+ Called in sql_delete.cc, sql_insert.cc, and sql_select.cc. In sql_select it is
+ used for removing duplicates while in insert it is used for REPLACE calls.
+*/
int ha_example::delete_row(const byte * buf)
{
DBUG_ENTER("ha_example::delete_row");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ Positions an index cursor to the index specified in the handle. Fetches the
+ row if available. If the key value is null, begin at the first key of the
+ index.
+*/
int ha_example::index_read(byte * buf, const byte * key,
uint key_len __attribute__((unused)),
enum ha_rkey_function find_flag
@@ -168,6 +312,11 @@ int ha_example::index_read(byte * buf, const byte * key,
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ Positions an index cursor to the index specified in key. Fetches the
+ row if any. This is only used to read whole keys.
+*/
int ha_example::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len __attribute__((unused)),
enum ha_rkey_function find_flag
@@ -178,66 +327,187 @@ int ha_example::index_read_idx(byte * buf, uint index, const byte * key,
}
+/*
+ Used to read forward through the index.
+*/
int ha_example::index_next(byte * buf)
{
DBUG_ENTER("ha_example::index_next");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ Used to read backwards through the index.
+*/
int ha_example::index_prev(byte * buf)
{
DBUG_ENTER("ha_example::index_prev");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ index_first() asks for the first key in the index.
+
+ Called from opt_range.cc, opt_sum.cc, sql_handler.cc,
+ and sql_select.cc.
+*/
int ha_example::index_first(byte * buf)
{
DBUG_ENTER("ha_example::index_first");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ index_last() asks for the last key in the index.
+
+ Called from opt_range.cc, opt_sum.cc, sql_handler.cc,
+ and sql_select.cc.
+*/
int ha_example::index_last(byte * buf)
{
DBUG_ENTER("ha_example::index_last");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ rnd_init() is called when the system wants the storage engine to do a table
+ scan.
+ See the example in the introduction at the top of this file to see when
+ rnd_init() is called.
+
+ Called from filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc,
+ and sql_update.cc.
+*/
int ha_example::rnd_init(bool scan)
{
DBUG_ENTER("ha_example::rnd_init");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ This is called for each row of the table scan. When you run out of records
+ you should return HA_ERR_END_OF_FILE. Fill buff up with the row information.
+ The Field structure for the table is the key to getting data into buf
+ in a manner that will allow the server to understand it.
+
+ Called from filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc,
+ and sql_update.cc.
+*/
int ha_example::rnd_next(byte *buf)
{
DBUG_ENTER("ha_example::rnd_next");
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
+
+/*
+ position() is called after each call to rnd_next() if the data needs
+ to be ordered. You can do something like the following to store
+ the position:
+ ha_store_ptr(ref, ref_length, current_position);
+
+ The server uses ref to store data. ref_length in the above case is
+ the size needed to store current_position. ref is just a byte array
+ that the server will maintain. If you are using offsets to mark rows, then
+ current_position should be the offset. If it is a primary key like in
+ BDB, then it needs to be a primary key.
+
+ Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc.
+*/
void ha_example::position(const byte *record)
{
DBUG_ENTER("ha_example::position");
DBUG_VOID_RETURN;
}
+
+/*
+ This is like rnd_next, but you are given a position to use
+ to determine the row. The position will be of the type that you stored in
+ ref. You can use ha_get_ptr(pos,ref_length) to retrieve whatever key
+ or position you saved when position() was called.
+ Called from filesort.cc records.cc sql_insert.cc sql_select.cc sql_update.cc.
+*/
int ha_example::rnd_pos(byte * buf, byte *pos)
{
DBUG_ENTER("ha_example::rnd_pos");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ ::info() is used to return information to the optimizer.
+ Currently this table handler doesn't implement most of the fields
+ really needed. SHOW also makes use of this data
+ Another note, you will probably want to have the following in your
+ code:
+ if (records < 2)
+ records = 2;
+ The reason is that the server will optimize for cases of only a single
+ record. If in a table scan you don't know the number of records
+ it will probably be better to set records to two so you can return
+ as many records as you need.
+ Along with records a few more variables you may wish to set are:
+ records
+ deleted
+ data_file_length
+ index_file_length
+ delete_length
+ check_time
+ Take a look at the public variables in handler.h for more information.
+
+ Called in:
+ filesort.cc
+ ha_heap.cc
+ item_sum.cc
+ opt_sum.cc
+ sql_delete.cc
+ sql_delete.cc
+ sql_derived.cc
+ sql_select.cc
+ sql_select.cc
+ sql_select.cc
+ sql_select.cc
+ sql_select.cc
+ sql_show.cc
+ sql_show.cc
+ sql_show.cc
+ sql_show.cc
+ sql_table.cc
+ sql_union.cc
+ sql_update.cc
+
+*/
void ha_example::info(uint flag)
{
DBUG_ENTER("ha_example::info");
DBUG_VOID_RETURN;
}
+
+/*
+ extra() is called whenever the server wishes to send a hint to
+ the storage engine. The myisam engine implements the most hints.
+ ha_innodb.cc has the most exhaustive list of these hints.
+*/
int ha_example::extra(enum ha_extra_function operation)
{
DBUG_ENTER("ha_example::extra");
DBUG_RETURN(0);
}
+
+/*
+ Deprecated and likely to be removed in the future. Storage engines normally
+ just make a call like:
+ ha_example::extra(HA_EXTRA_RESET);
+ to handle it.
+*/
int ha_example::reset(void)
{
DBUG_ENTER("ha_example::reset");
@@ -245,18 +515,71 @@ int ha_example::reset(void)
}
+/*
+ Used to delete all rows in a table. Both for cases of truncate and
+ for cases where the optimizer realizes that all rows will be
+ removed as a result of a SQL statement.
+
+ Called from item_sum.cc by Item_func_group_concat::clear(),
+ Item_sum_count_distinct::clear(), and Item_func_group_concat::clear().
+ Called from sql_delete.cc by mysql_delete().
+ Called from sql_select.cc by JOIN::reinit().
+ Called from sql_union.cc by st_select_lex_unit::exec().
+*/
int ha_example::delete_all_rows()
{
DBUG_ENTER("ha_example::delete_all_rows");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+
+/*
+ First you should go read the section "locking functions for mysql" in
+ lock.cc to understand this.
+ This create a lock on the table. If you are implementing a storage engine
+ that can handle transacations look at ha_berkely.cc to see how you will
+ want to goo about doing this. Otherwise you should consider calling flock()
+ here.
+
+ Called from lock.cc by lock_external() and unlock_external(). Also called
+ from sql_table.cc by copy_data_between_tables().
+*/
int ha_example::external_lock(THD *thd, int lock_type)
{
DBUG_ENTER("ha_example::external_lock");
DBUG_RETURN(0);
}
+
+/*
+ The idea with handler::store_lock() is the following:
+
+ The statement decided which locks we should need for the table
+ for updates/deletes/inserts we get WRITE locks, for SELECT... we get
+ read locks.
+
+ Before adding the lock into the table lock handler (see thr_lock.c)
+ mysqld calls store lock with the requested locks. Store lock can now
+ modify a write lock to a read lock (or some other lock), ignore the
+ lock (if we don't want to use MySQL table locks at all) or add locks
+ for many tables (like we do when we are using a MERGE handler).
+
+ Berkeley DB for example changes all WRITE locks to TL_WRITE_ALLOW_WRITE
+ (which signals that we are doing WRITES, but we are still allowing other
+ reader's and writer's.
+
+ When releasing locks, store_lock() are also called. In this case one
+ usually doesn't have to do anything.
+
+ In some exceptional cases MySQL may send a request for a TL_IGNORE;
+ This means that we are requesting the same lock as last time and this
+ should also be ignored. (This may happen when someone does a flush
+ table when we have opened a part of the tables, in which case mysqld
+ closes and reopens the tables and tries to get the same locks at last
+ time). In the future we will probably try to remove this.
+
+ Called from lock.cc by get_lock_data().
+*/
THR_LOCK_DATA **ha_example::store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
@@ -267,6 +590,16 @@ THR_LOCK_DATA **ha_example::store_lock(THD *thd,
return to;
}
+/*
+ Used to delete a table. By the time delete_table() has been called all
+ opened references to this table will have been closed (and your globally
+ shared references released. The variable name will just be the name of
+ the table. You will need to remove any files you have created at this point.
+
+ Called from handler.cc by delete_table and ha_create_table(). Only used
+ during create if the table_flag HA_DROP_BEFORE_CREATE was specified for
+ the storage engine.
+*/
int ha_example::delete_table(const char *name)
{
DBUG_ENTER("ha_example::delete_table");
@@ -274,12 +607,24 @@ int ha_example::delete_table(const char *name)
DBUG_RETURN(0);
}
+/*
+ Renames a table from one name to another from alter table call.
+
+ Called from sql_table.cc by mysql_rename_table().
+*/
int ha_example::rename_table(const char * from, const char * to)
{
DBUG_ENTER("ha_example::rename_table ");
DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
+/*
+ Given a starting key, and an ending key estimate the number of rows that
+ will exist between the two. end_key may be empty which in case determine
+ if start_key matches any rows.
+
+ Called from opt_range.cc by check_quick_keys().
+*/
ha_rows ha_example::records_in_range(int inx,
const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
@@ -287,11 +632,22 @@ ha_rows ha_example::records_in_range(int inx,
enum ha_rkey_function end_search_flag)
{
DBUG_ENTER("ha_example::records_in_range ");
- DBUG_RETURN(records); // HA_ERR_NOT_IMPLEMENTED
+ DBUG_RETURN(records);
}
-int ha_example::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info)
+/*
+ create() is called to create a database. The variable name will have the name
+ of the table. When create() is called you do not need to worry about opening
+ the table. Also, the FRM file will have already been created so adjusting
+ create_info will not do you any good. You can overwrite the frm file at this
+ point if you wish to change the table definition, but there are no methods
+ currently provided for doing that.
+
+ Called from handle.cc by ha_create_table().
+*/
+int ha_example::create(const char *name, TABLE *table_arg,
+ HA_CREATE_INFO *create_info)
{
DBUG_ENTER("ha_example::create");
/* This is not implemented but we want someone to be able that it works. */
diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h
index 466632a1795..ffc4f5b941c 100644
--- a/sql/examples/ha_example.h
+++ b/sql/examples/ha_example.h
@@ -14,6 +14,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/*
+ Please read ha_exmple.cc before reading this file.
+ Please keep in mind that the example storage engine implements all methods
+ that are required to be implemented. handler.h has a full list of methods
+ that you can implement.
+*/
+
+/*
+ EXAMPLE_SHARE is a structure that will be shared amoung all open handlers
+ The example implements the minimum of what you will probably need.
+*/
typedef struct st_example_share {
char *table_name;
uint table_name_length,use_count;
@@ -21,6 +32,9 @@ typedef struct st_example_share {
THR_LOCK lock;
} EXAMPLE_SHARE;
+/*
+ Class definition for the storage engine
+*/
class ha_example: public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
@@ -33,17 +47,34 @@ public:
~ha_example()
{
}
- const char *table_type() const { return "EXAMPLE"; }
+ /* The name that will be used for display purposes */
+ const char *table_type() const { return "EXAMPLE"; }
+ /* The name of the index type that will be used for display */
const char *index_type(uint inx) { return "NONE"; }
const char **bas_ext() const;
+ /*
+ This is a list of flags that says what the storage engine
+ implements. The current table flags are documented in
+ table_flags.
+ */
ulong table_flags() const
{
return 0;
}
+ /*
+ This is a list of flags that says how the storage engine
+ implements indexes. The current index flags are documented in
+ handler.h. If you do not implement indexes, just return zero
+ here.
+ */
ulong index_flags(uint inx) const
{
return 0;
}
+ /*
+ unireg.cc will call the following to make sure that the storage engine can
+ handle the data it is about to send.
+ */
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return 0; }
uint max_key_parts() const { return 0; }
@@ -52,10 +83,15 @@ public:
Called in test_quick_select to determine if indexes should be used.
*/
virtual double scan_time() { return (double) (records+deleted) / 20.0+10; }
- /* The next method will never be called */
+ /*
+ The next method will never be called if you do not implement indexes.
+ */
virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; }
virtual bool fast_key_read() { return 1;}
+ /*
+ Everything below are methods that we implment in ha_example.cc.
+ */
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
diff --git a/sql/field.cc b/sql/field.cc
index fdf314972c8..edaa29dbaa0 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2307,7 +2307,8 @@ int Field_float::store(double nr)
}
else
{
- max_value= (log_10[field_length]-1)/log_10[dec];
+ uint tmp=min(field_length,array_elements(log_10)-1);
+ max_value= (log_10[tmp]-1)/log_10[dec];
/*
The following comparison is needed to not get an overflow if nr
is close to FLT_MAX
@@ -2607,7 +2608,8 @@ int Field_double::store(double nr)
}
else
{
- max_value= (log_10[field_length]-1)/log_10[dec];
+ uint tmp=min(field_length,array_elements(log_10)-1);
+ max_value= (log_10[tmp]-1)/log_10[dec];
if (fabs(nr) < DBL_MAX/10.0e+32)
nr= floor(nr*log_10[dec]+0.5)/log_10[dec];
}
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 47978d647ec..12b922e6fc0 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,12 +47,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
if (file)
{
/* Initialize variables for the opened table */
- btree_keys.clear_all();
- for (uint i= 0 ; i < table->keys ; i++)
- {
- if (table->key_info[i].algorithm == HA_KEY_ALG_BTREE)
- btree_keys.set_bit(i);
- }
+ set_keys_for_scanning();
}
return (file ? 0 : 1);
}
@@ -62,6 +57,33 @@ int ha_heap::close(void)
return heap_close(file);
}
+
+/*
+ Compute which keys to use for scanning
+
+ SYNOPSIS
+ set_keys_for_scanning()
+ no parameter
+
+ DESCRIPTION
+ Set the bitmap btree_keys, which is used when the upper layers ask
+ which keys to use for scanning. For each btree index the
+ corresponding bit is set.
+
+ RETURN
+ void
+*/
+
+void ha_heap::set_keys_for_scanning(void)
+{
+ btree_keys.clear_all();
+ for (uint i= 0 ; i < table->keys ; i++)
+ {
+ if (table->key_info[i].algorithm == HA_KEY_ALG_BTREE)
+ btree_keys.set_bit(i);
+ }
+}
+
int ha_heap::write_row(byte * buf)
{
statistic_increment(ha_write_count,&LOCK_status);
@@ -207,6 +229,114 @@ int ha_heap::external_lock(THD *thd, int lock_type)
return 0; // No external locking
}
+
+/*
+ Disable indexes.
+
+ SYNOPSIS
+ disable_indexes()
+ mode mode of operation:
+ HA_KEY_SWITCH_NONUNIQ disable all non-unique keys
+ HA_KEY_SWITCH_ALL disable all keys
+ HA_KEY_SWITCH_NONUNIQ_SAVE dis. non-uni. and make persistent
+ HA_KEY_SWITCH_ALL_SAVE dis. all keys and make persistent
+
+ DESCRIPTION
+ Disable indexes and clear keys to use for scanning.
+
+ IMPLEMENTATION
+ HA_KEY_SWITCH_NONUNIQ is not implemented.
+ HA_KEY_SWITCH_NONUNIQ_SAVE is not implemented with HEAP.
+ HA_KEY_SWITCH_ALL_SAVE is not implemented with HEAP.
+
+ RETURN
+ 0 ok
+ HA_ERR_WRONG_COMMAND mode not implemented.
+*/
+
+int ha_heap::disable_indexes(uint mode)
+{
+ int error;
+
+ if (mode == HA_KEY_SWITCH_ALL)
+ {
+ if (!(error= heap_disable_indexes(file)))
+ set_keys_for_scanning();
+ }
+ else
+ {
+ /* mode not implemented */
+ error= HA_ERR_WRONG_COMMAND;
+ }
+ return error;
+}
+
+
+/*
+ Enable indexes.
+
+ SYNOPSIS
+ enable_indexes()
+ mode mode of operation:
+ HA_KEY_SWITCH_NONUNIQ enable all non-unique keys
+ HA_KEY_SWITCH_ALL enable all keys
+ HA_KEY_SWITCH_NONUNIQ_SAVE en. non-uni. and make persistent
+ HA_KEY_SWITCH_ALL_SAVE en. all keys and make persistent
+
+ DESCRIPTION
+ Enable indexes and set keys to use for scanning.
+ The indexes might have been disabled by disable_index() before.
+ The function works only if both data and indexes are empty,
+ since the heap storage engine cannot repair the indexes.
+ To be sure, call handler::delete_all_rows() before.
+
+ IMPLEMENTATION
+ HA_KEY_SWITCH_NONUNIQ is not implemented.
+ HA_KEY_SWITCH_NONUNIQ_SAVE is not implemented with HEAP.
+ HA_KEY_SWITCH_ALL_SAVE is not implemented with HEAP.
+
+ RETURN
+ 0 ok
+ HA_ERR_CRASHED data or index is non-empty. Delete all rows and retry.
+ HA_ERR_WRONG_COMMAND mode not implemented.
+*/
+
+int ha_heap::enable_indexes(uint mode)
+{
+ int error;
+
+ if (mode == HA_KEY_SWITCH_ALL)
+ {
+ if (!(error= heap_enable_indexes(file)))
+ set_keys_for_scanning();
+ }
+ else
+ {
+ /* mode not implemented */
+ error= HA_ERR_WRONG_COMMAND;
+ }
+ return error;
+}
+
+
+/*
+ Test if indexes are disabled.
+
+ SYNOPSIS
+ indexes_are_disabled()
+ no parameters
+
+ RETURN
+ 0 indexes are not disabled
+ 1 all indexes are disabled
+ [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+*/
+
+int ha_heap::indexes_are_disabled(void)
+{
+ return heap_indexes_are_disabled(file);
+}
+
THR_LOCK_DATA **ha_heap::store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 68406202c76..2f849d2574b 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -61,6 +61,7 @@ class ha_heap: public handler
int open(const char *name, int mode, uint test_if_locked);
int close(void);
+ void set_keys_for_scanning(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
int delete_row(const byte * buf);
@@ -82,6 +83,9 @@ class ha_heap: public handler
int extra(enum ha_extra_function operation);
int external_lock(THD *thd, int lock_type);
int delete_all_rows(void);
+ int disable_indexes(uint mode);
+ int enable_indexes(uint mode);
+ int indexes_are_disabled(void);
ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
enum ha_rkey_function start_search_flag,
const byte *end_key,uint end_key_len,
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index b9d6cec38aa..1b24633953d 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -810,47 +810,146 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
}
}
+
/*
- disable indexes, making it persistent if requested
+ Disable indexes, making it persistent if requested.
+
SYNOPSIS
- disable_indexes(all, save)
- all disable all indexes
- if not set only non-unique indexes will be disabled
- [all=1 is NOT IMPLEMENTED YET]
- save save the disabled state, so that it will persist
- between queries/threads/reboots
- [save=0 is NOT IMPLEMENTED YET]
+ disable_indexes()
+ mode mode of operation:
+ HA_KEY_SWITCH_NONUNIQ disable all non-unique keys
+ HA_KEY_SWITCH_ALL disable all keys
+ HA_KEY_SWITCH_NONUNIQ_SAVE dis. non-uni. and make persistent
+ HA_KEY_SWITCH_ALL_SAVE dis. all keys and make persistent
+
+ IMPLEMENTATION
+ HA_KEY_SWITCH_NONUNIQ is not implemented.
+ HA_KEY_SWITCH_ALL_SAVE is not implemented.
+
+ RETURN
+ 0 ok
+ HA_ERR_WRONG_COMMAND mode not implemented.
*/
-int ha_myisam::disable_indexes(bool all, bool save)
+
+int ha_myisam::disable_indexes(uint mode)
{
- mi_extra(file, HA_EXTRA_NO_KEYS, 0);
- info(HA_STATUS_CONST); // Read new key info
- return 0;
+ int error;
+
+ if (mode == HA_KEY_SWITCH_ALL)
+ {
+ /* call a storage engine function to switch the key map */
+ error= mi_disable_indexes(file);
+ }
+ else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
+ {
+ mi_extra(file, HA_EXTRA_NO_KEYS, 0);
+ info(HA_STATUS_CONST); // Read new key info
+ error= 0;
+ }
+ else
+ {
+ /* mode not implemented */
+ error= HA_ERR_WRONG_COMMAND;
+ }
+ return error;
}
-int ha_myisam::enable_indexes()
+
+/*
+ Enable indexes, making it persistent if requested.
+
+ SYNOPSIS
+ enable_indexes()
+ mode mode of operation:
+ HA_KEY_SWITCH_NONUNIQ enable all non-unique keys
+ HA_KEY_SWITCH_ALL enable all keys
+ HA_KEY_SWITCH_NONUNIQ_SAVE en. non-uni. and make persistent
+ HA_KEY_SWITCH_ALL_SAVE en. all keys and make persistent
+
+ DESCRIPTION
+ Enable indexes, which might have been disabled by disable_index() before.
+ The modes without _SAVE work only if both data and indexes are empty,
+ since the MyISAM repair would enable them persistently.
+ To be sure in these cases, call handler::delete_all_rows() before.
+
+ IMPLEMENTATION
+ HA_KEY_SWITCH_NONUNIQ is not implemented.
+ HA_KEY_SWITCH_ALL_SAVE is not implemented.
+
+ RETURN
+ 0 ok
+ !=0 Error, among others:
+ HA_ERR_CRASHED data or index is non-empty. Delete all rows and retry.
+ HA_ERR_WRONG_COMMAND mode not implemented.
+*/
+
+int ha_myisam::enable_indexes(uint mode)
{
+ int error;
+
if (file->s->state.key_map == set_bits(ulonglong, file->s->base.keys))
+ {
+ /* All indexes are enabled already. */
return 0;
+ }
- int error=0;
- THD *thd=current_thd;
- MI_CHECK param;
- const char *save_proc_info=thd->proc_info;
- thd->proc_info="Creating index";
- myisamchk_init(&param);
- param.op_name = (char*) "recreating_index";
- param.testflag = (T_SILENT | T_REP_BY_SORT | T_QUICK |
- T_CREATE_MISSING_KEYS);
- param.myf_rw&= ~MY_WAIT_IF_FULL;
- param.sort_buffer_length= thd->variables.myisam_sort_buff_size;
- param.tmpdir=&mysql_tmpdir_list;
- error=repair(thd,param,0) != HA_ADMIN_OK;
- info(HA_STATUS_CONST);
- thd->proc_info=save_proc_info;
+ if (mode == HA_KEY_SWITCH_ALL)
+ {
+ error= mi_enable_indexes(file);
+ /*
+ Do not try to repair on error,
+ as this could make the enabled state persistent,
+ but mode==HA_KEY_SWITCH_ALL forbids it.
+ */
+ }
+ else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
+ {
+ THD *thd=current_thd;
+ MI_CHECK param;
+ const char *save_proc_info=thd->proc_info;
+ thd->proc_info="Creating index";
+ myisamchk_init(&param);
+ param.op_name = (char*) "recreating_index";
+ param.testflag = (T_SILENT | T_REP_BY_SORT | T_QUICK |
+ T_CREATE_MISSING_KEYS);
+ param.myf_rw&= ~MY_WAIT_IF_FULL;
+ param.sort_buffer_length= thd->variables.myisam_sort_buff_size;
+ param.tmpdir=&mysql_tmpdir_list;
+ error=repair(thd,param,0) != HA_ADMIN_OK;
+ info(HA_STATUS_CONST);
+ thd->proc_info=save_proc_info;
+ }
+ else
+ {
+ /* mode not implemented */
+ error= HA_ERR_WRONG_COMMAND;
+ }
return error;
}
+
+/*
+ Test if indexes are disabled.
+
+
+ SYNOPSIS
+ indexes_are_disabled()
+ no parameters
+
+
+ RETURN
+ 0 indexes are not disabled
+ 1 all indexes are disabled
+ [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+*/
+
+int ha_myisam::indexes_are_disabled(void)
+{
+
+ return mi_indexes_are_disabled(file);
+}
+
+
/*
prepare for a many-rows insert operation
e.g. - disable indexes (if they can be recreated fast) or
@@ -898,7 +997,8 @@ int ha_myisam::end_bulk_insert()
{
mi_end_bulk_insert(file);
int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0);
- return err ? err : can_enable_indexes ? enable_indexes() : 0;
+ return err ? err : can_enable_indexes ?
+ enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE) : 0;
}
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index ca318b02778..206a1c62a2f 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -105,8 +105,9 @@ class ha_myisam: public handler
int extra_opt(enum ha_extra_function operation, ulong cache_size);
int external_lock(THD *thd, int lock_type);
int delete_all_rows(void);
- int disable_indexes(bool all, bool save);
- int enable_indexes();
+ int disable_indexes(uint mode);
+ int enable_indexes(uint mode);
+ int indexes_are_disabled(void);
void start_bulk_insert(ha_rows rows);
int end_bulk_insert();
ha_rows records_in_range(int inx,
diff --git a/sql/handler.h b/sql/handler.h
index 27ef0e263b6..4f721a01412 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -91,6 +91,13 @@
#define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */
+/* operations for disable/enable indexes */
+#define HA_KEY_SWITCH_NONUNIQ 0
+#define HA_KEY_SWITCH_ALL 1
+#define HA_KEY_SWITCH_NONUNIQ_SAVE 2
+#define HA_KEY_SWITCH_ALL_SAVE 3
+
+
/*
Bits in index_ddl_flags(KEY *wanted_index)
for what ddl you can do with index
@@ -373,8 +380,9 @@ public:
*/
virtual int restore(THD* thd, HA_CHECK_OPT* check_opt);
virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; }
- virtual int disable_indexes(bool all, bool save) { return HA_ERR_WRONG_COMMAND; }
- virtual int enable_indexes() { return HA_ERR_WRONG_COMMAND; }
+ virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
+ virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
+ virtual int indexes_are_disabled(void) {return 0;}
virtual void start_bulk_insert(ha_rows rows) {}
virtual int end_bulk_insert() {return 0; }
virtual int discard_or_import_tablespace(my_bool discard) {return -1;}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index afbf0b7163e..446d72ac143 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -221,6 +221,7 @@ void Item_bool_func2::fix_length_and_dec()
{
conv= new Item_func_conv_charset(args[weak],args[strong]->collation.collation);
conv->collation.set(args[weak]->collation.derivation);
+ conv->fix_fields(current_thd, 0, &conv);
}
args[weak]= conv ? conv : args[weak];
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index d7e778171a0..aaea676fee1 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2376,7 +2376,10 @@ longlong user_var_entry::val_int(my_bool *null_value)
case INT_RESULT:
return *(longlong*) value;
case STRING_RESULT:
- return strtoull(value,NULL,10); // String is null terminated
+ {
+ int error;
+ return my_strtoll10(value, (char**) 0, &error);// String is null terminated
+ }
case ROW_RESULT:
DBUG_ASSERT(1); // Impossible
break;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 2d10be62d53..4503c1b63a9 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -56,10 +56,24 @@ void Item_subselect::init(st_select_lex *select_lex,
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
unit= select_lex->master_unit();
- if (select_lex->next_select())
- engine= new subselect_union_engine(unit, result, this);
+ if (unit->item)
+ {
+ /*
+ Item can be changed in JOIN::prepare while engine in JOIN::optimize
+ => we do not copy old_engine here
+ */
+ engine= unit->item->engine;
+ unit->item->engine= 0;
+ unit->item= this;
+ engine->change_item(this, result);
+ }
else
- engine= new subselect_single_select_engine(select_lex, result, this);
+ {
+ if (select_lex->next_select())
+ engine= new subselect_union_engine(unit, result, this);
+ else
+ engine= new subselect_single_select_engine(select_lex, result, this);
+ }
DBUG_VOID_RETURN;
}
@@ -69,11 +83,13 @@ void Item_subselect::cleanup()
Item_result_field::cleanup();
if (old_engine)
{
- engine->cleanup();
+ if (engine)
+ engine->cleanup();
engine= old_engine;
old_engine= 0;
}
- engine->cleanup();
+ if (engine)
+ engine->cleanup();
reset();
value_assigned= 0;
DBUG_VOID_RETURN;
@@ -127,7 +143,6 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (have_to_be_excluded)
engine->exclude();
substitution= 0;
- fixed= 1;
thd->where= "checking transformed subquery";
if (!(*ref)->fixed)
ret= (*ref)->fix_fields(thd, tables, ref);
@@ -660,10 +675,20 @@ Item_in_subselect::single_value_transformer(JOIN *join,
item= new Item_sum_min(*select_lex->ref_pointer_array);
}
*select_lex->ref_pointer_array= item;
- select_lex->item_list.empty();
- select_lex->item_list.push_back(item);
+ {
+ List_iterator<Item> it(select_lex->item_list);
+ it++;
+ it.replace(item);
+ }
- // fix_fields call for 'item' will be made during new subquery fix_fields
+ /*
+ Item_sum_(max|min) can't substitute other item => we can use 0 as
+ reference
+ */
+ if (item->fix_fields(thd, join->tables_list, 0))
+ goto err;
+ /* we added aggregate function => we have to change statistic */
+ count_field_types(&join->tmp_table_param, join->all_fields, 0);
subs= new Item_singlerow_subselect(select_lex);
}
@@ -1428,3 +1453,67 @@ void subselect_indexsubquery_engine::print(String *str)
}
str->append(')');
}
+
+/*
+ change select_result object of engine
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ 0 OK
+ -1 error
+*/
+
+int subselect_single_select_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ item= si;
+ result= res;
+ return select_lex->join->change_result(result);
+}
+
+
+/*
+ change select_result object of engine
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ 0 OK
+ -1 error
+*/
+
+int subselect_union_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ item= si;
+ int rc= unit->change_result(res, result);
+ result= res;
+ return rc;
+}
+
+
+/*
+ change select_result emulation, never should be called
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ -1 error
+*/
+
+int subselect_uniquesubquery_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ DBUG_ASSERT(0);
+ return -1;
+}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 6d8f5353695..364781de362 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -290,6 +290,7 @@ public:
virtual table_map upper_select_const_tables()= 0;
static table_map calc_const_tables(TABLE_LIST *);
virtual void print(String *str)= 0;
+ virtual int change_item(Item_subselect *si, select_subselect *result)= 0;
};
@@ -313,6 +314,7 @@ public:
void exclude();
table_map upper_select_const_tables();
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
@@ -332,6 +334,7 @@ public:
void exclude();
table_map upper_select_const_tables();
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
@@ -360,6 +363,7 @@ public:
void exclude();
table_map upper_select_const_tables() { return 0; }
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index eac8d31b256..0c5b29fc069 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -502,6 +502,14 @@ void Item_sum_variance::update_field()
/* min & max */
+void Item_sum_hybrid::clear()
+{
+ sum= 0.0;
+ sum_int= 0;
+ value.length(0);
+ null_value= 1;
+}
+
double Item_sum_hybrid::val()
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 4cded41a9f6..ef947900fd2 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -415,13 +415,7 @@ class Item_sum_hybrid :public Item_sum
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
- void clear()
- {
- sum=0.0;
- sum_int=0;
- value.length(0);
- null_value=1;
- }
+ void clear();
double val();
longlong val_int();
void reset_field();
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index f254ffb3df3..2a5381ae478 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -915,12 +915,14 @@ int load_master_data(THD* thd)
setting active_mi, because init_master_info() sets active_mi with
defaults.
*/
+ int error;
+
if (init_master_info(active_mi, master_info_file, relay_log_info_file,
0))
send_error(thd, ER_MASTER_INFO);
strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name));
- active_mi->master_log_pos = strtoull(row[1], (char**) 0, 10);
+ active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error);
/* at least in recent versions, the condition below should be false */
if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE)
active_mi->master_log_pos = BIN_LOG_HEADER_SIZE;
diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml
index bb4b6bd24af..44eb6f386d4 100644
--- a/sql/share/charsets/Index.xml
+++ b/sql/share/charsets/Index.xml
@@ -36,7 +36,7 @@ To make maintaining easier please:
<alias>iso_8859-2</alias>
<alias>iso_8859-2:1987</alias>
<alias>l2</alias>
- <collation name="latin2_czech_ci" id="2" order="Czech" flag="compiled"/>
+ <collation name="latin2_czech_cs" id="2" order="Czech" flag="compiled"/>
<collation name="latin2_general_ci" id="9" flag="primary">
<order>Hungarian</order>
<order>Polish</order>
@@ -349,7 +349,7 @@ To make maintaining easier please:
<order>Slovenian</order>
<order>Sorbian</order>
</collation>
- <collation name="cp1250_czech_ci" id="34" order="Czech">
+ <collation name="cp1250_czech_cs" id="34" order="Czech">
<flag>compiled</flag>
</collation>
<collation name="cp1250_bin" id="66" order="Binary" flag="binary"/>
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index b2d030b523d..880b6eb74ee 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1918,7 +1918,8 @@ static int replace_column_table(GRANT_TABLE *g_t,
ulong privileges = xx->rights;
bool old_row_exists=0;
key_restore(table,key,0,key_length);
- table->field[4]->store(xx->column.ptr(),xx->column.length(),&my_charset_latin1);
+ table->field[4]->store(xx->column.ptr(),xx->column.length(),
+ &my_charset_latin1);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,
0, HA_READ_KEY_EXACT))
@@ -1931,9 +1932,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
continue; /* purecov: inspected */
}
old_row_exists = 0;
- restore_record(table,default_values); // Get empty record
+ restore_record(table,default_values); // Get empty record
key_restore(table,key,0,key_length);
- table->field[4]->store(xx->column.ptr(),xx->column.length(), &my_charset_latin1);
+ table->field[4]->store(xx->column.ptr(),xx->column.length(),
+ &my_charset_latin1);
}
else
{
@@ -3062,7 +3064,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* Add first global access grants */
{
- String global(buff,sizeof(buff),&my_charset_latin1);
+ String global(buff,sizeof(buff),system_charset_info);
global.length(0);
global.append("GRANT ",6);
@@ -3087,7 +3089,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
global.append (" ON *.* TO '",12);
- global.append(lex_user->user.str,lex_user->user.length);
+ global.append(lex_user->user.str, lex_user->user.length,
+ system_charset_info);
global.append ("'@'",3);
global.append(lex_user->host.str,lex_user->host.length);
global.append ('\'');
@@ -3175,7 +3178,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
want_access=acl_db->access;
if (want_access)
{
- String db(buff,sizeof(buff),&my_charset_latin1);
+ String db(buff,sizeof(buff),system_charset_info);
db.length(0);
db.append("GRANT ",6);
@@ -3201,7 +3204,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
db.append (" ON ",4);
append_identifier(thd, &db, acl_db->db, strlen(acl_db->db));
db.append (".* TO '",7);
- db.append(lex_user->user.str,lex_user->user.length);
+ db.append(lex_user->user.str, lex_user->user.length,
+ system_charset_info);
db.append ("'@'",3);
db.append(lex_user->host.str, lex_user->host.length);
db.append ('\'');
@@ -3235,7 +3239,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
ulong table_access= grant_table->privs;
if ((table_access | grant_table->cols) != 0)
{
- String global(buff,sizeof(buff),&my_charset_latin1);
+ String global(buff, sizeof(buff), system_charset_info);
ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL;
global.length(0);
@@ -3289,7 +3293,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
else
global.append(", ",2);
global.append(grant_column->column,
- grant_column->key_length);
+ grant_column->key_length,
+ system_charset_info);
}
}
if (found_col)
@@ -3305,7 +3310,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
append_identifier(thd, &global, grant_table->tname,
strlen(grant_table->tname));
global.append(" TO '",5);
- global.append(lex_user->user.str,lex_user->user.length);
+ global.append(lex_user->user.str, lex_user->user.length,
+ system_charset_info);
global.append("'@'",3);
global.append(lex_user->host.str,lex_user->host.length);
global.append('\'');
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 3c9563165fe..68f7d45e81c 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -187,7 +187,9 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
}
if (str == end && info->integers)
{
- info->ullval = (ulonglong) strtoull(begin ,NULL, 10);
+ char *endpos= (char*) end;
+ int error;
+ info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
if (info->integers == 1)
return 0; // a single number can't be zerofill
info->maybe_zerofill = 1;
@@ -199,7 +201,9 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
return 0;
if ((str + 1) == end) // number was something like '123[.eE]'
{
- info->ullval = (ulonglong) strtoull(begin, NULL, 10);
+ char *endpos= (char*) str;
+ int error;
+ info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
return 1;
}
if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
@@ -218,7 +222,9 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end
if (str == end) // number was something like '123.000'
{
- info->ullval = (ulonglong) strtoull(begin, NULL, 10);
+ char *endpos= (char*) str;
+ int error;
+ info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
return 1;
}
for (; str != end && my_isdigit(system_charset_info,*str); str++)
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index bf2dbb3fc5c..d50631e29c3 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -78,6 +78,79 @@ extern "C" void free_user_var(user_var_entry *entry)
my_free((char*) entry,MYF(0));
}
+bool key_part_spec::operator==(const key_part_spec& other) const
+{
+ return length == other.length && !strcmp(field_name, other.field_name);
+}
+
+
+/*
+ Test if a foreign key is a prefix of the given key
+ (ignoring key name, key type and order of columns)
+
+ NOTES:
+ This is only used to test if an index for a FOREIGN KEY exists
+
+ IMPLEMENTATION
+ We only compare field names
+
+ RETURN
+ 0 Generated key is a prefix of other key
+ 1 Not equal
+*/
+
+bool foreign_key_prefix(Key *a, Key *b)
+{
+ /* Ensure that 'a' is the generated key */
+ if (a->generated)
+ {
+ if (b->generated && a->columns.elements > b->columns.elements)
+ swap(Key*, a, b); // Put shorter key in 'a'
+ }
+ else
+ {
+ if (!b->generated)
+ return TRUE; // No foreign key
+ swap(Key*, a, b); // Put generated key in 'a'
+ }
+
+ /* Test if 'a' is a prefix of 'b' */
+ if (a->columns.elements > b->columns.elements)
+ return TRUE; // Can't be prefix
+
+ List_iterator<key_part_spec> col_it1(a->columns);
+ List_iterator<key_part_spec> col_it2(b->columns);
+ const key_part_spec *col1, *col2;
+
+#ifdef ENABLE_WHEN_INNODB_CAN_HANDLE_SWAPED_FOREIGN_KEY_COLUMNS
+ while ((col1= col_it1++))
+ {
+ bool found= 0;
+ col_it2.rewind();
+ while ((col2= col_it2++))
+ {
+ if (*col1 == *col2)
+ {
+ found= TRUE;
+ break;
+ }
+ }
+ if (!found)
+ return TRUE; // Error
+ }
+ return FALSE; // Is prefix
+#else
+ while ((col1= col_it1++))
+ {
+ col2= col_it2++;
+ if (!(*col1 == *col2))
+ return TRUE;
+ }
+ return FALSE; // Is prefix
+#endif
+}
+
+
/****************************************************************************
** Thread specific functions
****************************************************************************/
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 97baf47a8cb..f208a3f4d73 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -210,6 +210,7 @@ public:
const char *field_name;
uint length;
key_part_spec(const char *name,uint len=0) :field_name(name), length(len) {}
+ bool operator==(const key_part_spec& other) const;
};
@@ -239,12 +240,16 @@ public:
enum ha_key_alg algorithm;
List<key_part_spec> columns;
const char *name;
+ bool generated;
Key(enum Keytype type_par, const char *name_arg, enum ha_key_alg alg_par,
- List<key_part_spec> &cols)
- :type(type_par), algorithm(alg_par), columns(cols), name(name_arg)
+ bool generated_arg, List<key_part_spec> &cols)
+ :type(type_par), algorithm(alg_par), columns(cols), name(name_arg),
+ generated(generated_arg)
{}
~Key() {}
+ /* Equality comparison of keys (ignoring name) */
+ friend bool foreign_key_prefix(Key *a, Key *b);
};
class Table_ident;
@@ -262,7 +267,7 @@ public:
foreign_key(const char *name_arg, List<key_part_spec> &cols,
Table_ident *table, List<key_part_spec> &ref_cols,
uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
- :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, cols),
+ :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, 0, cols),
ref_table(table), ref_columns(cols),
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
match_opt(match_opt_arg)
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5fa8b37285e..1038066f6ef 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1710,6 +1710,7 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables,
st_select_lex::print is in sql_select.h
st_select_lex_unit::prepare, st_select_lex_unit::exec,
- st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism
+ st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism,
+ st_select_lex_unit::change_result
are in sql_union.cc
*/
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 543c58442cd..a525bc485c1 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -372,6 +372,7 @@ public:
void print(String *str);
ulong init_prepare_fake_select_lex(THD *thd);
+ int change_result(select_subselect *result, select_subselect *old_result);
friend void mysql_init_query(THD *thd);
friend int subselect_union_engine::exec();
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fc4ac48690f..65d538e3ac4 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3994,13 +3994,13 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
{
lex->col_list.push_back(new key_part_spec(field_name,0));
lex->key_list.push_back(new Key(Key::PRIMARY, NullS, HA_KEY_ALG_UNDEF,
- lex->col_list));
+ 0, lex->col_list));
lex->col_list.empty();
}
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
{
lex->col_list.push_back(new key_part_spec(field_name,0));
- lex->key_list.push_back(new Key(Key::UNIQUE, NullS, HA_KEY_ALG_UNDEF,
+ lex->key_list.push_back(new Key(Key::UNIQUE, NullS, HA_KEY_ALG_UNDEF, 0,
lex->col_list));
lex->col_list.empty();
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index abe239e7d4d..b847907a1a2 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000-2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -367,7 +367,7 @@ JOIN::prepare(Item ***rref_pointer_array,
{
if (item->with_sum_func)
flag|=1;
- else if (!(flag & 2) && !item->const_item())
+ else if (!(flag & 2) && !item->const_during_execution())
flag|=2;
}
if (flag == 3)
@@ -1585,8 +1585,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (select_lex->linkage != GLOBAL_OPTIONS_TYPE)
{
//here is EXPLAIN of subselect or derived table
- join->result= result;
- if (!join->procedure && result->prepare(join->fields_list, unit))
+ if (join->change_result(result))
{
DBUG_RETURN(-1);
}
@@ -5549,6 +5548,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
goto err2;
if (open_tmp_table(&new_table))
goto err1;
+ if (table->file->indexes_are_disabled())
+ new_table.file->disable_indexes(HA_KEY_SWITCH_ALL);
table->file->index_end();
table->file->rnd_init();
if (table->no_rows)
@@ -9121,7 +9122,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
THD *thd=join->thd;
select_result *result=join->result;
Item *item_null= new Item_null();
- CHARSET_INFO *cs= &my_charset_latin1;
+ CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("select_describe");
DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
(ulong)join->select_lex, join->select_lex->type,
@@ -9188,7 +9189,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
if (tmp1.length())
tmp1.append(',');
- tmp1.append(table->key_info[j].name);
+ tmp1.append(table->key_info[j].name, 0, system_charset_info);
}
}
}
@@ -9207,7 +9208,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
if (tmp2.length())
tmp2.append(',');
- tmp2.append((*ref)->name());
+ tmp2.append((*ref)->name(), 0, system_charset_info);
}
item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(),cs));
}
@@ -9368,21 +9369,21 @@ void st_select_lex::print(THD *thd, String *str)
//options
if (options & SELECT_STRAIGHT_JOIN)
str->append("straight_join ", 14);
- if ((thd->lex->lock_option & TL_READ_HIGH_PRIORITY) &&
+ if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) &&
(this == &thd->lex->select_lex))
str->append("high_priority ", 14);
if (options & SELECT_DISTINCT)
str->append("distinct ", 9);
if (options & SELECT_SMALL_RESULT)
- str->append("small_result ", 13);
+ str->append("sql_small_result ", 17);
if (options & SELECT_BIG_RESULT)
- str->append("big_result ", 11);
+ str->append("sql_big_result ", 15);
if (options & OPTION_BUFFER_RESULT)
- str->append("buffer_result ", 14);
+ str->append("sql_buffer_result ", 18);
if (options & OPTION_FOUND_ROWS)
- str->append("calc_found_rows ", 16);
+ str->append("sql_calc_found_rows ", 20);
if (!thd->lex->safe_to_cache_query)
- str->append("no_cache ", 9);
+ str->append("sql_no_cache ", 13);
if (options & OPTION_TO_QUERY_CACHE)
str->append("cache ", 6);
@@ -9512,3 +9513,27 @@ void st_select_lex::print(THD *thd, String *str)
// PROCEDURE unsupported here
}
+
+
+/*
+ change select_result object of JOIN
+
+ SYNOPSIS
+ JOIN::change_result()
+ res new select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int JOIN::change_result(select_result *res)
+{
+ DBUG_ENTER("JOIN::change_result");
+ result= res;
+ if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
+ {
+ DBUG_RETURN(-1);
+ }
+ DBUG_RETURN(0);
+}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 5a246a477cf..8aca43484d2 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -304,6 +304,7 @@ class JOIN :public Sql_alloc
return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
!group_list);
}
+ int change_result(select_result *result);
};
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 0d0be1b7e10..47574eab666 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (C) 2000-2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -639,12 +639,13 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
/* Create keys */
- List_iterator<Key> key_iterator(keys);
+ List_iterator<Key> key_iterator(keys), key_iterator2(keys);
uint key_parts=0, fk_key_count=0;
- List<Key> keys_in_order; // Add new keys here
bool primary_key=0,unique_key=0;
- Key *key;
+ Key *key, *key2;
uint tmp, key_number;
+ /* special marker for keys to be ignored */
+ static char ignore_key[1];
/* Calculate number of key segements */
*key_count= 0;
@@ -677,7 +678,46 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_TOO_LONG_IDENT, MYF(0), key->name);
DBUG_RETURN(-1);
}
- key_parts+=key->columns.elements;
+ key_iterator2.rewind ();
+ if (key->type != Key::FOREIGN_KEY)
+ {
+ while ((key2 = key_iterator2++) != key)
+ {
+ /*
+ foreign_key_prefix(key, key2) returns 0 if key or key2, or both, is
+ 'generated', and a generated key is a prefix of the other key. Then we
+ do not need the generated shorter key.
+ */
+ if ((key2->type != Key::FOREIGN_KEY && !foreign_key_prefix(key, key2)))
+ {
+ /* TO DO: issue warning message */
+ /* mark that the generated key should be ignored */
+ if (!key2->generated ||
+ (key->generated && key->columns.elements <
+ key2->columns.elements))
+ key->name= ignore_key;
+ else
+ {
+ /*
+ Remove the previous, generated key if it has not yet been
+ removed. Note that if we have several identical generated keys,
+ the last one will remain and others get removed here.
+ */
+ if (key2->name != ignore_key)
+ {
+ key2->name= ignore_key;
+ key_parts-= key2->columns.elements;
+ (*key_count)--;
+ }
+ }
+ break;
+ }
+ }
+ }
+ if (key->name != ignore_key)
+ key_parts+=key->columns.elements;
+ else
+ (*key_count)--;
if (key->name && !tmp_table &&
!my_strcasecmp(system_charset_info,key->name,primary_key_name))
{
@@ -704,16 +744,26 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
uint key_length=0;
key_part_spec *column;
+ if (key->name == ignore_key)
+ {
+ /* ignore redundant keys */
+ do
+ key=key_iterator++;
+ while (key && key->name == ignore_key);
+ if (!key)
+ break;
+ }
+
switch(key->type){
case Key::MULTIPLE:
- key_info->flags = 0;
+ key_info->flags= 0;
break;
case Key::FULLTEXT:
- key_info->flags = HA_FULLTEXT;
+ key_info->flags= HA_FULLTEXT;
break;
case Key::SPATIAL:
#ifdef HAVE_SPATIAL
- key_info->flags = HA_SPATIAL;
+ key_info->flags= HA_SPATIAL;
break;
#else
my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0),
@@ -724,8 +774,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
key_number--; // Skip this key
continue;
default:
- key_info->flags = HA_NOSAME;
+ key_info->flags = HA_NOSAME;
+ break;
}
+ if (key->generated)
+ key_info->flags|= HA_GENERATED_KEY;
key_info->key_parts=(uint8) key->columns.elements;
key_info->key_part=key_part_info;
@@ -749,7 +802,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
*/
/* TODO: Add proper checks if handler supports key_type and algorithm */
- if (key_info->flags == HA_SPATIAL)
+ if (key_info->flags & HA_SPATIAL)
{
if (key_info->key_parts != 1)
{
@@ -2556,14 +2609,14 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID(pthread_mutex_lock(&LOCK_open));
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
VOID(pthread_mutex_unlock(&LOCK_open));
- error= table->file->enable_indexes();
+ error= table->file->enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
/* COND_refresh will be signaled in close_thread_tables() */
break;
case DISABLE:
VOID(pthread_mutex_lock(&LOCK_open));
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
VOID(pthread_mutex_unlock(&LOCK_open));
- error=table->file->disable_indexes(0, 1);
+ error=table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
/* COND_refresh will be signaled in close_thread_tables() */
break;
}
@@ -2799,6 +2852,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
Key::FULLTEXT : Key::MULTIPLE)),
key_name,
key_info->algorithm,
+ test(key_info->flags & HA_GENERATED_KEY),
key_parts));
}
{
@@ -2830,6 +2884,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
db_create_options=table->db_create_options & ~(HA_OPTION_PACK_RECORD);
my_snprintf(tmp_name, sizeof(tmp_name), "%s-%lx_%lx", tmp_file_prefix,
current_pid, thd->thread_id);
+ /* Safety fix for innodb */
+ if (lower_case_table_names)
+ my_casedn_str(system_charset_info, tmp_name);
create_info->db_type=new_db_type;
if (!create_info->comment)
create_info->comment=table->comment;
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 63638b618d9..de3eeec0db0 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -555,3 +555,32 @@ void st_select_lex_unit::reinit_exec_mechanism()
}
#endif
}
+
+
+/*
+ change select_result object of unit
+
+ SYNOPSIS
+ st_select_lex_unit::change_result()
+ result new select_result object
+ old_result old select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int st_select_lex_unit::change_result(select_subselect *result,
+ select_subselect *old_result)
+{
+ int res= 0;
+ for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
+ {
+ if (sl->join && sl->join->result == old_result)
+ if ((res= sl->join->change_result(result)))
+ return (res);
+ }
+ if (fake_select_lex && fake_select_lex->join)
+ res= fake_select_lex->join->change_result(result);
+ return (res);
+}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 7cca990b4c5..6a683a26b01 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1026,7 +1026,7 @@ create:
{
LEX *lex=Lex;
- lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list));
+ lex->key_list.push_back(new Key($2,$4.str, $5, 0, lex->col_list));
lex->col_list.empty();
}
| CREATE DATABASE opt_if_not_exists ident
@@ -1258,25 +1258,29 @@ key_def:
key_type opt_ident key_alg '(' key_list ')'
{
LEX *lex=Lex;
- lex->key_list.push_back(new Key($1,$2, $3, lex->col_list));
+ lex->key_list.push_back(new Key($1,$2, $3, 0, lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */
}
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')'
{
LEX *lex=Lex;
const char *key_name= $3 ? $3:$1;
- lex->key_list.push_back(new Key($2, key_name, $4, lex->col_list));
+ lex->key_list.push_back(new Key($2, key_name, $4, 0,
+ lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */
}
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
{
LEX *lex=Lex;
- lex->key_list.push_back(new foreign_key($4, lex->col_list,
+ lex->key_list.push_back(new foreign_key($4 ? $4:$1, lex->col_list,
$8,
lex->ref_list,
lex->fk_delete_opt,
lex->fk_update_opt,
lex->fk_match_option));
+ lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4 : $1,
+ HA_KEY_ALG_UNDEF, 1,
+ lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */
}
| constraint opt_check_constraint
@@ -3703,18 +3707,20 @@ delete_limit_clause:
};
ULONG_NUM:
- NUM { $$= strtoul($1.str,NULL,10); }
- | LONG_NUM { $$= (ulong) strtoll($1.str,NULL,10); }
- | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); }
- | REAL_NUM { $$= strtoul($1.str,NULL,10); }
- | FLOAT_NUM { $$= strtoul($1.str,NULL,10); };
+ NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ | REAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ | FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
+ ;
ulonglong_num:
- NUM { $$= (ulonglong) strtoul($1.str,NULL,10); }
- | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); }
- | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); }
- | REAL_NUM { $$= strtoull($1.str,NULL,10); }
- | FLOAT_NUM { $$= strtoull($1.str,NULL,10); };
+ NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
+ | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
+ | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
+ | REAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
+ | FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
+ ;
procedure_clause:
/* empty */
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 5094a7c45da..f4350f87153 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -587,7 +587,7 @@ CHARSET_INFO my_charset_latin2_czech_ci =
2,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
"latin2", /* cs name */
- "latin2_czech_ci", /* name */
+ "latin2_czech_cs", /* name */
"", /* comment */
ctype_czech,
to_lower_czech,
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 7a010c3bef8..520fec676b1 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -18,60 +18,6 @@
#include "m_string.h"
#include "m_ctype.h"
-
-static uint16 latin1_uni[256]={
- 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
-0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
-0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
-0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
-0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
-0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
-0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
-0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
-0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
-0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
-0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
-0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
-0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
-0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
-0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
-0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
-0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
-0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
-0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
-0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
-0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
-0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
-0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
-0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
-0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
-0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
-0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
-};
-
-static uchar uni_latin1[]={
-0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
-0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
-0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
-0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
-0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
-0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
-0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
-0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
-0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
-0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
-0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
-0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
-0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
-
static uchar ctype_latin1[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
@@ -149,29 +95,287 @@ static uchar sort_order_latin1[] = {
68, 78, 79, 79, 79, 79, 93,247,216, 85, 85, 85, 89, 89,222,255
};
+/*
+ WL#1494 notes:
+
+ We'll use cp1252 instead of iso-8859-1.
+ cp1252 contains printable characters in the range 0x80-0x9F.
+ In ISO 8859-1, these code points have no associated printable
+ characters. Therefore, by converting from CP1252 to ISO 8859-1,
+ one would lose the euro (for instance). Since most people are
+ unaware of the difference, and since we don't really want a
+ "Windows ANSI" to differ from a "Unix ANSI", we will:
+
+ - continue to pretend the latin1 character set is ISO 8859-1
+ - actually allow the storage of euro etc. so it's actually cp1252
+*/
+
+unsigned short cs_to_uni[256]={
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
+0x20AC,0x0000,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
+0x02C6,0x2030,0x0160,0x2039,0x0152,0x0000,0x017D,0x0000,
+0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
+0x02DC,0x2122,0x0161,0x203A,0x0153,0x0000,0x017E,0x0178,
+0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
+0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
+0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
+0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
+0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
+0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
+0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
+0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
+0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
+0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
+0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
+0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
+};
+unsigned char pl00[256]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
+0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
+0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
+0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
+0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
+0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,
+0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
+0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
+0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,
+0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
+0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,
+0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
+0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,
+0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
+0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,
+0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
+0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
+0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
+0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
+0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
+};
+unsigned char pl01[256]={
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x8C,0x9C,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x8A,0x9A,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x9F,0x00,0x00,0x00,0x00,0x8E,0x9E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x83,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+unsigned char pl02[256]={
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+unsigned char pl20[256]={
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x96,0x97,0x00,0x00,0x00,
+0x91,0x92,0x82,0x00,0x93,0x94,0x84,0x00,
+0x86,0x87,0x95,0x00,0x00,0x00,0x85,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x8B,0x9B,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+unsigned char pl21[256]={
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x99,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+unsigned char *uni_to_cs[256]={
+pl00,pl01,pl02,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+pl20,pl21,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
+};
static
-int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t *wc,
- const unsigned char *str,
- const unsigned char *end)
+int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t *wc,
+ const unsigned char *str,
+ const unsigned char *end __attribute__((unused)))
{
if (str >= end)
return MY_CS_TOOFEW(0);
- return ((wc[0]= latin1_uni[*str]) || (!str[0])) ? 1 : MY_CS_ILSEQ;
+ *wc=cs_to_uni[*str];
+ return (!wc[0] && str[0]) ? MY_CS_ILSEQ : 1;
}
static
-int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)),
- my_wc_t wc,
- unsigned char *str,
- unsigned char *end)
+int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)),
+ my_wc_t wc,
+ unsigned char *str,
+ unsigned char *end __attribute__((unused)))
{
+ unsigned char *pl;
+
if (str >= end)
return MY_CS_TOOSMALL;
-
- return ((wc < 256) && ((str[0]=uni_latin1[wc]) || (!wc))) ? 1 : MY_CS_ILUNI;
+
+ pl= uni_to_cs[(wc>>8) & 0xFF];
+ str[0]= pl ? pl[wc & 0xFF] : '\0';
+ return (!str[0] && wc) ? MY_CS_ILUNI : 1;
}
static MY_CHARSET_HANDLER my_charset_handler=
@@ -212,7 +416,7 @@ CHARSET_INFO my_charset_latin1=
to_lower_latin1,
to_upper_latin1,
sort_order_latin1,
- latin1_uni, /* tab_to_uni */
+ cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
"","",
1, /* strxfrm_multiply */
@@ -489,7 +693,7 @@ CHARSET_INFO my_charset_latin1_german2_ci=
to_lower_latin1,
to_upper_latin1,
sort_order_latin1_de,
- latin1_uni, /* tab_to_uni */
+ cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
"","",
2, /* strxfrm_multiply */
@@ -513,7 +717,7 @@ CHARSET_INFO my_charset_latin1_bin=
to_lower_latin1,
to_upper_latin1,
sort_order_latin1_de,
- latin1_uni, /* tab_to_uni */
+ cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
"",
"",
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 68cd77f96fc..5f413305c88 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4474,6 +4474,11 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
if ((int) wc < 0x80)
{
+ if (wc == 0x5c)
+ {
+ code= 0x815f;
+ goto mb;
+ }
s[0]= (uchar) wc;
return 1;
}
@@ -4486,7 +4491,8 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
s[0]= code;
return 1;
}
-
+
+mb:
if (s+2>e)
return MY_CS_TOOSMALL;
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 8fd4e612713..ed6bb877dc8 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -621,7 +621,7 @@ CHARSET_INFO my_charset_cp1250_czech_ci =
34,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
"cp1250", /* cs name */
- "cp1250_czech_ci", /* name */
+ "cp1250_czech_cs", /* name */
"", /* comment */
ctype_win1250ch,
to_lower_win1250ch,
diff --git a/strings/dump_map.c b/strings/dump_map.c
index f999160d0d4..708d9139f3c 100644
--- a/strings/dump_map.c
+++ b/strings/dump_map.c
@@ -1,13 +1,15 @@
#include <stdio.h>
#include <string.h>
-static void print_short_array(unsigned short *a)
+static void print_short_array(unsigned short *a, size_t width)
{
int i;
printf("{\n");
for (i=0; i<=0xFF; i++)
{
- printf("0x%04X%s%s",(int)a[i],i<0xFF?",":"",(i+1) % 8 ? "" :"\n");
+ const char *fmt= (width==4) ? "0x%04X" : "0x%02X";
+ printf(fmt,(int)a[i]);
+ printf("%s%s",i<0xFF?",":"",(i+1) % 8 ? "" :"\n");
}
printf("};\n");
@@ -41,7 +43,7 @@ int main(void)
}
printf("unsigned short cs_to_uni[256]=");
- print_short_array(touni);
+ print_short_array(touni, 4);
for (i=0;i<=0xFF;i++)
{
@@ -53,7 +55,7 @@ int main(void)
if (fromstat[i])
{
printf("unsigned char pl%02X[256]=",i);
- print_short_array(fromuni+i*256);
+ print_short_array(fromuni+i*256, 2);
}
}
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 6319fbb4d9f..493d0d63de2 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -22,9 +22,9 @@
#define ULONGLONG_MAX (~(ulonglong) 0)
#define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000))
#define INIT_CNT 9
-#define LFACTOR LL(1000000000)
-#define LFACTOR1 LL(10000000000)
-#define LFACTOR2 LL(100000000000)
+#define LFACTOR ULL(1000000000)
+#define LFACTOR1 ULL(10000000000)
+#define LFACTOR2 ULL(100000000000)
static unsigned long lfactor[9]=
{
@@ -113,8 +113,8 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
negative= 1;
if (++s == end)
goto no_conv;
- cutoff= MAX_NEGATIVE_NUMBER / LL(100000000000);
- cutoff2= (MAX_NEGATIVE_NUMBER % LL(100000000000)) / 100;
+ cutoff= MAX_NEGATIVE_NUMBER / LFACTOR2;
+ cutoff2= (MAX_NEGATIVE_NUMBER % LFACTOR2) / 100;
cutoff3= MAX_NEGATIVE_NUMBER % 100;
}
else
@@ -125,8 +125,8 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
if (++s == end)
goto no_conv;
}
- cutoff= ULONGLONG_MAX / LL(100000000000);
- cutoff2= ULONGLONG_MAX % LL(100000000000) / 100;
+ cutoff= ULONGLONG_MAX / LFACTOR2;
+ cutoff2= ULONGLONG_MAX % LFACTOR2 / 100;
cutoff3= ULONGLONG_MAX % 100;
}
@@ -196,15 +196,15 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
goto overflow;
/* Check that we didn't get an overflow with the last digit */
- if (i > cutoff || i == cutoff && (j > cutoff2 || j == cutoff2 &&
- k > cutoff3))
+ if (i > cutoff || (i == cutoff && ((j > cutoff2 || j == cutoff2) &&
+ k > cutoff3)))
goto overflow;
li=i*LFACTOR2+ (ulonglong) j*100 + k;
return (longlong) li;
overflow: /* *endptr is set here */
*error= MY_ERRNO_ERANGE;
- return negative ? LONGLONG_MIN : ULONGLONG_MAX;
+ return negative ? LONGLONG_MIN : (longlong) ULONGLONG_MAX;
end_i:
*endptr= (char*) s;
diff --git a/strings/strings-x86.s b/strings/strings-x86.s
index d316c34febb..30a7517a372 100644
--- a/strings/strings-x86.s
+++ b/strings/strings-x86.s
@@ -43,7 +43,9 @@ bmove_align:
.ba_20: pop %esi
movl %edx,%edi
ret
- .size bmove_align,.end-bmove_align
+
+.bmove_align_end:
+ .size bmove_align,.bmove_align_end-bmove_align
# Move a string from higher to lower
# Arg from_end+1,to_end+1,length
diff --git a/support-files/MacOSX/StartupItem.Description.plist b/support-files/MacOSX/StartupItem.Description.plist
index 1f0023bde0d..e8ceb1ee062 100644
--- a/support-files/MacOSX/StartupItem.Description.plist
+++ b/support-files/MacOSX/StartupItem.Description.plist
@@ -10,6 +10,6 @@
<key>IFPkgDescriptionTitle</key>
<string>MySQL Startup Item</string>
<key>IFPkgDescriptionVersion</key>
- <string>1.0</string>
+ <string>1.1</string>
</dict>
</plist>
diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh
index ba92856df0e..5fdde0d2963 100644
--- a/support-files/my-huge.cnf.sh
+++ b/support-files/my-huge.cnf.sh
@@ -31,6 +31,7 @@ max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
+read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size = 32M
diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh
index ba865a5bfd0..a17ec7b5227 100644
--- a/support-files/my-large.cnf.sh
+++ b/support-files/my-large.cnf.sh
@@ -31,6 +31,7 @@ max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
+read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 16M
diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh
index 4650ed06dc1..d50d0717c17 100644
--- a/support-files/my-medium.cnf.sh
+++ b/support-files/my-medium.cnf.sh
@@ -32,6 +32,8 @@ max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh
index ca26a10a397..2ae62fb48f1 100644
--- a/support-files/my-small.cnf.sh
+++ b/support-files/my-small.cnf.sh
@@ -31,6 +31,8 @@ key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
+read_buffer_size = 256K
+read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
diff --git a/tests/client_test.c b/tests/client_test.c
index d382377fe49..ba70bcd7fa7 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -9453,7 +9453,6 @@ select col1 FROM t1 where col1=2");
myquery(rc);
}
-
/*
This tests for various mysql_send_long_data bugs described in #1664
*/
@@ -9595,6 +9594,51 @@ static void test_bug1664()
myquery(rc);
}
+
+static void test_order_param()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+
+ myheader("test_order_param");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql,"CREATE TABLE t1(a INT, b char(10))");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql,
+ "select sum(a) + 200, 1 from t1 \
+union distinct \
+select sum(a) + 200, 1 from t1 \
+group by b ");
+ check_stmt(stmt);
+
+ mysql_stmt_close(stmt);
+
+ stmt= mysql_simple_prepare(mysql,
+ "select sum(a) + 200, ? from t1 \
+group by b \
+union distinct \
+select sum(a) + 200, 1 from t1 \
+group by b ");
+ check_stmt(stmt);
+
+ stmt= mysql_simple_prepare(mysql,
+ "select sum(a) + 200, ? from t1 \
+union distinct \
+select sum(a) + 200, 1 from t1 \
+group by b ");
+ check_stmt(stmt);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -9877,6 +9921,8 @@ int main(int argc, char **argv)
test_union2(); /* repeatable execution of union (Bug #3577) */
test_bug1664(); /* test for bugs in mysql_stmt_send_long_data()
call (Bug #1664) */
+ test_order_param(); /* ORDER BY with parameters in select list
+ (Bug #3686 */
end_time= time((time_t *)0);
total_time+= difftime(end_time, start_time);