From 85323eda8a5823e4db1fa34dc998684b67e710b5 Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Tue, 28 Dec 2010 19:57:23 +0100 Subject: - Added/updated copyright headers - Removed files specific to compiling on OS/2 - Removed files specific to SCO Unix packaging - Removed "libmysqld/copyright", text is included in documentation - Removed LaTeX headers for NDB Doxygen documentation - Removed obsolete NDB files - Removed "mkisofs" binaries - Removed the "cvs2cl.pl" script - Changed a few GPL texts to use "program" instead of "library" --- BUILD/FINISH.sh | 17 + BUILD/Makefile.am | 4 +- BUILD/SETUP.sh | 17 + BUILD/autorun.sh | 18 + BUILD/check-cpu | 16 + BUILD/cleanup | 15 + BUILD/compile-alpha | 15 + BUILD/compile-alpha-ccc | 15 + BUILD/compile-alpha-cxx | 15 + BUILD/compile-alpha-debug | 15 + BUILD/compile-amd64-debug-max | 16 + BUILD/compile-amd64-gcov | 15 + BUILD/compile-amd64-gprof | 15 + BUILD/compile-amd64-max | 15 + BUILD/compile-amd64-max-sci | 15 + BUILD/compile-darwin-mwcc | 15 + BUILD/compile-dist | 16 + BUILD/compile-hpux11-parisc2-aCC | 15 + BUILD/compile-ia64-debug-max | 15 + BUILD/compile-irix-mips64-mipspro | 15 + BUILD/compile-ndb-autotest | 15 + BUILD/compile-pentium | 15 + BUILD/compile-pentium-cybozu | 15 + BUILD/compile-pentium-debug | 15 + BUILD/compile-pentium-debug-max | 15 + BUILD/compile-pentium-debug-max-no-embedded | 15 + BUILD/compile-pentium-debug-max-no-ndb | 15 + BUILD/compile-pentium-debug-no-bdb | 15 + BUILD/compile-pentium-debug-openssl | 15 + BUILD/compile-pentium-debug-yassl | 15 + BUILD/compile-pentium-gcov | 15 + BUILD/compile-pentium-gprof | 15 + BUILD/compile-pentium-icc | 15 + BUILD/compile-pentium-icc-valgrind-max | 15 + BUILD/compile-pentium-icc-yassl | 15 + BUILD/compile-pentium-max | 15 + BUILD/compile-pentium-myodbc | 15 + BUILD/compile-pentium-mysqlfs-debug | 15 + BUILD/compile-pentium-pgcc | 15 + BUILD/compile-pentium-valgrind-max | 15 + BUILD/compile-pentium64-debug | 15 + BUILD/compile-pentium64-debug-max | 15 + BUILD/compile-pentium64-gcov | 15 + BUILD/compile-pentium64-gprof | 15 + BUILD/compile-pentium64-max-sci | 15 + BUILD/compile-pentium64-valgrind-max | 15 + BUILD/compile-ppc | 15 + BUILD/compile-ppc-debug | 15 + BUILD/compile-ppc-debug-max | 15 + BUILD/compile-ppc-debug-max-no-ndb | 15 + BUILD/compile-ppc-max | 15 + BUILD/compile-sap | 15 + BUILD/compile-sap-debug | 15 + BUILD/compile-solaris-amd64 | 16 + BUILD/compile-solaris-amd64-debug | 16 + BUILD/compile-solaris-amd64-forte | 15 + BUILD/compile-solaris-amd64-forte-debug | 15 + BUILD/compile-solaris-sparc | 15 + BUILD/compile-solaris-sparc-debug | 15 + BUILD/compile-solaris-sparc-forte | 15 + BUILD/compile-solaris-sparc-purify | 15 + BUILD/test-alpha-ccc | 15 + Makefile.am | 4 +- client/completion_hash.h | 4 +- configure.in | 1 - dbug/dbug_add_tags.pl | 15 + extra/yassl/CMakeLists.txt | 2 +- extra/yassl/Makefile.am | 15 + extra/yassl/examples/client/client.cpp | 18 + extra/yassl/examples/echoclient/echoclient.cpp | 18 + extra/yassl/examples/echoserver/echoserver.cpp | 18 + extra/yassl/examples/server/server.cpp | 18 + extra/yassl/include/lock.hpp | 2 +- extra/yassl/include/openssl/crypto.h | 18 + extra/yassl/include/openssl/des.h | 18 + extra/yassl/include/openssl/des_old.h | 18 + extra/yassl/include/openssl/engine.h | 18 + extra/yassl/include/openssl/err.h | 18 + extra/yassl/include/openssl/evp.h | 18 + .../yassl/include/openssl/generate_prefix_files.pl | 16 + extra/yassl/include/openssl/hmac.h | 18 + extra/yassl/include/openssl/lhash.h | 18 + extra/yassl/include/openssl/md4.h | 18 + extra/yassl/include/openssl/md5.h | 18 + extra/yassl/include/openssl/objects.h | 18 + extra/yassl/include/openssl/opensslv.h | 18 + extra/yassl/include/openssl/pem.h | 18 + extra/yassl/include/openssl/pkcs12.h | 18 + extra/yassl/include/openssl/prefix_crypto.h | 18 + extra/yassl/include/openssl/prefix_ssl.h | 18 + extra/yassl/include/openssl/rand.h | 18 + extra/yassl/include/openssl/rsa.h | 18 + extra/yassl/include/openssl/sha.h | 18 + extra/yassl/include/openssl/x509.h | 18 + extra/yassl/include/openssl/x509v3.h | 18 + extra/yassl/src/Makefile.am | 15 + extra/yassl/src/lock.cpp | 2 +- extra/yassl/src/make.bat | 15 + extra/yassl/taocrypt/CMakeLists.txt | 2 +- extra/yassl/taocrypt/Makefile.am | 15 + extra/yassl/taocrypt/benchmark/Makefile.am | 15 + extra/yassl/taocrypt/benchmark/benchmark.cpp | 18 + extra/yassl/taocrypt/benchmark/make.bat | 15 + extra/yassl/taocrypt/src/Makefile.am | 15 + extra/yassl/taocrypt/src/make.bat | 15 + extra/yassl/taocrypt/test/Makefile.am | 15 + extra/yassl/taocrypt/test/make.bat | 15 + extra/yassl/taocrypt/test/memory.cpp | 18 + extra/yassl/taocrypt/test/test.cpp | 18 + extra/yassl/testsuite/Makefile.am | 15 + extra/yassl/testsuite/make.bat | 15 + extra/yassl/testsuite/test.hpp | 18 + extra/yassl/testsuite/testsuite.cpp | 18 + heap/hp_delete.c | 2 +- include/Makefile.am | 6 +- include/config-os2.h | 835 ----- include/my_handler.h | 4 +- include/my_sys.h | 2 +- include/mysql_com.h | 2 +- libmysqld/copyright | 14 - libmysqld/examples/test-run | 15 + man/Makefile.am | 4 +- myisam/ftbench/Ecompare.pl | 15 + myisam/ftbench/Ecreate.pl | 15 + myisam/ftbench/Ereport.pl | 15 + myisam/ftbench/ft-test-run.sh | 17 + myisam/mi_test_all.sh | 18 + myisam/myisampack.c | 4 +- myisam/rt_index.c | 2 +- mysql-test/Makefile.am | 4 +- mysql-test/create-test-result | 17 + mysql-test/fix-result | 17 + mysql-test/lib/mtr_cases.pl | 2 +- mysql-test/lib/mtr_process.pl | 2 +- mysql-test/misc/kill_master.sh | 17 + mysql-test/misc/mysql-test_V1.9.pl | 18 + mysql-test/mysql-stress-test.pl | 18 + mysql-test/mysql-test-run-shell.sh | 18 + mysql-test/mysql-test-run.pl | 17 + mysql-test/ndb/Makefile.am | 14 + mysql-test/ndb/ndb_config_1_node.ini | 17 + mysql-test/ndb/ndb_config_2_node.ini | 17 + mysql-test/ndb/ndb_config_4_node.ini | 17 + mysql-test/purify.supp | 17 + mysql-test/resolve-stack | 18 + mysql-test/valgrind.supp | 17 + mysys/Makefile.am | 5 +- mysys/mf_pack.c | 2 +- mysys/my_lib.c | 4 - mysys/my_os2cond.c | 162 - mysys/my_os2dirsrch.c | 184 - mysys/my_os2dirsrch.h | 88 - mysys/my_os2dlfcn.c | 74 - mysys/my_os2dlfcn.h0 | 39 - mysys/my_os2file64.c | 394 --- mysys/my_os2mutex.c | 83 - mysys/my_os2thread.c | 128 - mysys/my_os2tls.c | 151 - ndb/Makefile.am | 3 +- ndb/config/make-win-dsw.sh | 14 + ndb/config/win-includes | 15 + ndb/config/win-libraries | 15 + ndb/config/win-name | 15 + ndb/config/win-sources | 15 + ndb/docs/Makefile.am | 2 +- ndb/docs/doxygen/Doxyfile.mgmapi | 17 +- ndb/docs/doxygen/Doxyfile.ndb | 15 + ndb/docs/doxygen/Doxyfile.ndbapi | 17 +- ndb/docs/doxygen/Doxyfile.odbc | 15 + ndb/docs/doxygen/header.mgmapi.tex | 44 - ndb/docs/doxygen/header.ndbapi.tex | 44 - ndb/docs/doxygen/postdoxy.pl | 15 + ndb/docs/doxygen/predoxy.pl | 15 + ndb/home/bin/Linuxmkisofs | Bin 503146 -> 0 bytes ndb/home/bin/Solarismkisofs | Bin 634084 -> 0 bytes ndb/home/bin/cvs2cl.pl | 1865 ---------- ndb/home/bin/fix-cvs-root | 15 + ndb/home/bin/import-from-bk.sh | 15 + ndb/home/bin/ndb_deploy | 15 + ndb/home/bin/ndbdoxy.pl | 16 + ndb/home/bin/ngcalc | 15 + ndb/home/bin/parseConfigFile.awk | 15 + ndb/home/bin/setup-test.sh | 15 + ndb/home/bin/signallog2html.lib/signallog2list.awk | 15 + ndb/home/bin/signallog2html.lib/uniq_blocks.awk | 15 + ndb/home/bin/signallog2html.sh | 16 + ndb/home/bin/stripcr | 14 + ndb/home/lib/funcs.sh | 15 + ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs | 15 + ndb/src/cw/cpcc-win32/csharp/Computer.cs | 15 + ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs | 15 + .../cw/cpcc-win32/csharp/ComputerRemoveDialog.cs | 15 + ndb/src/cw/cpcc-win32/csharp/Database.cs | 15 + ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs | 15 + ndb/src/cw/cpcc-win32/csharp/Process.cs | 15 + .../cw/cpcc-win32/csharp/ProcessDefineDialog.cs | 15 + .../cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs | 15 + .../csharp/simpleparser/SimpleCPCParser.cs | 15 + .../cw/cpcc-win32/csharp/socketcomm/SocketComm.cs | 15 + .../cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs | 15 + ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs | 15 + .../cpcc-win32/csharp/telnetclient/telnetClient.cs | 15 + ndb/src/cw/cpcc-win32/vb6/Computer.cls | 20 - ndb/src/cw/cpcc-win32/vb6/Database.cls | 18 - ndb/src/cw/cpcc-win32/vb6/Icon 110.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 231.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 237.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 241.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 242.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 270.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 271.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 273.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 31.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 337.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 338.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/Icon 339.ico | Bin 766 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/MSSCCPRJ.SCC | 5 - ndb/src/cw/cpcc-win32/vb6/Module1.bas | 233 -- ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbp | 49 - ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbw | 13 - ndb/src/cw/cpcc-win32/vb6/Process.cls | 22 - ndb/src/cw/cpcc-win32/vb6/closed folder.ico | Bin 10134 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/computer.ico | Bin 10134 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/frmAbout.frm | 245 -- ndb/src/cw/cpcc-win32/vb6/frmLogin.frm | 119 - ndb/src/cw/cpcc-win32/vb6/frmMain.frm | 1207 ------- ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frm | 124 - ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frx | Bin 4 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/frmNewDatabase.frx | Bin 12 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/frmNewDatabase1.frm | 187 - ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.frm | 136 - ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.log | 1 - ndb/src/cw/cpcc-win32/vb6/frmNewDatabase3.frm | 88 - ndb/src/cw/cpcc-win32/vb6/frmOptions.frm | 231 -- ndb/src/cw/cpcc-win32/vb6/frmSplash.frx | Bin 70450 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/networking.ico | Bin 10134 -> 0 bytes ndb/src/cw/cpcc-win32/vb6/open folder.ico | Bin 10134 -> 0 bytes ndb/src/libndb.ver.in | 15 + ndb/src/old_files/client/Makefile | 9 - ndb/src/old_files/client/odbc/Extra.mk | 59 - ndb/src/old_files/client/odbc/Makefile | 75 - ndb/src/old_files/client/odbc/NdbOdbc.cpp | 78 - ndb/src/old_files/client/odbc/NdbOdbc.def | 85 - ndb/src/old_files/client/odbc/codegen/CodeGen.cpp | 229 -- ndb/src/old_files/client/odbc/codegen/CodeGen.hpp | 69 - .../old_files/client/odbc/codegen/Code_base.cpp | 167 - .../old_files/client/odbc/codegen/Code_base.hpp | 237 -- .../old_files/client/odbc/codegen/Code_column.cpp | 72 - .../old_files/client/odbc/codegen/Code_column.hpp | 122 - .../old_files/client/odbc/codegen/Code_comp_op.cpp | 485 --- .../old_files/client/odbc/codegen/Code_comp_op.hpp | 172 - .../client/odbc/codegen/Code_create_index.cpp | 124 - .../client/odbc/codegen/Code_create_index.hpp | 203 -- .../client/odbc/codegen/Code_create_row.cpp | 162 - .../client/odbc/codegen/Code_create_row.hpp | 99 - .../client/odbc/codegen/Code_create_table.cpp | 137 - .../client/odbc/codegen/Code_create_table.hpp | 178 - .../client/odbc/codegen/Code_data_type.cpp | 44 - .../client/odbc/codegen/Code_data_type.hpp | 49 - ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp | 37 - ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp | 63 - .../client/odbc/codegen/Code_ddl_column.cpp | 104 - .../client/odbc/codegen/Code_ddl_column.hpp | 150 - .../client/odbc/codegen/Code_ddl_constr.cpp | 51 - .../client/odbc/codegen/Code_ddl_constr.hpp | 65 - .../old_files/client/odbc/codegen/Code_ddl_row.cpp | 54 - .../old_files/client/odbc/codegen/Code_ddl_row.hpp | 72 - .../old_files/client/odbc/codegen/Code_delete.cpp | 205 -- .../old_files/client/odbc/codegen/Code_delete.hpp | 69 - .../client/odbc/codegen/Code_delete_index.cpp | 164 - .../client/odbc/codegen/Code_delete_index.hpp | 156 - .../client/odbc/codegen/Code_delete_lookup.cpp | 162 - .../client/odbc/codegen/Code_delete_lookup.hpp | 152 - .../client/odbc/codegen/Code_delete_scan.cpp | 110 - .../client/odbc/codegen/Code_delete_scan.hpp | 130 - ndb/src/old_files/client/odbc/codegen/Code_dml.cpp | 51 - ndb/src/old_files/client/odbc/codegen/Code_dml.hpp | 67 - .../client/odbc/codegen/Code_dml_column.cpp | 47 - .../client/odbc/codegen/Code_dml_column.hpp | 46 - .../old_files/client/odbc/codegen/Code_dml_row.cpp | 56 - .../old_files/client/odbc/codegen/Code_dml_row.hpp | 76 - .../client/odbc/codegen/Code_drop_index.cpp | 87 - .../client/odbc/codegen/Code_drop_index.hpp | 136 - .../client/odbc/codegen/Code_drop_table.cpp | 87 - .../client/odbc/codegen/Code_drop_table.hpp | 124 - .../old_files/client/odbc/codegen/Code_expr.cpp | 79 - .../old_files/client/odbc/codegen/Code_expr.hpp | 219 -- .../client/odbc/codegen/Code_expr_column.cpp | 160 - .../client/odbc/codegen/Code_expr_column.hpp | 120 - .../client/odbc/codegen/Code_expr_const.cpp | 138 - .../client/odbc/codegen/Code_expr_const.hpp | 120 - .../client/odbc/codegen/Code_expr_conv.cpp | 273 -- .../client/odbc/codegen/Code_expr_conv.hpp | 141 - .../client/odbc/codegen/Code_expr_func.cpp | 401 --- .../client/odbc/codegen/Code_expr_func.hpp | 193 - .../old_files/client/odbc/codegen/Code_expr_op.cpp | 424 --- .../old_files/client/odbc/codegen/Code_expr_op.hpp | 166 - .../client/odbc/codegen/Code_expr_param.cpp | 279 -- .../client/odbc/codegen/Code_expr_param.hpp | 136 - .../client/odbc/codegen/Code_expr_row.cpp | 204 -- .../client/odbc/codegen/Code_expr_row.hpp | 272 -- .../client/odbc/codegen/Code_idx_column.cpp | 49 - .../client/odbc/codegen/Code_idx_column.hpp | 50 - .../old_files/client/odbc/codegen/Code_insert.cpp | 253 -- .../old_files/client/odbc/codegen/Code_insert.hpp | 229 -- .../old_files/client/odbc/codegen/Code_pred.cpp | 70 - .../old_files/client/odbc/codegen/Code_pred.hpp | 172 - .../old_files/client/odbc/codegen/Code_pred_op.cpp | 188 - .../old_files/client/odbc/codegen/Code_pred_op.hpp | 158 - .../old_files/client/odbc/codegen/Code_query.cpp | 299 -- .../old_files/client/odbc/codegen/Code_query.hpp | 155 - .../client/odbc/codegen/Code_query_count.cpp | 177 - .../client/odbc/codegen/Code_query_count.hpp | 162 - .../client/odbc/codegen/Code_query_distinct.cpp | 204 -- .../client/odbc/codegen/Code_query_distinct.hpp | 165 - .../client/odbc/codegen/Code_query_filter.cpp | 161 - .../client/odbc/codegen/Code_query_filter.hpp | 162 - .../client/odbc/codegen/Code_query_group.cpp | 301 -- .../client/odbc/codegen/Code_query_group.hpp | 221 -- .../client/odbc/codegen/Code_query_index.cpp | 186 - .../client/odbc/codegen/Code_query_index.hpp | 160 - .../client/odbc/codegen/Code_query_join.cpp | 192 - .../client/odbc/codegen/Code_query_join.hpp | 159 - .../client/odbc/codegen/Code_query_lookup.cpp | 184 - .../client/odbc/codegen/Code_query_lookup.hpp | 155 - .../client/odbc/codegen/Code_query_project.cpp | 184 - .../client/odbc/codegen/Code_query_project.hpp | 178 - .../client/odbc/codegen/Code_query_range.cpp | 211 -- .../client/odbc/codegen/Code_query_range.hpp | 186 - .../client/odbc/codegen/Code_query_repeat.cpp | 109 - .../client/odbc/codegen/Code_query_repeat.hpp | 133 - .../client/odbc/codegen/Code_query_scan.cpp | 177 - .../client/odbc/codegen/Code_query_scan.hpp | 174 - .../client/odbc/codegen/Code_query_sort.cpp | 239 -- .../client/odbc/codegen/Code_query_sort.hpp | 208 -- .../client/odbc/codegen/Code_query_sys.cpp | 130 - .../client/odbc/codegen/Code_query_sys.hpp | 148 - .../old_files/client/odbc/codegen/Code_root.cpp | 307 -- .../old_files/client/odbc/codegen/Code_root.hpp | 162 - .../old_files/client/odbc/codegen/Code_select.cpp | 406 --- .../old_files/client/odbc/codegen/Code_select.hpp | 132 - .../old_files/client/odbc/codegen/Code_set_row.cpp | 44 - .../old_files/client/odbc/codegen/Code_set_row.hpp | 76 - .../old_files/client/odbc/codegen/Code_stmt.cpp | 49 - .../old_files/client/odbc/codegen/Code_stmt.hpp | 76 - .../old_files/client/odbc/codegen/Code_table.cpp | 254 -- .../old_files/client/odbc/codegen/Code_table.hpp | 202 -- .../client/odbc/codegen/Code_table_list.cpp | 53 - .../client/odbc/codegen/Code_table_list.hpp | 73 - .../old_files/client/odbc/codegen/Code_update.cpp | 246 -- .../old_files/client/odbc/codegen/Code_update.hpp | 102 - .../client/odbc/codegen/Code_update_index.cpp | 196 -- .../client/odbc/codegen/Code_update_index.hpp | 171 - .../client/odbc/codegen/Code_update_lookup.cpp | 194 -- .../client/odbc/codegen/Code_update_lookup.hpp | 167 - .../client/odbc/codegen/Code_update_scan.cpp | 146 - .../client/odbc/codegen/Code_update_scan.hpp | 160 - ndb/src/old_files/client/odbc/codegen/Makefile | 104 - .../old_files/client/odbc/codegen/SimpleGram.ypp | 1649 --------- .../old_files/client/odbc/codegen/SimpleParser.cpp | 96 - .../old_files/client/odbc/codegen/SimpleParser.hpp | 161 - .../old_files/client/odbc/codegen/SimpleScan.lpp | 243 -- ndb/src/old_files/client/odbc/common/AttrArea.cpp | 91 - ndb/src/old_files/client/odbc/common/AttrArea.hpp | 135 - ndb/src/old_files/client/odbc/common/CodeTree.cpp | 37 - ndb/src/old_files/client/odbc/common/CodeTree.hpp | 49 - ndb/src/old_files/client/odbc/common/ConnArea.cpp | 109 - ndb/src/old_files/client/odbc/common/ConnArea.hpp | 135 - ndb/src/old_files/client/odbc/common/Ctx.cpp | 355 -- ndb/src/old_files/client/odbc/common/Ctx.hpp | 182 - ndb/src/old_files/client/odbc/common/DataField.cpp | 3023 ---------------- ndb/src/old_files/client/odbc/common/DataField.hpp | 446 --- ndb/src/old_files/client/odbc/common/DataRow.cpp | 140 - ndb/src/old_files/client/odbc/common/DataRow.hpp | 185 - ndb/src/old_files/client/odbc/common/DataType.cpp | 551 --- ndb/src/old_files/client/odbc/common/DataType.hpp | 293 -- ndb/src/old_files/client/odbc/common/DescArea.cpp | 167 - ndb/src/old_files/client/odbc/common/DescArea.hpp | 266 -- ndb/src/old_files/client/odbc/common/DiagArea.cpp | 284 -- ndb/src/old_files/client/odbc/common/DiagArea.hpp | 196 -- ndb/src/old_files/client/odbc/common/Makefile | 29 - ndb/src/old_files/client/odbc/common/OdbcData.cpp | 560 --- ndb/src/old_files/client/odbc/common/OdbcData.hpp | 283 -- .../old_files/client/odbc/common/ResultArea.cpp | 29 - .../old_files/client/odbc/common/ResultArea.hpp | 162 - ndb/src/old_files/client/odbc/common/Sqlstate.cpp | 93 - ndb/src/old_files/client/odbc/common/Sqlstate.hpp | 85 - ndb/src/old_files/client/odbc/common/StmtArea.cpp | 112 - ndb/src/old_files/client/odbc/common/StmtArea.hpp | 157 - ndb/src/old_files/client/odbc/common/StmtInfo.cpp | 78 - ndb/src/old_files/client/odbc/common/StmtInfo.hpp | 86 - ndb/src/old_files/client/odbc/common/common.cpp | 17 - ndb/src/old_files/client/odbc/common/common.hpp | 124 - .../client/odbc/dictionary/DictCatalog.cpp | 42 - .../client/odbc/dictionary/DictCatalog.hpp | 64 - .../client/odbc/dictionary/DictColumn.cpp | 23 - .../client/odbc/dictionary/DictColumn.hpp | 143 - .../old_files/client/odbc/dictionary/DictIndex.cpp | 29 - .../old_files/client/odbc/dictionary/DictIndex.hpp | 108 - .../client/odbc/dictionary/DictSchema.cpp | 155 - .../client/odbc/dictionary/DictSchema.hpp | 89 - .../old_files/client/odbc/dictionary/DictSys.cpp | 433 --- .../old_files/client/odbc/dictionary/DictSys.hpp | 77 - .../old_files/client/odbc/dictionary/DictTable.cpp | 91 - .../old_files/client/odbc/dictionary/DictTable.hpp | 192 - ndb/src/old_files/client/odbc/dictionary/Makefile | 20 - ndb/src/old_files/client/odbc/docs/class.fig | 332 -- ndb/src/old_files/client/odbc/docs/descfield.pl | 1482 -------- ndb/src/old_files/client/odbc/docs/diag.txt | 48 - ndb/src/old_files/client/odbc/docs/getinfo.pl | 3676 -------------------- ndb/src/old_files/client/odbc/docs/gettypeinfo.pl | 645 ---- ndb/src/old_files/client/odbc/docs/handleattr.pl | 2232 ------------ ndb/src/old_files/client/odbc/docs/main.hpp | 104 - ndb/src/old_files/client/odbc/docs/ndbodbc.html | 659 ---- ndb/src/old_files/client/odbc/docs/select.fig | 94 - ndb/src/old_files/client/odbc/docs/systables.pl | 2192 ------------ ndb/src/old_files/client/odbc/docs/type.txt | 333 -- ndb/src/old_files/client/odbc/driver/Func.data | 2822 --------------- ndb/src/old_files/client/odbc/driver/Func.pl | 352 -- ndb/src/old_files/client/odbc/driver/Makefile | 16 - .../client/odbc/driver/SQLAllocConnect.cpp | 52 - .../old_files/client/odbc/driver/SQLAllocEnv.cpp | 46 - .../client/odbc/driver/SQLAllocHandle.cpp | 62 - .../client/odbc/driver/SQLAllocHandleStd.cpp | 56 - .../old_files/client/odbc/driver/SQLAllocStmt.cpp | 52 - .../old_files/client/odbc/driver/SQLBindCol.cpp | 50 - .../old_files/client/odbc/driver/SQLBindParam.cpp | 52 - .../client/odbc/driver/SQLBindParameter.cpp | 54 - .../client/odbc/driver/SQLBrowseConnect.cpp | 61 - .../client/odbc/driver/SQLBulkOperations.cpp | 53 - ndb/src/old_files/client/odbc/driver/SQLCancel.cpp | 45 - .../client/odbc/driver/SQLCloseCursor.cpp | 45 - .../client/odbc/driver/SQLColAttribute.cpp | 51 - .../client/odbc/driver/SQLColAttributes.cpp | 51 - .../client/odbc/driver/SQLColumnPrivileges.cpp | 67 - .../old_files/client/odbc/driver/SQLColumns.cpp | 49 - .../old_files/client/odbc/driver/SQLConnect.cpp | 51 - .../old_files/client/odbc/driver/SQLCopyDesc.cpp | 58 - .../client/odbc/driver/SQLDataSources.cpp | 65 - .../client/odbc/driver/SQLDescribeCol.cpp | 53 - .../client/odbc/driver/SQLDescribeParam.cpp | 50 - .../old_files/client/odbc/driver/SQLDisconnect.cpp | 45 - .../client/odbc/driver/SQLDriverConnect.cpp | 52 - .../old_files/client/odbc/driver/SQLDrivers.cpp | 65 - .../old_files/client/odbc/driver/SQLEndTran.cpp | 70 - ndb/src/old_files/client/odbc/driver/SQLError.cpp | 67 - .../old_files/client/odbc/driver/SQLExecDirect.cpp | 47 - .../old_files/client/odbc/driver/SQLExecute.cpp | 45 - .../client/odbc/driver/SQLExtendedFetch.cpp | 59 - ndb/src/old_files/client/odbc/driver/SQLFetch.cpp | 45 - .../client/odbc/driver/SQLFetchScroll.cpp | 55 - .../client/odbc/driver/SQLForeignKeys.cpp | 75 - .../client/odbc/driver/SQLFreeConnect.cpp | 53 - .../old_files/client/odbc/driver/SQLFreeEnv.cpp | 52 - .../old_files/client/odbc/driver/SQLFreeHandle.cpp | 60 - .../old_files/client/odbc/driver/SQLFreeStmt.cpp | 54 - .../client/odbc/driver/SQLGetConnectAttr.cpp | 49 - .../client/odbc/driver/SQLGetConnectOption.cpp | 47 - .../client/odbc/driver/SQLGetCursorName.cpp | 48 - .../old_files/client/odbc/driver/SQLGetData.cpp | 50 - .../client/odbc/driver/SQLGetDescField.cpp | 50 - .../old_files/client/odbc/driver/SQLGetDescRec.cpp | 55 - .../client/odbc/driver/SQLGetDiagField.cpp | 50 - .../old_files/client/odbc/driver/SQLGetDiagRec.cpp | 51 - .../old_files/client/odbc/driver/SQLGetEnvAttr.cpp | 66 - .../client/odbc/driver/SQLGetFunctions.cpp | 47 - .../old_files/client/odbc/driver/SQLGetInfo.cpp | 49 - .../client/odbc/driver/SQLGetStmtAttr.cpp | 49 - .../client/odbc/driver/SQLGetStmtOption.cpp | 47 - .../client/odbc/driver/SQLGetTypeInfo.cpp | 46 - .../client/odbc/driver/SQLMoreResults.cpp | 42 - .../old_files/client/odbc/driver/SQLNativeSql.cpp | 61 - .../old_files/client/odbc/driver/SQLNumParams.cpp | 46 - .../client/odbc/driver/SQLNumResultCols.cpp | 46 - .../old_files/client/odbc/driver/SQLParamData.cpp | 46 - .../client/odbc/driver/SQLParamOptions.cpp | 55 - .../old_files/client/odbc/driver/SQLPrepare.cpp | 47 - .../client/odbc/driver/SQLPrimaryKeys.cpp | 47 - .../client/odbc/driver/SQLProcedureColumns.cpp | 67 - .../old_files/client/odbc/driver/SQLProcedures.cpp | 63 - .../old_files/client/odbc/driver/SQLPutData.cpp | 47 - .../old_files/client/odbc/driver/SQLRowCount.cpp | 46 - .../client/odbc/driver/SQLSetConnectAttr.cpp | 48 - .../client/odbc/driver/SQLSetConnectOption.cpp | 47 - .../client/odbc/driver/SQLSetCursorName.cpp | 47 - .../client/odbc/driver/SQLSetDescField.cpp | 49 - .../old_files/client/odbc/driver/SQLSetDescRec.cpp | 54 - .../old_files/client/odbc/driver/SQLSetEnvAttr.cpp | 65 - .../old_files/client/odbc/driver/SQLSetParam.cpp | 52 - ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp | 57 - .../client/odbc/driver/SQLSetScrollOptions.cpp | 57 - .../client/odbc/driver/SQLSetStmtAttr.cpp | 48 - .../client/odbc/driver/SQLSetStmtOption.cpp | 47 - .../client/odbc/driver/SQLSpecialColumns.cpp | 69 - .../old_files/client/odbc/driver/SQLStatistics.cpp | 67 - .../client/odbc/driver/SQLTablePrivileges.cpp | 63 - ndb/src/old_files/client/odbc/driver/SQLTables.cpp | 49 - .../old_files/client/odbc/driver/SQLTransact.cpp | 71 - ndb/src/old_files/client/odbc/driver/driver.cpp | 150 - ndb/src/old_files/client/odbc/driver/driver.hpp | 28 - .../client/odbc/executor/Exec_comp_op.cpp | 518 --- .../client/odbc/executor/Exec_create_index.cpp | 46 - .../client/odbc/executor/Exec_create_table.cpp | 83 - .../client/odbc/executor/Exec_delete_index.cpp | 82 - .../client/odbc/executor/Exec_delete_lookup.cpp | 82 - .../client/odbc/executor/Exec_delete_scan.cpp | 54 - .../client/odbc/executor/Exec_drop_index.cpp | 38 - .../client/odbc/executor/Exec_drop_table.cpp | 38 - .../client/odbc/executor/Exec_expr_conv.cpp | 54 - .../client/odbc/executor/Exec_expr_func.cpp | 284 -- .../client/odbc/executor/Exec_expr_op.cpp | 147 - .../old_files/client/odbc/executor/Exec_insert.cpp | 144 - .../client/odbc/executor/Exec_pred_op.cpp | 197 -- .../client/odbc/executor/Exec_query_index.cpp | 136 - .../client/odbc/executor/Exec_query_lookup.cpp | 136 - .../client/odbc/executor/Exec_query_range.cpp | 143 - .../client/odbc/executor/Exec_query_scan.cpp | 130 - .../client/odbc/executor/Exec_query_sys.cpp | 761 ---- .../client/odbc/executor/Exec_update_index.cpp | 96 - .../client/odbc/executor/Exec_update_lookup.cpp | 96 - .../client/odbc/executor/Exec_update_scan.cpp | 61 - .../old_files/client/odbc/executor/Executor.cpp | 68 - .../old_files/client/odbc/executor/Executor.hpp | 52 - ndb/src/old_files/client/odbc/executor/Makefile | 36 - ndb/src/old_files/client/odbc/handles/AttrDbc.cpp | 473 --- ndb/src/old_files/client/odbc/handles/AttrEnv.cpp | 123 - ndb/src/old_files/client/odbc/handles/AttrRoot.cpp | 92 - ndb/src/old_files/client/odbc/handles/AttrStmt.cpp | 1005 ------ ndb/src/old_files/client/odbc/handles/DescSpec.cpp | 1140 ------ ndb/src/old_files/client/odbc/handles/FuncTab.cpp | 100 - .../old_files/client/odbc/handles/HandleBase.cpp | 162 - .../old_files/client/odbc/handles/HandleBase.hpp | 67 - .../old_files/client/odbc/handles/HandleDbc.cpp | 419 --- .../old_files/client/odbc/handles/HandleDbc.hpp | 111 - .../old_files/client/odbc/handles/HandleDesc.cpp | 254 -- .../old_files/client/odbc/handles/HandleDesc.hpp | 89 - .../old_files/client/odbc/handles/HandleEnv.cpp | 144 - .../old_files/client/odbc/handles/HandleEnv.hpp | 77 - .../old_files/client/odbc/handles/HandleRoot.cpp | 271 -- .../old_files/client/odbc/handles/HandleRoot.hpp | 103 - .../old_files/client/odbc/handles/HandleStmt.cpp | 823 ----- .../old_files/client/odbc/handles/HandleStmt.hpp | 117 - ndb/src/old_files/client/odbc/handles/InfoTab.cpp | 878 ----- ndb/src/old_files/client/odbc/handles/Makefile | 28 - ndb/src/old_files/client/odbc/handles/PoolNdb.cpp | 81 - ndb/src/old_files/client/odbc/handles/PoolNdb.hpp | 44 - ndb/src/old_files/client/odbc/handles/handles.hpp | 28 - ndb/src/old_files/ndbbaseclient/Makefile | 29 - .../ndbbaseclient/ndbbaseclient_dummy.cpp | 0 ndb/src/old_files/ndbclient/Makefile | 37 - ndb/src/old_files/ndbclient/ndbclient_dummy.cpp | 0 ndb/src/old_files/newtonapi/Makefile | 27 - ndb/src/old_files/newtonapi/dba_binding.cpp | 439 --- ndb/src/old_files/newtonapi/dba_bulkread.cpp | 267 -- ndb/src/old_files/newtonapi/dba_config.cpp | 115 - ndb/src/old_files/newtonapi/dba_dac.cpp | 842 ----- ndb/src/old_files/newtonapi/dba_error.cpp | 118 - ndb/src/old_files/newtonapi/dba_init.cpp | 86 - ndb/src/old_files/newtonapi/dba_internal.hpp | 122 - ndb/src/old_files/newtonapi/dba_process.cpp | 123 - ndb/src/old_files/newtonapi/dba_process.hpp | 56 - ndb/src/old_files/newtonapi/dba_schema.cpp | 150 - ndb/src/old_files/rep/ExtSender.cpp | 149 - ndb/src/old_files/rep/ExtSender.hpp | 76 - ndb/src/old_files/rep/Makefile | 28 - ndb/src/old_files/rep/NodeConnectInfo.hpp | 29 - ndb/src/old_files/rep/README | 147 - ndb/src/old_files/rep/RepApiInterpreter.cpp | 80 - ndb/src/old_files/rep/RepApiInterpreter.hpp | 54 - ndb/src/old_files/rep/RepApiService.cpp | 318 -- ndb/src/old_files/rep/RepApiService.hpp | 59 - ndb/src/old_files/rep/RepCommandInterpreter.cpp | 456 --- ndb/src/old_files/rep/RepCommandInterpreter.hpp | 45 - ndb/src/old_files/rep/RepComponents.cpp | 138 - ndb/src/old_files/rep/RepComponents.hpp | 60 - ndb/src/old_files/rep/RepMain.cpp | 97 - ndb/src/old_files/rep/Requestor.cpp | 224 -- ndb/src/old_files/rep/Requestor.hpp | 154 - ndb/src/old_files/rep/RequestorSubscriptions.cpp | 60 - ndb/src/old_files/rep/SignalQueue.cpp | 106 - ndb/src/old_files/rep/SignalQueue.hpp | 117 - ndb/src/old_files/rep/TODO | 119 - ndb/src/old_files/rep/adapters/AppNDB.cpp | 583 ---- ndb/src/old_files/rep/adapters/AppNDB.hpp | 141 - ndb/src/old_files/rep/adapters/ExtAPI.cpp | 31 - ndb/src/old_files/rep/adapters/ExtAPI.hpp | 107 - ndb/src/old_files/rep/adapters/ExtNDB.cpp | 559 --- ndb/src/old_files/rep/adapters/ExtNDB.hpp | 118 - ndb/src/old_files/rep/adapters/Makefile | 11 - ndb/src/old_files/rep/adapters/TableInfoPs.hpp | 118 - ndb/src/old_files/rep/dbug_hack.cpp | 75 - ndb/src/old_files/rep/rep_version.hpp | 88 - ndb/src/old_files/rep/repapi/Makefile | 25 - ndb/src/old_files/rep/repapi/repapi.cpp | 598 ---- ndb/src/old_files/rep/repapi/repapi.h | 216 -- ndb/src/old_files/rep/state/Channel.cpp | 487 --- ndb/src/old_files/rep/state/Channel.hpp | 206 -- ndb/src/old_files/rep/state/Interval.cpp | 171 - ndb/src/old_files/rep/state/Interval.hpp | 107 - ndb/src/old_files/rep/state/Makefile | 17 - ndb/src/old_files/rep/state/RepState.cpp | 869 ----- ndb/src/old_files/rep/state/RepState.hpp | 276 -- ndb/src/old_files/rep/state/RepStateEvent.cpp | 284 -- ndb/src/old_files/rep/state/RepStateRequests.cpp | 294 -- ndb/src/old_files/rep/state/testInterval/Makefile | 12 - .../rep/state/testInterval/testInterval.cpp | 127 - ndb/src/old_files/rep/state/testRepState/Makefile | 15 - .../rep/state/testRepState/testRequestor.cpp | 166 - .../rep/state/testRepState/testRequestor.hpp | 24 - ndb/src/old_files/rep/storage/GCIBuffer.cpp | 173 - ndb/src/old_files/rep/storage/GCIBuffer.hpp | 112 - ndb/src/old_files/rep/storage/GCIContainer.cpp | 272 -- ndb/src/old_files/rep/storage/GCIContainer.hpp | 121 - ndb/src/old_files/rep/storage/GCIContainerPS.cpp | 128 - ndb/src/old_files/rep/storage/GCIContainerPS.hpp | 90 - ndb/src/old_files/rep/storage/GCIPage.cpp | 165 - ndb/src/old_files/rep/storage/GCIPage.hpp | 114 - ndb/src/old_files/rep/storage/LogRecord.hpp | 81 - ndb/src/old_files/rep/storage/Makefile | 14 - ndb/src/old_files/rep/storage/NodeConnectInfo.hpp | 29 - ndb/src/old_files/rep/storage/NodeGroup.cpp | 149 - ndb/src/old_files/rep/storage/NodeGroup.hpp | 109 - ndb/src/old_files/rep/storage/NodeGroupInfo.cpp | 218 -- ndb/src/old_files/rep/storage/NodeGroupInfo.hpp | 145 - ndb/src/old_files/rep/transfer/Makefile | 11 - ndb/src/old_files/rep/transfer/TransPS.cpp | 553 --- ndb/src/old_files/rep/transfer/TransPS.hpp | 136 - ndb/src/old_files/rep/transfer/TransSS.cpp | 653 ---- ndb/src/old_files/rep/transfer/TransSS.hpp | 145 - .../rep/transfer/TransSSSubscriptions.cpp | 193 - ndb/test/ndbapi/old_dirs/acid/Makefile | 10 - ndb/test/ndbapi/old_dirs/acid2/Makefile | 10 - ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp | 131 - ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp | 465 --- ndb/test/ndbapi/old_dirs/basicAsynch/Makefile | 9 - ndb/test/ndbapi/old_dirs/bulk_copy/Makefile | 9 - ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile | 11 - ndb/test/ndbapi/old_dirs/create_tab/Makefile | 11 - ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile | 11 - ndb/test/ndbapi/old_dirs/flexAsynch/Makefile | 11 - ndb/test/ndbapi/old_dirs/flexBench/Makefile.am | 10 - ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl | 305 -- ndb/test/ndbapi/old_dirs/flexHammer/Makefile | 9 - ndb/test/ndbapi/old_dirs/flexHammer/README | 67 - ndb/test/ndbapi/old_dirs/flexScan/Makefile | 9 - ndb/test/ndbapi/old_dirs/flexScan/README | 66 - ndb/test/ndbapi/old_dirs/flexTT/Makefile | 11 - ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile | 11 - ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile | 15 - ndb/test/ndbapi/old_dirs/indexTest/Makefile | 9 - ndb/test/ndbapi/old_dirs/indexTest2/Makefile | 9 - ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile | 10 - ndb/test/ndbapi/old_dirs/lmc-bench/Makefile | 6 - .../ndbapi/old_dirs/lmc-bench/async-src/Makefile | 8 - .../lmc-bench/async-src/generator/Makefile | 13 - .../lmc-bench/async-src/include/dbGenerator.h | 62 - .../lmc-bench/async-src/include/testData.h | 155 - .../lmc-bench/async-src/include/userInterface.h | 78 - .../old_dirs/lmc-bench/async-src/user/Makefile | 11 - .../old_dirs/lmc-bench/async-src/user/macros.h | 50 - .../lmc-bench/async-src/user/ndb_error.hpp | 62 - ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty | 0 .../old_dirs/lmc-bench/include/ndb_schema.hpp | 77 - .../old_dirs/lmc-bench/include/testDefinitions.h | 89 - ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty | 0 ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile | 5 - .../lmc-bench/script/async-lmc-bench-l-p10.sh | 14 - .../old_dirs/lmc-bench/script/async-lmc-bench-l.sh | 14 - .../lmc-bench/script/async-lmc-bench-p10.sh | 14 - .../old_dirs/lmc-bench/script/async-lmc-bench.sh | 14 - ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile | 8 - ndb/test/ndbapi/old_dirs/lmc-bench/src/README | 8 - .../old_dirs/lmc-bench/src/generator/Makefile | 17 - .../old_dirs/lmc-bench/src/generator/dbGenerator.c | 542 --- .../old_dirs/lmc-bench/src/generator/dbGenerator.h | 60 - .../lmc-bench/src/generator/mainGenerator.c | 322 -- .../old_dirs/lmc-bench/src/include/testData.h | 102 - .../old_dirs/lmc-bench/src/include/userInterface.h | 127 - .../ndbapi/old_dirs/lmc-bench/src/makevars.linux | 6 - .../ndbapi/old_dirs/lmc-bench/src/makevars.sparc | 15 - .../old_dirs/lmc-bench/src/populator/Makefile | 15 - .../old_dirs/lmc-bench/src/populator/dbPopulate.c | 243 -- .../old_dirs/lmc-bench/src/populator/dbPopulate.h | 58 - .../lmc-bench/src/populator/mainPopulate.c | 75 - .../ndbapi/old_dirs/lmc-bench/src/user/Makefile | 11 - .../old_dirs/lmc-bench/src/user/localDbPrepare.c | 647 ---- .../ndbapi/old_dirs/lmc-bench/src/user/macros.h | 50 - .../old_dirs/lmc-bench/src/user/ndb_error.hpp | 30 - .../old_dirs/lmc-bench/src/user/old/Makefile | 10 - .../old_dirs/lmc-bench/src/user/old/userHandle.h | 189 - .../lmc-bench/src/user/old/userInterface.c | 452 --- .../lmc-bench/src/user/old/userTransaction.c | 472 --- .../old_dirs/lmc-bench/src/user/userHandle.h | 50 - .../old_dirs/lmc-bench/src/user/userInterface.cpp | 738 ---- .../old_dirs/lmc-bench/src/user/userTransaction.c | 472 --- ndb/test/ndbapi/old_dirs/restarter/Makefile | 11 - ndb/test/ndbapi/old_dirs/restarter2/Makefile | 11 - ndb/test/ndbapi/old_dirs/restarts/Makefile | 11 - ndb/test/ndbapi/old_dirs/ronja/Makefile | 6 - ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile | 10 - ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile | 9 - ndb/test/ndbapi/old_dirs/telco/Makefile | 10 - ndb/test/ndbapi/old_dirs/telco/readme | 9 - ndb/test/ndbapi/old_dirs/testBackup/Makefile | 8 - ndb/test/ndbapi/old_dirs/testBasic/Makefile | 9 - ndb/test/ndbapi/old_dirs/testBlobs/Makefile | 11 - ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile | 9 - ndb/test/ndbapi/old_dirs/testDict/Makefile | 11 - ndb/test/ndbapi/old_dirs/testGrep/Makefile | 9 - ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile | 10 - ndb/test/ndbapi/old_dirs/testIndex/Makefile | 11 - ndb/test/ndbapi/old_dirs/testInterpreter/Makefile | 9 - ndb/test/ndbapi/old_dirs/testMgm/Makefile | 9 - ndb/test/ndbapi/old_dirs/testNdbApi/Makefile | 9 - ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile | 9 - ndb/test/ndbapi/old_dirs/testOIBasic/Makefile | 13 - ndb/test/ndbapi/old_dirs/testOIBasic/times.txt | 8 - ndb/test/ndbapi/old_dirs/testOperations/Makefile | 9 - ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile | 9 - ndb/test/ndbapi/old_dirs/testRestartGci/Makefile | 9 - ndb/test/ndbapi/old_dirs/testScan/Makefile | 9 - .../ndbapi/old_dirs/testScanInterpreter/Makefile | 9 - .../ndbapi/old_dirs/testSystemRestart/Makefile | 11 - ndb/test/ndbapi/old_dirs/testTimeout/Makefile | 9 - ndb/test/ndbapi/old_dirs/testTransactions/Makefile | 10 - ndb/test/ndbapi/old_dirs/test_event/Makefile | 9 - ndb/test/ndbapi/old_dirs/vw_test/Makefile | 11 - ndb/test/ndbapi/old_dirs/vw_test/bcd.h | 25 - .../ndbapi/old_dirs/vw_test/script/client_start | 10 - ndb/test/ndbapi/old_dirs/vw_test/utv.h | 160 - ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h | 54 - ndb/test/ndbapi/slow_select.cpp | 14 + ndb/test/ndbapi/testBitfield.cpp | 14 + ndb/test/ndbapi/testLcp.cpp | 14 + ndb/test/ndbnet/test.run | 15 + ndb/test/ndbnet/testError.run | 17 + ndb/test/ndbnet/testMNF.run | 17 + ndb/test/ndbnet/testNR.run | 15 + ndb/test/ndbnet/testNR1.run | 17 + ndb/test/ndbnet/testNR4.run | 17 + ndb/test/ndbnet/testSRhang.run | 15 + ndb/test/ndbnet/testTR295.run | 17 + ndb/test/run-test/16node-tests.txt | 15 + ndb/test/run-test/atrt-analyze-result.sh | 17 + ndb/test/run-test/atrt-clear-result.sh | 17 + ndb/test/run-test/atrt-gather-result.sh | 17 + ndb/test/run-test/atrt-mysql-test-run | 17 + ndb/test/run-test/atrt-setup.sh | 17 + ndb/test/run-test/atrt-testBackup | 17 + ndb/test/run-test/basic.txt | 15 + ndb/test/run-test/conf-daily-devel-ndbmaster.txt | 15 + ndb/test/run-test/conf-daily-sql-ndbmaster.txt | 15 + ndb/test/run-test/conf-dl145a.txt | 15 + ndb/test/run-test/conf-ndbmaster.txt | 15 + ndb/test/run-test/conf-shark.txt | 15 + ndb/test/run-test/daily-basic-tests.txt | 15 + ndb/test/run-test/daily-devel-tests.txt | 15 + ndb/test/run-test/make-config.sh | 17 + ndb/test/run-test/make-html-reports.sh | 17 + ndb/test/run-test/make-index.sh | 18 + ndb/test/run-test/ndb-autotest.sh | 18 + ndb/test/sql/test_create_drop.pl | 17 + ndb/test/sql/test_range_bounds.pl | 17 + ndb/tools/clean-links.sh | 15 + ndb/tools/make-errors.pl | 15 + ndb/tools/make-links.sh | 15 + ndb/tools/ndb_error_reporter | 15 + ndb/tools/ndb_size.pl | 30 +- ndb/tools/ndb_size.tmpl | 17 + ndb/tools/rgrep | 15 + os2/BldLevel.RES | Bin 127 -> 0 bytes os2/BldLevel.cmd | 10 - os2/BldLevel.rc | 1 - os2/BldLevelInf.cmd | 570 --- os2/ChangeLog.os2 | 56 - os2/Makefile.am | 27 - os2/MySQL-Client.icc | 122 - os2/MySQL-Opt.icc | 59 - os2/MySQL-Source.icc | 324 -- os2/MySQL-Sql.icc | 44 - os2/MySQL-Sql.irs | 7 - os2/MySQL-Util.icc | 171 - os2/MySQL-Util.irs | 3271 ----------------- os2/ReadMe.txt | 205 -- os2/build-all.cmd | 10 - os2/include/Makefile.am | 22 - os2/include/config.h | 13 - os2/include/pwd.h | 1 - os2/include/sgtty.h | 1 - os2/include/sys/Makefile.am | 21 - os2/include/sys/file.h | 1 - os2/include/termio.h | 156 - os2/mysql-inf.wis | 15 - os2/mysql.wis | 127 - os2/mysqlalt.wis | 15 - os2/rint.cmd | 4 - os2/rint.obj | Bin 334 -> 0 bytes os2/rint.s | 32 - scripts/fill_help_tables.sql | 15 + scripts/make_binary_distribution.sh | 2 +- scripts/make_win_bin_dist | 2 +- scripts/make_win_src_distribution_old.sh | 4 +- scripts/mysql_fix_extensions.sh | 18 + scripts/mysql_prepare_privilege_tables_for_5.sql | 14 + scripts/mysql_setpermission.sh | 18 + scripts/mysql_system_tables.sql | 15 + scripts/mysql_system_tables_data.sql | 15 + scripts/mysql_system_tables_fix.sql | 15 + scripts/mysql_tableinfo.sh | 17 + scripts/mysql_test_data_timezone.sql | 15 + scripts/mysqlaccess.sh | 18 + scripts/mysqld_multi.sh | 17 + scripts/mysqldumpslow.sh | 18 + scripts/mysqlhotcopy.sh | 17 + server-tools/instance-manager/options.cc | 4 +- sql/field.cc | 2 +- sql/gen_lex_hash.cc | 4 +- sql/item.h | 2 +- sql/item_cmpfunc.cc | 2 +- sql/item_cmpfunc.h | 2 +- sql/item_func.cc | 2 +- sql/item_func.h | 2 +- sql/item_subselect.cc | 2 +- sql/item_sum.cc | 2 +- sql/message.h | 15 + sql/mysqld.cc | 2 +- sql/net_serv.cc | 6 +- sql/opt_range.cc | 2 +- sql/set_var.cc | 2 +- sql/set_var.h | 2 +- sql/share/charsets/languages.html | 16 + sql/sql_base.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_parse.cc | 2 +- sql/sql_prepare.cc | 2 +- sql/sql_select.cc | 2 +- sql/sql_select.h | 2 +- sql/sql_show.cc | 2 +- sql/sql_update.cc | 2 +- sql/table.h | 2 +- strings/strtod.c | 22 + support-files/MacOSX/Description.plist.sh | 16 + support-files/MacOSX/Info.plist.sh | 16 + support-files/MacOSX/Makefile.am | 4 +- support-files/MacOSX/MySQLCOM | 16 + support-files/MacOSX/StartupItem.Description.plist | 16 + support-files/MacOSX/StartupItem.Info.plist | 16 + support-files/MacOSX/StartupItem.postinstall | 16 + support-files/MacOSX/StartupParameters.plist.sh | 16 + support-files/MacOSX/mwar-wrapper | 15 + support-files/MacOSX/mwcc-wrapper | 15 + support-files/MacOSX/postflight.sh | 18 + support-files/MacOSX/preflight.sh | 18 + support-files/Makefile.am | 4 +- support-files/RHEL4-SElinux/Makefile.am | 4 +- support-files/RHEL4-SElinux/mysql.fc | 15 + support-files/RHEL4-SElinux/mysql.te | 14 + support-files/SCO/INSTALL.sh | 29 - support-files/SCO/compile.sh | 102 - support-files/SCO/doc.sh | 17 - support-files/SCO/mkpkg.sh | 47 - support-files/SCO/patch | 96 - support-files/SCO/pkginfo.ini | 8 - support-files/SCO/postinstall | 30 - support-files/SCO/preinstall | 21 - support-files/SCO/preremove | 25 - support-files/SCO/prototype.ini | 4 - support-files/SCO/version | 1 - support-files/compiler_warnings.supp | 15 + support-files/mysql.spec.sh | 2 +- tests/Makefile.am | 4 +- tests/big_record.pl | 15 + tests/drop_test.pl | 16 + tests/export.pl | 15 + tests/fork2_test.pl | 15 + tests/fork_big.pl | 16 + tests/fork_big2.pl | 16 + tests/grant.pl | 16 + tests/index_corrupt.pl | 16 + tests/insert_and_repair.pl | 16 + tests/lock_test.pl | 15 + tests/mysql_client_test.c | 2 +- tests/pmail.pl | 16 + tests/rename_test.pl | 16 + tests/table_types.pl | 16 +- tests/test_delayed_insert.pl | 15 + tests/truncate.pl | 16 + win/create_manifest.js | 15 + win/mysql_manifest.cmake | 14 + 889 files changed, 4032 insertions(+), 93816 deletions(-) delete mode 100644 include/config-os2.h delete mode 100644 libmysqld/copyright delete mode 100644 mysys/my_os2cond.c delete mode 100644 mysys/my_os2dirsrch.c delete mode 100644 mysys/my_os2dirsrch.h delete mode 100644 mysys/my_os2dlfcn.c delete mode 100644 mysys/my_os2dlfcn.h0 delete mode 100644 mysys/my_os2file64.c delete mode 100644 mysys/my_os2mutex.c delete mode 100644 mysys/my_os2thread.c delete mode 100644 mysys/my_os2tls.c delete mode 100644 ndb/docs/doxygen/header.mgmapi.tex delete mode 100644 ndb/docs/doxygen/header.ndbapi.tex delete mode 100755 ndb/home/bin/Linuxmkisofs delete mode 100755 ndb/home/bin/Solarismkisofs delete mode 100755 ndb/home/bin/cvs2cl.pl delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Computer.cls delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Database.cls delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 110.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 231.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 237.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 241.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 242.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 270.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 271.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 273.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 31.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 337.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 338.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Icon 339.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/MSSCCPRJ.SCC delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Module1.bas delete mode 100644 ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbp delete mode 100644 ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbw delete mode 100644 ndb/src/cw/cpcc-win32/vb6/Process.cls delete mode 100644 ndb/src/cw/cpcc-win32/vb6/closed folder.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/computer.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmAbout.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmLogin.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmMain.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frx delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewDatabase.frx delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewDatabase1.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.log delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmNewDatabase3.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmOptions.frm delete mode 100644 ndb/src/cw/cpcc-win32/vb6/frmSplash.frx delete mode 100644 ndb/src/cw/cpcc-win32/vb6/networking.ico delete mode 100644 ndb/src/cw/cpcc-win32/vb6/open folder.ico delete mode 100644 ndb/src/old_files/client/Makefile delete mode 100644 ndb/src/old_files/client/odbc/Extra.mk delete mode 100644 ndb/src/old_files/client/odbc/Makefile delete mode 100755 ndb/src/old_files/client/odbc/NdbOdbc.cpp delete mode 100755 ndb/src/old_files/client/odbc/NdbOdbc.def delete mode 100644 ndb/src/old_files/client/odbc/codegen/CodeGen.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/CodeGen.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_base.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_base.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_column.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_column.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_dml.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_dml.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_insert.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_insert.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_pred.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_pred.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_root.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_root.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_select.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_select.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_table.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_table.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/Makefile delete mode 100644 ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp delete mode 100644 ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp delete mode 100644 ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp delete mode 100644 ndb/src/old_files/client/odbc/common/AttrArea.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/AttrArea.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/CodeTree.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/CodeTree.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/ConnArea.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/ConnArea.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/Ctx.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/Ctx.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/DataField.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/DataField.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/DataRow.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/DataRow.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/DataType.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/DataType.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/DescArea.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/DescArea.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/DiagArea.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/DiagArea.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/Makefile delete mode 100644 ndb/src/old_files/client/odbc/common/OdbcData.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/OdbcData.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/ResultArea.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/ResultArea.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/Sqlstate.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/Sqlstate.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/StmtArea.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/StmtArea.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/StmtInfo.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/StmtInfo.hpp delete mode 100644 ndb/src/old_files/client/odbc/common/common.cpp delete mode 100644 ndb/src/old_files/client/odbc/common/common.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictSys.cpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictSys.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictTable.cpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/DictTable.hpp delete mode 100644 ndb/src/old_files/client/odbc/dictionary/Makefile delete mode 100644 ndb/src/old_files/client/odbc/docs/class.fig delete mode 100644 ndb/src/old_files/client/odbc/docs/descfield.pl delete mode 100644 ndb/src/old_files/client/odbc/docs/diag.txt delete mode 100644 ndb/src/old_files/client/odbc/docs/getinfo.pl delete mode 100644 ndb/src/old_files/client/odbc/docs/gettypeinfo.pl delete mode 100644 ndb/src/old_files/client/odbc/docs/handleattr.pl delete mode 100644 ndb/src/old_files/client/odbc/docs/main.hpp delete mode 100644 ndb/src/old_files/client/odbc/docs/ndbodbc.html delete mode 100644 ndb/src/old_files/client/odbc/docs/select.fig delete mode 100644 ndb/src/old_files/client/odbc/docs/systables.pl delete mode 100644 ndb/src/old_files/client/odbc/docs/type.txt delete mode 100644 ndb/src/old_files/client/odbc/driver/Func.data delete mode 100644 ndb/src/old_files/client/odbc/driver/Func.pl delete mode 100644 ndb/src/old_files/client/odbc/driver/Makefile delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLCancel.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLColumns.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLConnect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLError.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLExecute.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLFetch.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetData.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLParamData.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLPutData.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLTables.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/SQLTransact.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/driver.cpp delete mode 100644 ndb/src/old_files/client/odbc/driver/driver.hpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_insert.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Executor.cpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Executor.hpp delete mode 100644 ndb/src/old_files/client/odbc/executor/Makefile delete mode 100644 ndb/src/old_files/client/odbc/handles/AttrDbc.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/AttrEnv.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/AttrRoot.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/AttrStmt.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/DescSpec.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/FuncTab.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleBase.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleBase.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleDbc.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleDbc.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleDesc.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleDesc.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleEnv.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleEnv.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleRoot.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleRoot.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleStmt.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/HandleStmt.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/InfoTab.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/Makefile delete mode 100644 ndb/src/old_files/client/odbc/handles/PoolNdb.cpp delete mode 100644 ndb/src/old_files/client/odbc/handles/PoolNdb.hpp delete mode 100644 ndb/src/old_files/client/odbc/handles/handles.hpp delete mode 100644 ndb/src/old_files/ndbbaseclient/Makefile delete mode 100644 ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp delete mode 100644 ndb/src/old_files/ndbclient/Makefile delete mode 100644 ndb/src/old_files/ndbclient/ndbclient_dummy.cpp delete mode 100644 ndb/src/old_files/newtonapi/Makefile delete mode 100644 ndb/src/old_files/newtonapi/dba_binding.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_bulkread.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_config.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_dac.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_error.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_init.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_internal.hpp delete mode 100644 ndb/src/old_files/newtonapi/dba_process.cpp delete mode 100644 ndb/src/old_files/newtonapi/dba_process.hpp delete mode 100644 ndb/src/old_files/newtonapi/dba_schema.cpp delete mode 100644 ndb/src/old_files/rep/ExtSender.cpp delete mode 100644 ndb/src/old_files/rep/ExtSender.hpp delete mode 100644 ndb/src/old_files/rep/Makefile delete mode 100644 ndb/src/old_files/rep/NodeConnectInfo.hpp delete mode 100644 ndb/src/old_files/rep/README delete mode 100644 ndb/src/old_files/rep/RepApiInterpreter.cpp delete mode 100644 ndb/src/old_files/rep/RepApiInterpreter.hpp delete mode 100644 ndb/src/old_files/rep/RepApiService.cpp delete mode 100644 ndb/src/old_files/rep/RepApiService.hpp delete mode 100644 ndb/src/old_files/rep/RepCommandInterpreter.cpp delete mode 100644 ndb/src/old_files/rep/RepCommandInterpreter.hpp delete mode 100644 ndb/src/old_files/rep/RepComponents.cpp delete mode 100644 ndb/src/old_files/rep/RepComponents.hpp delete mode 100644 ndb/src/old_files/rep/RepMain.cpp delete mode 100644 ndb/src/old_files/rep/Requestor.cpp delete mode 100644 ndb/src/old_files/rep/Requestor.hpp delete mode 100644 ndb/src/old_files/rep/RequestorSubscriptions.cpp delete mode 100644 ndb/src/old_files/rep/SignalQueue.cpp delete mode 100644 ndb/src/old_files/rep/SignalQueue.hpp delete mode 100644 ndb/src/old_files/rep/TODO delete mode 100644 ndb/src/old_files/rep/adapters/AppNDB.cpp delete mode 100644 ndb/src/old_files/rep/adapters/AppNDB.hpp delete mode 100644 ndb/src/old_files/rep/adapters/ExtAPI.cpp delete mode 100644 ndb/src/old_files/rep/adapters/ExtAPI.hpp delete mode 100644 ndb/src/old_files/rep/adapters/ExtNDB.cpp delete mode 100644 ndb/src/old_files/rep/adapters/ExtNDB.hpp delete mode 100644 ndb/src/old_files/rep/adapters/Makefile delete mode 100644 ndb/src/old_files/rep/adapters/TableInfoPs.hpp delete mode 100644 ndb/src/old_files/rep/dbug_hack.cpp delete mode 100644 ndb/src/old_files/rep/rep_version.hpp delete mode 100644 ndb/src/old_files/rep/repapi/Makefile delete mode 100644 ndb/src/old_files/rep/repapi/repapi.cpp delete mode 100644 ndb/src/old_files/rep/repapi/repapi.h delete mode 100644 ndb/src/old_files/rep/state/Channel.cpp delete mode 100644 ndb/src/old_files/rep/state/Channel.hpp delete mode 100644 ndb/src/old_files/rep/state/Interval.cpp delete mode 100644 ndb/src/old_files/rep/state/Interval.hpp delete mode 100644 ndb/src/old_files/rep/state/Makefile delete mode 100644 ndb/src/old_files/rep/state/RepState.cpp delete mode 100644 ndb/src/old_files/rep/state/RepState.hpp delete mode 100644 ndb/src/old_files/rep/state/RepStateEvent.cpp delete mode 100644 ndb/src/old_files/rep/state/RepStateRequests.cpp delete mode 100644 ndb/src/old_files/rep/state/testInterval/Makefile delete mode 100644 ndb/src/old_files/rep/state/testInterval/testInterval.cpp delete mode 100644 ndb/src/old_files/rep/state/testRepState/Makefile delete mode 100644 ndb/src/old_files/rep/state/testRepState/testRequestor.cpp delete mode 100644 ndb/src/old_files/rep/state/testRepState/testRequestor.hpp delete mode 100644 ndb/src/old_files/rep/storage/GCIBuffer.cpp delete mode 100644 ndb/src/old_files/rep/storage/GCIBuffer.hpp delete mode 100644 ndb/src/old_files/rep/storage/GCIContainer.cpp delete mode 100644 ndb/src/old_files/rep/storage/GCIContainer.hpp delete mode 100644 ndb/src/old_files/rep/storage/GCIContainerPS.cpp delete mode 100644 ndb/src/old_files/rep/storage/GCIContainerPS.hpp delete mode 100644 ndb/src/old_files/rep/storage/GCIPage.cpp delete mode 100644 ndb/src/old_files/rep/storage/GCIPage.hpp delete mode 100644 ndb/src/old_files/rep/storage/LogRecord.hpp delete mode 100644 ndb/src/old_files/rep/storage/Makefile delete mode 100644 ndb/src/old_files/rep/storage/NodeConnectInfo.hpp delete mode 100644 ndb/src/old_files/rep/storage/NodeGroup.cpp delete mode 100644 ndb/src/old_files/rep/storage/NodeGroup.hpp delete mode 100644 ndb/src/old_files/rep/storage/NodeGroupInfo.cpp delete mode 100644 ndb/src/old_files/rep/storage/NodeGroupInfo.hpp delete mode 100644 ndb/src/old_files/rep/transfer/Makefile delete mode 100644 ndb/src/old_files/rep/transfer/TransPS.cpp delete mode 100644 ndb/src/old_files/rep/transfer/TransPS.hpp delete mode 100644 ndb/src/old_files/rep/transfer/TransSS.cpp delete mode 100644 ndb/src/old_files/rep/transfer/TransSS.hpp delete mode 100644 ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp delete mode 100644 ndb/test/ndbapi/old_dirs/acid/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/acid2/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp delete mode 100644 ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp delete mode 100755 ndb/test/ndbapi/old_dirs/basicAsynch/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/bulk_copy/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/create_tab/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/flexAsynch/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/flexBench/Makefile.am delete mode 100755 ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl delete mode 100644 ndb/test/ndbapi/old_dirs/flexHammer/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/flexHammer/README delete mode 100644 ndb/test/ndbapi/old_dirs/flexScan/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/flexScan/README delete mode 100644 ndb/test/ndbapi/old_dirs/flexTT/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/indexTest/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/indexTest2/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile delete mode 100755 ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh delete mode 100755 ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh delete mode 100755 ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh delete mode 100755 ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/README delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp delete mode 100644 ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c delete mode 100644 ndb/test/ndbapi/old_dirs/restarter/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/restarter2/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/restarts/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/ronja/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/telco/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/telco/readme delete mode 100644 ndb/test/ndbapi/old_dirs/testBackup/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testBasic/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testBlobs/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testDict/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testGrep/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testIndex/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testInterpreter/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testMgm/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testNdbApi/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testOIBasic/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testOIBasic/times.txt delete mode 100644 ndb/test/ndbapi/old_dirs/testOperations/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testRestartGci/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testScan/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testTimeout/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/testTransactions/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/test_event/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/vw_test/Makefile delete mode 100644 ndb/test/ndbapi/old_dirs/vw_test/bcd.h delete mode 100644 ndb/test/ndbapi/old_dirs/vw_test/script/client_start delete mode 100644 ndb/test/ndbapi/old_dirs/vw_test/utv.h delete mode 100644 ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h delete mode 100644 os2/BldLevel.RES delete mode 100644 os2/BldLevel.cmd delete mode 100644 os2/BldLevel.rc delete mode 100644 os2/BldLevelInf.cmd delete mode 100644 os2/ChangeLog.os2 delete mode 100644 os2/Makefile.am delete mode 100644 os2/MySQL-Client.icc delete mode 100644 os2/MySQL-Opt.icc delete mode 100644 os2/MySQL-Source.icc delete mode 100644 os2/MySQL-Sql.icc delete mode 100644 os2/MySQL-Sql.irs delete mode 100644 os2/MySQL-Util.icc delete mode 100644 os2/MySQL-Util.irs delete mode 100644 os2/ReadMe.txt delete mode 100644 os2/build-all.cmd delete mode 100644 os2/include/Makefile.am delete mode 100644 os2/include/config.h delete mode 100644 os2/include/pwd.h delete mode 100644 os2/include/sgtty.h delete mode 100644 os2/include/sys/Makefile.am delete mode 100644 os2/include/sys/file.h delete mode 100644 os2/include/termio.h delete mode 100644 os2/mysql-inf.wis delete mode 100644 os2/mysql.wis delete mode 100644 os2/mysqlalt.wis delete mode 100644 os2/rint.cmd delete mode 100644 os2/rint.obj delete mode 100644 os2/rint.s delete mode 100755 support-files/SCO/INSTALL.sh delete mode 100644 support-files/SCO/compile.sh delete mode 100644 support-files/SCO/doc.sh delete mode 100644 support-files/SCO/mkpkg.sh delete mode 100644 support-files/SCO/patch delete mode 100644 support-files/SCO/pkginfo.ini delete mode 100644 support-files/SCO/postinstall delete mode 100644 support-files/SCO/preinstall delete mode 100644 support-files/SCO/preremove delete mode 100644 support-files/SCO/prototype.ini delete mode 100644 support-files/SCO/version diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index 2fc8015ea28..7c73d8e0723 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -1,3 +1,20 @@ +# Copyright (C) 2000, 2005 MySQL AB, 2008 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + cflags="$c_warnings $extra_flags" cxxflags="$cxx_warnings $base_cxxflags $extra_flags" extra_configs="$extra_configs $local_infile_configs" diff --git a/BUILD/Makefile.am b/BUILD/Makefile.am index ee0f07864e8..43ffc78e82e 100644 --- a/BUILD/Makefile.am +++ b/BUILD/Makefile.am @@ -1,11 +1,11 @@ # Copyright (C) 2002, 2004-2005 MySQL AB # -# This library is free software; you can redistribute it and/or +# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # -# This library is distributed in the hope that it will be useful, +# 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 # Library General Public License for more details. diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 532ea4eb0f1..a4ec8be1018 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2000, 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + if test ! -f sql/mysqld.cc then echo "You must run this script from the MySQL top-level directory" diff --git a/BUILD/autorun.sh b/BUILD/autorun.sh index f5986720b48..53668e2f24d 100755 --- a/BUILD/autorun.sh +++ b/BUILD/autorun.sh @@ -1,4 +1,22 @@ #!/bin/sh + +# Copyright (C) 2005 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # Create MySQL autotools infrastructure die() { echo "$@"; exit 1; } diff --git a/BUILD/check-cpu b/BUILD/check-cpu index e7cae1c1da8..ce14afcc57a 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -1,4 +1,20 @@ #!/bin/sh + +# Copyright (C) 2005, 2008 MySQL AB, 2009 Sun Microsystems, Inc. +# +# 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; version 2 of the License. +# +# 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 + # # Check cpu of current machine and find the # best compiler optimization flags for gcc diff --git a/BUILD/cleanup b/BUILD/cleanup index 518c5722d87..1ae29368fa7 100755 --- a/BUILD/cleanup +++ b/BUILD/cleanup @@ -1,5 +1,20 @@ #! /bin/sh +# 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-alpha b/BUILD/compile-alpha index ce5050fee72..a0b98ecb2a5 100755 --- a/BUILD/compile-alpha +++ b/BUILD/compile-alpha @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2002 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-alpha-ccc b/BUILD/compile-alpha-ccc index 889592295b5..1146a8bc53c 100755 --- a/BUILD/compile-alpha-ccc +++ b/BUILD/compile-alpha-ccc @@ -1,3 +1,18 @@ +# Copyright (C) 2000, 2005 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; version 2 of the License. +# +# 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 + /bin/rm -f */.deps/*.P */*.o make -k clean /bin/rm -f */.deps/*.P */*.o diff --git a/BUILD/compile-alpha-cxx b/BUILD/compile-alpha-cxx index c49846fd964..386778fb045 100755 --- a/BUILD/compile-alpha-cxx +++ b/BUILD/compile-alpha-cxx @@ -1,3 +1,18 @@ +# Copyright (C) 2000, 2005 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; version 2 of the License. +# +# 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 + /bin/rm -f */.deps/*.P */*.o make -k clean /bin/rm -f */.deps/*.P */*.o diff --git a/BUILD/compile-alpha-debug b/BUILD/compile-alpha-debug index 113c2151461..ccaec6aa17a 100755 --- a/BUILD/compile-alpha-debug +++ b/BUILD/compile-alpha-debug @@ -1,3 +1,18 @@ +# Copyright (C) 2000, 2005 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; version 2 of the License. +# +# 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 + /bin/rm -f */.deps/*.P */*.o make -k clean /bin/rm -f */.deps/*.P */*.o diff --git a/BUILD/compile-amd64-debug-max b/BUILD/compile-amd64-debug-max index 530bdba009b..a394d3e2101 100755 --- a/BUILD/compile-amd64-debug-max +++ b/BUILD/compile-amd64-debug-max @@ -1,4 +1,20 @@ #! /bin/sh + +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" extra_flags="$amd64_cflags $debug_cflags $max_cflags" diff --git a/BUILD/compile-amd64-gcov b/BUILD/compile-amd64-gcov index 239a4aed0fb..2b33b5c81ab 100755 --- a/BUILD/compile-amd64-gcov +++ b/BUILD/compile-amd64-gcov @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-amd64-gprof b/BUILD/compile-amd64-gprof index 6cfb8a4302c..6545013771b 100755 --- a/BUILD/compile-amd64-gprof +++ b/BUILD/compile-amd64-gprof @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-amd64-max b/BUILD/compile-amd64-max index 228448f6392..3bd8d6cd8ba 100755 --- a/BUILD/compile-amd64-max +++ b/BUILD/compile-amd64-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" extra_flags="$amd64_cflags $fast_cflags $max_cflags -g" diff --git a/BUILD/compile-amd64-max-sci b/BUILD/compile-amd64-max-sci index 4afa9004742..dcb6967850b 100644 --- a/BUILD/compile-amd64-max-sci +++ b/BUILD/compile-amd64-max-sci @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" extra_flags="$amd64_cflags $fast_cflags -g" diff --git a/BUILD/compile-darwin-mwcc b/BUILD/compile-darwin-mwcc index 6fd0eab7e26..2fb96b32f80 100755 --- a/BUILD/compile-darwin-mwcc +++ b/BUILD/compile-darwin-mwcc @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 7c2dbe00dc5..66c3754381e 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -1,4 +1,20 @@ #!/bin/sh + +# Copyright (C) 2004, 2006 MySQL AB, 2008, 2009 Sun Microsystems, Inc. +# +# 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; version 2 of the License. +# +# 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 + # # This script's purpose is to update the automake/autoconf helper scripts and # to run a plain "configure" without any special compile flags. Only features diff --git a/BUILD/compile-hpux11-parisc2-aCC b/BUILD/compile-hpux11-parisc2-aCC index c286488bb26..ca2ae93e69f 100755 --- a/BUILD/compile-hpux11-parisc2-aCC +++ b/BUILD/compile-hpux11-parisc2-aCC @@ -1,5 +1,20 @@ #!/bin/sh +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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 + if [ ! -f "sql/mysqld.cc" ]; then echo "You must run this script from the MySQL top-level directory." exit 1 diff --git a/BUILD/compile-ia64-debug-max b/BUILD/compile-ia64-debug-max index 5082844f088..ecbd750bff5 100755 --- a/BUILD/compile-ia64-debug-max +++ b/BUILD/compile-ia64-debug-max @@ -1,3 +1,18 @@ +# Copyright (C) 2001, 2005 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; version 2 of the License. +# +# 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 + gmake -k clean || true /bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache diff --git a/BUILD/compile-irix-mips64-mipspro b/BUILD/compile-irix-mips64-mipspro index 0cebb4b9f5b..0c54309e822 100755 --- a/BUILD/compile-irix-mips64-mipspro +++ b/BUILD/compile-irix-mips64-mipspro @@ -1,5 +1,20 @@ #!/bin/sh +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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 + if [ ! -f "sql/mysqld.cc" ]; then echo "You must run this script from the MySQL top-level directory." exit 1 diff --git a/BUILD/compile-ndb-autotest b/BUILD/compile-ndb-autotest index be28cc28346..1f0e2a888d1 100755 --- a/BUILD/compile-ndb-autotest +++ b/BUILD/compile-ndb-autotest @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2006 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium index b8f8d028e1f..0b8caa763ce 100755 --- a/BUILD/compile-pentium +++ b/BUILD/compile-pentium @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2002 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-cybozu b/BUILD/compile-pentium-cybozu index 841635985a1..86445715fba 100755 --- a/BUILD/compile-pentium-cybozu +++ b/BUILD/compile-pentium-cybozu @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug index e31cb59a8a4..af7c0fa978c 100755 --- a/BUILD/compile-pentium-debug +++ b/BUILD/compile-pentium-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` set -- "$@" --with-debug=full . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max index 56e24617abb..66db0d31e87 100755 --- a/BUILD/compile-pentium-debug-max +++ b/BUILD/compile-pentium-debug-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` set -- "$@" --with-debug=full . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug-max-no-embedded b/BUILD/compile-pentium-debug-max-no-embedded index dfdf7d0a5e1..ae43eada2b3 100755 --- a/BUILD/compile-pentium-debug-max-no-embedded +++ b/BUILD/compile-pentium-debug-max-no-embedded @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug-max-no-ndb b/BUILD/compile-pentium-debug-max-no-ndb index 92a388f9cb9..cbcd954b8c2 100755 --- a/BUILD/compile-pentium-debug-max-no-ndb +++ b/BUILD/compile-pentium-debug-max-no-ndb @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` set -- "$@" --with-debug=full . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug-no-bdb b/BUILD/compile-pentium-debug-no-bdb index d7e70f868cc..c28b7d0132a 100755 --- a/BUILD/compile-pentium-debug-no-bdb +++ b/BUILD/compile-pentium-debug-no-bdb @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2002 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug-openssl b/BUILD/compile-pentium-debug-openssl index 68d99b6eda6..b8b014c512b 100755 --- a/BUILD/compile-pentium-debug-openssl +++ b/BUILD/compile-pentium-debug-openssl @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-debug-yassl b/BUILD/compile-pentium-debug-yassl index 666e73d0267..16786151d4d 100755 --- a/BUILD/compile-pentium-debug-yassl +++ b/BUILD/compile-pentium-debug-yassl @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-gcov b/BUILD/compile-pentium-gcov index d4878dc591e..7d355b90fba 100755 --- a/BUILD/compile-pentium-gcov +++ b/BUILD/compile-pentium-gcov @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-gprof b/BUILD/compile-pentium-gprof index 4aebc1d2e02..f04d7154888 100755 --- a/BUILD/compile-pentium-gprof +++ b/BUILD/compile-pentium-gprof @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-icc b/BUILD/compile-pentium-icc index bf550a4b574..0c41b6045af 100755 --- a/BUILD/compile-pentium-icc +++ b/BUILD/compile-pentium-icc @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-icc-valgrind-max b/BUILD/compile-pentium-icc-valgrind-max index b765c777e2b..0e32efdc9a6 100755 --- a/BUILD/compile-pentium-icc-valgrind-max +++ b/BUILD/compile-pentium-icc-valgrind-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-icc-yassl b/BUILD/compile-pentium-icc-yassl index 53b191e4db3..78a547d91e0 100644 --- a/BUILD/compile-pentium-icc-yassl +++ b/BUILD/compile-pentium-icc-yassl @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-max b/BUILD/compile-pentium-max index 595581f604e..91e8d967302 100755 --- a/BUILD/compile-pentium-max +++ b/BUILD/compile-pentium-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-myodbc b/BUILD/compile-pentium-myodbc index 4fcfc7e49dc..2d5a06f5f78 100755 --- a/BUILD/compile-pentium-myodbc +++ b/BUILD/compile-pentium-myodbc @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-mysqlfs-debug b/BUILD/compile-pentium-mysqlfs-debug index 6643553d943..6ef61177980 100755 --- a/BUILD/compile-pentium-mysqlfs-debug +++ b/BUILD/compile-pentium-mysqlfs-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2002 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium-pgcc b/BUILD/compile-pentium-pgcc index 639f108bb2b..c91def7faa5 100755 --- a/BUILD/compile-pentium-pgcc +++ b/BUILD/compile-pentium-pgcc @@ -1,3 +1,18 @@ +# Copyright (C) 2000, 2005 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; version 2 of the License. +# +# 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 + AM_MAKEFLAGS="-j 2" gmake -k clean || true /bin/rm -f */.deps/*.P config.cache diff --git a/BUILD/compile-pentium-valgrind-max b/BUILD/compile-pentium-valgrind-max index f0dc92c2ffd..5aa6654bf6f 100755 --- a/BUILD/compile-pentium-valgrind-max +++ b/BUILD/compile-pentium-valgrind-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2002, 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium64-debug b/BUILD/compile-pentium64-debug index 1edc9827366..8a768b65bc4 100755 --- a/BUILD/compile-pentium64-debug +++ b/BUILD/compile-pentium64-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` set -- "$@" --with-debug=full . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium64-debug-max b/BUILD/compile-pentium64-debug-max index 656825d8494..5cf89c75017 100755 --- a/BUILD/compile-pentium64-debug-max +++ b/BUILD/compile-pentium64-debug-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005, 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` set -- "$@" --with-debug=full . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium64-gcov b/BUILD/compile-pentium64-gcov index 5a99b7f8796..72cfa2cbcf8 100755 --- a/BUILD/compile-pentium64-gcov +++ b/BUILD/compile-pentium64-gcov @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium64-gprof b/BUILD/compile-pentium64-gprof index f64dee6d196..c74ea7ba775 100755 --- a/BUILD/compile-pentium64-gprof +++ b/BUILD/compile-pentium64-gprof @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium64-max-sci b/BUILD/compile-pentium64-max-sci index 9ebb1988475..e6b7e3b02df 100644 --- a/BUILD/compile-pentium64-max-sci +++ b/BUILD/compile-pentium64-max-sci @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-pentium64-valgrind-max b/BUILD/compile-pentium64-valgrind-max index ef932920130..4a78977b847 100755 --- a/BUILD/compile-pentium64-valgrind-max +++ b/BUILD/compile-pentium64-valgrind-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-ppc b/BUILD/compile-ppc index d248ecf2677..d0845b3ddd2 100755 --- a/BUILD/compile-ppc +++ b/BUILD/compile-ppc @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-ppc-debug b/BUILD/compile-ppc-debug index 2be11eaaf22..c8279de6439 100755 --- a/BUILD/compile-ppc-debug +++ b/BUILD/compile-ppc-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-ppc-debug-max b/BUILD/compile-ppc-debug-max index 49d1442fd45..c5718bbab21 100755 --- a/BUILD/compile-ppc-debug-max +++ b/BUILD/compile-ppc-debug-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-ppc-debug-max-no-ndb b/BUILD/compile-ppc-debug-max-no-ndb index a5b922a1ec9..85d786d35ee 100755 --- a/BUILD/compile-ppc-debug-max-no-ndb +++ b/BUILD/compile-ppc-debug-max-no-ndb @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-ppc-max b/BUILD/compile-ppc-max index 1d89be81c9c..91db8699017 100755 --- a/BUILD/compile-ppc-max +++ b/BUILD/compile-ppc-max @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-sap b/BUILD/compile-sap index 376afaf6f56..bdde866c49d 100755 --- a/BUILD/compile-sap +++ b/BUILD/compile-sap @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-sap-debug b/BUILD/compile-sap-debug index d7e70f868cc..1691fe26120 100755 --- a/BUILD/compile-sap-debug +++ b/BUILD/compile-sap-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" diff --git a/BUILD/compile-solaris-amd64 b/BUILD/compile-solaris-amd64 index 9204170b908..bcd62e6de24 100755 --- a/BUILD/compile-solaris-amd64 +++ b/BUILD/compile-solaris-amd64 @@ -1,4 +1,20 @@ #! /bin/sh + +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" amd64_cflags="-m64 -mtune=athlon64" diff --git a/BUILD/compile-solaris-amd64-debug b/BUILD/compile-solaris-amd64-debug index ad1c298907f..f2cdb1f56c3 100644 --- a/BUILD/compile-solaris-amd64-debug +++ b/BUILD/compile-solaris-amd64-debug @@ -1,4 +1,20 @@ #! /bin/sh + +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + path=`dirname $0` . "$path/SETUP.sh" amd64_cflags="-m64 -mtune=athlon64" diff --git a/BUILD/compile-solaris-amd64-forte b/BUILD/compile-solaris-amd64-forte index 63aceb16c04..0f13bdddb16 100644 --- a/BUILD/compile-solaris-amd64-forte +++ b/BUILD/compile-solaris-amd64-forte @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + gmake -k clean || true /bin/rm -f */.deps/*.P config.cache diff --git a/BUILD/compile-solaris-amd64-forte-debug b/BUILD/compile-solaris-amd64-forte-debug index 8e3ade9b429..9c1e892e9f4 100644 --- a/BUILD/compile-solaris-amd64-forte-debug +++ b/BUILD/compile-solaris-amd64-forte-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2007 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; version 2 of the License. +# +# 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 + gmake -k clean || true /bin/rm -f */.deps/*.P config.cache diff --git a/BUILD/compile-solaris-sparc b/BUILD/compile-solaris-sparc index 0c05bf8a101..c3546111789 100755 --- a/BUILD/compile-solaris-sparc +++ b/BUILD/compile-solaris-sparc @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2005 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; version 2 of the License. +# +# 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 + gmake -k clean || true /bin/rm -f */.deps/*.P config.cache diff --git a/BUILD/compile-solaris-sparc-debug b/BUILD/compile-solaris-sparc-debug index 3384b623ccb..dfc0d9ed354 100755 --- a/BUILD/compile-solaris-sparc-debug +++ b/BUILD/compile-solaris-sparc-debug @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2005 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; version 2 of the License. +# +# 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 + gmake -k clean || true /bin/rm -f */.deps/*.P config.cache diff --git a/BUILD/compile-solaris-sparc-forte b/BUILD/compile-solaris-sparc-forte index 7cdbff6ae4a..cd101ace310 100755 --- a/BUILD/compile-solaris-sparc-forte +++ b/BUILD/compile-solaris-sparc-forte @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2005 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; version 2 of the License. +# +# 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 + gmake -k clean || true /bin/rm -f */.deps/*.P config.cache diff --git a/BUILD/compile-solaris-sparc-purify b/BUILD/compile-solaris-sparc-purify index 29cf5671432..952137a42a2 100755 --- a/BUILD/compile-solaris-sparc-purify +++ b/BUILD/compile-solaris-sparc-purify @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2000, 2005 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; version 2 of the License. +# +# 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 + mode="" cxxfilt="" diff --git a/BUILD/test-alpha-ccc b/BUILD/test-alpha-ccc index c6f4abc0973..92da165ceed 100755 --- a/BUILD/test-alpha-ccc +++ b/BUILD/test-alpha-ccc @@ -1,3 +1,18 @@ +# Copyright (C) 2000 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; version 2 of the License. +# +# 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 + cd /usr/local/mysql bin/mysqladmin shutdown libexec/mysqld --basedir . & diff --git a/Makefile.am b/Makefile.am index 1f171bc9c7c..f082aaa5df7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -32,7 +32,7 @@ DIST_SUBDIRS = . include @docs_dirs@ zlib \ @readline_topdir@ sql-common \ @thread_dirs@ pstack \ @sql_union_dirs@ scripts @man_dirs@ tests SSL\ - BUILD netware os2 @libmysqld_dirs@ \ + BUILD netware @libmysqld_dirs@ \ @bench_dirs@ support-files @tools_dirs@ win # Run these targets before any others, also make part of clean target, diff --git a/client/completion_hash.h b/client/completion_hash.h index b91d6e4d187..8e1b2d6e453 100644 --- a/client/completion_hash.h +++ b/client/completion_hash.h @@ -1,11 +1,11 @@ /* Copyright (C) 2000-2002 MySQL AB - This library is free software; you can redistribute it and/or + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License. - This library is distributed in the hope that it will be useful, + 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 Library General Public License for more details. diff --git a/configure.in b/configure.in index 53598d2b4c7..21386494bda 100644 --- a/configure.in +++ b/configure.in @@ -3120,7 +3120,6 @@ AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS) AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl strings/Makefile regex/Makefile heap/Makefile dnl myisam/Makefile myisammrg/Makefile dnl - os2/Makefile os2/include/Makefile os2/include/sys/Makefile dnl man/Makefile BUILD/Makefile vio/Makefile dnl libmysql/Makefile client/Makefile dnl pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl diff --git a/dbug/dbug_add_tags.pl b/dbug/dbug_add_tags.pl index 141a2ed85f1..df913e650cb 100755 --- a/dbug/dbug_add_tags.pl +++ b/dbug/dbug_add_tags.pl @@ -1,5 +1,20 @@ #!/usr/bin/perl +# Copyright (C) 2002 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; version 2 of the License. +# +# 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 + die "No files specified\n" unless $ARGV[0]; $ctags="exctags -x -f - --c-types=f -u"; diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index 981f679f785..f3b541dfa0c 100755 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 diff --git a/extra/yassl/Makefile.am b/extra/yassl/Makefile.am index 35946e002c4..87be92f07e4 100644 --- a/extra/yassl/Makefile.am +++ b/extra/yassl/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (C) 2005, 2006 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; version 2 of the License. +# +# 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 + SUBDIRS = taocrypt src testsuite EXTRA_DIST = yassl.dsp yassl.dsw CMakeLists.txt diff --git a/extra/yassl/examples/client/client.cpp b/extra/yassl/examples/client/client.cpp index 6c3cdf04dc1..a80a8c2f1a2 100644 --- a/extra/yassl/examples/client/client.cpp +++ b/extra/yassl/examples/client/client.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* client.cpp */ #include "../../testsuite/test.hpp" diff --git a/extra/yassl/examples/echoclient/echoclient.cpp b/extra/yassl/examples/echoclient/echoclient.cpp index e2c33c7cda2..787e554f8bf 100644 --- a/extra/yassl/examples/echoclient/echoclient.cpp +++ b/extra/yassl/examples/echoclient/echoclient.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* echoclient.cpp */ #include "../../testsuite/test.hpp" diff --git a/extra/yassl/examples/echoserver/echoserver.cpp b/extra/yassl/examples/echoserver/echoserver.cpp index 92613744ba0..a3ba8c12c60 100644 --- a/extra/yassl/examples/echoserver/echoserver.cpp +++ b/extra/yassl/examples/echoserver/echoserver.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* echoserver.cpp */ #include "../../testsuite/test.hpp" diff --git a/extra/yassl/examples/server/server.cpp b/extra/yassl/examples/server/server.cpp index 75ce4224770..8b8066eace5 100644 --- a/extra/yassl/examples/server/server.cpp +++ b/extra/yassl/examples/server/server.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* server.cpp */ diff --git a/extra/yassl/include/lock.hpp b/extra/yassl/include/lock.hpp index 99829b0b6de..ae875001633 100644 --- a/extra/yassl/include/lock.hpp +++ b/extra/yassl/include/lock.hpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 MySQL AB + Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/extra/yassl/include/openssl/crypto.h b/extra/yassl/include/openssl/crypto.h index f53e5231027..22bbbbf594e 100644 --- a/extra/yassl/include/openssl/crypto.h +++ b/extra/yassl/include/openssl/crypto.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2005, 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* crypto.h for openSSL */ #ifndef ysSSL_crypto_h__ diff --git a/extra/yassl/include/openssl/des.h b/extra/yassl/include/openssl/des.h index 67be7eecfb9..6e2ebbd83f5 100644 --- a/extra/yassl/include/openssl/des.h +++ b/extra/yassl/include/openssl/des.h @@ -1 +1,19 @@ +/* + Copyright (C) 2005 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* des.h for openssl */ diff --git a/extra/yassl/include/openssl/des_old.h b/extra/yassl/include/openssl/des_old.h index 40e8fbc02af..1223a38056c 100644 --- a/extra/yassl/include/openssl/des_old.h +++ b/extra/yassl/include/openssl/des_old.h @@ -1 +1,19 @@ +/* + Copyright (C) 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* des_old.h for openvn */ diff --git a/extra/yassl/include/openssl/engine.h b/extra/yassl/include/openssl/engine.h index 39952fcae84..cadb05a92b4 100644 --- a/extra/yassl/include/openssl/engine.h +++ b/extra/yassl/include/openssl/engine.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* engine.h for libcurl */ #undef HAVE_OPENSSL_ENGINE_H diff --git a/extra/yassl/include/openssl/err.h b/extra/yassl/include/openssl/err.h index 45ac1ca2469..23f2f1393ab 100644 --- a/extra/yassl/include/openssl/err.h +++ b/extra/yassl/include/openssl/err.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2005, 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* err.h for openssl */ #ifndef yaSSL_err_h__ diff --git a/extra/yassl/include/openssl/evp.h b/extra/yassl/include/openssl/evp.h index 1d66b08df46..eccdcdffda6 100644 --- a/extra/yassl/include/openssl/evp.h +++ b/extra/yassl/include/openssl/evp.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* evp.h for openSSL */ #ifndef SSLEAY_NUMBER_DEFINED diff --git a/extra/yassl/include/openssl/generate_prefix_files.pl b/extra/yassl/include/openssl/generate_prefix_files.pl index da591b31332..f74d79c8143 100755 --- a/extra/yassl/include/openssl/generate_prefix_files.pl +++ b/extra/yassl/include/openssl/generate_prefix_files.pl @@ -1,4 +1,20 @@ #!/usr/bin/perl + +# Copyright (C) 2006 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; version 2 of the License. +# +# 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 + # # This script generates defines for all functions # in yassl/include/openssl/ so they are renamed to diff --git a/extra/yassl/include/openssl/hmac.h b/extra/yassl/include/openssl/hmac.h index a2eae4c08c1..478d92e087d 100644 --- a/extra/yassl/include/openssl/hmac.h +++ b/extra/yassl/include/openssl/hmac.h @@ -1 +1,19 @@ +/* + Copyright (C) 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* hmac.h for openvpn */ diff --git a/extra/yassl/include/openssl/lhash.h b/extra/yassl/include/openssl/lhash.h index 01f8535f869..34bc34c3f11 100644 --- a/extra/yassl/include/openssl/lhash.h +++ b/extra/yassl/include/openssl/lhash.h @@ -1,2 +1,20 @@ +/* + Copyright (C) 2005 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* lhash.h for openSSL */ diff --git a/extra/yassl/include/openssl/md4.h b/extra/yassl/include/openssl/md4.h index 2e99f977fca..2718d170fcf 100644 --- a/extra/yassl/include/openssl/md4.h +++ b/extra/yassl/include/openssl/md4.h @@ -1 +1,19 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* md4.h for libcurl */ diff --git a/extra/yassl/include/openssl/md5.h b/extra/yassl/include/openssl/md5.h index dfaf9799c44..9400649ebd8 100644 --- a/extra/yassl/include/openssl/md5.h +++ b/extra/yassl/include/openssl/md5.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2005, 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* md5.h for openssl */ #include "ssl.h" /* in there for now */ diff --git a/extra/yassl/include/openssl/objects.h b/extra/yassl/include/openssl/objects.h index 99f2326e51b..ec00e04e213 100644 --- a/extra/yassl/include/openssl/objects.h +++ b/extra/yassl/include/openssl/objects.h @@ -1 +1,19 @@ +/* + Copyright (C) 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* objects.h for openvpn */ diff --git a/extra/yassl/include/openssl/opensslv.h b/extra/yassl/include/openssl/opensslv.h index d932130684f..bafcfaec8a3 100644 --- a/extra/yassl/include/openssl/opensslv.h +++ b/extra/yassl/include/openssl/opensslv.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2005 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* opensslv.h compatibility */ #ifndef yaSSL_opensslv_h__ diff --git a/extra/yassl/include/openssl/pem.h b/extra/yassl/include/openssl/pem.h index b4c63d56a4d..3762b9597a4 100644 --- a/extra/yassl/include/openssl/pem.h +++ b/extra/yassl/include/openssl/pem.h @@ -1 +1,19 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* pem.h for libcurl */ diff --git a/extra/yassl/include/openssl/pkcs12.h b/extra/yassl/include/openssl/pkcs12.h index e452fc879c4..71ba287ede0 100644 --- a/extra/yassl/include/openssl/pkcs12.h +++ b/extra/yassl/include/openssl/pkcs12.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* pkcs12.h for libcurl */ diff --git a/extra/yassl/include/openssl/prefix_crypto.h b/extra/yassl/include/openssl/prefix_crypto.h index 3fa5f32c627..ff3aea14b0e 100644 --- a/extra/yassl/include/openssl/prefix_crypto.h +++ b/extra/yassl/include/openssl/prefix_crypto.h @@ -1 +1,19 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + #define SSLeay_version yaSSLeay_version diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h index 3a3a8c26c9c..5906ecbbbce 100644 --- a/extra/yassl/include/openssl/prefix_ssl.h +++ b/extra/yassl/include/openssl/prefix_ssl.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006, 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + #define Copyright yaCopyright #define yaSSL_CleanUp yayaSSL_CleanUp #define BN_bin2bn yaBN_bin2bn diff --git a/extra/yassl/include/openssl/rand.h b/extra/yassl/include/openssl/rand.h index df9c9020346..136a01459e2 100644 --- a/extra/yassl/include/openssl/rand.h +++ b/extra/yassl/include/openssl/rand.h @@ -1,2 +1,20 @@ +/* + Copyright (C) 2005 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* rand.h for openSSL */ diff --git a/extra/yassl/include/openssl/rsa.h b/extra/yassl/include/openssl/rsa.h index fe64e655bdc..b20da32be24 100644 --- a/extra/yassl/include/openssl/rsa.h +++ b/extra/yassl/include/openssl/rsa.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2005, 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* rsa.h for openSSL */ diff --git a/extra/yassl/include/openssl/sha.h b/extra/yassl/include/openssl/sha.h index bb487c05c2e..79b46ec83ce 100644 --- a/extra/yassl/include/openssl/sha.h +++ b/extra/yassl/include/openssl/sha.h @@ -1 +1,19 @@ +/* + Copyright (C) 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* sha.h for openvpn */ diff --git a/extra/yassl/include/openssl/x509.h b/extra/yassl/include/openssl/x509.h index dcd847c0337..eb60bcbc0a6 100644 --- a/extra/yassl/include/openssl/x509.h +++ b/extra/yassl/include/openssl/x509.h @@ -1 +1,19 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* x509.h for libcurl */ diff --git a/extra/yassl/include/openssl/x509v3.h b/extra/yassl/include/openssl/x509v3.h index adf94af8f48..1215826f53f 100644 --- a/extra/yassl/include/openssl/x509v3.h +++ b/extra/yassl/include/openssl/x509v3.h @@ -1 +1,19 @@ +/* + Copyright (C) 2006 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + /* x509v3.h for libcurl */ diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am index d192eb03b49..7db36f652ac 100644 --- a/extra/yassl/src/Makefile.am +++ b/extra/yassl/src/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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 + INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL noinst_LTLIBRARIES = libyassl.la diff --git a/extra/yassl/src/lock.cpp b/extra/yassl/src/lock.cpp index 6e85fefa14d..9eb41408ff7 100644 --- a/extra/yassl/src/lock.cpp +++ b/extra/yassl/src/lock.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 MySQL AB + Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/extra/yassl/src/make.bat b/extra/yassl/src/make.bat index dde305721a7..cccd11dbd17 100644 --- a/extra/yassl/src/make.bat +++ b/extra/yassl/src/make.bat @@ -1,3 +1,18 @@ +REM Copyright (C) 2006, 2007 MySQL AB +REM +REM This program is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; version 2 of the License. +REM +REM This program is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with this program; if not, write to the Free Software +REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + REM quick and dirty build file for testing different MSDEVs setlocal diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index c8faeac3b77..5965f0d29d0 100755 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 diff --git a/extra/yassl/taocrypt/Makefile.am b/extra/yassl/taocrypt/Makefile.am index c03c1a2713b..37a884e4deb 100644 --- a/extra/yassl/taocrypt/Makefile.am +++ b/extra/yassl/taocrypt/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (C) 2005, 2006 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; version 2 of the License. +# +# 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 + SUBDIRS = src test benchmark EXTRA_DIST = taocrypt.dsw taocrypt.dsp CMakeLists.txt $(wildcard mySTL/*.hpp) diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am index 1f082f22f40..32fe504734d 100644 --- a/extra/yassl/taocrypt/benchmark/Makefile.am +++ b/extra/yassl/taocrypt/benchmark/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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 + INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL noinst_PROGRAMS = benchmark benchmark_SOURCES = benchmark.cpp diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp index bb725a90187..55e94275b20 100644 --- a/extra/yassl/taocrypt/benchmark/benchmark.cpp +++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006, 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + // benchmark.cpp // TaoCrypt benchmark diff --git a/extra/yassl/taocrypt/benchmark/make.bat b/extra/yassl/taocrypt/benchmark/make.bat index bf1383f5e97..1457521bce9 100644 --- a/extra/yassl/taocrypt/benchmark/make.bat +++ b/extra/yassl/taocrypt/benchmark/make.bat @@ -1,3 +1,18 @@ +REM Copyright (C) 2006, 2007 MySQL AB +REM +REM This program is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; version 2 of the License. +REM +REM This program is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with this program; if not, write to the Free Software +REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + REM quick and dirty build file for testing different MSDEVs setlocal diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am index 6ca969ad686..760205a625c 100644 --- a/extra/yassl/taocrypt/src/Makefile.am +++ b/extra/yassl/taocrypt/src/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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 + INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL noinst_LTLIBRARIES = libtaocrypt.la diff --git a/extra/yassl/taocrypt/src/make.bat b/extra/yassl/taocrypt/src/make.bat index 0aa1350f7d8..ecd3023f5ab 100644 --- a/extra/yassl/taocrypt/src/make.bat +++ b/extra/yassl/taocrypt/src/make.bat @@ -1,3 +1,18 @@ +REM Copyright (C) 2006, 2007 MySQL AB +REM +REM This program is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; version 2 of the License. +REM +REM This program is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with this program; if not, write to the Free Software +REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + REM quick and dirty build file for testing different MSDEVs setlocal diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am index aa325ff9b75..87f35f2f78e 100644 --- a/extra/yassl/taocrypt/test/Makefile.am +++ b/extra/yassl/taocrypt/test/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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 + INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../mySTL noinst_PROGRAMS = test test_SOURCES = test.cpp diff --git a/extra/yassl/taocrypt/test/make.bat b/extra/yassl/taocrypt/test/make.bat index 7b53e9abc90..d6d62b984a8 100644 --- a/extra/yassl/taocrypt/test/make.bat +++ b/extra/yassl/taocrypt/test/make.bat @@ -1,3 +1,18 @@ +REM Copyright (C) 2006, 2007 MySQL AB +REM +REM This program is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; version 2 of the License. +REM +REM This program is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with this program; if not, write to the Free Software +REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + REM quick and dirty build file for testing different MSDEVs setlocal diff --git a/extra/yassl/taocrypt/test/memory.cpp b/extra/yassl/taocrypt/test/memory.cpp index a879a497800..bac8f9c2e97 100644 --- a/extra/yassl/taocrypt/test/memory.cpp +++ b/extra/yassl/taocrypt/test/memory.cpp @@ -1,3 +1,21 @@ +/* + Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + // memory.cpp #include "../../include/lock.hpp" // locking #include // std::bad_alloc diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp index 0af278404ab..f8177b31e2f 100644 --- a/extra/yassl/taocrypt/test/test.cpp +++ b/extra/yassl/taocrypt/test/test.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006, 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + // test.cpp // test taocrypt functionality diff --git a/extra/yassl/testsuite/Makefile.am b/extra/yassl/testsuite/Makefile.am index e626b1822ec..081b76401fa 100644 --- a/extra/yassl/testsuite/Makefile.am +++ b/extra/yassl/testsuite/Makefile.am @@ -1,3 +1,18 @@ +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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; version 2 of the License. +# +# 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 + INCLUDES = -I$(srcdir)/../include -I$(srcdir)/../taocrypt/include -I$(srcdir)/../taocrypt/mySTL noinst_PROGRAMS = testsuite testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \ diff --git a/extra/yassl/testsuite/make.bat b/extra/yassl/testsuite/make.bat index ea2677db481..941e499d7e6 100644 --- a/extra/yassl/testsuite/make.bat +++ b/extra/yassl/testsuite/make.bat @@ -1,3 +1,18 @@ +REM Copyright (C) 2006, 2007 MySQL AB +REM +REM This program is free software; you can redistribute it and/or modify +REM it under the terms of the GNU General Public License as published by +REM the Free Software Foundation; version 2 of the License. +REM +REM This program is distributed in the hope that it will be useful, +REM but WITHOUT ANY WARRANTY; without even the implied warranty of +REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +REM GNU General Public License for more details. +REM +REM You should have received a copy of the GNU General Public License +REM along with this program; if not, write to the Free Software +REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + REM quick and dirty build file for testing different MSDEVs setlocal diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp index c921f8f9c69..4555080f84c 100644 --- a/extra/yassl/testsuite/test.hpp +++ b/extra/yassl/testsuite/test.hpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006, 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + // test.hpp #ifndef yaSSL_TEST_HPP diff --git a/extra/yassl/testsuite/testsuite.cpp b/extra/yassl/testsuite/testsuite.cpp index 3cd832ebb03..5ddb9bb4dab 100644 --- a/extra/yassl/testsuite/testsuite.cpp +++ b/extra/yassl/testsuite/testsuite.cpp @@ -1,3 +1,21 @@ +/* + Copyright (C) 2006, 2007 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + // testsuite.cpp #include "test.hpp" diff --git a/heap/hp_delete.c b/heap/hp_delete.c index e5c8dfcef01..6f27b88d203 100644 --- a/heap/hp_delete.c +++ b/heap/hp_delete.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2002, 2004-200 MySQL AB +/* Copyright (C) 2000-2002, 2004-2007 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 diff --git a/include/Makefile.am b/include/Makefile.am index c856b6398fe..06d7efe754b 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,11 +1,11 @@ # Copyright (C) 2000-2006 MySQL AB # -# This library is free software; you can redistribute it and/or +# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # -# This library is distributed in the hope that it will be useful, +# 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 # Library General Public License for more details. @@ -26,7 +26,7 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \ my_getopt.h sslopt-longopts.h my_dir.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ m_ctype.h my_attribute.h $(HEADERS_GEN) -noinst_HEADERS = config-win.h config-os2.h config-netware.h \ +noinst_HEADERS = config-win.h config-netware.h \ heap.h my_bitmap.h\ myisam.h myisampack.h myisammrg.h ft_global.h\ mysys_err.h my_base.h help_start.h help_end.h \ diff --git a/include/config-os2.h b/include/config-os2.h deleted file mode 100644 index 8e2d0e2e836..00000000000 --- a/include/config-os2.h +++ /dev/null @@ -1,835 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & Yuri Dario - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/* Defines for OS2 to make it compatible for MySQL */ - -#ifndef __CONFIG_OS2_H__ -#define __CONFIG_OS2_H__ - -#include -#include -#include -#include - -/* Define to name of system eg solaris*/ -#define SYSTEM_TYPE "IBM OS/2 Warp" -/* Define to machine type name eg sun10 */ -#define MACHINE_TYPE "i686" -/* Name of package */ -#define PACKAGE "mysql" -/* Version number of package */ -#define VERSION MYSQL_SERVER_VERSION -/* Default socket */ -#define MYSQL_UNIX_ADDR "\\socket\\MySQL" - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define MY_NFILE 1024 /* This is only used to save filenames */ - -#define HAVE_ACCESS - -#define DEFAULT_MYSQL_HOME "c:\\mysql" -#define DEFAULT_BASEDIR "C:\\" -#define SHAREDIR "share" -#define DEFAULT_CHARSET_HOME "C:/mysql/" -#define _POSIX_PATH_MAX 255 -#define DWORD ULONG - -#define O_SHARE 0x1000 /* Open file in sharing mode */ -#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ -#define S_IROTH S_IREAD /* for my_lib */ - -#define CANT_DELETE_OPEN_FILES /* saves open files in a list, for delayed delete */ - -#define O_NONBLOCK 0x10 - -#define NO_OPEN_3 /* For my_create() */ -#define SIGQUIT SIGTERM /* No SIGQUIT */ -#define SIGALRM 14 /* Alarm */ - -#define NO_FCNTL_NONBLOCK - -#define EFBIG E2BIG -/*#define ENFILE EMFILE */ -/*#define ENAMETOOLONG (EOS2ERR+2) */ -/*#define ETIMEDOUT 145 */ -/*#define EPIPE 146 */ -#define EROFS 147 - -#define sleep(A) DosSleep((A)*1000) -#define closesocket(A) soclose(A) - -#define F_OK 0 -#define W_OK 2 - -#define bzero(x,y) memset((x),'\0',(y)) -#define bcopy(x,y,z) memcpy((y),(x),(z)) -#define bcmp(x,y,z) memcmp((y),(x),(z)) - -#define F_RDLCK 4 /* Read lock. */ -#define F_WRLCK 2 /* Write lock. */ -#define F_UNLCK 0 /* Remove lock. */ - -#define S_IFMT 0x17000 /* Mask for file type */ -#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ - -#define HUGE_PTR - -#ifdef __cplusplus -extern "C" -#endif -double _cdecl rint( double nr); - -DWORD TlsAlloc( void); -BOOL TlsFree( DWORD); -PVOID TlsGetValue( DWORD); -BOOL TlsSetValue( DWORD, PVOID); - -/* support for > 2GB file size */ -#define SIZEOF_OFF_T 8 -#define lseek(A,B,C) _lseek64( A, B, C) -#define tell(A) _lseek64( A, 0, SEEK_CUR) - -void* dlopen( char* path, int flag); -char* dlerror( void); -void* dlsym( void* hmod, char* fn); -void dlclose( void* hmod); - -/* Some typedefs */ -typedef unsigned long long os_off_t; - -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -/* #undef C_ALLOCA */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -/* #undef CRAY_STACKSEG_END */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have and it should be used (not on Ultrix). */ -/* #define HAVE_ALLOCA_H 1 */ - -/* Define if you don't have vprintf but do have _doprnt. */ -/* #undef HAVE_DOPRNT */ - -/* Define if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define if system calls automatically restart after interruption - by a signal. */ -/* #undef HAVE_RESTARTABLE_SYSCALLS */ - -/* Define if your struct stat has st_rdev. */ -#define HAVE_ST_RDEV 1 - -/* Define if you have that is POSIX.1 compatible. */ -/* #define HAVE_SYS_WAIT_H 1 */ - -/* Define if you don't have tm_zone but do have the external array - tzname. */ -#define HAVE_TZNAME 1 - -/* Define if utime(file, NULL) sets file's timestamp to the present. */ -#define HAVE_UTIME_NULL 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `long' if doesn't define. */ -/* #undef off_t */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define to `unsigned' if doesn't define. */ -/* #undef size_t */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#define STACK_DIRECTION -1 - -/* Define if the `S_IS*' macros in do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if your declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Version of .frm files */ -#define DOT_FRM_VERSION 6 - -/* READLINE: */ -#define FIONREAD_IN_SYS_IOCTL 1 - -/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ -/* #undef GWINSZ_IN_SYS_IOCTL */ - -/* Do we have FIONREAD */ -#define FIONREAD_IN_SYS_IOCTL 1 - -/* atomic_add() from (Linux only) */ -/* #undef HAVE_ATOMIC_ADD */ - -/* atomic_sub() from (Linux only) */ -/* #undef HAVE_ATOMIC_SUB */ - -/* bool is not defined by all C++ compilators */ -#define HAVE_BOOL 1 - -/* Have berkeley db installed */ -/* #define HAVE_BERKELEY_DB 1 */ - -/* DSB style signals ? */ -/* #undef HAVE_BSD_SIGNALS */ - -/* Can netinet be included */ -/* #undef HAVE_BROKEN_NETINET_INCLUDES */ - -/* READLINE: */ -/* #undef HAVE_BSD_SIGNALS */ - -/* ZLIB and compress: */ -#define HAVE_COMPRESS 1 - -/* Define if we are using OSF1 DEC threads */ -/* #undef HAVE_DEC_THREADS */ - -/* Define if we are using OSF1 DEC threads on 3.2 */ -/* #undef HAVE_DEC_3_2_THREADS */ - -/* fp_except from ieeefp.h */ -/* #undef HAVE_FP_EXCEPT */ - -/* READLINE: */ -/* #undef HAVE_GETPW_DECLS */ - -/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines - this with 6 arguments */ -/* #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE */ - -/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */ -/* #undef HAVE_GETHOSTBYNAME_R_RETURN_INT */ - -/* Define if int8, int16 and int32 types exist */ -/* #undef HAVE_INT_8_16_32 */ - -/* Define if have -lwrap */ -/* #undef HAVE_LIBWRAP */ - -/* Define if we are using Xavier Leroy's LinuxThreads */ -/* #undef HAVE_LINUXTHREADS */ - -/* Do we use user level threads */ -/* #undef HAVE_mit_thread */ - -/* For some non posix threads */ -/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */ - -/* For some non posix threads */ -/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ - -/* READLINE: */ -#define HAVE_POSIX_SIGNALS 0 - -/* sigwait with one argument */ -/* #undef HAVE_NONPOSIX_SIGWAIT */ - -/* pthread_attr_setscope */ -#define HAVE_PTHREAD_ATTR_SETSCOPE 1 - -/* POSIX readdir_r */ -/* #undef HAVE_READDIR_R */ - -/* POSIX sigwait */ -/* #undef HAVE_SIGWAIT */ - -/* crypt */ -#define HAVE_CRYPT 1 - -/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines - this with 8 arguments */ -/* #undef HAVE_SOLARIS_STYLE_GETHOST */ - -/* Timespec has a ts_sec instead of tv_sev */ -#define HAVE_TIMESPEC_TS_SEC 1 - -/* Have the tzname variable */ -#define HAVE_TZNAME 1 - -/* Define if the system files define uchar */ -/* #undef HAVE_UCHAR */ - -/* Define if the system files define uint */ -/* #undef HAVE_UINT */ - -/* Define if the system files define ulong */ -/* #undef HAVE_ULONG */ - -/* UNIXWARE7 threads are not posix */ -/* #undef HAVE_UNIXWARE7_THREADS */ - -/* new UNIXWARE7 threads that are not yet posix */ -/* #undef HAVE_UNIXWARE7_POSIX */ - -/* READLINE: */ -/* #undef HAVE_USG_SIGHOLD */ - -/* Define if want -lwrap */ -/* #undef LIBWRAP */ - -/* mysql client protocoll version */ -#define PROTOCOL_VERSION 10 - -/* Define if qsort returns void */ -#define QSORT_TYPE_IS_VOID 1 - -/* Define as the return type of qsort (int or void). */ -#define RETQSORTTYPE void - -/* Define as the base type of the last arg to accept */ -#define SOCKET_SIZE_TYPE int - -/* Last argument to get/setsockopt */ -/* #undef SOCKOPT_OPTLEN_TYPE */ - -/* #undef SPEED_T_IN_SYS_TYPES */ -/* #undef SPRINTF_RETURNS_PTR */ -#define SPRINTF_RETURNS_INT 1 -/* #undef SPRINTF_RETURNS_GARBAGE */ - -/* #undef STRUCT_DIRENT_HAS_D_FILENO */ -#define STRUCT_DIRENT_HAS_D_INO 1 - -/* Define if you want to have threaded code. This may be undef on client code */ -#define THREAD 1 - -/* Should be client be thread safe */ -/* #undef THREAD_SAFE_CLIENT */ - -/* READLINE: */ -/* #undef TIOCSTAT_IN_SYS_IOCTL */ - -/* Use multi-byte character routines */ -/* #undef USE_MB */ -/* #undef USE_MB_IDENT */ - -/* Use MySQL RAID */ -/* #undef USE_RAID */ - -/* Use strcoll() functions when comparing and sorting. */ -/* #undef USE_STRCOLL */ - -/* READLINE: */ -#define VOID_SIGHANDLER 1 - -/* The number of bytes in a char. */ -#define SIZEOF_CHAR 1 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* Define if you have the alarm function. */ -#define HAVE_ALARM 1 - -/* Define if you have the atod function. */ -/* #undef HAVE_ATOD */ - -/* Define if you have the bcmp function. */ -#define HAVE_BCMP 1 - -/* Define if you have the bfill function. */ -/* #undef HAVE_BFILL */ - -/* Define if you have the bmove function. */ -/* #undef HAVE_BMOVE */ - -/* Define if you have the bzero function. */ -#define HAVE_BZERO 1 - -/* Define if you have the chsize function. */ -#define HAVE_CHSIZE 1 - -/* Define if you have the cuserid function. */ -/* #define HAVE_CUSERID 1 */ - -/* Define if you have the dlerror function. */ -#define HAVE_DLERROR 1 - -/* Define if you have the dlopen function. */ -#define HAVE_DLOPEN 1 - -/* Define if you have the fchmod function. */ -/* #undef HAVE_FCHMOD */ - -/* Define if you have the fcntl function. */ -/* #define HAVE_FCNTL 1 */ - -/* Define if you have the fconvert function. */ -/* #undef HAVE_FCONVERT */ - -/* Define if you have the finite function. */ -/* #undef HAVE_FINITE */ - -/* Define if you have the fpresetsticky function. */ -/* #undef HAVE_FPRESETSTICKY */ - -/* Define if you have the fpsetmask function. */ -/* #undef HAVE_FPSETMASK */ - -/* Define if you have the fseeko function. */ -/* #undef HAVE_FSEEKO */ - -/* Define if you have the ftruncate function. */ -/* #define HAVE_FTRUNCATE 1 */ - -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the gethostbyaddr_r function. */ -/* #undef HAVE_GETHOSTBYADDR_R */ - -/* Define if you have the gethostbyname_r function. */ -/* #undef HAVE_GETHOSTBYNAME_R */ - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the getpass function. */ -/*#define HAVE_GETPASS 1 */ - -/* Define if you have the getpassphrase function. */ -/* #undef HAVE_GETPASSPHRASE */ - -/* Define if you have the getpwnam function. */ -/* #define HAVE_GETPWNAM 1 */ - -/* Define if you have the getpwuid function. */ -/* #define HAVE_GETPWUID 1 */ - -/* Define if you have the getrlimit function. */ -/* #undef HAVE_GETRLIMIT */ - -/* Define if you have the getrusage function. */ -/* #undef HAVE_GETRUSAGE */ - -/* Define if you have the getwd function. */ -#define HAVE_GETWD 1 - -/* Define to 1 if you have the `gmtime_r' function. */ -#define HAVE_GMTIME_R 1 - -/* Define if you have the index function. */ -#define HAVE_INDEX 1 - -/* Define if you have the initgroups function. */ -/* #undef HAVE_INITGROUPS */ - -/* Define if you have the localtime_r function. */ -#define HAVE_LOCALTIME_R 1 - -/* Define if you have the locking function. */ -/* #undef HAVE_LOCKING */ - -/* Define if you have the longjmp function. */ -#define HAVE_LONGJMP 1 - -/* Define if you have the lrand48 function. */ -/* #undef HAVE_LRAND48 */ - -/* Define if you have the lstat function. */ -/* #undef HAVE_LSTAT */ - -/* Define if you have the madvise function. */ -/* #undef HAVE_MADVISE */ - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the mkstemp function. */ -/* #define HAVE_MKSTEMP 1 */ - -/* Define if you have the mlockall function. */ -/* #undef HAVE_MLOCKALL */ - -/* Define if you have the perror function. */ -#define HAVE_PERROR 1 - -/* Define if you have the poll function. */ -/* #undef HAVE_POLL */ - -/* Define if you have the pread function. */ -/* #undef HAVE_PREAD */ - -/* Define if you have the pthread_attr_create function. */ -/* #undef HAVE_PTHREAD_ATTR_CREATE */ - -/* Define if you have the pthread_attr_setprio function. */ -#define HAVE_PTHREAD_ATTR_SETPRIO 1 - -/* Define if you have the pthread_attr_setschedparam function. */ -/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */ - -/* Define if you have the pthread_attr_setstacksize function. */ -#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 - -/* Define if you have the pthread_condattr_create function. */ -/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ - -/* Define if you have the pthread_getsequence_np function. */ -/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */ - -/* Define if you have the pthread_init function. */ -/* #undef HAVE_PTHREAD_INIT */ - -/* Define if you have the pthread_rwlock_rdlock function. */ -/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ - -/* Define if you have the pthread_setprio function. */ -#define HAVE_PTHREAD_SETPRIO 1 - -/* Define if you have the pthread_setprio_np function. */ -/* #undef HAVE_PTHREAD_SETPRIO_NP */ - -/* Define if you have the pthread_setschedparam function. */ -/* #undef HAVE_PTHREAD_SETSCHEDPARAM */ - -/* Define if you have the pthread_sigmask function. */ -#define HAVE_PTHREAD_SIGMASK 1 - -/* Define if you have the putenv function. */ -#define HAVE_PUTENV 1 - -/* Define if you have the readlink function. */ -/* #undef HAVE_READLINK */ - -/* Define if you have the realpath function. */ -/* #undef HAVE_REALPATH */ - -/* Define if you have the rename function. */ -#define HAVE_RENAME 1 - -/* Define if you have the rint function. */ -#define HAVE_RINT 1 - -/* Define if you have the rwlock_init function. */ -/* #undef HAVE_RWLOCK_INIT */ - -/* Define if you have the select function. */ -#define HAVE_SELECT 1 - -/* Define if you have the setenv function. */ -/* #undef HAVE_SETENV */ - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the setupterm function. */ -/* #undef HAVE_SETUPTERM */ - -/* Define if you have the sighold function. */ -/* #undef HAVE_SIGHOLD */ - -/* Define if you have the sigset function. */ -/* #undef HAVE_SIGSET */ - -/* Define if you have the sigthreadmask function. */ -/* #undef HAVE_SIGTHREADMASK */ - -/* Define if you have the snprintf function. */ -/* #define HAVE_SNPRINTF 1 */ - -/* Define if you have the socket function. */ -#define HAVE_SOCKET 1 - -/* Define if you have the stpcpy function. */ -/* #undef HAVE_STPCPY */ - -/* Define if you have the strcasecmp function. */ -/* #undef HAVE_STRCASECMP */ - -/* Define if you have the strcoll function. */ -#define HAVE_STRCOLL 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strnlen function. */ -/* #undef HAVE_STRNLEN */ - -/* Define if you have the strpbrk function. */ -#define HAVE_STRPBRK 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the strtok_r function. */ -/* #undef HAVE_STRTOK_R */ - -/* Define if you have the strtol function. */ -#define HAVE_STRTOL 1 - -/* Define if you have the strtoul function. */ -#define HAVE_STRTOUL 1 - -/* Define if you have the strtoull function. */ -/* #undef HAVE_STRTOULL */ - -/* Define if you have the tcgetattr function. */ -#define HAVE_TCGETATTR 1 - -/* Define if you have the tell function. */ -#define HAVE_TELL 1 - -/* Define if you have the tempnam function. */ -#define HAVE_TEMPNAM 1 - -/* Define if you have the thr_setconcurrency function. */ -/* #undef HAVE_THR_SETCONCURRENCY */ - -/* Define if you have the vidattr function. */ -/* #undef HAVE_VIDATTR */ - -/* Define if you have the header file. */ -/* #define HAVE_ALLOCA_H 1 */ - -/* Define if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_ASM_TERMBITS_H */ - -/* Define if you have the header file. */ -#define HAVE_CRYPT_H 1 - -/* Define if you have the header file. */ -/* #define HAVE_CURSES_H 1 */ - -/* Define if you have the header file. */ -/* #define HAVE_DIRENT_H 1 */ - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_FLOAT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_FLOATINGPOINT_H */ - -/* Define if you have the header file. */ -/* #define HAVE_GRP_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_IEEEFP_H */ - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_PATHS_H */ - -/* Define if you have the header file. */ -/* #define HAVE_PWD_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_SCHED_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SELECT_H */ - -/* Define if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -/* #define HAVE_STRINGS_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYNCH_H */ - -/* Define if you have the header file. */ -/* #define HAVE_SYS_DIR_H 1 */ - -/* Define if you have the header file. */ -/* #define HAVE_SYS_FILE_H 1 */ - -/* Define if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_MMAN_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_PTE_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_PTEM_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_STREAM_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_UN_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_UTIME_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_VADVISE_H */ - -/* Define if you have the header file. */ -/* #define HAVE_SYS_WAIT_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_TERM_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_TERMBITS_H */ - -/* Define if you have the header file. */ -/* #define HAVE_TERMCAP_H 1 */ - -/* Define if you have the header file. */ -/* /#define HAVE_TERMIO_H 1 */ - -/* Define if you have the header file. */ -/* #define HAVE_TERMIOS_H 1 */ - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the header file. */ -#define HAVE_UTIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_VARARGS_H 1 - -/* Define if you have the bind library (-lbind). */ -/* #undef HAVE_LIBBIND */ - -/* Define if you have the c_r library (-lc_r). */ -/* #undef HAVE_LIBC_R */ - -/* Define if you have the compat library (-lcompat). */ -/* #undef HAVE_LIBCOMPAT */ - -/* Define if you have the crypt library (-lcrypt). */ -#define HAVE_LIBCRYPT 1 - -/* Define if you have the dl library (-ldl). */ -#define HAVE_LIBDL 1 - -/* Define if you have the gen library (-lgen). */ -/* #undef HAVE_LIBGEN */ - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* Define if you have the nsl library (-lnsl). */ -/* #undef HAVE_LIBNSL */ - -/* Define if you have the nsl_r library (-lnsl_r). */ -/* #undef HAVE_LIBNSL_R */ - -/* Define if you have the pthread library (-lpthread). */ -/* #undef HAVE_LIBPTHREAD */ - -/* Define if you have the socket library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define to make fseeko etc. visible, on some hosts. */ -/* #undef _LARGEFILE_SOURCE */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -#endif /* __CONFIG_OS2_H__ */ diff --git a/include/my_handler.h b/include/my_handler.h index d7cd0567f9c..20cc90e4a8f 100644 --- a/include/my_handler.h +++ b/include/my_handler.h @@ -1,11 +1,11 @@ /* Copyright (C) 2002-2006 MySQL AB - This library is free software; you can redistribute it and/or + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License. - This library is distributed in the hope that it will be useful, + 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 Library General Public License for more details. diff --git a/include/my_sys.h b/include/my_sys.h index 40ae6924f9f..93cab0852f7 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/include/mysql_com.h b/include/mysql_com.h index 2eeec270cd0..9d29ee1e724 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/libmysqld/copyright b/libmysqld/copyright deleted file mode 100644 index 0b4dd1725a2..00000000000 --- a/libmysqld/copyright +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2000 - * SWsoft company - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ diff --git a/libmysqld/examples/test-run b/libmysqld/examples/test-run index aea5b13eaba..1667280a986 100755 --- a/libmysqld/examples/test-run +++ b/libmysqld/examples/test-run @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 2001, 2006 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; version 2 of the License. +# +# 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 + # This is slapped together as a quick way to run the tests and # is not meant for prime time. Please hack at it and submit # changes, though, so we can gradually turn it into something diff --git a/man/Makefile.am b/man/Makefile.am index 7fdfc297f96..8a3228b4630 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,11 +1,11 @@ # Copyright (C) 2000-2001, 2003-2006 MySQL AB # -# This library is free software; you can redistribute it and/or +# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # -# This library is distributed in the hope that it will be useful, +# 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 # Library General Public License for more details. diff --git a/myisam/ftbench/Ecompare.pl b/myisam/ftbench/Ecompare.pl index 265534e704d..2c50ae9b9ce 100755 --- a/myisam/ftbench/Ecompare.pl +++ b/myisam/ftbench/Ecompare.pl @@ -1,5 +1,20 @@ #!/usr/bin/perl +# 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; version 2 of the License. +# +# 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 + # compares out-files (as created by Ereport.pl) from dir1/*.out and dir2/*.out # for each effectiveness column computes the probability of the hypothesis # "Both files have the same effectiveness" diff --git a/myisam/ftbench/Ecreate.pl b/myisam/ftbench/Ecreate.pl index d90a6f7a0ad..123ca729c31 100755 --- a/myisam/ftbench/Ecreate.pl +++ b/myisam/ftbench/Ecreate.pl @@ -1,5 +1,20 @@ #!/usr/bin/perl +# 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; version 2 of the License. +# +# 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 + $test=shift || die "Usage $0 testname [option]"; $option=shift; diff --git a/myisam/ftbench/Ereport.pl b/myisam/ftbench/Ereport.pl index 5969304da09..2f63d7ea37a 100755 --- a/myisam/ftbench/Ereport.pl +++ b/myisam/ftbench/Ereport.pl @@ -1,5 +1,20 @@ #!/usr/bin/perl +# 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; version 2 of the License. +# +# 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 + die "Use: $0 eval_output qrels_file\n" unless @ARGV==2; open(EOUT,$eout=shift) || die "Cannot open $eout: $!"; diff --git a/myisam/ftbench/ft-test-run.sh b/myisam/ftbench/ft-test-run.sh index ceba818fa5c..6ef5f81c527 100755 --- a/myisam/ftbench/ft-test-run.sh +++ b/myisam/ftbench/ft-test-run.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2003 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + if [ ! -x ./ft-test-run.sh ] ; then echo "Usage: ./ft-test-run.sh" exit 1 diff --git a/myisam/mi_test_all.sh b/myisam/mi_test_all.sh index 5989d9cfaf0..812ea914464 100755 --- a/myisam/mi_test_all.sh +++ b/myisam/mi_test_all.sh @@ -1,4 +1,22 @@ #!/bin/sh + +# Copyright (C) 2000, 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # # Execute some simple basic test on MyISAM libary to check if things # works at all. diff --git a/myisam/myisampack.c b/myisam/myisampack.c index fa58211ea88..e1b9e99fc2d 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (C) 2000-2007 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 @@ -300,7 +300,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2002 MySQL AB"); + puts("Copyright (C) 2000-2007 MySQL AB"); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); puts("and you are welcome to modify and redistribute it under the GPL license\n"); diff --git a/myisam/rt_index.c b/myisam/rt_index.c index 7ac55bbb549..4df83978983 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2006 MySQL AB & Ramil Kalimullin +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index cdb2d9fd598..09f6c9d34d5 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -1,11 +1,11 @@ # Copyright (C) 2000-2006 MySQL AB # -# This library is free software; you can redistribute it and/or +# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # -# This library is distributed in the hope that it will be useful, +# 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 # Library General Public License for more details. diff --git a/mysql-test/create-test-result b/mysql-test/create-test-result index ad19cdf08a1..bfc41a6a7ce 100755 --- a/mysql-test/create-test-result +++ b/mysql-test/create-test-result @@ -1,5 +1,22 @@ #! /bin/sh +# 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 Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # This script is a hack for lazy developers who want to get a quick # start on the result file. The code here is rather dirty, but it works # If you have a spare moment feel free to improve it - the right way is diff --git a/mysql-test/fix-result b/mysql-test/fix-result index bd380332ff5..4b67ddcaff9 100755 --- a/mysql-test/fix-result +++ b/mysql-test/fix-result @@ -1,5 +1,22 @@ #! /bin/sh +# Copyright (C) 2001 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # Sasha's hack to fix results generated with mysql-test-run --record # to be version and test port independent. In some cases, further minor # manual edititing may be required, but most of the time it should not diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index b74512e5a39..90c6233e77d 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2005-2006 MySQL AB +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index ee5277d39d7..ddfce977b62 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 diff --git a/mysql-test/misc/kill_master.sh b/mysql-test/misc/kill_master.sh index 7938c9d3ac2..d272212052e 100644 --- a/mysql-test/misc/kill_master.sh +++ b/mysql-test/misc/kill_master.sh @@ -1,3 +1,20 @@ +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + kill -9 `cat var/run/master.pid` # The kill may fail if process has already gone away, # so don't use the exit code of the kill. Use 0. diff --git a/mysql-test/misc/mysql-test_V1.9.pl b/mysql-test/misc/mysql-test_V1.9.pl index 129ec41b4d5..31d12b44613 100644 --- a/mysql-test/misc/mysql-test_V1.9.pl +++ b/mysql-test/misc/mysql-test_V1.9.pl @@ -1,4 +1,22 @@ #!/usr/bin/perl + +# Copyright (C) 2000 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # # Tests MySQL. Output is given to the stderr. Use # diff to check the possible differencies. diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl index 3061506da51..e64bb69f883 100755 --- a/mysql-test/mysql-stress-test.pl +++ b/mysql-test/mysql-stress-test.pl @@ -1,4 +1,22 @@ #!/usr/bin/perl + +# Copyright (C) 2005, 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # ====================================================================== # MySQL server stress test system # ====================================================================== diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh index 7d3e871fe19..d919246f2e1 100644 --- a/mysql-test/mysql-test-run-shell.sh +++ b/mysql-test/mysql-test-run-shell.sh @@ -1,4 +1,22 @@ #!/bin/sh + +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # mysql-test-run - originally written by Matt Wagner # modified by Sasha Pachev # Slightly updated by Monty diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 046199f49f3..2cfd689b0e7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1,6 +1,23 @@ #!/usr/bin/perl # -*- cperl -*- +# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # ############################################################################## # diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am index 178e40fb19a..abd89bddbbe 100644 --- a/mysql-test/ndb/Makefile.am +++ b/mysql-test/ndb/Makefile.am @@ -1,3 +1,17 @@ +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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 benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test/ndb diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/ndb/ndb_config_1_node.ini index 68533396930..15437b54949 100644 --- a/mysql-test/ndb/ndb_config_1_node.ini +++ b/mysql-test/ndb/ndb_config_1_node.ini @@ -1,3 +1,20 @@ +# Copyright (C) 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + [ndbd default] NoOfReplicas= 1 MaxNoOfConcurrentTransactions= 64 diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini index 55c9c285310..333520ade1c 100644 --- a/mysql-test/ndb/ndb_config_2_node.ini +++ b/mysql-test/ndb/ndb_config_2_node.ini @@ -1,3 +1,20 @@ +# Copyright (C) 2004, 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + [ndbd default] NoOfReplicas= 2 MaxNoOfConcurrentTransactions= 64 diff --git a/mysql-test/ndb/ndb_config_4_node.ini b/mysql-test/ndb/ndb_config_4_node.ini index 779432e1660..fdb98db3ed7 100644 --- a/mysql-test/ndb/ndb_config_4_node.ini +++ b/mysql-test/ndb/ndb_config_4_node.ini @@ -1,3 +1,20 @@ +# Copyright (C) 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + [ndbd default] NoOfReplicas= 2 MaxNoOfConcurrentTransactions= 64 diff --git a/mysql-test/purify.supp b/mysql-test/purify.supp index 58553130c51..74ed8c42181 100644 --- a/mysql-test/purify.supp +++ b/mysql-test/purify.supp @@ -1,3 +1,20 @@ +# Copyright (C) 2005, 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + suppress UMR rw_read_held; mi_open; ha_myisam::open64; handler::ha_open; openfrm suppress UMR my_end; main suppress UMR _doprnt; fprintf; my_end; main diff --git a/mysql-test/resolve-stack b/mysql-test/resolve-stack index cdbe362c752..90db2e2e40b 100755 --- a/mysql-test/resolve-stack +++ b/mysql-test/resolve-stack @@ -1,4 +1,22 @@ #! /bin/sh + +# Copyright (C) 2002 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # A shortcut for resolving stacks when debugging when # we cannot duplicate the crash in a debugger and have to # resort to using stack traces diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index d7ac6bc6c88..8267b29e5c6 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1,3 +1,20 @@ +# Copyright (C) 2005, 2008 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # # Suppress some common (not fatal) errors in system libraries found by valgrind # diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 7cb87492b40..77af5a47e99 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -21,10 +21,7 @@ INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \ pkglib_LIBRARIES = libmysys.a LDADD = libmysys.a ../dbug/libdbug.a \ ../strings/libmystrings.a -noinst_HEADERS = mysys_priv.h my_static.h \ - my_os2cond.c my_os2dirsrch.c my_os2dirsrch.h \ - my_os2dlfcn.c my_os2file64.c my_os2mutex.c \ - my_os2thread.c my_os2tls.c +noinst_HEADERS = mysys_priv.h my_static.h libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_path.c mf_loadpath.c my_file.c \ my_open.c my_create.c my_dup.c my_seek.c my_read.c \ diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index df206f7e235..e833aeb0b06 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/mysys/my_lib.c b/mysys/my_lib.c index a076a0c971d..76f27cfb645 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -51,10 +51,6 @@ #include #endif -#ifdef OS2 -#include "my_os2dirsrch.h" -#endif - #if defined(THREAD) && defined(HAVE_READDIR_R) #define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) #else diff --git a/mysys/my_os2cond.c b/mysys/my_os2cond.c deleted file mode 100644 index f0cf91404d2..00000000000 --- a/mysys/my_os2cond.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/***************************************************************************** -** The following is a simple implementation of posix conditions -*****************************************************************************/ - -#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ -#include "mysys_priv.h" -#if defined(THREAD) && defined(OS2) -#include -#include -#include - -int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) -{ - cond->waiting= 0; - /* Warp3 FP29 or Warp4 FP4 or better required */ - if (DosCreateEventSem(NULL, &cond->semaphore, 0x0800, 0)) - return ENOMEM; - return 0; -} - -int pthread_cond_destroy(pthread_cond_t *cond) -{ - for (;;) - { - APIRET rc; - if ((rc= DosCloseEventSem(cond->semaphore)) != 301) - return rc ? EINVAL : 0; - DosPostEventSem(cond->semaphore); - } -} - - -int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) -{ - int rval= 0; - cond->waiting++; - if (mutex) - pthread_mutex_unlock(mutex); - if (DosWaitEventSem(cond->semaphore, SEM_INDEFINITE_WAIT)) - rval= EINVAL; - if (mutex) - pthread_mutex_lock(mutex); - cond->waiting--; - return rval; -} - -int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - struct timespec *abstime) -{ - struct timeb curtime; - int result; - long timeout; - int rval= 0; - - _ftime(&curtime); - timeout= ((long) (abstime->ts_sec - curtime.time) * 1000L + - (long) ((abstime->ts_nsec / 1000) - curtime.millitm) / 1000L); - if (timeout < 0) /* Some safety */ - timeout= 0L; - - cond->waiting++; - - if (mutex) - pthread_mutex_unlock(mutex); - if (DosWaitEventSem(cond->semaphore, timeout) != 0) - rval= ETIMEDOUT; - if (mutex) - pthread_mutex_lock(mutex); - - cond->waiting--; - - return rval; -} - - -int pthread_cond_signal(pthread_cond_t *cond) -{ - /* Bring the next thread off the condition queue: */ - DosPostEventSem(cond->semaphore); - return 0; -} - - -int pthread_cond_broadcast(pthread_cond_t *cond) -{ - int i; - /* Enter a loop to bring all threads off the condition queue */ - for (i= cond->waiting; i--;) - DosPostEventSem(cond->semaphore); - return 0; -} - - -int pthread_attr_init(pthread_attr_t *connect_att) -{ - connect_att->dwStackSize= 0; - connect_att->dwCreatingFlag= 0; - connect_att->priority= 0; - return 0; -} - -int pthread_attr_setstacksize(pthread_attr_t *connect_att, DWORD stack) -{ - connect_att->dwStackSize= stack; - return 0; -} - -int pthread_attr_setprio(pthread_attr_t *connect_att, int priority) -{ - connect_att->priority= priority; - return 0; -} - -int pthread_attr_destroy(pthread_attr_t *connect_att) -{ - bzero((gptr) connect_att, sizeof(*connect_att)); - return 0; -} - -/**************************************************************************** -** Fix localtime_r() to be a bit safer -****************************************************************************/ - -struct tm *localtime_r(const time_t *timep, struct tm *tmp) -{ - if (*timep == (time_t) - 1) /* This will crash win32 */ - { - bzero(tmp, sizeof(*tmp)); - } - else - { - struct tm *res= localtime(timep); - if (!res) /* Wrong date */ - { - bzero(tmp, sizeof(*tmp)); /* Keep things safe */ - return 0; - } - *tmp= *res; - } - return tmp; -} -#endif /* __WIN__ */ diff --git a/mysys/my_os2dirsrch.c b/mysys/my_os2dirsrch.c deleted file mode 100644 index 27e774c8e04..00000000000 --- a/mysys/my_os2dirsrch.c +++ /dev/null @@ -1,184 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000-2003 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - - -/* Win32 directory search emulation */ - -#if defined(OS2) - -long _findfirst( char* path, struct _finddata_t* dos_file) -{ - HDIR hdir = HDIR_CREATE; - APIRET rc; - FILEFINDBUF3 buf3; - ULONG entries = 1; - -#ifdef _DEBUG - printf( "_findfirst path %s\n", path); -#endif - - memset( &buf3, 0, sizeof( buf3)); - rc = DosFindFirst( - path, /* The ASCIIZ path name of the file or subdirectory to be found. */ - &hdir, /* The handle associated with this DosFindFirst request. */ - FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */ - &buf3, /* Result buffer. */ - sizeof( buf3), /* The length, in bytes, of pfindbuf. */ - &entries, /* Pointer to the number of entries: */ - FIL_STANDARD); /* The level of file information required. */ - -#ifdef _DEBUG - printf( "_findfirst rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, - buf3.achName); -#endif - - if (rc /* && entries == 0 */) - return -1; - - if (dos_file) - { - memset( dos_file, 0, sizeof( struct _finddata_t)); - strcpy( dos_file->name, buf3.achName); - dos_file->size = buf3.cbFile; - dos_file->attrib = buf3.attrFile; - } - return (ULONG) hdir; -} - - -long _findnext( long hdir, struct _finddata_t* dos_file) -{ - APIRET rc; - FILEFINDBUF3 buf3; - ULONG entries = 1; - - memset( &buf3, 0, sizeof( buf3)); - rc = DosFindNext(hdir, - &buf3, /* Result buffer. */ - sizeof( buf3), /* Length, in bytes, of pfindbuf. */ - &entries); /* Pointer to the number of entries */ - -#ifdef _DEBUG - printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, hdir, entries, - buf3.achName); -#endif - - if (rc /* && entries == 0 */) - return -1; - - if (dos_file) - { - memset( dos_file, 0, sizeof( struct _finddata_t)); - strcpy( dos_file->name, buf3.achName); - dos_file->size = buf3.cbFile; - dos_file->attrib = buf3.attrFile; - } - return 0; -} - -void _findclose( long hdir) -{ - APIRET rc; - - rc = DosFindClose( hdir); -#ifdef _DEBUG - printf( "_findclose rc=%d hdir=%d\n", rc, hdir); -#endif -} - -DIR* opendir(char* path) -{ - DIR* dir = (DIR*) calloc(1, sizeof( DIR)); - char buffer[260]; - APIRET rc; - ULONG entries = 1; - - strmov(strmov(buffer, path), "*.*"); - -#ifdef _DEBUG - printf( "_findfirst path %s\n", buffer); -#endif - - dir->hdir = HDIR_CREATE; - memset( &dir->buf3, 0, sizeof( dir->buf3)); - rc = DosFindFirst( - buffer, /* Address of the ASCIIZ path name of the file or subdirectory to be found. */ - &dir->hdir, /* Address of the handle associated with this DosFindFirst request. */ - FILE_NORMAL | FILE_DIRECTORY, /* Attribute value that determines the file objects to be searched for. */ - &dir->buf3, /* Result buffer. */ - sizeof( dir->buf3), /* The length, in bytes, of pfindbuf. */ - &entries, /* Pointer to the number of entries: */ - FIL_STANDARD); /* The level of file information required. */ - -#ifdef _DEBUG - printf( "opendir rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, dir->buf3.achName); -#endif - - if (rc /* && entries == 0 */) - return NULL; - - return dir; -} - - -struct dirent* readdir( DIR* dir) -{ - APIRET rc; - ULONG entries = 1; - - if (!dir->buf3.achName[0]) /* file not found on previous query */ - return NULL; - - /* copy last file name */ - strcpy( dir->ent.d_name, dir->buf3.achName); - - /* query next file */ - memset( &dir->buf3, 0, sizeof( dir->buf3)); - rc= DosFindNext( - dir->hdir, - &dir->buf3, /* Result buffer. */ - sizeof(dir->buf3), /* Length, in bytes, of pfindbuf. */ - &entries); /* Pointer to the number of entries */ - -#ifdef _DEBUG - printf( "_findnext rc=%d hdir=%d entries=%d->%s\n", rc, dir->hdir, entries, - dir->buf3.achName); -#endif - - if (rc /* && entries == 0 */) - *dir->buf3.achName= 0; /* reset name for next query */ - - return &dir->ent; -} - - -int closedir (DIR *dir) -{ - APIRET rc; - - rc = DosFindClose( dir->hdir); -#ifdef _DEBUG - printf( "_findclose rc=%d hdir=%d\n", rc, dir->hdir); -#endif - free(dir); - return 0; -} - -#endif /* OS2 */ diff --git a/mysys/my_os2dirsrch.h b/mysys/my_os2dirsrch.h deleted file mode 100644 index e3af6740769..00000000000 --- a/mysys/my_os2dirsrch.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/* Win32 directory search emulation */ - -#ifndef __MY_OS2DIRSRCH2_H__ -#define __MY_OS2DIRSRCH2_H__ - -#ifdef __cplusplus_00 -extern "C" { -#endif - -struct _finddata_t -{ - unsigned attrib; -#ifdef NOT_USED - unsigned long time_create; /* -1 for FAT file systems */ - unsigned long time_access; /* -1 for FAT file systems */ - unsigned long time_write; -#endif - unsigned long size; - char name[260]; -#ifdef NOT_USED - uint16 wr_date; - uint16 wr_time; -#endif -}; - - -struct dirent -{ -#ifdef NOT_USED - unsigned attrib; - unsigned long time_create; /* -1 for FAT file systems */ - unsigned long time_access; /* -1 for FAT file systems */ - unsigned long time_write; - unsigned long size; -#endif - char d_name[260]; -#ifdef NOT_USED - uint16 wr_date; - uint16 wr_time; -#endif -}; - -struct DIR -{ - HDIR hdir; - FILEFINDBUF3 buf3; - struct dirent ent; -}; - -DIR *opendir ( char *); -struct dirent *readdir (DIR *); -int closedir (DIR *); - -#ifdef NOT_USED -#define _A_NORMAL FILE_NORMAL -#define _A_SUBDIR FILE_DIRECTORY -#define _A_RDONLY FILE_READONLY - -long _findfirst( char*, struct _finddata_t*); -long _findnext( long, struct _finddata_t*); -void _findclose( long); -#endif - -#ifdef __cplusplus_00 -} -#endif - -#endif /* __MY_OS2DIRSRCH2_H__ */ diff --git a/mysys/my_os2dlfcn.c b/mysys/my_os2dlfcn.c deleted file mode 100644 index 74be940d0d4..00000000000 --- a/mysys/my_os2dlfcn.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/* - * dlfcn::Unix dynamic loading for OS/2 - * - * Compatibility layer for dynamic loading. - * Only minimal implementation - * -*/ - -#define RTLD_LAZY 0 -#define RTLD_NOW 0 - -void* dlopen( char* path, int flag); -char* dlerror( void); -void* dlsym( void* hmod, char* fn); -void dlclose( void* hmod); - -char fail[ 256]; - -void* dlopen( char* path, int flag) -{ - APIRET rc; - HMODULE hmod; - - rc = DosLoadModule( fail, sizeof( fail), path, &hmod); - if (rc) - return NULL; - - return (void*) hmod; -} - -char* dlerror( void) -{ - return fail; -} - -void* dlsym( void* hmod, char* fn) -{ - APIRET rc; - PFN addr; - - rc = DosQueryProcAddr( (HMODULE) hmod, 0l, fn, &addr); - if (rc) - return NULL; - - return (void*) addr; -} - -void dlclose( void* hmod) -{ - APIRET rc; - - rc = DosFreeModule( (HMODULE) hmod); - -} diff --git a/mysys/my_os2dlfcn.h0 b/mysys/my_os2dlfcn.h0 deleted file mode 100644 index ec05eebc47b..00000000000 --- a/mysys/my_os2dlfcn.h0 +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ -/* - * dlfcn::Unix dynamic loading for OS/2 - * - * Compatibility layer for dynamic loading. - * Only minimal implementation - * -*/ - -#ifndef __DLFCN_H__ -#define __DLFCN_H__ - -#define RTLD_LAZY 0 -#define RTLD_NOW 0 - -void* dlopen( char* path, int flag); -char* dlerror( void); -void* dlsym( void* hmod, char* fn); -void dlclose( void* hmod); - -#endif diff --git a/mysys/my_os2file64.c b/mysys/my_os2file64.c deleted file mode 100644 index 52156903b80..00000000000 --- a/mysys/my_os2file64.c +++ /dev/null @@ -1,394 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -void _OS2errno( APIRET rc); -longlong _lseek64( int fd, longlong offset, int seektype); -int _lock64( int fd, int locktype, my_off_t start, - my_off_t length, myf MyFlags); -int _sopen64( const char *name, int oflag, int shflag, int mask); - -/* - This class is used to define a global c++ variable, that - is initialized before main() gets called. -*/ - -class File64bit -{ - public: - File64bit(); /* default constructor */ -} initFile64bit; - -static APIRET (* APIENTRY _DosOpenL)(PCSZ pszFileName, - PHFILE phf, - PULONG pulAction, - LONGLONG cbFile, - ULONG ulAttribute, - ULONG fsOpenFlags, - ULONG fsOpenMode, - PEAOP2 peaop2); -static APIRET (* APIENTRY _DosSetFilePtrL)(HFILE hFile, - LONGLONG ib, - ULONG method, - PLONGLONG ibActual); -static APIRET (* APIENTRY _DosSetFileLocksL)(HFILE hFile, - PFILELOCKL pflUnlock, - PFILELOCKL pflLock, - ULONG timeout, - ULONG flags); - -#define EIO EINVAL -#define ESPIPE EBADSEEK - - -static unsigned char const errno_tab[] = -{ - 0 , EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */ - EACCES, EBADF, EIO, ENOMEM, EIO, /* 5..9 */ - EINVAL, ENOEXEC,EINVAL, EINVAL, EINVAL, /* 10..14 */ - ENOENT, EBUSY, EXDEV, ENOENT, EROFS, /* 15..19 */ - EIO, EIO, EIO, EIO, EIO, /* 20..24 */ - EIO, EIO, EIO, ENOSPC, EIO, /* 25..29 */ - EIO, EIO, EACCES, EACCES, EIO, /* 30..34 */ - EIO, EIO, EIO, EIO, ENOSPC, /* 35..39 */ - EIO, EIO, EIO, EIO, EIO, /* 40..44 */ - EIO, EIO, EIO, EIO, EIO, /* 45..49 */ - EIO, EIO, EIO, EIO, EBUSY, /* 50..54 */ - EIO, EIO, EIO, EIO, EIO, /* 55..59 */ - EIO, ENOSPC, ENOSPC, EIO, EIO, /* 60..64 */ - EACCES, EIO, EIO, EIO, EIO, /* 65..69 */ - EIO, EIO, EIO, EROFS, EIO, /* 70..74 */ - EIO, EIO, EIO, EIO, EIO, /* 75..79 */ - EEXIST, EIO, ENOENT, EIO, EIO, /* 80..84 */ - EIO, EIO, EINVAL, EIO, EAGAIN, /* 85..89 */ - EIO, EIO, EIO, EIO, EIO, /* 90..94 */ - EINTR, EIO, EIO, EIO, EACCES, /* 95..99 */ - ENOMEM, EINVAL, EINVAL, ENOMEM, EINVAL, /* 100..104 */ - EINVAL, ENOMEM, EIO, EACCES, EPIPE, /* 105..109 */ - ENOENT, E2BIG, ENOSPC, ENOMEM, EBADF, /* 110..114 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 115..119 */ - EINVAL, EINVAL, EINVAL, ENOENT, EINVAL, /* 120..124 */ - ENOENT, ENOENT, ENOENT, ECHILD, ECHILD, /* 125..129 */ - EACCES, EINVAL, ESPIPE, EINVAL, EINVAL, /* 130..134 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 135..139 */ - EINVAL, EINVAL, EBUSY, EINVAL, EINVAL, /* 140..144 */ - EINVAL, EINVAL, EINVAL, EBUSY, EINVAL, /* 145..149 */ - EINVAL, EINVAL, ENOMEM, EINVAL, EINVAL, /* 150..154 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 155..159 */ - EINVAL, EINVAL, EINVAL, EINVAL, EAGAIN, /* 160..164 */ - EINVAL, EINVAL, EACCES, EINVAL, EINVAL, /* 165..169 */ - EBUSY, EINVAL, EINVAL, EINVAL, EINVAL, /* 170..174 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 175..179 */ - EINVAL, EINVAL, EINVAL, EINVAL, ECHILD, /* 180..184 */ - EINVAL, EINVAL, ENOENT, EINVAL, EINVAL, /* 185..189 */ - ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 190..194 */ - ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC,ENOEXEC, /* 195..199 */ - ENOEXEC,ENOEXEC,ENOEXEC,ENOENT, EINVAL, /* 200..204 */ - EINVAL, ENAMETOOLONG, EINVAL, EINVAL, EINVAL, /* 205..209 */ - EINVAL, EINVAL, EACCES, ENOEXEC,ENOEXEC, /* 210..214 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 215..219 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 220..224 */ - EINVAL, EINVAL, EINVAL, ECHILD, EINVAL, /* 225..229 */ - EINVAL, EBUSY, EAGAIN, ENOTCONN, EINVAL, /* 230..234 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 235..239 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 240..244 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 245..249 */ - EACCES, EACCES, EINVAL, ENOENT, EINVAL, /* 250..254 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 255..259 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 260..264 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 265..269 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 270..274 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 275..279 */ - EINVAL, EINVAL, EINVAL, EINVAL, EEXIST, /* 280..284 */ - EEXIST, EINVAL, EINVAL, EINVAL, EINVAL, /* 285..289 */ - ENOMEM, EMFILE, EINVAL, EINVAL, EINVAL, /* 290..294 */ - EINVAL, EINVAL, EINVAL, EINVAL, EINVAL, /* 295..299 */ - EINVAL, EBUSY, EINVAL, ESRCH, EINVAL, /* 300..304 */ - ESRCH, EINVAL, EINVAL, EINVAL, ESRCH, /* 305..309 */ - EINVAL, ENOMEM, EINVAL, EINVAL, EINVAL, /* 310..314 */ - EINVAL, E2BIG, ENOENT, EIO, EIO, /* 315..319 */ - EINVAL, EINVAL, EINVAL, EINVAL, EAGAIN, /* 320..324 */ - EINVAL, EINVAL, EINVAL, EIO, ENOENT, /* 325..329 */ - EACCES, EACCES, EACCES, ENOENT, ENOMEM /* 330..334 */ -}; - -/* - * Initialize 64bit file access: dynamic load of WSeB API -*/ - File64bit :: File64bit() -{ - HMODULE hDoscalls; - - if (DosQueryModuleHandle("DOSCALLS", &hDoscalls) != NO_ERROR) - return; - - if (DosQueryProcAddr(hDoscalls, 981, NULL, (PFN *)&_DosOpenL) != NO_ERROR) - return; - - if (DosQueryProcAddr(hDoscalls, 988, NULL, (PFN *)&_DosSetFilePtrL) != NO_ERROR) { - _DosOpenL = NULL; - return; - } - - if (DosQueryProcAddr(hDoscalls, 986, NULL, (PFN *)&_DosSetFileLocksL) != NO_ERROR) { - _DosOpenL = NULL; - _DosSetFilePtrL = NULL; - return; - } - /* notify success */ -#ifdef MYSQL_SERVER - printf( "WSeB 64bit file API loaded.\n"); -#endif -} - -void _OS2errno( APIRET rc) -{ - if (rc >= sizeof (errno_tab)) - errno = EINVAL; - else - errno = errno_tab[rc]; -} - - -longlong _lseek64( int fd, longlong offset, int seektype) -{ - APIRET rc; - longlong actual; - - if (_DosSetFilePtrL) - rc = _DosSetFilePtrL( fd, offset, seektype, &actual); - else - { - ULONG ulActual; - rc = DosSetFilePtr( fd, (long) offset, seektype, &ulActual); - actual = ulActual; - } - - if (!rc) - return( actual); /* NO_ERROR */ - - _OS2errno( rc); /* set errno */ - return(-1); /* seek failed */ -} - - -inline APIRET _SetFileLocksL(HFILE hFile, - PFILELOCKL pflUnlock, - PFILELOCKL pflLock, - ULONG timeout, - ULONG flags) -{ - if (_DosSetFileLocksL) - { - APIRET rc; - rc = _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags); - - /* - on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that - only JFS can handle >2GB ranges. - */ - if (rc != 87) - return rc; - /* got INVALID_PARAMETER, fallback to standard call */ - } - - FILELOCK flUnlock = { pflUnlock->lOffset, pflUnlock->lRange }; - FILELOCK flLock = { pflLock->lOffset, pflLock->lRange }; - return DosSetFileLocks( hFile, &flUnlock, &flLock, timeout, flags); -} - - -int _lock64( int fd, int locktype, my_off_t start, - my_off_t length, myf MyFlags) -{ - FILELOCKL LockArea = {0,0}, UnlockArea = {0,0}; - ULONG readonly = 0; - APIRET rc = -1; - - switch (locktype) { - case F_UNLCK: - UnlockArea.lOffset = start; - UnlockArea.lRange = length ? length : LONGLONG_MAX; - break; - - case F_RDLCK: - case F_WRLCK: - LockArea.lOffset = start; - LockArea.lRange = length ? length : LONGLONG_MAX; - readonly = (locktype == F_RDLCK ? 1 : 0); - break; - - default: - errno = EINVAL; - rc = -1; - break; - } - - if (MyFlags & MY_DONT_WAIT) - { - rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly); - /* printf("fd %d, locktype %d, rc %d (dont_wait)\n", fd, locktype, rc); */ - if (rc == 33) { /* Lock Violation */ - - DBUG_PRINT("info",("Was locked, trying with timeout")); - rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 1 * 1000, readonly); - /* printf( "fd %d, locktype %d, rc %d (dont_wait with timeout)\n", fd, locktype, rc); */ - } - } - else - { - while (rc = _SetFileLocksL( fd, &UnlockArea, &LockArea, 0, readonly) && - (rc == 33)) - { - printf("."); - DosSleep(1 * 1000); - } - /* printf( "fd %d, locktype %d, rc %d (wait2)\n", fd, locktype, rc); */ - } - if (!rc) - return(0); /* NO_ERROR */ - _OS2errno( rc); /* set errno */ - return(-1); /* lock failed */ -} - - -int sopen(const char *name, int oflag, int shflag, int mask) -{ - int fail_errno; - APIRET rc = 0; - HFILE hf = 0; - ULONG ulAction = 0; - LONGLONG cbFile = 0; - ULONG ulAttribute = FILE_NORMAL; - ULONG fsOpenFlags = 0; - ULONG fsOpenMode = 0; - - /* Extract the access mode and sharing mode bits. */ - fsOpenMode = (shflag & 0xFF) | (oflag & 0x03); - - /* - Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see - below). - */ - fail_errno = ENOENT; - - /* - Compute `open_flag' depending on `flags'. Note that _SO_CREAT is - set for O_CREAT. - */ - - if (oflag & O_CREAT) - { - if (oflag & O_EXCL) - { - fsOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; - fail_errno = EEXIST; - } - else if (oflag & O_TRUNC) - fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; - else - fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; - - if (mask & S_IWRITE) - ulAttribute = FILE_NORMAL; - else - ulAttribute = FILE_READONLY; - - } - else if (oflag & O_TRUNC) - fsOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW; - else - fsOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW; - - /* Try to open the file and handle errors. */ - if (_DosOpenL) - rc = _DosOpenL( name, &hf, &ulAction, cbFile, - ulAttribute, fsOpenFlags, fsOpenMode, NULL); - else - rc = DosOpen( name, &hf, &ulAction, (LONG) cbFile, - ulAttribute, fsOpenFlags, fsOpenMode, NULL); - - if (rc == ERROR_OPEN_FAILED) - { - errno = fail_errno; - return -1; - } - if (rc != 0) - { - _OS2errno( rc); /* set errno */ - return -1; - } - if (oflag & O_APPEND) - _lseek64( hf, 0L, SEEK_END); - return hf; -} - - -int read(int fd, void *buffer, unsigned int count) -{ - APIRET rc; - ULONG actual; - - rc= DosRead( fd, (PVOID) buffer, count, &actual); - - if (!rc) - return( actual); /* NO_ERROR */ - _OS2errno( rc); /* set errno */ - return(-1); /* read failed */ -} - - -int write(int fd, const void *buffer, unsigned int count) -{ - APIRET rc; - ULONG actual; - - rc = DosWrite( fd, (PVOID) buffer, count, &actual); - - if (!rc) - return( actual); /* NO_ERROR */ - _OS2errno( rc); /* set errno */ - return(-1); /* write failed */ -} - - -int close( int fd) -{ - APIRET rc; - ULONG actual; - - rc = DosClose( fd); - - if (!rc) - return( 0); /* NO_ERROR */ - _OS2errno( rc); /* set errno */ - return(-1); /* close failed */ -} - - -int open( const char *name, int oflag) -{ - return sopen( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE); -} - - -int open( const char *name, int oflag, int mask) -{ - return sopen( name, oflag, OPEN_SHARE_DENYNONE, mask); -} diff --git a/mysys/my_os2mutex.c b/mysys/my_os2mutex.c deleted file mode 100644 index 5010d6e8dd5..00000000000 --- a/mysys/my_os2mutex.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1995 John Birrell . - * All rights reserved. - * - * Modified and extended by Antony T Curtis - * for use with OS/2. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include -#include -#ifdef _THREAD_SAFE - -int -pthread_mutex_init(pthread_mutex_t * mutex, - const pthread_mutexattr_t * mutex_attr) -{ - (void) DosCreateMutexSem(NULL,mutex,0,0); - return (0); /* Return the completion status: */ -} - - -int -pthread_mutex_destroy(pthread_mutex_t * mutex) -{ - APIRET rc; - - do - { - rc = DosCloseMutexSem(*mutex); - if (rc == 301) DosReleaseMutexSem(*mutex); - } while (rc == 301); - - *mutex = 0; - return (0); /* Return the completion status: */ -} - - -int -pthread_mutex_lock(pthread_mutex_t * mutex) -{ - APIRET rc; - - rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT); - if (rc) - return(EINVAL); - return (0); /* Return the completion status: */ -} - - -int -pthread_mutex_unlock(pthread_mutex_t * mutex) -{ - (void) DosReleaseMutexSem(*mutex); - return (0); /* Return the completion status: */ -} -#endif diff --git a/mysys/my_os2thread.c b/mysys/my_os2thread.c deleted file mode 100644 index e34fd18d596..00000000000 --- a/mysys/my_os2thread.c +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/***************************************************************************** -** Simulation of posix threads calls for OS/2 -*****************************************************************************/ - -#include "mysys_priv.h" -#if defined(THREAD) && defined(OS2) -#include -#include - -static pthread_mutex_t THR_LOCK_thread; - -struct pthread_map -{ - HANDLE pthreadself; - pthread_handler func; - void * param; -}; - -void win_pthread_init(void) -{ - pthread_mutex_init(&THR_LOCK_thread,NULL); -} - -/* -** We have tried to use '_beginthreadex' instead of '_beginthread' here -** but in this case the program leaks about 512 characters for each -** created thread ! -** As we want to save the created thread handler for other threads to -** use and to be returned by pthread_self() (instead of the Win32 pseudo -** handler), we have to go trough pthread_start() to catch the returned handler -** in the new thread. -*/ - -pthread_handler_t pthread_start(void *param) -{ - DBUG_ENTER("pthread_start"); - pthread_handler func=((struct pthread_map *) param)->func; - void *func_param=((struct pthread_map *) param)->param; - my_thread_init(); /* Will always succeed in windows */ - pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */ - win_pthread_self=((struct pthread_map *) param)->pthreadself; - pthread_mutex_unlock(&THR_LOCK_thread); - free((char*) param); /* Free param from create */ - /* pthread_exit((void*) (*func)(func_param)); */ - (*func)(func_param); - DBUG_RETURN(0); -} - - -int pthread_create(pthread_t *thread_id, pthread_attr_t *attr, - pthread_handler func, void *param) -{ - HANDLE hThread; - struct pthread_map *map; - DBUG_ENTER("pthread_create"); - - if (!(map=(struct pthread_map *)malloc(sizeof(*map)))) - DBUG_RETURN(-1); - map->func=func; - map->param=param; - pthread_mutex_lock(&THR_LOCK_thread); -#ifdef __BORLANDC__ - hThread=(HANDLE)_beginthread((void(_USERENTRY *)(void *)) pthread_start, - attr->dwStackSize ? attr->dwStackSize : - 65535, (void*) map); -#elif defined( OS2) - hThread=(HANDLE)_beginthread((void( _Optlink *)(void *)) pthread_start, NULL, - attr->dwStackSize ? attr->dwStackSize : - 65535, (void*) map); -#else - hThread=(HANDLE)_beginthread((void( __cdecl *)(void *)) pthread_start, - attr->dwStackSize ? attr->dwStackSize : - 65535, (void*) map); -#endif - DBUG_PRINT("info", ("hThread=%lu",(long) hThread)); - *thread_id=map->pthreadself=hThread; - pthread_mutex_unlock(&THR_LOCK_thread); - - if (hThread == (HANDLE) -1) - { - int error=errno; - DBUG_PRINT("error", - ("Can't create thread to handle request (error %d)",error)); - DBUG_RETURN(error ? error : -1); - } -#ifdef OS2 - my_pthread_setprio(hThread, attr->priority); -#else - VOID(SetThreadPriority(hThread, attr->priority)) ; -#endif - DBUG_RETURN(0); -} - - -void pthread_exit(void *a) -{ - _endthread(); -} - -/* This is neaded to get the macro pthread_setspecific to work */ - -int win_pthread_setspecific(void *a,void *b,uint length) -{ - memcpy(a,b,length); - return 0; -} - -#endif diff --git a/mysys/my_os2tls.c b/mysys/my_os2tls.c deleted file mode 100644 index 49100c65516..00000000000 --- a/mysys/my_os2tls.c +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright (C) Yuri Dario & 2000 MySQL AB - All the above parties has a full, independent copyright to - the following code, including the right to use the code in - any manner without any demands from the other parties. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; version 2 - of the License. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -DWORD TlsAlloc( void); -BOOL TlsFree( DWORD); -PVOID TlsGetValue( DWORD); -BOOL TlsSetValue( DWORD, PVOID); - -#define TLS_MINIMUM_AVAILABLE 64 - - -PULONG tls_storage; /* TLS local storage */ -DWORD tls_bits[2]; /* TLS in-use bits */ -pthread_mutex_t tls_mutex; /* TLS mutex for in-use bits */ - - -DWORD TlsAlloc( void) -{ - DWORD index = -1; - DWORD mask, tibidx; - int i; - - if (tls_storage == NULL) - { - - APIRET rc; - - /* allocate memory for TLS storage */ - rc = DosAllocThreadLocalMemory( 1, &tls_storage); - if (rc) - fprintf( stderr, "DosAllocThreadLocalMemory error: return code = %u\n", - rc); - /* create a mutex */ - if (pthread_mutex_init( &tls_mutex, NULL)) - fprintf( stderr, "Failed to init TLS mutex\n"); - } - - pthread_mutex_lock( &tls_mutex); - - tibidx = 0; - if (tls_bits[0] == 0xFFFFFFFF) - { - if (tls_bits[1] == 0xFFFFFFFF) - { - fprintf( stderr, "tid#%d, no more TLS bits available\n", _threadid); - pthread_mutex_unlock( &tls_mutex); - return -1; - } - tibidx = 1; - } - - for (i=0; i<32; i++) - { - mask = (1 << i); - if ((tls_bits[ tibidx] & mask) == 0) - { - tls_bits[ tibidx] |= mask; - index = (tibidx*32) + i; - break; - } - } - tls_storage[index] = 0; - - pthread_mutex_unlock( &tls_mutex); - /* fprintf( stderr, "tid#%d, TlsAlloc index %d\n", _threadid, index); */ - return index; -} - -BOOL TlsFree( DWORD index) -{ - int tlsidx; - DWORD mask; - - if (index >= TLS_MINIMUM_AVAILABLE) - return NULL; - - pthread_mutex_lock( &tls_mutex); - - tlsidx = 0; - if (index > 32) - tlsidx++; - - mask = (1 << index); - if (tls_bits[ tlsidx] & mask) - { - tls_bits[tlsidx] &= ~mask; - tls_storage[index] = 0; - pthread_mutex_unlock( &tls_mutex); - return TRUE; - } - - pthread_mutex_unlock( &tls_mutex); - return FALSE; -} - - -PVOID TlsGetValue( DWORD index) -{ - if (index >= TLS_MINIMUM_AVAILABLE) - return NULL; - - /* verify if memory has been allocated for this thread */ - if (*tls_storage == NULL) - { - /* allocate memory for indexes */ - *tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int)); - /* fprintf(stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); */ - } - - ULONG* tls_array = (ULONG*) *tls_storage; - return (PVOID) tls_array[index]; -} - - -BOOL TlsSetValue( DWORD index, PVOID val) -{ - - /* verify if memory has been allocated for this thread */ - if (*tls_storage == NULL) - { - /* allocate memory for indexes */ - *tls_storage = (ULONG)calloc( TLS_MINIMUM_AVAILABLE, sizeof(int)); - /* fprintf(stderr, "tid#%d, tls_storage %x\n", _threadid, *tls_storage); */ - } - - if (index >= TLS_MINIMUM_AVAILABLE) - return FALSE; - - ULONG* tls_array = (ULONG*) *tls_storage; - /* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x (old)\n", _threadid, tls_array, index, tls_array[ index]); */ - tls_array[ index] = (ULONG) val; - /* fprintf( stderr, "tid#%d, TlsSetValue array %08x index %d -> %08x\n", _threadid, tls_array, index, val); */ - return TRUE; -} diff --git a/ndb/Makefile.am b/ndb/Makefile.am index a652fc5b6a9..b7dfcde3c2b 100644 --- a/ndb/Makefile.am +++ b/ndb/Makefile.am @@ -21,7 +21,6 @@ include $(top_srcdir)/ndb/config/common.mk.am dist-hook: -rm -rf `find $(distdir) -type d -name SCCS` - -rm -rf `find $(distdir) -type d -name old_files` -rm -rf `find $(distdir)/ndbapi-examples -name '*.o'` list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" != "." -a "$$subdir" != "include"; then \ @@ -35,7 +34,7 @@ dist-hook: done windoze: - for i in `find . -name 'old_dirs' -prune -o -name 'Makefile.am' -print`; \ + for i in `find . -name 'Makefile.am' -print`; \ do make -C `dirname $$i` windoze-dsp; done windoze-dsp: diff --git a/ndb/config/make-win-dsw.sh b/ndb/config/make-win-dsw.sh index b0613620f8a..070a3665bc0 100755 --- a/ndb/config/make-win-dsw.sh +++ b/ndb/config/make-win-dsw.sh @@ -1,3 +1,17 @@ +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA cat <, under the GNU GPL. -## -## (Extensively hacked on by Melissa O'Neill .) -## -## cvs2cl.pl 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, or (at your option) -## any later version. -## -## cvs2cl.pl 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 may have received a copy of the GNU General Public License -## along with cvs2cl.pl; see the file COPYING. If not, write to the -## Free Software Foundation, Inc., 59 Temple Place - Suite 330, -## Boston, MA 02111-1307, USA. - - - -use strict; -use Text::Wrap; -use Time::Local; -use File::Basename; - - -# The Plan: -# -# Read in the logs for multiple files, spit out a nice ChangeLog that -# mirrors the information entered during `cvs commit'. -# -# The problem presents some challenges. In an ideal world, we could -# detect files with the same author, log message, and checkin time -- -# each would be a changelog entry. -# We'd sort them; and spit them out. Unfortunately, CVS is *not atomic* -# so checkins can span a range of times. Also, the directory structure -# could be hierarchical. -# -# Another question is whether we really want to have the ChangeLog -# exactly reflect commits. An author could issue two related commits, -# with different log entries, reflecting a single logical change to the -# source. GNU style ChangeLogs group these under a single author/date. -# We try to do the same. -# -# So, we parse the output of `cvs log', storing log messages in a -# multilevel hash that stores the mapping: -# directory => author => time => message => filelist -# As we go, we notice "nearby" commit times and store them together -# (i.e., under the same timestamp), so they appear in the same log -# entry. -# -# When we've read all the logs, we twist this mapping into -# a time => author => message => filelist mapping for each directory. -# -# If we're not using the `--distributed' flag, the directory is always -# considered to be `./', even as descend into subdirectories. - - -############### Globals ################ - - -# What we run to generate it: -my $Log_Source_Command = "cvs log"; - -# In case we have to print it out: -my $VERSION = '$Revision: 2.38 $'; -$VERSION =~ s/\S+\s+(\S+)\s+\S+/$1/; - -## Vars set by options: - -# Print debugging messages? -my $Debug = 0; - -# Just show version and exit? -my $Print_Version = 0; - -# Just print usage message and exit? -my $Print_Usage = 0; - -# Single top-level ChangeLog, or one per subdirectory? -my $Distributed = 0; - -# What file should we generate (defaults to "ChangeLog")? -my $Log_File_Name = "ChangeLog"; - -# Grab most recent entry date from existing ChangeLog file, just add -# to that ChangeLog. -my $Cumulative = 0; - -# Expand usernames to email addresses based on a map file? -my $User_Map_File = ""; - -# Output to a file or to stdout? -my $Output_To_Stdout = 0; - -# Eliminate empty log messages? -my $Prune_Empty_Msgs = 0; - -# Don't call Text::Wrap on the body of the message -my $No_Wrap = 0; - -# Separates header from log message. Code assumes it is either " " or -# "\n\n", so if there's ever an option to set it to something else, -# make sure to go through all conditionals that use this var. -my $After_Header = " "; - -# Format more for programs than for humans. -my $XML_Output = 0; - -# Do some special tweaks for log data that was written in FSF -# ChangeLog style. -my $FSF_Style = 0; - -# Show times in UTC instead of local time -my $UTC_Times = 0; - -# Show day of week in output? -my $Show_Day_Of_Week = 0; - -# Show revision numbers in output? -my $Show_Revisions = 0; - -# Show tags (symbolic names) in output? -my $Show_Tags = 0; - -# Show branches by symbolic name in output? -my $Show_Branches = 0; - -# Show only revisions on these branches or their ancestors. -my @Follow_Branches; - -# Don't bother with files matching this regexp. -my @Ignore_Files; - -# How exactly we match entries. We definitely want "o", -# and user might add "i" by using --case-insensitive option. -my $Case_Insensitive = 0; - -# Maybe only show log messages matching a certain regular expression. -my $Regexp_Gate = ""; - -# Pass this global option string along to cvs, to the left of `log': -my $Global_Opts = ""; - -# Pass this option string along to the cvs log subcommand: -my $Command_Opts = ""; - -# Read log output from stdin instead of invoking cvs log? -my $Input_From_Stdin = 0; - -# Don't show filenames in output. -my $Hide_Filenames = 0; - -# Max checkin duration. CVS checkin is not atomic, so we may have checkin -# times that span a range of time. We assume that checkins will last no -# longer than $Max_Checkin_Duration seconds, and that similarly, no -# checkins will happen from the same users with the same message less -# than $Max_Checkin_Duration seconds apart. -my $Max_Checkin_Duration = 180; - -# What to put at the front of [each] ChangeLog. -my $ChangeLog_Header = ""; - -## end vars set by options. - -# In 'cvs log' output, one long unbroken line of equal signs separates -# files: -my $file_separator = "=======================================" - . "======================================"; - -# In 'cvs log' output, a shorter line of dashes separates log messages -# within a file: -my $logmsg_separator = "----------------------------"; - - -############### End globals ############ - - - - -&parse_options (); -&derive_change_log (); - - - -### Everything below is subroutine definitions. ### - -# If accumulating, grab the boundary date from pre-existing ChangeLog. -sub maybe_grab_accumulation_date () -{ - if (! $Cumulative) { - return ""; - } - - # else - - open (LOG, "$Log_File_Name") - or die ("trouble opening $Log_File_Name for reading ($!)"); - - my $boundary_date; - while () - { - if (/^(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)/) - { - $boundary_date = "$1"; - last; - } - } - - close (LOG); - return $boundary_date; -} - - -# Fills up a ChangeLog structure in the current directory. -sub derive_change_log () -{ - # See "The Plan" above for a full explanation. - - my %grand_poobah; - - my $file_full_path; - my $time; - my $revision; - my $author; - my $msg_txt; - my $detected_file_separator; - - # Might be adding to an existing ChangeLog - my $accumulation_date = &maybe_grab_accumulation_date (); - if ($accumulation_date) { - $Log_Source_Command .= " -d\'>${accumulation_date}\'"; - } - - # We might be expanding usernames - my %usermap; - - # In general, it's probably not very maintainable to use state - # variables like this to tell the loop what it's doing at any given - # moment, but this is only the first one, and if we never have more - # than a few of these, it's okay. - my $collecting_symbolic_names = 0; - my %symbolic_names; # Where tag names get stored. - my %branch_names; # We'll grab branch names while we're at it. - my %branch_numbers; # Save some revisions for @Follow_Branches - my @branch_roots; # For showing which files are branch ancestors. - - # Bleargh. Compensate for a deficiency of custom wrapping. - if (($After_Header ne " ") and $FSF_Style) - { - $After_Header .= "\t"; - } - - if (! $Input_From_Stdin) { - open (LOG_SOURCE, "$Log_Source_Command |") - or die "unable to run \"${Log_Source_Command}\""; - } - else { - open (LOG_SOURCE, "-") or die "unable to open stdin for reading"; - } - - %usermap = &maybe_read_user_map_file (); - - while () - { - # If on a new file and don't see filename, skip until we find it, and - # when we find it, grab it. - if ((! (defined $file_full_path)) and /^Working file: (.*)/) - { - $file_full_path = $1; - if (@Ignore_Files) - { - my $base; - ($base, undef, undef) = fileparse ($file_full_path); - # Ouch, I wish trailing operators in regexps could be - # evaluated on the fly! - if ($Case_Insensitive) { - if (grep ($file_full_path =~ m|$_|i, @Ignore_Files)) { - undef $file_full_path; - } - } - elsif (grep ($file_full_path =~ m|$_|, @Ignore_Files)) { - undef $file_full_path; - } - } - next; - } - - # Just spin wheels if no file defined yet. - next if (! $file_full_path); - - # Collect tag names in case we're asked to print them in the output. - if (/^symbolic names:$/) { - $collecting_symbolic_names = 1; - next; # There's no more info on this line, so skip to next - } - if ($collecting_symbolic_names) - { - # All tag names are listed with whitespace in front in cvs log - # output; so if see non-whitespace, then we're done collecting. - if (/^\S/) { - $collecting_symbolic_names = 0; - } - else # we're looking at a tag name, so parse & store it - { - # According to the Cederqvist manual, in node "Tags", tag - # names must start with an uppercase or lowercase letter and - # can contain uppercase and lowercase letters, digits, `-', - # and `_'. However, it's not our place to enforce that, so - # we'll allow anything CVS hands us to be a tag: - /^\s+([^:]+): ([\d.]+)$/; - my $tag_name = $1; - my $tag_rev = $2; - - # A branch number either has an odd number of digit sections - # (and hence an even number of dots), or has ".0." as the - # second-to-last digit section. Test for these conditions. - my $real_branch_rev = ""; - if (($tag_rev =~ /^(\d+\.\d+\.)+\d+$/) # Even number of dots... - and (! ($tag_rev =~ /^(1\.)+1$/))) # ...but not "1.[1.]1" - { - $real_branch_rev = $tag_rev; - } - elsif ($tag_rev =~ /(\d+\.(\d+\.)+)0.(\d+)/) # Has ".0." - { - $real_branch_rev = $1 . $3; - } - # If we got a branch, record its number. - if ($real_branch_rev) - { - $branch_names{$real_branch_rev} = $tag_name; - if (@Follow_Branches) { - if (grep ($_ eq $tag_name, @Follow_Branches)) { - $branch_numbers{$tag_name} = $real_branch_rev; - } - } - } - else { - # Else it's just a regular (non-branch) tag. - push (@{$symbolic_names{$tag_rev}}, $tag_name); - } - } - } - # End of code for collecting tag names. - - # If have file name, but not revision, and see revision, then grab - # it. (We collect unconditionally, even though we may or may not - # ever use it.) - if ((! (defined $revision)) and (/^revision (\d+\.[\d.]+)/)) - { - $revision = $1; - - if (@Follow_Branches) - { - foreach my $branch (@Follow_Branches) - { - # Special case for following trunk revisions - if (($branch =~ /^trunk$/i) and ($revision =~ /^[0-9]+\.[0-9]+$/)) - { - goto dengo; - } - - my $branch_number = $branch_numbers{$branch}; - if ($branch_number) - { - # Are we on one of the follow branches or an ancestor of - # same? - # - # If this revision is a prefix of the branch number, or - # possibly is less in the minormost number, OR if this - # branch number is a prefix of the revision, then yes. - # Otherwise, no. - # - # So below, we determine if any of those conditions are - # met. - - # Trivial case: is this revision on the branch? - # (Compare this way to avoid regexps that screw up Emacs - # indentation, argh.) - if ((substr ($revision, 0, ((length ($branch_number)) + 1))) - eq ($branch_number . ".")) - { - goto dengo; - } - # Non-trivial case: check if rev is ancestral to branch - elsif ((length ($branch_number)) > (length ($revision))) - { - $revision =~ /^((?:\d+\.)+)(\d+)$/; - my $r_left = $1; # still has the trailing "." - my $r_end = $2; - - $branch_number =~ /^((?:\d+\.)+)(\d+)\.\d+$/; - my $b_left = $1; # still has trailing "." - my $b_mid = $2; # has no trailing "." - - if (($r_left eq $b_left) - && ($r_end <= $b_mid)) - { - goto dengo; - } - } - } - } - } - else # (! @Follow_Branches) - { - next; - } - - # Else we are following branches, but this revision isn't on the - # path. So skip it. - undef $revision; - dengo: - next; - } - - # If we don't have a revision right now, we couldn't possibly - # be looking at anything useful. - if (! (defined ($revision))) { - $detected_file_separator = /^$file_separator$/o; - if ($detected_file_separator) { - # No revisions for this file; can happen, e.g. "cvs log -d DATE" - goto CLEAR; - } - else { - next; - } - } - - # If have file name but not date and author, and see date or - # author, then grab them: - unless (defined $time) - { - if (/^date: .*/) - { - ($time, $author) = &parse_date_and_author ($_); - if (defined ($usermap{$author}) and $usermap{$author}) { - $author = $usermap{$author}; - } - } - else { - $detected_file_separator = /^$file_separator$/o; - if ($detected_file_separator) { - # No revisions for this file; can happen, e.g. "cvs log -d DATE" - goto CLEAR; - } - } - # If the date/time/author hasn't been found yet, we couldn't - # possibly care about anything we see. So skip: - next; - } - - # A "branches: ..." line here indicates that one or more branches - # are rooted at this revision. If we're showing branches, then we - # want to show that fact as well, so we collect all the branches - # that this is the latest ancestor of and store them in - # @branch_roots. Just for reference, the format of the line we're - # seeing at this point is: - # - # branches: 1.5.2; 1.5.4; ...; - # - # Okay, here goes: - - if (/^branches:\s+(.*);$/) - { - if ($Show_Branches) - { - my $lst = $1; - $lst =~ s/(1\.)+1;|(1\.)+1$//; # ignore the trivial branch 1.1.1 - if ($lst) { - @branch_roots = split (/;\s+/, $lst); - } - else { - undef @branch_roots; - } - next; - } - else - { - # Ugh. This really bothers me. Suppose we see a log entry - # like this: - # - # ---------------------------- - # revision 1.1 - # date: 1999/10/17 03:07:38; author: jrandom; state: Exp; - # branches: 1.1.2; - # Intended first line of log message begins here. - # ---------------------------- - # - # The question is, how we can tell the difference between that - # log message and a *two*-line log message whose first line is - # - # "branches: 1.1.2;" - # - # See the problem? The output of "cvs log" is inherently - # ambiguous. - # - # For now, we punt: we liberally assume that people don't - # write log messages like that, and just toss a "branches:" - # line if we see it but are not showing branches. I hope no - # one ever loses real log data because of this. - next; - } - } - - # If have file name, time, and author, then we're just grabbing - # log message texts: - $detected_file_separator = /^$file_separator$/o; - if ($detected_file_separator && ! (defined $revision)) { - # No revisions for this file; can happen, e.g. "cvs log -d DATE" - goto CLEAR; - } - unless ($detected_file_separator || /^$logmsg_separator$/o) - { - $msg_txt .= $_; # Normally, just accumulate the message... - next; - } - # ... until a msg separator is encountered: - # Ensure the message contains something: - if ((! $msg_txt) - || ($msg_txt =~ /^\s*\.\s*$|^\s*$/) - || ($msg_txt =~ /\*\*\* empty log message \*\*\*/)) - { - if ($Prune_Empty_Msgs) { - goto CLEAR; - } - # else - $msg_txt = "[no log message]\n"; - } - - ### Store it all in the Grand Poobah: - { - my $dir_key; # key into %grand_poobah - my %qunk; # complicated little jobbie, see below - - # Each revision of a file has a little data structure (a `qunk') - # associated with it. That data structure holds not only the - # file's name, but any additional information about the file - # that might be needed in the output, such as the revision - # number, tags, branches, etc. The reason to have these things - # arranged in a data structure, instead of just appending them - # textually to the file's name, is that we may want to do a - # little rearranging later as we write the output. For example, - # all the files on a given tag/branch will go together, followed - # by the tag in parentheses (so trunk or otherwise non-tagged - # files would go at the end of the file list for a given log - # message). This rearrangement is a lot easier to do if we - # don't have to reparse the text. - # - # A qunk looks like this: - # - # { - # filename => "hello.c", - # revision => "1.4.3.2", - # time => a timegm() return value (moment of commit) - # tags => [ "tag1", "tag2", ... ], - # branch => "branchname" # There should be only one, right? - # branchroots => [ "branchtag1", "branchtag2", ... ] - # } - - if ($Distributed) { - # Just the basename, don't include the path. - ($qunk{'filename'}, $dir_key, undef) = fileparse ($file_full_path); - } - else { - $dir_key = "./"; - $qunk{'filename'} = $file_full_path; - } - - # This may someday be used in a more sophisticated calculation - # of what other files are involved in this commit. For now, we - # don't use it, because the common-commit-detection algorithm is - # hypothesized to be "good enough" as it stands. - $qunk{'time'} = $time; - - # We might be including revision numbers and/or tags and/or - # branch names in the output. Most of the code from here to - # loop-end deals with organizing these in qunk. - - $qunk{'revision'} = $revision; - - # Grab the branch, even though we may or may not need it: - $qunk{'revision'} =~ /((?:\d+\.)+)\d+/; - my $branch_prefix = $1; - $branch_prefix =~ s/\.$//; # strip off final dot - if ($branch_names{$branch_prefix}) { - $qunk{'branch'} = $branch_names{$branch_prefix}; - } - - # If there's anything in the @branch_roots array, then this - # revision is the root of at least one branch. We'll display - # them as branch names instead of revision numbers, the - # substitution for which is done directly in the array: - if (@branch_roots) { - my @roots = map { $branch_names{$_} } @branch_roots; - $qunk{'branchroots'} = \@roots; - } - - # Save tags too. - if (defined ($symbolic_names{$revision})) { - $qunk{'tags'} = $symbolic_names{$revision}; - delete $symbolic_names{$revision}; - } - - # Add this file to the list - # (We use many spoonfuls of autovivication magic. Hashes and arrays - # will spring into existence if they aren't there already.) - - &debug ("(pushing log msg for ${dir_key}$qunk{'filename'})\n"); - - # Store with the files in this commit. Later we'll loop through - # again, making sure that revisions with the same log message - # and nearby commit times are grouped together as one commit. - push (@{$grand_poobah{$dir_key}{$author}{$time}{$msg_txt}}, \%qunk); - } - - CLEAR: - # Make way for the next message - undef $msg_txt; - undef $time; - undef $revision; - undef $author; - undef @branch_roots; - - # Maybe even make way for the next file: - if ($detected_file_separator) { - undef $file_full_path; - undef %branch_names; - undef %branch_numbers; - undef %symbolic_names; - } - } - - close (LOG_SOURCE); - - ### Process each ChangeLog - - while (my ($dir,$authorhash) = each %grand_poobah) - { - &debug ("DOING DIR: $dir\n"); - - # Here we twist our hash around, from being - # author => time => message => filelist - # in %$authorhash to - # time => author => message => filelist - # in %changelog. - # - # This is also where we merge entries. The algorithm proceeds - # through the timeline of the changelog with a sliding window of - # $Max_Checkin_Duration seconds; within that window, entries that - # have the same log message are merged. - # - # (To save space, we zap %$authorhash after we've copied - # everything out of it.) - - my %changelog; - while (my ($author,$timehash) = each %$authorhash) - { - my $lasttime; - my %stamptime; - foreach my $time (sort {$main::a <=> $main::b} (keys %$timehash)) - { - my $msghash = $timehash->{$time}; - while (my ($msg,$qunklist) = each %$msghash) - { - my $stamptime = $stamptime{$msg}; - if ((defined $stamptime) - and (($time - $stamptime) < $Max_Checkin_Duration) - and (defined $changelog{$stamptime}{$author}{$msg})) - { - push(@{$changelog{$stamptime}{$author}{$msg}}, @$qunklist); - } - else { - $changelog{$time}{$author}{$msg} = $qunklist; - $stamptime{$msg} = $time; - } - } - } - } - undef (%$authorhash); - - ### Now we can write out the ChangeLog! - - my ($logfile_here, $logfile_bak, $tmpfile); - - if (! $Output_To_Stdout) { - $logfile_here = $dir . $Log_File_Name; - $logfile_here =~ s/^\.\/\//\//; # fix any leading ".//" problem - $tmpfile = "${logfile_here}.cvs2cl$$.tmp"; - $logfile_bak = "${logfile_here}.bak"; - - open (LOG_OUT, ">$tmpfile") or die "Unable to open \"$tmpfile\""; - } - else { - open (LOG_OUT, ">-") or die "Unable to open stdout for writing"; - } - - print LOG_OUT $ChangeLog_Header; - - if ($XML_Output) { - print LOG_OUT "\n\n" - . "\n\n"; - } - - foreach my $time (sort {$main::b <=> $main::a} (keys %changelog)) - { - my $authorhash = $changelog{$time}; - while (my ($author,$mesghash) = each %$authorhash) - { - # If XML, escape in outer loop to avoid compound quoting: - if ($XML_Output) { - $author = &xml_escape ($author); - } - - while (my ($msg,$qunklist) = each %$mesghash) - { - my $files = &pretty_file_list ($qunklist); - my $header_line; # date and author - my $body; # see below - my $wholething; # $header_line + $body - - # Set up the date/author line. - # kff todo: do some more XML munging here, on the header - # part of the entry: - my ($ignore,$min,$hour,$mday,$mon,$year,$wday) - = $UTC_Times ? gmtime($time) : localtime($time); - - # XML output includes everything else, we might as well make - # it always include Day Of Week too, for consistency. - if ($Show_Day_Of_Week or $XML_Output) { - $wday = ("Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday")[$wday]; - $wday = ($XML_Output) ? "${wday}\n" : " $wday"; - } - else { - $wday = ""; - } - - if ($XML_Output) { - $header_line = - sprintf ("%4u-%02u-%02u\n" - . "${wday}" - . "\n" - . "%s\n", - $year+1900, $mon+1, $mday, $hour, $min, $author); - } - else { - $header_line = - sprintf ("%4u-%02u-%02u${wday} %02u:%02u %s\n\n", - $year+1900, $mon+1, $mday, $hour, $min, $author); - } - - # Reshape the body according to user preferences. - if ($XML_Output) - { - $msg = &preprocess_msg_text ($msg); - $body = $files . $msg; - } - elsif ($No_Wrap) - { - $msg = &preprocess_msg_text ($msg); - $files = wrap ("\t", " ", "$files"); - $msg =~ s/\n(.*)/\n\t$1/g; - unless ($After_Header eq " ") { - $msg =~ s/^(.*)/\t$1/g; - } - $body = $files . $After_Header . $msg; - } - else # do wrapping, either FSF-style or regular - { - if ($FSF_Style) - { - $files = wrap ("\t", " ", "$files"); - - my $files_last_line_len = 0; - if ($After_Header eq " ") - { - $files_last_line_len = &last_line_len ($files); - $files_last_line_len += 1; # for $After_Header - } - - $msg = &wrap_log_entry - ($msg, "\t", 69 - $files_last_line_len, 69); - $body = $files . $After_Header . $msg; - } - else # not FSF-style - { - $msg = &preprocess_msg_text ($msg); - $body = $files . $After_Header . $msg; - $body = wrap ("\t", " ", "$body"); - } - } - - $wholething = $header_line . $body; - - if ($XML_Output) { - $wholething = "\n${wholething}\n"; - } - - # One last check: make sure it passes the regexp test, if the - # user asked for that. We have to do it here, so that the - # test can match against information in the header as well - # as in the text of the log message. - - # How annoying to duplicate so much code just because I - # can't figure out a way to evaluate scalars on the trailing - # operator portion of a regular expression. Grrr. - if ($Case_Insensitive) { - unless ($Regexp_Gate && ($wholething !~ /$Regexp_Gate/oi)) { - print LOG_OUT "${wholething}\n"; - } - } - else { - unless ($Regexp_Gate && ($wholething !~ /$Regexp_Gate/o)) { - print LOG_OUT "${wholething}\n"; - } - } - } - } - } - - if ($XML_Output) { - print LOG_OUT "\n"; - } - - close (LOG_OUT); - - if (! $Output_To_Stdout) - { - # If accumulating, append old data to new before renaming. But - # don't append the most recent entry, since it's already in the - # new log due to CVS's idiosyncratic interpretation of "log -d". - if ($Cumulative && -f $logfile_here) - { - open (NEW_LOG, ">>$tmpfile") - or die "trouble appending to $tmpfile ($!)"; - - open (OLD_LOG, "<$logfile_here") - or die "trouble reading from $logfile_here ($!)"; - - my $started_first_entry = 0; - my $passed_first_entry = 0; - while () - { - if (! $passed_first_entry) - { - if ((! $started_first_entry) - && /^(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)/) { - $started_first_entry = 1; - } - elsif (/^(\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)/) { - $passed_first_entry = 1; - print NEW_LOG $_; - } - } - else { - print NEW_LOG $_; - } - } - - close (NEW_LOG); - close (OLD_LOG); - } - - if (-f $logfile_here) { - rename ($logfile_here, $logfile_bak); - } - rename ($tmpfile, $logfile_here); - } - } -} - - -sub parse_date_and_author () -{ - # Parses the date/time and author out of a line like: - # - # date: 1999/02/19 23:29:05; author: apharris; state: Exp; - - my $line = shift; - - my ($year, $mon, $mday, $hours, $min, $secs, $author) = $line =~ - m#(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+author:\s+([^;]+);# - or die "Couldn't parse date ``$line''"; - die "Bad date or Y2K issues" unless ($year > 1969 and $year < 2258); - # Kinda arbitrary, but useful as a sanity check - my $time = timegm($secs,$min,$hours,$mday,$mon-1,$year-1900); - - return ($time, $author); -} - - -# Here we take a bunch of qunks and convert them into printed -# summary that will include all the information the user asked for. -sub pretty_file_list () -{ - if ($Hide_Filenames and (! $XML_Output)) { - return ""; - } - - my $qunksref = shift; - my @qunkrefs = @$qunksref; - my @filenames; - my $beauty = ""; # The accumulating header string for this entry. - my %non_unanimous_tags; # Tags found in a proper subset of qunks - my %unanimous_tags; # Tags found in all qunks - my %all_branches; # Branches found in any qunk - my $common_dir = undef; # Dir prefix common to all files ("" if none) - my $fbegun = 0; # Did we begin printing filenames yet? - - # First, loop over the qunks gathering all the tag/branch names. - # We'll put them all in non_unanimous_tags, and take out the - # unanimous ones later. - foreach my $qunkref (@qunkrefs) - { - # Keep track of whether all the files in this commit were in the - # same directory, and memorize it if so. We can make the output a - # little more compact by mentioning the directory only once. - if ((scalar (@qunkrefs)) > 1) - { - if (! (defined ($common_dir))) - { - my ($base, $dir); - ($base, $dir, undef) = fileparse ($$qunkref{'filename'}); - - if ((! (defined ($dir))) # this first case is sheer paranoia - or ($dir eq "") - or ($dir eq "./") - or ($dir eq ".\\")) - { - $common_dir = ""; - } - else - { - $common_dir = $dir; - } - } - elsif ($common_dir ne "") - { - # Already have a common dir prefix, so how much of it can we preserve? - $common_dir = &common_path_prefix ($$qunkref{'filename'}, $common_dir); - } - } - else # only one file in this entry anyway, so common dir not an issue - { - $common_dir = ""; - } - - if (defined ($$qunkref{'branch'})) { - $all_branches{$$qunkref{'branch'}} = 1; - } - if (defined ($$qunkref{'tags'})) { - foreach my $tag (@{$$qunkref{'tags'}}) { - $non_unanimous_tags{$tag} = 1; - } - } - } - - # Any tag held by all qunks will be printed specially... but only if - # there are multiple qunks in the first place! - if ((scalar (@qunkrefs)) > 1) { - foreach my $tag (keys (%non_unanimous_tags)) { - my $everyone_has_this_tag = 1; - foreach my $qunkref (@qunkrefs) { - if ((! (defined ($$qunkref{'tags'}))) - or (! (grep ($_ eq $tag, @{$$qunkref{'tags'}})))) { - $everyone_has_this_tag = 0; - } - } - if ($everyone_has_this_tag) { - $unanimous_tags{$tag} = 1; - delete $non_unanimous_tags{$tag}; - } - } - } - - if ($XML_Output) - { - # If outputting XML, then our task is pretty simple, because we - # don't have to detect common dir, common tags, branch prefixing, - # etc. We just output exactly what we have, and don't worry about - # redundancy or readability. - - foreach my $qunkref (@qunkrefs) - { - my $filename = $$qunkref{'filename'}; - my $revision = $$qunkref{'revision'}; - my $tags = $$qunkref{'tags'}; - my $branch = $$qunkref{'branch'}; - my $branchroots = $$qunkref{'branchroots'}; - - $filename = &xml_escape ($filename); # probably paranoia - $revision = &xml_escape ($revision); # definitely paranoia - - $beauty .= "\n"; - $beauty .= "${filename}\n"; - $beauty .= "${revision}\n"; - if ($branch) { - $branch = &xml_escape ($branch); # more paranoia - $beauty .= "${branch}\n"; - } - foreach my $tag (@$tags) { - $tag = &xml_escape ($tag); # by now you're used to the paranoia - $beauty .= "${tag}\n"; - } - foreach my $root (@$branchroots) { - $root = &xml_escape ($root); # which is good, because it will continue - $beauty .= "${root}\n"; - } - $beauty .= "\n"; - } - - # Theoretically, we could go home now. But as long as we're here, - # let's print out the common_dir and utags, as a convenience to - # the receiver (after all, earlier code calculated that stuff - # anyway, so we might as well take advantage of it). - - if ((scalar (keys (%unanimous_tags))) > 1) { - foreach my $utag ((keys (%unanimous_tags))) { - $utag = &xml_escape ($utag); # the usual paranoia - $beauty .= "${utag}\n"; - } - } - if ($common_dir) { - $common_dir = &xml_escape ($common_dir); - $beauty .= "${common_dir}\n"; - } - - # That's enough for XML, time to go home: - return $beauty; - } - - # Else not XML output, so complexly compactify for chordate - # consumption. At this point we have enough global information - # about all the qunks to organize them non-redundantly for output. - - if ($common_dir) { - # Note that $common_dir still has its trailing slash - $beauty .= "$common_dir: "; - } - - if ($Show_Branches) - { - # For trailing revision numbers. - my @brevisions; - - foreach my $branch (keys (%all_branches)) - { - foreach my $qunkref (@qunkrefs) - { - if ((defined ($$qunkref{'branch'})) - and ($$qunkref{'branch'} eq $branch)) - { - if ($fbegun) { - # kff todo: comma-delimited in XML too? Sure. - $beauty .= ", "; - } - else { - $fbegun = 1; - } - my $fname = substr ($$qunkref{'filename'}, length ($common_dir)); - $beauty .= $fname; - $$qunkref{'printed'} = 1; # Just setting a mark bit, basically - - if ($Show_Tags && (defined @{$$qunkref{'tags'}})) { - my @tags = grep ($non_unanimous_tags{$_}, @{$$qunkref{'tags'}}); - if (@tags) { - $beauty .= " (tags: "; - $beauty .= join (', ', @tags); - $beauty .= ")"; - } - } - - if ($Show_Revisions) { - # Collect the revision numbers' last components, but don't - # print them -- they'll get printed with the branch name - # later. - $$qunkref{'revision'} =~ /.+\.([\d]+)$/; - push (@brevisions, $1); - - # todo: we're still collecting branch roots, but we're not - # showing them anywhere. If we do show them, it would be - # nifty to just call them revision "0" on a the branch. - # Yeah, that's the ticket. - } - } - } - $beauty .= " ($branch"; - if (@brevisions) { - if ((scalar (@brevisions)) > 1) { - $beauty .= ".["; - $beauty .= (join (',', @brevisions)); - $beauty .= "]"; - } - else { - $beauty .= ".$brevisions[0]"; - } - } - $beauty .= ")"; - } - } - - # Okay; any qunks that were done according to branch are taken care - # of, and marked as printed. Now print everyone else. - - foreach my $qunkref (@qunkrefs) - { - next if (defined ($$qunkref{'printed'})); # skip if already printed - - if ($fbegun) { - $beauty .= ", "; - } - else { - $fbegun = 1; - } - $beauty .= substr ($$qunkref{'filename'}, length ($common_dir)); - # todo: Shlomo's change was this: - # $beauty .= substr ($$qunkref{'filename'}, - # (($common_dir eq "./") ? "" : length ($common_dir))); - $$qunkref{'printed'} = 1; # Set a mark bit. - - if ($Show_Revisions || $Show_Tags) - { - my $started_addendum = 0; - - if ($Show_Revisions) { - $started_addendum = 1; - $beauty .= " ("; - $beauty .= "$$qunkref{'revision'}"; - } - if ($Show_Tags && (defined $$qunkref{'tags'})) { - my @tags = grep ($non_unanimous_tags{$_}, @{$$qunkref{'tags'}}); - if ((scalar (@tags)) > 0) { - if ($started_addendum) { - $beauty .= ", "; - } - else { - $beauty .= " (tags: "; - } - $beauty .= join (', ', @tags); - $started_addendum = 1; - } - } - if ($started_addendum) { - $beauty .= ")"; - } - } - } - - # Unanimous tags always come last. - if ($Show_Tags && %unanimous_tags) - { - $beauty .= " (utags: "; - $beauty .= join (', ', keys (%unanimous_tags)); - $beauty .= ")"; - } - - # todo: still have to take care of branch_roots? - - $beauty = "* $beauty:"; - - return $beauty; -} - - -sub common_path_prefix () -{ - my $path1 = shift; - my $path2 = shift; - - my ($dir1, $dir2); - (undef, $dir1, undef) = fileparse ($path1); - (undef, $dir2, undef) = fileparse ($path2); - - # Transmogrify Windows filenames to look like Unix. - # (It is far more likely that someone is running cvs2cl.pl under - # Windows than that they would genuinely have backslashes in their - # filenames.) - $dir1 =~ tr#\\#/#; - $dir2 =~ tr#\\#/#; - - my $accum1 = ""; - my $accum2 = ""; - my $last_common_prefix = ""; - - while ($accum1 eq $accum2) - { - $last_common_prefix = $accum1; - last if ($accum1 eq $dir1); - my ($tmp1) = split (/\//, (substr ($dir1, length ($accum1)))); - my ($tmp2) = split (/\//, (substr ($dir2, length ($accum2)))); - $accum1 .= "$tmp1/" if ((defined ($tmp1)) and $tmp1); - $accum2 .= "$tmp2/" if ((defined ($tmp2)) and $tmp2); - } - - return $last_common_prefix; -} - - -sub preprocess_msg_text () -{ - my $text = shift; - - # Strip out carriage returns (as they probably result from DOSsy editors). - $text =~ s/\r\n/\n/g; - - # If it *looks* like two newlines, make it *be* two newlines: - $text =~ s/\n\s*\n/\n\n/g; - - if ($XML_Output) - { - $text = &xml_escape ($text); - $text = "${text}\n"; - } - elsif (! $No_Wrap) - { - # Strip off lone newlines, but only for lines that don't begin with - # whitespace or a mail-quoting character, since we want to preserve - # that kind of formatting. Also don't strip newlines that follow a - # period; we handle those specially next. And don't strip - # newlines that precede an open paren. - 1 while ($text =~ s/(^|\n)([^>\s].*[^.\n])\n([^>\n])/$1$2 $3/g); - - # If a newline follows a period, make sure that when we bring up the - # bottom sentence, it begins with two spaces. - 1 while ($text =~ s/(^|\n)([^>\s].*)\n([^>\n])/$1$2 $3/g); - } - - return $text; -} - - -sub last_line_len () -{ - my $files_list = shift; - my @lines = split (/\n/, $files_list); - my $last_line = pop (@lines); - return length ($last_line); -} - - -# A custom wrap function, sensitive to some common constructs used in -# log entries. -sub wrap_log_entry () -{ - my $text = shift; # The text to wrap. - my $left_pad_str = shift; # String to pad with on the left. - - # These do NOT take left_pad_str into account: - my $length_remaining = shift; # Amount left on current line. - my $max_line_length = shift; # Amount left for a blank line. - - my $wrapped_text = ""; # The accumulating wrapped entry. - my $user_indent = ""; # Inherited user_indent from prev line. - - my $first_time = 1; # First iteration of the loop? - my $suppress_line_start_match = 0; # Set to disable line start checks. - - my @lines = split (/\n/, $text); - while (@lines) # Don't use `foreach' here, it won't work. - { - my $this_line = shift (@lines); - chomp $this_line; - - if ($this_line =~ /^(\s+)/) { - $user_indent = $1; - } - else { - $user_indent = ""; - } - - # If it matches any of the line-start regexps, print a newline now... - if ($suppress_line_start_match) - { - $suppress_line_start_match = 0; - } - elsif (($this_line =~ /^(\s*)\*\s+[a-zA-Z0-9]/) - || ($this_line =~ /^(\s*)\* [a-zA-Z0-9_\.\/\+-]+/) - || ($this_line =~ /^(\s*)\([a-zA-Z0-9_\.\/\+-]+(\)|,\s*)/) - || ($this_line =~ /^(\s+)(\S+)/) - || ($this_line =~ /^(\s*)- +/) - || ($this_line =~ /^()\s*$/) - || ($this_line =~ /^(\s*)\*\) +/) - || ($this_line =~ /^(\s*)[a-zA-Z0-9](\)|\.|\:) +/)) - { - # Make a line break immediately, unless header separator is set - # and this line is the first line in the entry, in which case - # we're getting the blank line for free already and shouldn't - # add an extra one. - unless (($After_Header ne " ") and ($first_time)) - { - if ($this_line =~ /^()\s*$/) { - $suppress_line_start_match = 1; - $wrapped_text .= "\n${left_pad_str}"; - } - - $wrapped_text .= "\n${left_pad_str}"; - } - - $length_remaining = $max_line_length - (length ($user_indent)); - } - - # Now that any user_indent has been preserved, strip off leading - # whitespace, so up-folding has no ugly side-effects. - $this_line =~ s/^\s*//; - - # Accumulate the line, and adjust parameters for next line. - my $this_len = length ($this_line); - if ($this_len == 0) - { - # Blank lines should cancel any user_indent level. - $user_indent = ""; - $length_remaining = $max_line_length; - } - elsif ($this_len >= $length_remaining) # Line too long, try breaking it. - { - # Walk backwards from the end. At first acceptable spot, break - # a new line. - my $idx = $length_remaining - 1; - if ($idx < 0) { $idx = 0 }; - while ($idx > 0) - { - if (substr ($this_line, $idx, 1) =~ /\s/) - { - my $line_now = substr ($this_line, 0, $idx); - my $next_line = substr ($this_line, $idx); - $this_line = $line_now; - - # Clean whitespace off the end. - chomp $this_line; - - # The current line is ready to be printed. - $this_line .= "\n${left_pad_str}"; - - # Make sure the next line is allowed full room. - $length_remaining = $max_line_length - (length ($user_indent)); - - # Strip next_line, but then preserve any user_indent. - $next_line =~ s/^\s*//; - - # Sneak a peek at the user_indent of the upcoming line, so - # $next_line (which will now precede it) can inherit that - # indent level. Otherwise, use whatever user_indent level - # we currently have, which might be none. - my $next_next_line = shift (@lines); - if ((defined ($next_next_line)) && ($next_next_line =~ /^(\s+)/)) { - $next_line = $1 . $next_line if (defined ($1)); - # $length_remaining = $max_line_length - (length ($1)); - $next_next_line =~ s/^\s*//; - } - else { - $next_line = $user_indent . $next_line; - } - if (defined ($next_next_line)) { - unshift (@lines, $next_next_line); - } - unshift (@lines, $next_line); - - # Our new next line might, coincidentally, begin with one of - # the line-start regexps, so we temporarily turn off - # sensitivity to that until we're past the line. - $suppress_line_start_match = 1; - - last; - } - else - { - $idx--; - } - } - - if ($idx == 0) - { - # We bottomed out because the line is longer than the - # available space. But that could be because the space is - # small, or because the line is longer than even the maximum - # possible space. Handle both cases below. - - if ($length_remaining == ($max_line_length - (length ($user_indent)))) - { - # The line is simply too long -- there is no hope of ever - # breaking it nicely, so just insert it verbatim, with - # appropriate padding. - $this_line = "\n${left_pad_str}${this_line}"; - } - else - { - # Can't break it here, but may be able to on the next round... - unshift (@lines, $this_line); - $length_remaining = $max_line_length - (length ($user_indent)); - $this_line = "\n${left_pad_str}"; - } - } - } - else # $this_len < $length_remaining, so tack on what we can. - { - # Leave a note for the next iteration. - $length_remaining = $length_remaining - $this_len; - - if ($this_line =~ /\.$/) - { - $this_line .= " "; - $length_remaining -= 2; - } - else # not a sentence end - { - $this_line .= " "; - $length_remaining -= 1; - } - } - - # Unconditionally indicate that loop has run at least once. - $first_time = 0; - - $wrapped_text .= "${user_indent}${this_line}"; - } - - # One last bit of padding. - $wrapped_text .= "\n"; - - return $wrapped_text; -} - - -sub xml_escape () -{ - my $txt = shift; - $txt =~ s/&/&/g; - $txt =~ s//>/g; - return $txt; -} - - -sub maybe_read_user_map_file () -{ - my %expansions; - - if ($User_Map_File) - { - open (MAPFILE, "<$User_Map_File") - or die ("Unable to open $User_Map_File ($!)"); - - while () - { - next if /^\s*#/; # Skip comment lines. - next if not /:/; # Skip lines without colons. - - # It is now safe to split on ':'. - my ($username, $expansion) = split ':'; - chomp $expansion; - $expansion =~ s/^'(.*)'$/$1/; - $expansion =~ s/^"(.*)"$/$1/; - - # If it looks like the expansion has a real name already, then - # we toss the username we got from CVS log. Otherwise, keep - # it to use in combination with the email address. - - if ($expansion =~ /^\s*<{0,1}\S+@.*/) { - # Also, add angle brackets if none present - if (! ($expansion =~ /<\S+@\S+>/)) { - $expansions{$username} = "$username <$expansion>"; - } - else { - $expansions{$username} = "$username $expansion"; - } - } - else { - $expansions{$username} = $expansion; - } - } - - close (MAPFILE); - } - - return %expansions; -} - - -sub parse_options () -{ - # Check this internally before setting the global variable. - my $output_file; - - # If this gets set, we encountered unknown options and will exit at - # the end of this subroutine. - my $exit_with_admonishment = 0; - - while (my $arg = shift (@ARGV)) - { - if ($arg =~ /^-h$|^-help$|^--help$|^--usage$|^-?$/) { - $Print_Usage = 1; - } - elsif ($arg =~ /^--debug$/) { # unadvertised option, heh - $Debug = 1; - } - elsif ($arg =~ /^--version$/) { - $Print_Version = 1; - } - elsif ($arg =~ /^-g$|^--global-opts$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - # Don't assume CVS is called "cvs" on the user's system: - $Log_Source_Command =~ s/(^\S*)/$1 $narg/; - } - elsif ($arg =~ /^-l$|^--log-opts$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - $Log_Source_Command .= " $narg"; - } - elsif ($arg =~ /^-f$|^--file$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - $output_file = $narg; - } - elsif ($arg =~ /^--accum$/) { - $Cumulative = 1; - } - elsif ($arg =~ /^--fsf$/) { - $FSF_Style = 1; - } - elsif ($arg =~ /^-U$|^--usermap$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - $User_Map_File = $narg; - } - elsif ($arg =~ /^-W$|^--window$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - $Max_Checkin_Duration = $narg; - } - elsif ($arg =~ /^-I$|^--ignore$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - push (@Ignore_Files, $narg); - } - elsif ($arg =~ /^-C$|^--case-insensitive$/) { - $Case_Insensitive = 1; - } - elsif ($arg =~ /^-R$|^--regexp$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - $Regexp_Gate = $narg; - } - elsif ($arg =~ /^--stdout$/) { - $Output_To_Stdout = 1; - } - elsif ($arg =~ /^--version$/) { - $Print_Version = 1; - } - elsif ($arg =~ /^-d$|^--distributed$/) { - $Distributed = 1; - } - elsif ($arg =~ /^-P$|^--prune$/) { - $Prune_Empty_Msgs = 1; - } - elsif ($arg =~ /^-S$|^--separate-header$/) { - $After_Header = "\n\n"; - } - elsif ($arg =~ /^--no-wrap$/) { - $No_Wrap = 1; - } - elsif ($arg =~ /^--gmt$|^--utc$/) { - $UTC_Times = 1; - } - elsif ($arg =~ /^-w$|^--day-of-week$/) { - $Show_Day_Of_Week = 1; - } - elsif ($arg =~ /^-r$|^--revisions$/) { - $Show_Revisions = 1; - } - elsif ($arg =~ /^-t$|^--tags$/) { - $Show_Tags = 1; - } - elsif ($arg =~ /^-b$|^--branches$/) { - $Show_Branches = 1; - } - elsif ($arg =~ /^-F$|^--follow$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - push (@Follow_Branches, $narg); - } - elsif ($arg =~ /^--stdin$/) { - $Input_From_Stdin = 1; - } - elsif ($arg =~ /^--header$/) { - my $narg = shift (@ARGV) || die "$arg needs argument.\n"; - $ChangeLog_Header = &slurp_file ($narg); - if (! defined ($ChangeLog_Header)) { - $ChangeLog_Header = ""; - } - } - elsif ($arg =~ /^--xml$/) { - $XML_Output = 1; - } - elsif ($arg =~ /^--hide-filenames$/) { - $Hide_Filenames = 1; - $After_Header = ""; - } - else { - # Just add a filename as argument to the log command - $Log_Source_Command .= " $arg"; - } - } - - ## Check for contradictions... - - if ($Output_To_Stdout && $Distributed) { - print STDERR "cannot pass both --stdout and --distributed\n"; - $exit_with_admonishment = 1; - } - - if ($Output_To_Stdout && $output_file) { - print STDERR "cannot pass both --stdout and --file\n"; - $exit_with_admonishment = 1; - } - - if ($XML_Output && $Cumulative) { - print STDERR "cannot pass both --xml and --accum\n"; - $exit_with_admonishment = 1; - } - - # Or if any other error message has already been printed out, we - # just leave now: - if ($exit_with_admonishment) { - &usage (); - exit (1); - } - elsif ($Print_Usage) { - &usage (); - exit (0); - } - elsif ($Print_Version) { - &version (); - exit (0); - } - - ## Else no problems, so proceed. - - if ($output_file) { - $Log_File_Name = $output_file; - } -} - - -sub slurp_file () -{ - my $filename = shift || die ("no filename passed to slurp_file()"); - my $retstr; - - open (SLURPEE, "<${filename}") or die ("unable to open $filename ($!)"); - my $saved_sep = $/; - undef $/; - $retstr = ; - $/ = $saved_sep; - close (SLURPEE); - return $retstr; -} - - -sub debug () -{ - if ($Debug) { - my $msg = shift; - print STDERR $msg; - } -} - - -sub version () -{ - print "cvs2cl.pl version ${VERSION}; distributed under the GNU GPL.\n"; -} - - -sub usage () -{ - &version (); - print <<'END_OF_INFO'; -Generate GNU-style ChangeLogs in CVS working copies. - -Notes about the output format(s): - - The default output of cvs2cl.pl is designed to be compact, formally - unambiguous, but still easy for humans to read. It is largely - self-explanatory, I hope; the one abbreviation that might not be - obvious is "utags". That stands for "universal tags" -- a - universal tag is one held by all the files in a given change entry. - - If you need output that's easy for a program to parse, use the - --xml option. Note that with XML output, just about all available - information is included with each change entry, whether you asked - for it or not, on the theory that your parser can ignore anything - it's not looking for. - -Notes about the options and arguments (the actual options are listed -last in this usage message): - - * The -I and -F options may appear multiple times. - - * To follow trunk revisions, use "-F trunk" ("-F TRUNK" also works). - This is okay because no would ever, ever be crazy enough to name a - branch "trunk", right? Right. - - * For the -U option, the UFILE should be formatted like - CVSROOT/users. That is, each line of UFILE looks like this - jrandom:jrandom@red-bean.com - or maybe even like this - jrandom:'Jesse Q. Random ' - Don't forget to quote the portion after the colon if necessary. - - * Many people want to filter by date. To do so, invoke cvs2cl.pl - like this: - cvs2cl.pl -l "-d'DATESPEC'" - where DATESPEC is any date specification valid for "cvs log -d". - (Note that CVS 1.10.7 and below requires there be no space between - -d and its argument). - -Options/Arguments: - - -h, -help, --help, or -? Show this usage and exit - --version Show version and exit - -r, --revisions Show revision numbers in output - -b, --branches Show branch names in revisions when possible - -t, --tags Show tags (symbolic names) in output - --stdin Read from stdin, don't run cvs log - --stdout Output to stdout not to ChangeLog - -d, --distributed Put ChangeLogs in subdirs - -f FILE, --file FILE Write to FILE instead of "ChangeLog" - --fsf Use this if log data is in FSF ChangeLog style - -W SECS, --window SECS Window of time within which log entries unify - -U UFILE, --usermap UFILE Expand usernames to email addresses from UFILE - -R REGEXP, --regexp REGEXP Include only entries that match REGEXP - -I REGEXP, --ignore REGEXP Ignore files whose names match REGEXP - -C, --case-insensitive Any regexp matching is done case-insensitively - -F BRANCH, --follow BRANCH Show only revisions on or ancestral to BRANCH - -S, --separate-header Blank line between each header and log message - --no-wrap Don't auto-wrap log message (recommend -S also) - --gmt, --utc Show times in GMT/UTC instead of local time - --accum Add to an existing ChangeLog (incompat w/ --xml) - -w, --day-of-week Show day of week - --header FILE Get ChangeLog header from FILE ("-" means stdin) - --xml Output XML instead of ChangeLog format - --hide-filenames Don't show filenames (ignored for XML output) - -P, --prune Don't show empty log messages - -g OPTS, --global-opts OPTS Invoke like this "cvs OPTS log ..." - -l OPTS, --log-opts OPTS Invoke like this "cvs ... log OPTS" - FILE1 [FILE2 ...] Show only log information for the named FILE(s) - -See http://www.red-bean.com/cvs2cl for maintenance and bug info. -END_OF_INFO -} - -__END__ - -=head1 NAME - -cvs2cl.pl - produces GNU-style ChangeLogs in CVS working copies, by - running "cvs log" and parsing the output. Shared log entries are - unified in an intuitive way. - -=head1 DESCRIPTION - -This script generates GNU-style ChangeLog files from CVS log -information. Basic usage: just run it inside a working copy and a -ChangeLog will appear. It requires repository access (i.e., 'cvs log' -must work). Run "cvs2cl.pl --help" to see more advanced options. - -See http://www.red-bean.com/cvs2cl for updates, and for instructions -on getting anonymous CVS access to this script. - -Maintainer: Karl Fogel -Please report bugs to . - -=head1 README - -This script generates GNU-style ChangeLog files from CVS log -information. Basic usage: just run it inside a working copy and a -ChangeLog will appear. It requires repository access (i.e., 'cvs log' -must work). Run "cvs2cl.pl --help" to see more advanced options. - -See http://www.red-bean.com/cvs2cl for updates, and for instructions -on getting anonymous CVS access to this script. - -Maintainer: Karl Fogel -Please report bugs to . - -=head1 PREREQUISITES - -This script requires C, C, and -C. -It also seems to require C or higher. - -=pod OSNAMES - -any - -=pod SCRIPT CATEGORIES - -Version_Control/CVS - -=cut - - --*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- - -Note about a bug-slash-opportunity: ------------------------------------ - -There's a bug in Text::Wrap, which affects cvs2cl. This script -reveals it: - - #!/usr/bin/perl -w - - use Text::Wrap; - - my $test_text = - "This script demonstrates a bug in Text::Wrap. The very long line - following this paragraph will be relocated relative to the surrounding - text: - - ==================================================================== - - See? When the bug happens, we'll get the line of equal signs below - this paragraph, even though it should be above."; - - - # Print out the test text with no wrapping: - print "$test_text"; - print "\n"; - print "\n"; - - # Now print it out wrapped, and see the bug: - print wrap ("\t", " ", "$test_text"); - print "\n"; - print "\n"; - -If the line of equal signs were one shorter, then the bug doesn't -happen. Interesting. - -Anyway, rather than fix this in Text::Wrap, we might as well write a -new wrap() which has the following much-needed features: - -* initial indentation, like current Text::Wrap() -* subsequent line indentation, like current Text::Wrap() -* user chooses among: force-break long words, leave them alone, or die()? -* preserve existing indentation: chopped chunks from an indented line - are indented by same (like this line, not counting the asterisk!) -* optional list of things to preserve on line starts, default ">" - -Note that the last two are essentially the same concept, so unify in -implementation and give a good interface to controlling them. - -And how about: - -Optionally, when encounter a line pre-indented by same as previous -line, then strip the newline and refill, but indent by the same. -Yeah... diff --git a/ndb/home/bin/fix-cvs-root b/ndb/home/bin/fix-cvs-root index 2c4f158f825..1ba6fca170e 100755 --- a/ndb/home/bin/fix-cvs-root +++ b/ndb/home/bin/fix-cvs-root @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # change all CVS/Root to current CVSROOT [ "$CVSROOT" ] || { echo "no CVSROOT in environment" >&2; exit 1; } diff --git a/ndb/home/bin/import-from-bk.sh b/ndb/home/bin/import-from-bk.sh index 4e3957be6d5..d3e7e4ae9f3 100755 --- a/ndb/home/bin/import-from-bk.sh +++ b/ndb/home/bin/import-from-bk.sh @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # XXX does not delete files # XXX does not handle nested new dirs # this script screams for perl, no time now diff --git a/ndb/home/bin/ndb_deploy b/ndb/home/bin/ndb_deploy index 773fc9b8fd7..347d6c45f51 100755 --- a/ndb/home/bin/ndb_deploy +++ b/ndb/home/bin/ndb_deploy @@ -1,5 +1,20 @@ #!/bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + if [ $# -eq 0 ] then for i in $DEPLOY_DST diff --git a/ndb/home/bin/ndbdoxy.pl b/ndb/home/bin/ndbdoxy.pl index 89b7de8440e..8896437fa0f 100755 --- a/ndb/home/bin/ndbdoxy.pl +++ b/ndb/home/bin/ndbdoxy.pl @@ -1,4 +1,20 @@ #!/usr/local/bin/perl + +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # # ndbdoxy.pl Executes doxygen on a checked out version of NDB Cluster # diff --git a/ndb/home/bin/ngcalc b/ndb/home/bin/ngcalc index a289d384db9..921a82881f0 100755 --- a/ndb/home/bin/ngcalc +++ b/ndb/home/bin/ngcalc @@ -1,5 +1,20 @@ #! /usr/local/bin/perl +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + use strict; use Getopt::Long; diff --git a/ndb/home/bin/parseConfigFile.awk b/ndb/home/bin/parseConfigFile.awk index 6903949156c..8c9b308b4cf 100644 --- a/ndb/home/bin/parseConfigFile.awk +++ b/ndb/home/bin/parseConfigFile.awk @@ -1,3 +1,18 @@ +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + BEGIN{ where=0; n_hosts=0; diff --git a/ndb/home/bin/setup-test.sh b/ndb/home/bin/setup-test.sh index 61097c30027..7d7b33cd002 100755 --- a/ndb/home/bin/setup-test.sh +++ b/ndb/home/bin/setup-test.sh @@ -1,5 +1,20 @@ #!/bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # NAME # run-test.sh - Run a test program # diff --git a/ndb/home/bin/signallog2html.lib/signallog2list.awk b/ndb/home/bin/signallog2html.lib/signallog2list.awk index 9839f314556..c049b33ef16 100644 --- a/ndb/home/bin/signallog2html.lib/signallog2list.awk +++ b/ndb/home/bin/signallog2html.lib/signallog2list.awk @@ -1,3 +1,18 @@ +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + BEGIN{ PRINT=0; SIGNAL_ARRAY[0]=""; diff --git a/ndb/home/bin/signallog2html.lib/uniq_blocks.awk b/ndb/home/bin/signallog2html.lib/uniq_blocks.awk index 43f48d1cde1..f1463889ef6 100644 --- a/ndb/home/bin/signallog2html.lib/uniq_blocks.awk +++ b/ndb/home/bin/signallog2html.lib/uniq_blocks.awk @@ -1,3 +1,18 @@ +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + BEGIN{ NAMES[""]=""; ORDER[0]=""; diff --git a/ndb/home/bin/signallog2html.sh b/ndb/home/bin/signallog2html.sh index 5665275807c..8b49849be50 100755 --- a/ndb/home/bin/signallog2html.sh +++ b/ndb/home/bin/signallog2html.sh @@ -1,4 +1,20 @@ #!/bin/sh + +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # NAME # signallog2html.sh # diff --git a/ndb/home/bin/stripcr b/ndb/home/bin/stripcr index 540418f88cf..97b35fd42d5 100755 --- a/ndb/home/bin/stripcr +++ b/ndb/home/bin/stripcr @@ -1,5 +1,19 @@ #!/bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 # NAME # stripcr - a program for removing carriage return chars from dos-files. diff --git a/ndb/home/lib/funcs.sh b/ndb/home/lib/funcs.sh index b7d8914035e..f967f52c567 100644 --- a/ndb/home/lib/funcs.sh +++ b/ndb/home/lib/funcs.sh @@ -1,3 +1,18 @@ +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # NAME # safe, safe_eval, die, rawdie, syndie, msg, errmsg, # rawmsg, rawerrmsg, trace, errtrace, is_wordmatch diff --git a/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs b/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs index ea1798c8c67..b19875b97ef 100644 --- a/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs +++ b/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/Computer.cs b/ndb/src/cw/cpcc-win32/csharp/Computer.cs index 9763fac5622..5ee35e5e90e 100644 --- a/ndb/src/cw/cpcc-win32/csharp/Computer.cs +++ b/ndb/src/cw/cpcc-win32/csharp/Computer.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs b/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs index c01e41f3e60..506cb6777f0 100644 --- a/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs +++ b/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs b/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs index 5b4d1b56df7..a126c632ffd 100644 --- a/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs +++ b/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/Database.cs b/ndb/src/cw/cpcc-win32/csharp/Database.cs index 39b8c160159..80a8daee2d0 100644 --- a/ndb/src/cw/cpcc-win32/csharp/Database.cs +++ b/ndb/src/cw/cpcc-win32/csharp/Database.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs b/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs index f492aa64c60..a780190f86c 100644 --- a/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs +++ b/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + //author:Arun //date:Nov 13,2002 //Wizard using panel diff --git a/ndb/src/cw/cpcc-win32/csharp/Process.cs b/ndb/src/cw/cpcc-win32/csharp/Process.cs index c1ee1b2fe9e..eac12d4868e 100644 --- a/ndb/src/cw/cpcc-win32/csharp/Process.cs +++ b/ndb/src/cw/cpcc-win32/csharp/Process.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs b/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs index 581b8383e7c..ab8d58ed11f 100644 --- a/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs +++ b/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs b/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs index b3a2361bcb0..41929c104d0 100644 --- a/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs +++ b/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Text; using System.Collections.Specialized; diff --git a/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs b/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs index b8ff2844af9..6e070875b25 100644 --- a/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs +++ b/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Collections; using System.IO; diff --git a/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs b/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs index 2cef5d34f17..9025f122994 100644 --- a/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs +++ b/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Net; using System.Net.Sockets; diff --git a/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs b/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs index 9c0d82a0b27..25d0d9947d6 100644 --- a/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs +++ b/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Net; using System.Net.Sockets; diff --git a/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs b/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs index cecfcaeb0f3..4261efc8a29 100644 --- a/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs +++ b/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs b/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs index a7966947e1f..5258ad290fc 100644 --- a/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs +++ b/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs @@ -1,3 +1,18 @@ +/* Copyright (C) 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 + the Free Software Foundation; version 2 of the License. + + 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 */ + using System; using System.Drawing; using System.Collections; diff --git a/ndb/src/cw/cpcc-win32/vb6/Computer.cls b/ndb/src/cw/cpcc-win32/vb6/Computer.cls deleted file mode 100644 index 5b42dfeadb6..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/Computer.cls +++ /dev/null @@ -1,20 +0,0 @@ -VERSION 1.0 CLASS -BEGIN - MultiUse = -1 'True - Persistable = 0 'NotPersistable - DataBindingBehavior = 0 'vbNone - DataSourceBehavior = 0 'vbNone - MTSTransactionMode = 0 'NotAnMTSObject -END -Attribute VB_Name = "Computer" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = True -Attribute VB_PredeclaredId = False -Attribute VB_Exposed = False -Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes" -Attribute VB_Ext_KEY = "Top_Level" ,"Yes" -Public m_ip As String -Public m_name As String -Public m_status As String -Public m_processes As Collection - diff --git a/ndb/src/cw/cpcc-win32/vb6/Database.cls b/ndb/src/cw/cpcc-win32/vb6/Database.cls deleted file mode 100644 index dfb1195d910..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/Database.cls +++ /dev/null @@ -1,18 +0,0 @@ -VERSION 1.0 CLASS -BEGIN - MultiUse = -1 'True - Persistable = 0 'NotPersistable - DataBindingBehavior = 0 'vbNone - DataSourceBehavior = 0 'vbNone - MTSTransactionMode = 0 'NotAnMTSObject -END -Attribute VB_Name = "Database_" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = True -Attribute VB_PredeclaredId = False -Attribute VB_Exposed = False -Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes" -Attribute VB_Ext_KEY = "Top_Level" ,"Yes" -Public m_name As String -Public m_processes As Collection -Public m_status As String diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 110.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 110.ico deleted file mode 100644 index 34b85992394..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 110.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 231.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 231.ico deleted file mode 100644 index fe30ff5d1e6..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 231.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 237.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 237.ico deleted file mode 100644 index af0a1294f9e..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 237.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 241.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 241.ico deleted file mode 100644 index e8caf6e9a73..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 241.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 242.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 242.ico deleted file mode 100644 index 2deff5472bc..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 242.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 270.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 270.ico deleted file mode 100644 index 9cab239de23..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 270.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 271.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 271.ico deleted file mode 100644 index f05c95f74fe..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 271.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 273.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 273.ico deleted file mode 100644 index 800606eda0c..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 273.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 31.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 31.ico deleted file mode 100644 index a2404977771..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 31.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 337.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 337.ico deleted file mode 100644 index 9dadb12cfbe..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 337.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 338.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 338.ico deleted file mode 100644 index a13c80c81b4..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 338.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/Icon 339.ico b/ndb/src/cw/cpcc-win32/vb6/Icon 339.ico deleted file mode 100644 index 5eb4c06815d..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/Icon 339.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/MSSCCPRJ.SCC b/ndb/src/cw/cpcc-win32/vb6/MSSCCPRJ.SCC deleted file mode 100644 index 3100640f8bd..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/MSSCCPRJ.SCC +++ /dev/null @@ -1,5 +0,0 @@ -[SCC] -SCC=This is a source code control file -[NdbCPC.vbp] -SCC_Project_Name=this project is not under source code control -SCC_Aux_Path= diff --git a/ndb/src/cw/cpcc-win32/vb6/Module1.bas b/ndb/src/cw/cpcc-win32/vb6/Module1.bas deleted file mode 100644 index ae8ed444a41..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/Module1.bas +++ /dev/null @@ -1,233 +0,0 @@ -Attribute VB_Name = "Module1" -Option Explicit -Public fMainForm As frmMain -Public g_computers As New Collection -Public g_databases As New Collection - -Sub Main() - If False Then - Dim fLogin As New frmLogin - fLogin.Show vbModal - If Not fLogin.OK Then - 'Login Failed so exit app - End - End If - Unload fLogin - - frmSplash.Show - frmSplash.Refresh - End If - - init - - Set fMainForm = New frmMain - Load fMainForm - Unload frmSplash - - fMainForm.Show -End Sub - -Private Sub init() - Dim c As Computer - Dim p As Process - - ' --- - ' One node configuration - ' - Set c = New Computer - With c - .m_ip = "130.100.232.31" - .m_name = "ndb-client31" - .m_status = "Connected" - Set .m_processes = New Collection - End With - addComputer c - - Set p = New Process - With p - .m_id = "1" - .m_name = "mgm-1" - .m_database = "elathal" - .m_status = "Running" - .m_owner = "elathal" - Set .m_computer = c - End With - addProcess c, p - - Set p = New Process - With p - .m_id = "2" - .m_name = "ndb-2" - .m_database = "elathal" - .m_status = "Running" - .m_owner = "elathal" - Set .m_computer = c - End With - addProcess c, p - - Set p = New Process - With p - .m_id = "3" - .m_name = "api-3" - .m_database = "elathal" - .m_status = "Running" - .m_owner = "elathal" - Set .m_computer = c - End With - addProcess c, p - - ' --- - ' Two node configuration - ' - Set p = New Process - With p - .m_id = "4" - .m_name = "mgm-1" - .m_database = "ejonore-2-node" - .m_status = "Running" - .m_owner = "ejonore" - Set .m_computer = c - End With - addProcess c, p - - Set c = New Computer - With c - .m_ip = "10.0.1.1" - .m_name = "cluster-1" - .m_status = "Connected" - Set .m_processes = New Collection - End With - addComputer c - - Set p = New Process - With p - .m_id = "1" - .m_name = "ndb-2" - .m_database = "ejonore-2-node" - .m_status = "Running" - .m_owner = "ejonore" - Set .m_computer = c - End With - addProcess c, p - - Set c = New Computer - With c - .m_ip = "10.0.2.1" - .m_name = "cluster-2" - .m_status = "Connected" - Set .m_processes = New Collection - End With - addComputer c - - Set p = New Process - With p - .m_id = "1" - .m_name = "ndb-3" - .m_database = "ejonore-2-node" - .m_status = "Running" - .m_owner = "ejonore" - Set .m_computer = c - End With - addProcess c, p - - Set c = New Computer - With c - .m_ip = "10.0.3.1" - .m_name = "cluster-3" - .m_status = "Connected" - Set .m_processes = New Collection - End With - addComputer c - - Set p = New Process - With p - .m_id = "1" - .m_name = "api-4" - .m_database = "ejonore-2-node" - .m_status = "Running" - .m_owner = "ejonore" - Set .m_computer = c - End With - addProcess c, p - - Set c = New Computer - With c - .m_ip = "10.0.4.1" - .m_name = "cluster-4" - .m_status = "Connected" - Set .m_processes = New Collection - End With - addComputer c - - Set p = New Process - With p - .m_id = "1" - .m_name = "api-5" - .m_database = "ejonore-2-node" - .m_status = "Running" - .m_owner = "ejonore" - Set .m_computer = c - End With - addProcess c, p - - Set c = New Computer - With c - .m_ip = "130.100.232.5" - .m_name = "ndbs05" - .m_status = "Not connected" - Set .m_processes = New Collection - End With - addComputer c - - Set c = New Computer - With c - .m_ip = "130.100.232.7" - .m_name = "ndb-srv7" - .m_status = "No contact" - Set .m_processes = New Collection - End With - addComputer c - -End Sub - -Public Sub addComputer(ByRef c As Computer) - g_computers.Add c, "_" & c.m_name -End Sub - -Private Sub addProcess(ByRef c As Computer, ByRef p As Process) - c.m_processes.Add p, "_" & p.m_id - - Dim cl As Database_ - If Not Exists(g_databases, "_" & p.m_database) Then - Set cl = New Database_ - With cl - .m_name = p.m_database - .m_status = "Unknown" - Set .m_processes = New Collection - End With - g_databases.Add cl, "_" & p.m_database - Else - Set cl = g_databases("_" & p.m_database) - End If - cl.m_processes.Add p, "_" & p.m_computer.m_name & "_" & p.m_id -End Sub - -Public Function Exists(ByRef c As Collection, ByVal k As String) As Boolean - Dim r As Boolean - Dim o As Object - - r = True - - On Error GoTo NotFound - Set o = c.Item(k) - GoTo Continue -NotFound: - If Err.Number <> 5 Then - Err.Raise Err.Number, Err.Source, Err.Description - End If - - r = False -Continue: - Exists = r -End Function - diff --git a/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbp b/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbp deleted file mode 100644 index dc8f3780a74..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbp +++ /dev/null @@ -1,49 +0,0 @@ -Type=Exe -Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx -Module=Module1; Module1.bas -Form=frmMain.frm -Form=frmSplash.frm -Form=frmLogin.frm -Form=frmOptions.frm -Form=frmAbout.frm -Class=Computer; Computer.cls -Class=Process; Process.cls -Class=Database_; Database.cls -Form=frmNewComputer.frm -Form=frmNewDatabase3.frm -Form=frmNewDatabase1.frm -Form=frmNewDatabase2.frm -IconForm="frmAbout" -Startup="Sub Main" -HelpFile="" -Title="NdbCPC" -ExeName32="NdbCPC.exe" -Command32="" -Name="NdbCPC" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="ctp" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbw b/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbw deleted file mode 100644 index 825abbc923a..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbw +++ /dev/null @@ -1,13 +0,0 @@ -Module1 = 44, 44, 577, 492, -frmMain = 44, 44, 577, 492, , 66, 66, 599, 514, C -frmSplash = 132, 132, 670, 576, C, 88, 88, 621, 536, C -frmLogin = 0, 0, 538, 444, C, 110, 110, 643, 558, C -frmOptions = 176, 176, 714, 620, C, 132, 132, 665, 580, C -frmAbout = 132, 132, 759, 511, C, 154, 154, 687, 602, C -Computer = 110, 110, 648, 554, -Process = 132, 132, 670, 576, C -Database_ = 88, 88, 626, 532, C -frmNewComputer = 44, 44, 582, 488, , 22, 22, 390, 218, C -frmNewDatabase3 = 0, 0, 506, 444, , 0, 0, 506, 444, C -frmNewDatabase1 = 132, 132, 638, 550, , 154, 154, 660, 572, C -frmNewDatabase2 = 198, 198, 704, 616, , 176, 176, 682, 594, C diff --git a/ndb/src/cw/cpcc-win32/vb6/Process.cls b/ndb/src/cw/cpcc-win32/vb6/Process.cls deleted file mode 100644 index fcb4c2cbb2c..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/Process.cls +++ /dev/null @@ -1,22 +0,0 @@ -VERSION 1.0 CLASS -BEGIN - MultiUse = -1 'True - Persistable = 0 'NotPersistable - DataBindingBehavior = 0 'vbNone - DataSourceBehavior = 0 'vbNone - MTSTransactionMode = 0 'NotAnMTSObject -END -Attribute VB_Name = "Process" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = True -Attribute VB_PredeclaredId = False -Attribute VB_Exposed = False -Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes" -Attribute VB_Ext_KEY = "Top_Level" ,"Yes" -Public m_computer As Computer -Public m_id As String -Public m_name As String -Public m_database As String -Public m_status As String -Public m_owner As String - diff --git a/ndb/src/cw/cpcc-win32/vb6/closed folder.ico b/ndb/src/cw/cpcc-win32/vb6/closed folder.ico deleted file mode 100644 index fe82350d376..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/closed folder.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/computer.ico b/ndb/src/cw/cpcc-win32/vb6/computer.ico deleted file mode 100644 index d73302d1cd5..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/computer.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/frmAbout.frm b/ndb/src/cw/cpcc-win32/vb6/frmAbout.frm deleted file mode 100644 index b842d20de21..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmAbout.frm +++ /dev/null @@ -1,245 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmAbout - BorderStyle = 3 'Fixed Dialog - Caption = "About NdbCPC" - ClientHeight = 3630 - ClientLeft = 45 - ClientTop = 330 - ClientWidth = 5865 - ClipControls = 0 'False - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 3630 - ScaleWidth = 5865 - ShowInTaskbar = 0 'False - StartUpPosition = 1 'CenterOwner - Tag = "About NdbCPC" - Begin VB.PictureBox picIcon - AutoSize = -1 'True - BackColor = &H00C0C0C0& - ClipControls = 0 'False - Height = 540 - Left = 240 - Picture = "frmAbout.frx":0000 - ScaleHeight = 480 - ScaleMode = 0 'User - ScaleWidth = 480 - TabIndex = 2 - TabStop = 0 'False - Top = 240 - Width = 540 - End - Begin VB.CommandButton cmdOK - Cancel = -1 'True - Caption = "OK" - Default = -1 'True - Height = 345 - Left = 4245 - TabIndex = 0 - Tag = "OK" - Top = 2625 - Width = 1467 - End - Begin VB.CommandButton cmdSysInfo - Caption = "&System Info..." - Height = 345 - Left = 4260 - TabIndex = 1 - Tag = "&System Info..." - Top = 3075 - Width = 1452 - End - Begin VB.Label lblDescription - Caption = "App Description" - ForeColor = &H00000000& - Height = 1170 - Left = 1050 - TabIndex = 6 - Tag = "App Description" - Top = 1125 - Width = 4092 - End - Begin VB.Label lblTitle - Caption = "Application Title" - ForeColor = &H00000000& - Height = 480 - Left = 1050 - TabIndex = 5 - Tag = "Application Title" - Top = 240 - Width = 4092 - End - Begin VB.Line Line1 - BorderColor = &H00808080& - BorderStyle = 6 'Inside Solid - Index = 1 - X1 = 225 - X2 = 5657 - Y1 = 2430 - Y2 = 2430 - End - Begin VB.Line Line1 - BorderColor = &H00FFFFFF& - BorderWidth = 2 - Index = 0 - X1 = 240 - X2 = 5657 - Y1 = 2445 - Y2 = 2445 - End - Begin VB.Label lblVersion - Caption = "Version" - Height = 225 - Left = 1050 - TabIndex = 4 - Tag = "Version" - Top = 780 - Width = 4092 - End - Begin VB.Label lblDisclaimer - Caption = "Warning: ..." - ForeColor = &H00000000& - Height = 825 - Left = 255 - TabIndex = 3 - Tag = "Warning: ..." - Top = 2625 - Width = 3870 - End -End -Attribute VB_Name = "frmAbout" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -' Reg Key Security Options... -Const KEY_ALL_ACCESS = &H2003F - - -' Reg Key ROOT Types... -Const HKEY_LOCAL_MACHINE = &H80000002 -Const ERROR_SUCCESS = 0 -Const REG_SZ = 1 ' Unicode nul terminated string -Const REG_DWORD = 4 ' 32-bit number - - -Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location" -Const gREGVALSYSINFOLOC = "MSINFO" -Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO" -Const gREGVALSYSINFO = "PATH" - - -Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long -Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long -Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long - -Private Sub Form_Load() - lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision - lblTitle.Caption = App.Title -End Sub - - - -Private Sub cmdSysInfo_Click() - Call StartSysInfo -End Sub - - -Private Sub cmdOK_Click() - Unload Me -End Sub - - -Public Sub StartSysInfo() - On Error GoTo SysInfoErr - - - Dim rc As Long - Dim SysInfoPath As String - - - ' Try To Get System Info Program Path\Name From Registry... - If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then - ' Try To Get System Info Program Path Only From Registry... - ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then - ' Validate Existance Of Known 32 Bit File Version - If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then - SysInfoPath = SysInfoPath & "\MSINFO32.EXE" - - - ' Error - File Can Not Be Found... - Else - GoTo SysInfoErr - End If - ' Error - Registry Entry Can Not Be Found... - Else - GoTo SysInfoErr - End If - - - Call Shell(SysInfoPath, vbNormalFocus) - - - Exit Sub -SysInfoErr: - MsgBox "System Information Is Unavailable At This Time", vbOKOnly -End Sub - - -Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean - Dim i As Long ' Loop Counter - Dim rc As Long ' Return Code - Dim hKey As Long ' Handle To An Open Registry Key - Dim hDepth As Long ' - Dim KeyValType As Long ' Data Type Of A Registry Key - Dim tmpVal As String ' Tempory Storage For A Registry Key Value - Dim KeyValSize As Long ' Size Of Registry Key Variable - '------------------------------------------------------------ - ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...} - '------------------------------------------------------------ - rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key - - - If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Error... - - - tmpVal = String$(1024, 0) ' Allocate Variable Space - KeyValSize = 1024 ' Mark Variable Size - - - '------------------------------------------------------------ - ' Retrieve Registry Key Value... - '------------------------------------------------------------ - rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize) ' Get/Create Key Value - - - If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Errors - - - tmpVal = VBA.Left(tmpVal, InStr(tmpVal, VBA.Chr(0)) - 1) - '------------------------------------------------------------ - ' Determine Key Value Type For Conversion... - '------------------------------------------------------------ - Select Case KeyValType ' Search Data Types... - Case REG_SZ ' String Registry Key Data Type - KeyVal = tmpVal ' Copy String Value - Case REG_DWORD ' Double Word Registry Key Data Type - For i = Len(tmpVal) To 1 Step -1 ' Convert Each Bit - KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) ' Build Value Char. By Char. - Next - KeyVal = Format$("&h" + KeyVal) ' Convert Double Word To String - End Select - - - GetKeyValue = True ' Return Success - rc = RegCloseKey(hKey) ' Close Registry Key - Exit Function ' Exit - - -GetKeyError: ' Cleanup After An Error Has Occured... - KeyVal = "" ' Set Return Val To Empty String - GetKeyValue = False ' Return Failure - rc = RegCloseKey(hKey) ' Close Registry Key -End Function - diff --git a/ndb/src/cw/cpcc-win32/vb6/frmLogin.frm b/ndb/src/cw/cpcc-win32/vb6/frmLogin.frm deleted file mode 100644 index d4d663c93c2..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmLogin.frm +++ /dev/null @@ -1,119 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmLogin - BorderStyle = 3 'Fixed Dialog - Caption = "Login" - ClientHeight = 1590 - ClientLeft = 45 - ClientTop = 330 - ClientWidth = 3750 - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 1590 - ScaleWidth = 3750 - ShowInTaskbar = 0 'False - StartUpPosition = 2 'CenterScreen - Tag = "Login" - Begin VB.CommandButton cmdCancel - Cancel = -1 'True - Caption = "Cancel" - Height = 360 - Left = 2100 - TabIndex = 5 - Tag = "Cancel" - Top = 1020 - Width = 1140 - End - Begin VB.CommandButton cmdOK - Caption = "OK" - Default = -1 'True - Height = 360 - Left = 495 - TabIndex = 4 - Tag = "OK" - Top = 1020 - Width = 1140 - End - Begin VB.TextBox txtPassword - Height = 285 - IMEMode = 3 'DISABLE - Left = 1305 - PasswordChar = "*" - TabIndex = 1 - Top = 525 - Width = 2325 - End - Begin VB.TextBox txtUserName - Height = 285 - Left = 1305 - TabIndex = 3 - Top = 135 - Width = 2325 - End - Begin VB.Label lblLabels - Caption = "&Password:" - Height = 248 - Index = 1 - Left = 105 - TabIndex = 0 - Tag = "&Password:" - Top = 540 - Width = 1080 - End - Begin VB.Label lblLabels - Caption = "&User Name:" - Height = 248 - Index = 0 - Left = 105 - TabIndex = 2 - Tag = "&User Name:" - Top = 150 - Width = 1080 - End -End -Attribute VB_Name = "frmLogin" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long - - -Public OK As Boolean -Private Sub Form_Load() - Dim sBuffer As String - Dim lSize As Long - - - sBuffer = Space$(255) - lSize = Len(sBuffer) - Call GetUserName(sBuffer, lSize) - If lSize > 0 Then - txtUserName.Text = Left$(sBuffer, lSize) - Else - txtUserName.Text = vbNullString - End If -End Sub - - - -Private Sub cmdCancel_Click() - OK = False - Me.Hide -End Sub - - -Private Sub cmdOK_Click() - 'ToDo: create test for correct password - 'check for correct password - If txtPassword.Text = "" Then - OK = True - Me.Hide - Else - MsgBox "Invalid Password, try again!", , "Login" - txtPassword.SetFocus - txtPassword.SelStart = 0 - txtPassword.SelLength = Len(txtPassword.Text) - End If -End Sub - diff --git a/ndb/src/cw/cpcc-win32/vb6/frmMain.frm b/ndb/src/cw/cpcc-win32/vb6/frmMain.frm deleted file mode 100644 index a4bf5b58941..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmMain.frm +++ /dev/null @@ -1,1207 +0,0 @@ -VERSION 5.00 -Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" -Begin VB.Form frmMain - Caption = "NdbCPC" - ClientHeight = 5955 - ClientLeft = 2115 - ClientTop = 2250 - ClientWidth = 8880 - LinkTopic = "Form1" - ScaleHeight = 5955 - ScaleWidth = 8880 - Begin MSComctlLib.ImageList ImageList1 - Left = 6840 - Top = 3120 - _ExtentX = 1005 - _ExtentY = 1005 - BackColor = 16777215 - ImageWidth = 16 - ImageHeight = 16 - MaskColor = 12632256 - _Version = 393216 - BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} - NumListImages = 11 - BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":0000 - Key = "close" - EndProperty - BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":27B4 - Key = "open" - EndProperty - BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":4F68 - Key = "computer_unknown" - EndProperty - BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":5284 - Key = "computer_stopped" - EndProperty - BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":55A0 - Key = "computer_started" - EndProperty - BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":58BC - Key = "" - EndProperty - BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":5BD8 - Key = "" - EndProperty - BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":5EF4 - Key = "" - EndProperty - BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":6210 - Key = "db" - EndProperty - BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":652A - Key = "computer" - EndProperty - BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} - Picture = "frmMain.frx":6844 - Key = "properties" - EndProperty - EndProperty - End - Begin VB.PictureBox picSplitter - BackColor = &H00808080& - BorderStyle = 0 'None - FillColor = &H00808080& - Height = 4800 - Left = 5400 - ScaleHeight = 2090.126 - ScaleMode = 0 'User - ScaleWidth = 780 - TabIndex = 6 - Top = 705 - Width = 72 - Visible = 0 'False - End - Begin MSComctlLib.TreeView tvTreeView - Height = 4800 - Left = 0 - TabIndex = 5 - Top = 705 - Width = 2016 - _ExtentX = 3545 - _ExtentY = 8467 - _Version = 393217 - HideSelection = 0 'False - Indentation = 0 - LineStyle = 1 - Sorted = -1 'True - Style = 7 - FullRowSelect = -1 'True - ImageList = "ImageList1" - Appearance = 1 - End - Begin VB.PictureBox picTitles - Align = 1 'Align Top - Appearance = 0 'Flat - BorderStyle = 0 'None - ForeColor = &H80000008& - Height = 300 - Left = 0 - ScaleHeight = 300 - ScaleWidth = 8880 - TabIndex = 2 - TabStop = 0 'False - Top = 420 - Width = 8880 - Begin VB.Label lblTitle - BorderStyle = 1 'Fixed Single - Caption = " ListView:" - Height = 270 - Index = 1 - Left = 2078 - TabIndex = 4 - Tag = " ListView:" - Top = 12 - Width = 3216 - End - Begin VB.Label lblTitle - BorderStyle = 1 'Fixed Single - Caption = " TreeView:" - Height = 270 - Index = 0 - Left = 0 - TabIndex = 3 - Tag = " TreeView:" - Top = 12 - Width = 2016 - End - End - Begin MSComctlLib.Toolbar tbToolBar - Align = 1 'Align Top - Height = 420 - Left = 0 - TabIndex = 1 - Top = 0 - Width = 8880 - _ExtentX = 15663 - _ExtentY = 741 - ButtonWidth = 609 - ButtonHeight = 582 - Appearance = 1 - ImageList = "ImageList1" - _Version = 393216 - BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} - NumButtons = 5 - BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} - Style = 3 - EndProperty - BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} - Key = "Add computer" - Object.ToolTipText = "Add computer" - ImageKey = "computer" - EndProperty - BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} - Key = "New database" - Object.ToolTipText = "New database" - ImageKey = "db" - EndProperty - BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} - Style = 3 - EndProperty - BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} - Key = "Properties" - Object.ToolTipText = "Properties" - ImageKey = "properties" - EndProperty - EndProperty - End - Begin MSComctlLib.StatusBar sbStatusBar - Align = 2 'Align Bottom - Height = 270 - Left = 0 - TabIndex = 0 - Top = 5685 - Width = 8880 - _ExtentX = 15663 - _ExtentY = 476 - _Version = 393216 - BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} - NumPanels = 3 - BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} - AutoSize = 1 - Object.Width = 10028 - Text = "Status" - TextSave = "Status" - EndProperty - BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} - Style = 6 - AutoSize = 2 - TextSave = "2002-10-15" - EndProperty - BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} - Style = 5 - AutoSize = 2 - TextSave = "09:44" - EndProperty - EndProperty - End - Begin MSComctlLib.ListView lvProcesses - Height = 4815 - Left = 2040 - TabIndex = 8 - Top = 720 - Width = 3255 - _ExtentX = 5741 - _ExtentY = 8493 - Sorted = -1 'True - MultiSelect = -1 'True - LabelWrap = -1 'True - HideSelection = 0 'False - AllowReorder = -1 'True - FullRowSelect = -1 'True - _Version = 393217 - ForeColor = -2147483640 - BackColor = -2147483643 - BorderStyle = 1 - Appearance = 1 - NumItems = 6 - BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} - Key = "Id" - Text = "Id" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 1 - Key = "Computer" - Text = "Computer" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 2 - Key = "Database" - Text = "Database" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 3 - Key = "Name" - Text = "Name" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 4 - Key = "Status" - Text = "Status" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 5 - Key = "Owner" - Text = "Owner" - Object.Width = 2540 - EndProperty - End - Begin MSComctlLib.ListView lvComputers - Height = 4815 - Left = 2040 - TabIndex = 7 - Top = 720 - Width = 3255 - _ExtentX = 5741 - _ExtentY = 8493 - Sorted = -1 'True - MultiSelect = -1 'True - LabelWrap = -1 'True - HideSelection = -1 'True - AllowReorder = -1 'True - FullRowSelect = -1 'True - _Version = 393217 - Icons = "ImageList1" - SmallIcons = "ImageList1" - ForeColor = -2147483640 - BackColor = -2147483643 - BorderStyle = 1 - Appearance = 1 - NumItems = 2 - BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} - Text = "Computer" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 1 - Text = "Status" - Object.Width = 2540 - EndProperty - End - Begin MSComctlLib.ListView lvDatabases - Height = 4815 - Left = 2040 - TabIndex = 9 - Top = 720 - Width = 3255 - _ExtentX = 5741 - _ExtentY = 8493 - View = 3 - Sorted = -1 'True - MultiSelect = -1 'True - LabelWrap = -1 'True - HideSelection = -1 'True - AllowReorder = -1 'True - FullRowSelect = -1 'True - _Version = 393217 - Icons = "ImageList1" - SmallIcons = "ImageList1" - ForeColor = -2147483640 - BackColor = -2147483643 - BorderStyle = 1 - Appearance = 1 - NumItems = 2 - BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} - Key = "Database" - Text = "Database" - Object.Width = 2540 - EndProperty - BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} - SubItemIndex = 1 - Key = "Status" - Text = "Status" - Object.Width = 2540 - EndProperty - End - Begin VB.Image imgSplitter - Height = 4788 - Left = 1965 - MousePointer = 9 'Size W E - Top = 705 - Width = 150 - End - Begin VB.Menu mnuFile - Caption = "&File" - Begin VB.Menu mnuFileOpen - Caption = "&Open..." - End - Begin VB.Menu mnuFileFind - Caption = "&Find" - End - Begin VB.Menu mnuFileBar0 - Caption = "-" - End - Begin VB.Menu mnuFileSendTo - Caption = "Sen&d to" - End - Begin VB.Menu mnuFileBar1 - Caption = "-" - End - Begin VB.Menu mnuFileNew - Caption = "&New" - Shortcut = ^N - End - Begin VB.Menu mnuFileBar2 - Caption = "-" - End - Begin VB.Menu mnuFileDelete - Caption = "&Delete" - End - Begin VB.Menu mnuFileRename - Caption = "Rena&me" - End - Begin VB.Menu mnuFileProperties - Caption = "Propert&ies" - End - Begin VB.Menu mnuFileBar3 - Caption = "-" - End - Begin VB.Menu mnuFileMRU - Caption = "" - Index = 1 - Visible = 0 'False - End - Begin VB.Menu mnuFileMRU - Caption = "" - Index = 2 - Visible = 0 'False - End - Begin VB.Menu mnuFileMRU - Caption = "" - Index = 3 - Visible = 0 'False - End - Begin VB.Menu mnuFileBar4 - Caption = "-" - Visible = 0 'False - End - Begin VB.Menu mnuFileBar5 - Caption = "-" - End - Begin VB.Menu mnuFileClose - Caption = "&Close" - End - End - Begin VB.Menu mnuEdit - Caption = "&Edit" - Begin VB.Menu mnuEditUndo - Caption = "&Undo" - End - Begin VB.Menu mnuEditBar0 - Caption = "-" - End - Begin VB.Menu mnuEditCut - Caption = "Cu&t" - Shortcut = ^X - End - Begin VB.Menu mnuEditCopy - Caption = "&Copy" - Shortcut = ^C - End - Begin VB.Menu mnuEditPaste - Caption = "&Paste" - Shortcut = ^V - End - Begin VB.Menu mnuEditPasteSpecial - Caption = "Paste &Special..." - End - Begin VB.Menu mnuEditBar1 - Caption = "-" - End - Begin VB.Menu mnuEditSelectAll - Caption = "Select &All" - Shortcut = ^A - End - Begin VB.Menu mnuEditInvertSelection - Caption = "&Invert Selection" - End - End - Begin VB.Menu mnuView - Caption = "&View" - Begin VB.Menu mnuViewToolbar - Caption = "&Toolbar" - Checked = -1 'True - End - Begin VB.Menu mnuViewStatusBar - Caption = "Status &Bar" - Checked = -1 'True - End - Begin VB.Menu mnuViewBar0 - Caption = "-" - End - Begin VB.Menu mnuListViewMode - Caption = "Lar&ge Icons" - Index = 0 - End - Begin VB.Menu mnuListViewMode - Caption = "S&mall Icons" - Index = 1 - End - Begin VB.Menu mnuListViewMode - Caption = "&List" - Index = 2 - End - Begin VB.Menu mnuListViewMode - Caption = "&Details" - Index = 3 - End - Begin VB.Menu mnuViewBar1 - Caption = "-" - End - Begin VB.Menu mnuViewArrangeIcons - Caption = "Arrange &Icons" - End - Begin VB.Menu mnuViewBar2 - Caption = "-" - End - Begin VB.Menu mnuViewRefresh - Caption = "&Refresh" - End - Begin VB.Menu mnuViewOptions - Caption = "&Options..." - End - Begin VB.Menu mnuViewWebBrowser - Caption = "&Web Browser" - End - End - Begin VB.Menu mnuHelp - Caption = "&Help" - Begin VB.Menu mnuHelpContents - Caption = "&Contents" - End - Begin VB.Menu mnuHelpSearchForHelpOn - Caption = "&Search For Help On..." - End - Begin VB.Menu mnuHelpBar0 - Caption = "-" - End - Begin VB.Menu mnuHelpAbout - Caption = "&About " - End - End - Begin VB.Menu mnuPopComputers - Caption = "" - Visible = 0 'False - Begin VB.Menu mnuPopAddComputer - Caption = "Add computer" - End - Begin VB.Menu mnuPop__ - Caption = "-" - End - Begin VB.Menu mnuPopSortComputers - Caption = "Sorted" - End - End - Begin VB.Menu mnuPopDatabases - Caption = "" - Visible = 0 'False - Begin VB.Menu mnuPopNewDatabase - Caption = "New database" - End - Begin VB.Menu mnuPopSortDatabases0 - Caption = "-" - End - Begin VB.Menu mnuPopSortDatabases - Caption = "Sorted" - End - End - Begin VB.Menu mnuPopComputer - Caption = "" - Visible = 0 'False - Begin VB.Menu mnuPopComputerName - Caption = "ComputerName" - Enabled = 0 'False - End - Begin VB.Menu mnuPopComputer0 - Caption = "-" - End - Begin VB.Menu mnuPopConnectComputer - Caption = "Connect" - End - Begin VB.Menu mnuPopDisconnectComputer - Caption = "Disconnect" - End - Begin VB.Menu mnuPopRemoveComputer - Caption = "Remove" - End - Begin VB.Menu mnuComputer1 - Caption = "-" - End - Begin VB.Menu mnuPopComputerProperties - Caption = "Properties" - End - End -End -Attribute VB_Name = "frmMain" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit -Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any) - -Dim mbMoving As Boolean -Const sglSplitLimit = 500 -Dim m_currentNode As MSComctlLib.Node -Dim m_currentList As ListView - -Dim m_currentView As Integer -Dim m_computerWidth As Integer -Dim m_databaseWidth As Integer - -Dim m_currentComputer As Computer -Dim m_currentDatabase As Database_ - -Private Sub Form_Load() - tvTreeView.Nodes.Clear - lvComputers.ListItems.Clear - lvProcesses.ListItems.Clear - lvDatabases.ListItems.Clear - - Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000) - Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000) - Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500) - Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500) - - tvTreeView.Nodes.Add , tvwChild, "Computers", "Computers", 1, 2 - Dim c As Computer - For Each c In g_computers - addComputer c - Next - - Set m_currentNode = tvTreeView.Nodes("Computers") - Set m_currentList = lvComputers - - tvTreeView.Nodes.Add , tvwChild, "Databases", "Databases", 1, 2 - Dim d As Database_ - For Each d In g_databases - AddDatabase d - Next - - lvComputers.Visible = True - lvProcesses.Visible = False - lvDatabases.Visible = False - lvComputers.View = lvwReport - lvProcesses.View = lvwReport - lvDatabases.View = lvwReport - m_computerWidth = lvProcesses.ColumnHeaders("Computer").Width - m_databaseWidth = lvProcesses.ColumnHeaders("Database").Width - lvProcesses.ColumnHeaders("Id").Width = 0 -End Sub - -Private Sub setComputer(ByVal f_ip As String) - Dim c As Computer - Set c = g_computers(f_ip) - If c Is Nothing Then - MsgBox "Unknown computer: " & f_ip - Exit Sub - End If - - Set m_currentComputer = c - - lblTitle(1).Caption = "Processes defined on computer: " & c.m_name - setProcesses c.m_processes - - If lvProcesses.ColumnHeaders("Computer").Width <> 0 Then - m_computerWidth = lvProcesses.ColumnHeaders("Computer").Width - lvProcesses.ColumnHeaders("Computer").Width = 0 - End If - - If lvProcesses.ColumnHeaders("Database").Width = 0 Then - lvProcesses.ColumnHeaders("Database").Width = m_databaseWidth - End If -End Sub - -Private Sub setDatabase(ByVal f_name As String) - Dim c As Database_ - Set c = g_databases(f_name) - If c Is Nothing Then - MsgBox "Unknown database: " & f_name - Exit Sub - End If - - Set m_currentDatabase = c - - lblTitle(1).Caption = "Processes defined for database: " & c.m_name - setProcesses c.m_processes - - If lvProcesses.ColumnHeaders("Database").Width <> 0 Then - m_databaseWidth = lvProcesses.ColumnHeaders("Database").Width - lvProcesses.ColumnHeaders("Database").Width = 0 - End If - - If lvProcesses.ColumnHeaders("Computer").Width = 0 Then - lvProcesses.ColumnHeaders("Computer").Width = m_computerWidth - End If - -End Sub - -Private Sub setProcesses(ByRef c As Collection) - lvProcesses.ListItems.Clear - Dim p As Process - For Each p In c - Dim li As ListItem - Set li = lvProcesses.ListItems.Add(, "_" & p.m_computer.m_name & "_" & p.m_id, p.m_id) - li.SubItems(1) = p.m_computer.m_name - li.SubItems(2) = p.m_database - li.SubItems(3) = p.m_name - li.SubItems(4) = p.m_status - li.SubItems(5) = p.m_owner - Next -End Sub - -Public Sub addComputer(ByRef c As Computer) - Dim icon As Integer - Select Case c.m_status - Case "No contact" - icon = 4 - Case "Connected" - icon = 5 - Case Else - icon = 3 - End Select - - Dim li As ListItem - Set li = lvComputers.ListItems.Add(, "_" & c.m_name, c.m_name, icon, icon) - li.SubItems(1) = c.m_status - - tvTreeView.Nodes.Add "Computers", tvwChild, "_" & c.m_name, c.m_name, icon, icon -End Sub - -Public Sub removeComputer(ByRef name As String) - lvComputers.ListItems.Remove "_" & name - tvTreeView.Nodes.Remove "_" & name - - ' - ' Check if should remove database - Dim c As Computer - Set c = g_computers("_" & name) - Dim db As Database_ - Dim dbs As New Collection - Dim p As Process - For Each p In c.m_processes - Set db = g_databases("_" & p.m_database) - db.m_processes.Remove "_" & p.m_computer.m_name & "_" & p.m_id - If Not Exists(dbs, p.m_database) Then dbs.Add db, p.m_database - Next - - For Each db In dbs - If db.m_processes.Count = 0 Then - g_databases.Remove "_" & db.m_name - tvTreeView.Nodes.Remove "_" & db.m_name - End If - Next - - g_computers.Remove "_" & name - - ' - ' Check if should remove database - - Dim n As MSComctlLib.Node - Set n = tvTreeView.SelectedItem - selectNode n -End Sub - -Private Sub AddDatabase(ByRef c As Database_) - Dim li As ListItem - Set li = lvDatabases.ListItems.Add(, "_" & c.m_name, c.m_name, 9, 9) - li.SubItems(1) = c.m_status - tvTreeView.Nodes.Add "Databases", tvwChild, "_" & c.m_name, c.m_name, 9, 9 -End Sub - -Private Sub Form_Unload(Cancel As Integer) - Dim i As Integer - - - 'close all sub forms - For i = Forms.Count - 1 To 1 Step -1 - Unload Forms(i) - Next - If Me.WindowState <> vbMinimized Then - SaveSetting App.Title, "Settings", "MainLeft", Me.Left - SaveSetting App.Title, "Settings", "MainTop", Me.Top - SaveSetting App.Title, "Settings", "MainWidth", Me.Width - SaveSetting App.Title, "Settings", "MainHeight", Me.Height - End If -End Sub - -Private Sub Form_Resize() - On Error Resume Next - If Me.Width < 3000 Then Me.Width = 3000 - SizeControls imgSplitter.Left -End Sub - -Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) - With imgSplitter - picSplitter.Move .Left, .Top, .Width \ 2, .Height - 20 - End With - picSplitter.Visible = True - mbMoving = True -End Sub - -Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) - Dim sglPos As Single - - - If mbMoving Then - sglPos = X + imgSplitter.Left - If sglPos < sglSplitLimit Then - picSplitter.Left = sglSplitLimit - ElseIf sglPos > Me.Width - sglSplitLimit Then - picSplitter.Left = Me.Width - sglSplitLimit - Else - picSplitter.Left = sglPos - End If - End If -End Sub - - -Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) - SizeControls picSplitter.Left - picSplitter.Visible = False - mbMoving = False -End Sub - - -Private Sub TreeView1_DragDrop(Source As Control, X As Single, Y As Single) - If Source = imgSplitter Then - SizeControls X - End If -End Sub - - -Sub SizeControls(X As Single) - On Error Resume Next - - 'set the width - If X < 1500 Then X = 1500 - If X > (Me.Width - 1500) Then X = Me.Width - 1500 - tvTreeView.Width = X - imgSplitter.Left = X - - Dim t_left, t_width As Integer - t_left = X + 40 - t_width = Me.Width - (tvTreeView.Width + 140) - - lblTitle(0).Width = tvTreeView.Width - lblTitle(1).Left = t_left + 20 - lblTitle(1).Width = t_width - 40 - - - 'set the top - If tbToolBar.Visible Then - tvTreeView.Top = tbToolBar.Height + picTitles.Height - Else - tvTreeView.Top = picTitles.Height - End If - - - 'set the height - If sbStatusBar.Visible Then - tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height + sbStatusBar.Height) - Else - tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height) - End If - - - imgSplitter.Top = tvTreeView.Top - imgSplitter.Height = tvTreeView.Height - - setListDimensions t_left, t_width, tvTreeView.Top, tvTreeView.Height -End Sub - -Private Sub setListView(ByVal f_View As Integer) - lvComputers.View = f_View - lvProcesses.View = f_View -End Sub - -Private Sub setListDimensions(ByVal f_Left As Integer, ByVal f_Width As Integer, ByVal f_Top As Integer, ByVal f_Height As Integer) - With lvComputers - .Left = f_Left - .Width = f_Width - .Top = f_Top - .Height = f_Height - End With - With lvProcesses - .Left = f_Left - .Width = f_Width - .Top = f_Top - .Height = f_Height - End With - With lvDatabases - .Left = f_Left - .Width = f_Width - .Top = f_Top - .Height = f_Height - End With -End Sub - -Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button) - On Error Resume Next - Select Case Button.Key - Case "New database" - 'ToDo: Add 'Back' button code. - mnuPopNewDatabase_Click - Case "Add computer" - 'ToDo: Add 'Forward' button code. - frmNewComputer.Show vbModal, Me - Dim c As Computer - For Each c In frmNewComputer.m_hosts - addComputer c - g_computers.Add c, "_" & c.m_name - Next - Case "Properties" - mnuFileProperties_Click - End Select -End Sub - -Private Sub mnuHelpAbout_Click() - frmAbout.Show vbModal, Me -End Sub - -Private Sub mnuHelpSearchForHelpOn_Click() - Dim nRet As Integer - - - 'if there is no helpfile for this project display a message to the user - 'you can set the HelpFile for your application in the - 'Project Properties dialog - If Len(App.HelpFile) = 0 Then - MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption - Else - On Error Resume Next - nRet = OSWinHelp(Me.hwnd, App.HelpFile, 261, 0) - If Err Then - MsgBox Err.Description - End If - End If - -End Sub - -Private Sub mnuHelpContents_Click() - Dim nRet As Integer - - - 'if there is no helpfile for this project display a message to the user - 'you can set the HelpFile for your application in the - 'Project Properties dialog - If Len(App.HelpFile) = 0 Then - MsgBox "Unable to display Help Contents. There is no Help associated with this project.", vbInformation, Me.Caption - Else - On Error Resume Next - nRet = OSWinHelp(Me.hwnd, App.HelpFile, 3, 0) - If Err Then - MsgBox Err.Description - End If - End If - -End Sub - - -Private Sub mnuViewWebBrowser_Click() - 'ToDo: Add 'mnuViewWebBrowser_Click' code. - MsgBox "Add 'mnuViewWebBrowser_Click' code." -End Sub - -Private Sub mnuViewOptions_Click() - frmOptions.Show vbModal, Me -End Sub - -Private Sub mnuViewRefresh_Click() - 'ToDo: Add 'mnuViewRefresh_Click' code. - MsgBox "Add 'mnuViewRefresh_Click' code." -End Sub - - -Private Sub mnuViewStatusBar_Click() - mnuViewStatusBar.Checked = Not mnuViewStatusBar.Checked - sbStatusBar.Visible = mnuViewStatusBar.Checked - SizeControls imgSplitter.Left -End Sub - -Private Sub mnuViewToolbar_Click() - mnuViewToolbar.Checked = Not mnuViewToolbar.Checked - tbToolBar.Visible = mnuViewToolbar.Checked - SizeControls imgSplitter.Left -End Sub - -Private Sub mnuEditInvertSelection_Click() - 'ToDo: Add 'mnuEditInvertSelection_Click' code. - MsgBox "Add 'mnuEditInvertSelection_Click' code." -End Sub - -Private Sub mnuEditSelectAll_Click() - 'ToDo: Add 'mnuEditSelectAll_Click' code. - MsgBox "Add 'mnuEditSelectAll_Click' code." -End Sub - -Private Sub mnuEditPasteSpecial_Click() - 'ToDo: Add 'mnuEditPasteSpecial_Click' code. - MsgBox "Add 'mnuEditPasteSpecial_Click' code." -End Sub - -Private Sub mnuEditPaste_Click() - 'ToDo: Add 'mnuEditPaste_Click' code. - MsgBox "Add 'mnuEditPaste_Click' code." -End Sub - -Private Sub mnuEditCopy_Click() - 'ToDo: Add 'mnuEditCopy_Click' code. - MsgBox "Add 'mnuEditCopy_Click' code." -End Sub - -Private Sub mnuEditCut_Click() - 'ToDo: Add 'mnuEditCut_Click' code. - MsgBox "Add 'mnuEditCut_Click' code." -End Sub - -Private Sub mnuEditUndo_Click() - 'ToDo: Add 'mnuEditUndo_Click' code. - MsgBox "Add 'mnuEditUndo_Click' code." -End Sub - -Private Sub mnuFileClose_Click() - 'unload the form - Unload Me - -End Sub - -Private Sub mnuFileProperties_Click() - 'ToDo: Add 'mnuFileProperties_Click' code. - MsgBox "Add 'mnuFileProperties_Click' code." -End Sub - -Private Sub mnuFileRename_Click() - 'ToDo: Add 'mnuFileRename_Click' code. - MsgBox "Add 'mnuFileRename_Click' code." -End Sub - -Private Sub mnuFileDelete_Click() - 'ToDo: Add 'mnuFileDelete_Click' code. - MsgBox "Add 'mnuFileDelete_Click' code." -End Sub - -Private Sub mnuFileNew_Click() - 'ToDo: Add 'mnuFileNew_Click' code. - MsgBox "Add 'mnuFileNew_Click' code." -End Sub - -Private Sub mnuFileSendTo_Click() - 'ToDo: Add 'mnuFileSendTo_Click' code. - MsgBox "Add 'mnuFileSendTo_Click' code." -End Sub - -Private Sub mnuFileFind_Click() - 'ToDo: Add 'mnuFileFind_Click' code. - MsgBox "Add 'mnuFileFind_Click' code." -End Sub - -Private Sub mnuFileOpen_Click() - Dim sFile As String -End Sub - -Private Sub mnuPopComputerProperties_Click() - mnuFileProperties_Click -End Sub - -Private Sub mnuPopNewDatabase_Click() - frmNewDatabase1.Show vbModal, Me - frmNewDatabase2.Show vbModal, Me - frmNewDatabase3.Show vbModal, Me -End Sub - -Private Sub mnuPopAddComputer_Click() - frmNewComputer.Show vbModal, Me - Dim c As Computer - For Each c In frmNewComputer.m_hosts - addComputer c - g_computers.Add c, "_" & c.m_name - Next -End Sub - -Private Sub mnuPopSortComputers_Click() - If m_currentNode.Sorted = True Then - mnuPopSortComputers.Checked = False - m_currentNode.Sorted = False - Else - mnuPopSortComputers.Checked = True - m_currentNode.Sorted = True - End If -End Sub - -Private Sub mnuPopRemoveComputer_Click() - Dim res As VbMsgBoxResult - Dim str As String - str = "Remove computer " & m_currentComputer.m_name - res = MsgBox(str, vbOKCancel, str) - If res = vbOK Then - removeComputer (m_currentComputer.m_name) - End If -End Sub - -Private Sub mnuPopSortDatabases_Click() - If m_currentNode.Sorted = True Then - mnuPopSortDatabases.Checked = False - m_currentNode.Sorted = False - Else - mnuPopSortDatabases.Checked = True - m_currentNode.Sorted = True - End If -End Sub - -Private Sub tvTreeView_BeforeLabelEdit(Cancel As Integer) - Cancel = True -End Sub - -Private Sub tvTreeView_Collapse(ByVal Node As MSComctlLib.Node) - 'MsgBox "tvTreeView_Collapse" -End Sub - -Private Sub tvTreeView_Expand(ByVal Node As MSComctlLib.Node) - 'MsgBox "tvTreeView_Expand" -End Sub - -Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node) - selectNode Node -End Sub - -Private Sub tvTreeView_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) - 'MsgBox "tvTreeView_MouseUp Button: " & Button & " Shift: " & Shift - Dim Node As MSComctlLib.Node - Dim place As Integer - - Set Node = tvTreeView.HitTest(X, Y) - place = selectNode(Node) - If Button = vbRightButton Then - ShowPopup place - End If -End Sub - -Private Function selectNode(ByRef n As MSComctlLib.Node) As Integer - Dim list As ListView - Dim place As Integer - - If n Is Nothing Then - If Not m_currentNode Is Nothing Then - place = 1 - m_currentNode.Selected = False - Else - place = 2 - End If - Else - n.Selected = True - If n.Text = "Computers" Then - place = 3 - Set list = lvComputers - lblTitle(1).Caption = "Computers" - ElseIf n.Text = "Databases" Then - place = 4 - Set list = lvDatabases - lblTitle(1).Caption = "Databases" - ElseIf n.Parent.Text = "Computers" Then - place = 5 - Set list = lvProcesses - setComputer (n.Key) - ElseIf n.Parent.Text = "Databases" Then - place = 6 - Set list = lvProcesses - setDatabase (n.Key) - End If - - If m_currentList.hwnd <> list.hwnd Then - m_currentList.Visible = False - list.Visible = True - Set m_currentList = list - End If - End If - Set m_currentNode = n - selectNode = place -End Function - -Private Sub lvComputers_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) - Dim li As ListItem - Set li = lvComputers.HitTest(X, Y) - If Button = vbRightButton And Not li Is Nothing Then - Dim c As Computer - Set m_currentComputer = g_computers(li.Key) - ShowPopup 5 - End If -End Sub - -Private Sub ShowPopup(ByVal place As Integer) - Select Case place - Case 3 - PopupMenu mnuPopComputers - Case 4 - PopupMenu mnuPopDatabases - Case 5 - mnuPopComputerName.Caption = m_currentComputer.m_name & ": " & m_currentComputer.m_status - Select Case m_currentComputer.m_status - Case "Connected" - mnuPopConnectComputer.Enabled = False - mnuPopDisconnectComputer.Enabled = True - Case "Connecting" - mnuPopConnectComputer.Enabled = False - mnuPopDisconnectComputer.Enabled = True - Case "Not connected" - mnuPopConnectComputer.Enabled = True - mnuPopDisconnectComputer.Enabled = False - Case "No contact" - mnuPopConnectComputer.Enabled = True - mnuPopDisconnectComputer.Enabled = False - Case Else - mnuPopConnectComputer.Enabled = False - mnuPopDisconnectComputer.Enabled = False - End Select - - PopupMenu mnuPopComputer, , , , mnuPopComputerName - End Select -End Sub - -Private Sub lvComputers_BeforeLabelEdit(Cancel As Integer) - Cancel = True -End Sub - -Private Sub lvProcesses_BeforeLabelEdit(Cancel As Integer) - Cancel = True -End Sub - -Private Sub lvDatabases_BeforeLabelEdit(Cancel As Integer) - Cancel = True -End Sub - -Private Sub ColumnClick(ByRef list As ListView, i As Integer) - i = i - 1 - If list.SortKey = i Then - list.SortOrder = 1 - list.SortOrder - Else - list.SortKey = i - End If -End Sub - -Private Sub lvComputers_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) - ColumnClick lvComputers, ColumnHeader.Index -End Sub - -Private Sub lvProcesses_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) - ColumnClick lvProcesses, ColumnHeader.Index -End Sub - -Private Sub lvDatabases_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) - ColumnClick lvDatabases, ColumnHeader.Index -End Sub - diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frm b/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frm deleted file mode 100644 index eae5802493c..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frm +++ /dev/null @@ -1,124 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmNewComputer - Caption = "Add computer" - ClientHeight = 1545 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 4605 - LinkTopic = "Form1" - ScaleHeight = 1545 - ScaleWidth = 4605 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton Command3 - Caption = "Apply" - Default = -1 'True - Height = 360 - Left = 3240 - TabIndex = 4 - Tag = "OK" - Top = 840 - Width = 1140 - End - Begin VB.CommandButton Command2 - Caption = "Cancel" - Height = 360 - Left = 1920 - TabIndex = 3 - Tag = "OK" - Top = 840 - Width = 1140 - End - Begin VB.CommandButton Command1 - Caption = "OK" - Height = 360 - Left = 600 - TabIndex = 2 - Tag = "OK" - Top = 840 - Width = 1140 - End - Begin VB.TextBox Text1 - Height = 285 - Left = 1440 - TabIndex = 1 - Top = 240 - Width = 2925 - End - Begin VB.Label lblLabels - Caption = "Computer name:" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 0 - Tag = "&User Name:" - Top = 240 - Width = 1440 - End -End -Attribute VB_Name = "frmNewComputer" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Public m_hosts As New Collection - -Private Sub Form_Load() - If m_hosts.Count > 0 Then - For i = m_hosts.Count To 1 Step -1 - m_hosts.Remove i - Next - End If -End Sub - -Private Sub Command1_Click() - If Text1.Text = "" Then - MsgBox "Invalid hostname" - Exit Sub - End If - - If Exists(g_computers, "_" & Text1.Text) Then - MsgBox Text1.Text & " already exists" - Exit Sub - End If - - Dim c As New Computer - With c - .m_ip = "" - .m_name = Text1.Text - .m_status = "Not connected" - Set .m_processes = New Collection - End With - - m_hosts.Add c - - Unload Me -End Sub - -Private Sub Command2_Click() - Unload Me -End Sub - -Private Sub Command3_Click() - If Text1.Text = "" Then - MsgBox "Invalid hostname" - Exit Sub - End If - - If Exists(g_computers, "_" & Text1.Text) Then - MsgBox Text1.Text & " already exists" - Exit Sub - End If - - Dim c As New Computer - With c - .m_ip = "" - .m_name = Text1.Text - .m_status = "Not connected" - Set .m_processes = New Collection - End With - - m_hosts.Add c - - Text1.Text = "" -End Sub - diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frx b/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frx deleted file mode 100644 index 593f4708db8..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frx and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase.frx b/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase.frx deleted file mode 100644 index b20c2b651ae..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase.frx and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase1.frm b/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase1.frm deleted file mode 100644 index 3fa1fd4c4e8..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase1.frm +++ /dev/null @@ -1,187 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmNewDatabase1 - BorderStyle = 5 'Sizable ToolWindow - Caption = "Nodes" - ClientHeight = 3000 - ClientLeft = 2850 - ClientTop = 3450 - ClientWidth = 6240 - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 3281.25 - ScaleMode = 0 'User - ScaleWidth = 6359.712 - ShowInTaskbar = 0 'False - StartUpPosition = 2 'CenterScreen - Begin VB.TextBox textApiNodes - Height = 285 - Left = 2760 - TabIndex = 12 - Text = "4" - Top = 1665 - Width = 375 - End - Begin VB.VScrollBar VScroll1 - Height = 255 - Left = 3240 - TabIndex = 11 - Top = 1680 - Width = 135 - End - Begin VB.OptionButton Option4 - Alignment = 1 'Right Justify - Caption = "1" - Height = 375 - Left = 2760 - TabIndex = 10 - Top = 1020 - Width = 375 - End - Begin VB.OptionButton Option3 - Alignment = 1 'Right Justify - Caption = "4" - Height = 375 - Left = 3960 - TabIndex = 9 - Top = 360 - Width = 375 - End - Begin VB.OptionButton Option2 - Alignment = 1 'Right Justify - Caption = "2" - Height = 375 - Left = 3360 - TabIndex = 8 - Top = 360 - Width = 375 - End - Begin VB.OptionButton Option1 - Alignment = 1 'Right Justify - Caption = "1" - Height = 375 - Left = 2760 - TabIndex = 7 - Top = 360 - Value = -1 'True - Width = 375 - End - Begin VB.CommandButton cmdCancel - Cancel = -1 'True - Caption = "Cancel" - Height = 305 - Left = 1320 - TabIndex = 3 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdFinish - Caption = "Finish" - Enabled = 0 'False - Height = 305 - Left = 5040 - TabIndex = 2 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdBack - Caption = "Back" - Default = -1 'True - Enabled = 0 'False - Height = 305 - Left = 2640 - TabIndex = 0 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdNext - Caption = "Next" - Height = 305 - Left = 3720 - TabIndex = 1 - Top = 2400 - Width = 1140 - End - Begin VB.Label Label3 - Caption = "No of api nodes" - Height = 255 - Left = 240 - TabIndex = 6 - Top = 1680 - Width = 2415 - End - Begin VB.Label Label2 - Caption = "No of management nodes" - Height = 255 - Left = 240 - TabIndex = 5 - Top = 1080 - Width = 2415 - End - Begin VB.Label Label1 - Caption = "No of database nodes" - Height = 255 - Left = 240 - TabIndex = 4 - Top = 420 - Width = 2415 - End - Begin VB.Line Line1 - BorderColor = &H80000003& - X1 = 122.302 - X2 = 6237.41 - Y1 = 2493.75 - Y2 = 2493.75 - End -End -Attribute VB_Name = "frmNewDatabase1" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub Form_Resize() - If Me.Width < 6375 Then Me.Width = 6375 - cmdCancel.Left = Me.ScaleWidth - 5136 + 400 - cmdBack.Left = Me.ScaleWidth - 3897 + 400 - cmdNext.Left = Me.ScaleWidth - 2883 + 400 - cmdFinish.Left = Me.ScaleWidth - 1643 + 400 - Line1.X2 = Me.ScaleWidth - 480 + 400 - - cmdCancel.Top = Me.ScaleHeight - 375 - cmdBack.Top = Me.ScaleHeight - 375 - cmdNext.Top = Me.ScaleHeight - 375 - cmdFinish.Top = Me.ScaleHeight - 375 - Line1.Y1 = Me.ScaleHeight - 475 - Line1.Y2 = Me.ScaleHeight - 475 -End Sub - -Private Sub cmdCancel_Click() - 'set the global var to false - 'to denote a failed login - Unload Me -End Sub - -Private Sub Option1_Click() - Option2.Value = False - Option3.Value = False -End Sub - -Private Sub Option2_Click() - Option1.Value = False - Option3.Value = False -End Sub - -Private Sub Option3_Click() - Option1.Value = False - Option2.Value = False -End Sub - -Private Sub Option4_Click() - Option4.Value = True -End Sub - -Private Sub textApiNodes_Validate(Cancel As Boolean) - 'If Not isnumber(textApiNodes.Text) Then Cancel = False -End Sub diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.frm b/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.frm deleted file mode 100644 index 49806a695ea..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.frm +++ /dev/null @@ -1,136 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmNewDatabase2 - BorderStyle = 5 'Sizable ToolWindow - Caption = "Computers" - ClientHeight = 2895 - ClientLeft = 2850 - ClientTop = 3450 - ClientWidth = 6240 - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 3166.406 - ScaleMode = 0 'User - ScaleWidth = 6359.712 - ShowInTaskbar = 0 'False - StartUpPosition = 2 'CenterScreen - Begin VB.ComboBox Combo1 - Height = 315 - Left = 2400 - TabIndex = 7 - Text = "Combo1" - Top = 360 - Width = 1455 - End - Begin VB.VScrollBar VScroll2 - Height = 255 - Left = 4560 - TabIndex = 6 - Top = 375 - Width = 135 - End - Begin VB.TextBox Text1 - Height = 285 - Left = 4080 - TabIndex = 5 - Text = "4" - Top = 360 - Width = 375 - End - Begin VB.CommandButton cmdCancel - Cancel = -1 'True - Caption = "Cancel" - Height = 305 - Left = 1320 - TabIndex = 3 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdFinish - Caption = "Finish" - Enabled = 0 'False - Height = 305 - Left = 5040 - TabIndex = 2 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdBack - Caption = "Back" - Default = -1 'True - Enabled = 0 'False - Height = 305 - Left = 2640 - TabIndex = 0 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdNext - Caption = "Next" - Height = 305 - Left = 3720 - TabIndex = 1 - Top = 2400 - Width = 1140 - End - Begin VB.Label Label5 - Caption = "Computer" - Height = 255 - Left = 2400 - TabIndex = 9 - Top = 0 - Width = 975 - End - Begin VB.Label Label4 - Caption = "Node id" - Height = 255 - Left = 4080 - TabIndex = 8 - Top = 120 - Width = 615 - End - Begin VB.Label Label1 - Caption = "Database node 1" - Height = 255 - Left = 240 - TabIndex = 4 - Top = 420 - Width = 2415 - End - Begin VB.Line Line1 - BorderColor = &H80000003& - X1 = 122.302 - X2 = 6237.41 - Y1 = 2493.75 - Y2 = 2493.75 - End -End -Attribute VB_Name = "frmNewDatabase2" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub Form_Resize() - If Me.Width < 6375 Then Me.Width = 6375 - cmdCancel.Left = Me.ScaleWidth - 5136 + 400 - cmdBack.Left = Me.ScaleWidth - 3897 + 400 - cmdNext.Left = Me.ScaleWidth - 2883 + 400 - cmdFinish.Left = Me.ScaleWidth - 1643 + 400 - Line1.X2 = Me.ScaleWidth - 480 + 400 - - cmdCancel.Top = Me.ScaleHeight - 375 - cmdBack.Top = Me.ScaleHeight - 375 - cmdNext.Top = Me.ScaleHeight - 375 - cmdFinish.Top = Me.ScaleHeight - 375 - Line1.Y1 = Me.ScaleHeight - 475 - Line1.Y2 = Me.ScaleHeight - 475 -End Sub - -Private Sub cmdCancel_Click() - 'set the global var to false - 'to denote a failed login - Unload Me -End Sub - diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.log b/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.log deleted file mode 100644 index 808b21866e5..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.log +++ /dev/null @@ -1 +0,0 @@ -Line 2: The Form or MDIForm name frmNewDatabase1 is already in use; cannot load this form. diff --git a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase3.frm b/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase3.frm deleted file mode 100644 index ba050a58a09..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase3.frm +++ /dev/null @@ -1,88 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmNewDatabase3 - BorderStyle = 5 'Sizable ToolWindow - Caption = "Database configuration" - ClientHeight = 3000 - ClientLeft = 2850 - ClientTop = 3450 - ClientWidth = 6240 - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 3281.25 - ScaleMode = 0 'User - ScaleWidth = 6359.712 - ShowInTaskbar = 0 'False - StartUpPosition = 2 'CenterScreen - Begin VB.CommandButton cmdCancel - Cancel = -1 'True - Caption = "Cancel" - Height = 305 - Left = 1320 - TabIndex = 3 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdFinish - Caption = "Finish" - Enabled = 0 'False - Height = 305 - Left = 5040 - TabIndex = 2 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdBack - Caption = "Back" - Default = -1 'True - Enabled = 0 'False - Height = 305 - Left = 2640 - TabIndex = 0 - Top = 2400 - Width = 1140 - End - Begin VB.CommandButton cmdNext - Caption = "Next" - Height = 305 - Left = 3720 - TabIndex = 1 - Top = 2400 - Width = 1140 - End - Begin VB.Line Line1 - BorderColor = &H80000003& - X1 = 122.302 - X2 = 6237.41 - Y1 = 2493.75 - Y2 = 2493.75 - End -End -Attribute VB_Name = "frmNewDatabase3" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub Form_Resize() - If Me.Width < 6375 Then Me.Width = 6375 - cmdCancel.Left = Me.ScaleWidth - 5136 + 400 - cmdBack.Left = Me.ScaleWidth - 3897 + 400 - cmdNext.Left = Me.ScaleWidth - 2883 + 400 - cmdFinish.Left = Me.ScaleWidth - 1643 + 400 - Line1.X2 = Me.ScaleWidth - 480 + 400 - - cmdCancel.Top = Me.ScaleHeight - 375 - cmdBack.Top = Me.ScaleHeight - 375 - cmdNext.Top = Me.ScaleHeight - 375 - cmdFinish.Top = Me.ScaleHeight - 375 - Line1.Y1 = Me.ScaleHeight - 475 - Line1.Y2 = Me.ScaleHeight - 475 -End Sub - -Private Sub cmdCancel_Click() - 'set the global var to false - 'to denote a failed login - Unload Me -End Sub diff --git a/ndb/src/cw/cpcc-win32/vb6/frmOptions.frm b/ndb/src/cw/cpcc-win32/vb6/frmOptions.frm deleted file mode 100644 index e526a35b3ec..00000000000 --- a/ndb/src/cw/cpcc-win32/vb6/frmOptions.frm +++ /dev/null @@ -1,231 +0,0 @@ -VERSION 5.00 -Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" -Begin VB.Form frmOptions - BorderStyle = 3 'Fixed Dialog - Caption = "Options" - ClientHeight = 5040 - ClientLeft = 6600 - ClientTop = 4575 - ClientWidth = 6150 - KeyPreview = -1 'True - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 5040 - ScaleWidth = 6150 - ShowInTaskbar = 0 'False - Tag = "Options" - Begin VB.CommandButton cmdOK - Caption = "OK" - Height = 375 - Left = 2490 - TabIndex = 1 - Tag = "OK" - Top = 4455 - Width = 1095 - End - Begin VB.CommandButton cmdCancel - Cancel = -1 'True - Caption = "Cancel" - Height = 375 - Left = 3720 - TabIndex = 3 - Tag = "Cancel" - Top = 4455 - Width = 1095 - End - Begin VB.CommandButton cmdApply - Caption = "&Apply" - Height = 375 - Left = 4920 - TabIndex = 5 - Tag = "&Apply" - Top = 4455 - Width = 1095 - End - Begin VB.PictureBox picOptions - BorderStyle = 0 'None - Height = 3780 - Index = 3 - Left = -20000 - ScaleHeight = 3840.968 - ScaleMode = 0 'User - ScaleWidth = 5745.64 - TabIndex = 7 - TabStop = 0 'False - Top = 480 - Width = 5685 - Begin VB.Frame fraSample4 - Caption = "Sample 4" - Height = 2022 - Left = 505 - TabIndex = 11 - Tag = "Sample 4" - Top = 502 - Width = 2033 - End - End - Begin VB.PictureBox picOptions - BorderStyle = 0 'None - Height = 3780 - Index = 2 - Left = -20000 - ScaleHeight = 3840.968 - ScaleMode = 0 'User - ScaleWidth = 5745.64 - TabIndex = 9 - TabStop = 0 'False - Top = 480 - Width = 5685 - Begin VB.Frame fraSample3 - Caption = "Sample 3" - Height = 2022 - Left = 406 - TabIndex = 10 - Tag = "Sample 3" - Top = 403 - Width = 2033 - End - End - Begin VB.PictureBox picOptions - BorderStyle = 0 'None - Height = 3780 - Index = 1 - Left = -20000 - ScaleHeight = 3840.968 - ScaleMode = 0 'User - ScaleWidth = 5745.64 - TabIndex = 6 - TabStop = 0 'False - Top = 480 - Width = 5685 - Begin VB.Frame fraSample2 - Caption = "Sample 2" - Height = 2022 - Left = 307 - TabIndex = 8 - Tag = "Sample 2" - Top = 305 - Width = 2033 - End - End - Begin VB.PictureBox picOptions - BorderStyle = 0 'None - Height = 3780 - Index = 0 - Left = 210 - ScaleHeight = 3840.968 - ScaleMode = 0 'User - ScaleWidth = 5745.64 - TabIndex = 2 - TabStop = 0 'False - Top = 480 - Width = 5685 - Begin VB.Frame fraSample1 - Caption = "Sample 1" - Height = 2022 - Left = 208 - TabIndex = 4 - Tag = "Sample 1" - Top = 207 - Width = 2033 - End - End - Begin MSComctlLib.TabStrip tbsOptions - Height = 4245 - Left = 105 - TabIndex = 0 - Top = 120 - Width = 5895 - _ExtentX = 10398 - _ExtentY = 7488 - _Version = 393216 - BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} - NumTabs = 4 - BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} - Caption = "Group 1" - ImageVarType = 2 - EndProperty - BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} - Caption = "Group 2" - ImageVarType = 2 - EndProperty - BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} - Caption = "Group 3" - ImageVarType = 2 - EndProperty - BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} - Caption = "Group 4" - ImageVarType = 2 - EndProperty - EndProperty - End -End -Attribute VB_Name = "frmOptions" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub cmdApply_Click() - 'ToDo: Add 'cmdApply_Click' code. - MsgBox "Apply Code goes here to set options w/o closing dialog!" -End Sub - - -Private Sub cmdCancel_Click() - Unload Me -End Sub - - -Private Sub cmdOK_Click() - 'ToDo: Add 'cmdOK_Click' code. - MsgBox "Code goes here to set options and close dialog!" - Unload Me -End Sub - - -Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) - Dim i As Integer - i = tbsOptions.SelectedItem.Index - 'handle ctrl+tab to move to the next tab - If (Shift And 3) = 2 And KeyCode = vbKeyTab Then - If i = tbsOptions.Tabs.Count Then - 'last tab so we need to wrap to tab 1 - Set tbsOptions.SelectedItem = tbsOptions.Tabs(1) - Else - 'increment the tab - Set tbsOptions.SelectedItem = tbsOptions.Tabs(i + 1) - End If - ElseIf (Shift And 3) = 3 And KeyCode = vbKeyTab Then - If i = 1 Then - 'last tab so we need to wrap to tab 1 - Set tbsOptions.SelectedItem = tbsOptions.Tabs(tbsOptions.Tabs.Count) - Else - 'increment the tab - Set tbsOptions.SelectedItem = tbsOptions.Tabs(i - 1) - End If - End If -End Sub - - - - -Private Sub tbsOptions_Click() - - - Dim i As Integer - 'show and enable the selected tab's controls - 'and hide and disable all others - For i = 0 To tbsOptions.Tabs.Count - 1 - If i = tbsOptions.SelectedItem.Index - 1 Then - picOptions(i).Left = 210 - picOptions(i).Enabled = True - Else - picOptions(i).Left = -20000 - picOptions(i).Enabled = False - End If - Next - - -End Sub - diff --git a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frx b/ndb/src/cw/cpcc-win32/vb6/frmSplash.frx deleted file mode 100644 index fee0c5c59de..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frx and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/networking.ico b/ndb/src/cw/cpcc-win32/vb6/networking.ico deleted file mode 100644 index 6bbf8022fc6..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/networking.ico and /dev/null differ diff --git a/ndb/src/cw/cpcc-win32/vb6/open folder.ico b/ndb/src/cw/cpcc-win32/vb6/open folder.ico deleted file mode 100644 index 7bb32cc83d3..00000000000 Binary files a/ndb/src/cw/cpcc-win32/vb6/open folder.ico and /dev/null differ diff --git a/ndb/src/libndb.ver.in b/ndb/src/libndb.ver.in index 72bf93d196f..c7b97876d44 100644 --- a/ndb/src/libndb.ver.in +++ b/ndb/src/libndb.ver.in @@ -1,2 +1,17 @@ +# Copyright (C) 2007 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + libndbclient_@NDB_SHARED_LIB_MAJOR_VERSION@ { global: *; }; diff --git a/ndb/src/old_files/client/Makefile b/ndb/src/old_files/client/Makefile deleted file mode 100644 index 1751a98bdfe..00000000000 --- a/ndb/src/old_files/client/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -DIRS = - -ifneq ($(NDB_ODBC),N) -DIRS += odbc -endif - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/client/odbc/Extra.mk b/ndb/src/old_files/client/odbc/Extra.mk deleted file mode 100644 index 762fb0bedd0..00000000000 --- a/ndb/src/old_files/client/odbc/Extra.mk +++ /dev/null @@ -1,59 +0,0 @@ -# before Epilogue.mk - -CCFLAGS_LOC += -I.. - -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) - -ifeq ($(NDB_OS),SOLARIS) - -CCFLAGS_LOC += -I/usr/local/include - -ifeq ($(NDB_COMPILER),GCC) -LIBS_LOC += -Wl,-z,text -CCFLAGS_WARNINGS += -Wno-unused -Wformat -CCFLAGS_TOP += -D__STL_PTHREADS -endif - -ifeq ($(NDB_COMPILER),FORTE6) -LIBS_LOC += -z text -LIBS_SPEC += /usr/lib/libCrun.so.1 -endif - -LIB_TARGET_LIBS += -lthread -lrt - -endif -ifneq ($(filter $(NDB_OS), LINUX MACOSX IBMAIX TRU64X),) - -LIBS_LOC += -Wl,-z,text -CCFLAGS_WARNINGS += -Wno-unused -Wformat -GCC_VER := $(shell $(CC) --version) - -ifeq ($(GCC_VER),2.96) -CCFLAGS_TOP += -D__STL_PTHREADS -CCFLAGS_TOP += -fmessage-length=0 -endif - -CCFLAGS_TOP += -fno-rtti - -LIB_TARGET_LIBS += -lpthread - -endif - -ifeq ($(NDB_OS),WIN32) -ifeq (RELEASE, $(NDB_VERSION)) -CCFLAGS_WIN += /MT /GR /GS /Zi -D_WINDOWS -D_USRDLL -DNDBODBC_EXPORTS -DNO_COMMAND_HANDLER -D_MBCS -D_WINDLL -U_LIB -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -CCFLAGS_WIN += /MT /GR /GS /Zi -D_WINDOWS -D_USRDLL -DNDBODBC_EXPORTS -DNO_COMMAND_HANDLER -D_MBCS -D_WINDLL -U_LIB -else -CCFLAGS_WIN += /MT /GR /GS /Zi -D_WINDOWS -D_USRDLL -DNDBODBC_EXPORTS -DNO_COMMAND_HANDLER -D_MBCS -D_WINDLL -U_LIB -endif -endif -endif - -CCFLAGS_TOP += -DYYDEBUG=0 -fexceptions - -CCFLAGS_TOP += -DHAVE_LONG_LONG diff --git a/ndb/src/old_files/client/odbc/Makefile b/ndb/src/old_files/client/odbc/Makefile deleted file mode 100644 index 2da683e7d86..00000000000 --- a/ndb/src/old_files/client/odbc/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -include .defs.mk - -TYPE = * - -A_LIB = N -PIC_LIB = Y -SO_LIB = Y - -LIB_TARGET = NDB_ODBC - -LIB_TARGET_ARCHIVES = $(LIB_DIRS:%=odbc%) NDB_API - -# Overide Defs.mk -LDFLAGS_LAST = -lstdc++ -lm - -XXX = \ - ndbapi \ - mgmsrvcommon \ - transporter \ - general \ - signaldataprint \ - portlib \ - logger \ - trace - -ifeq ($(NDB_OS),WIN32) - -LIB_DIRS = \ - handles \ - dictionary \ - codegen \ - executor \ - common - -SOURCES += NdbOdbc.cpp -CFLAGS_NdbOdbc.cpp += -I. -I$(call fixpath,driver) - -PIC_ARCHIVE := Y -NONPIC_ARCHIVE := N -ARCHIVE_TARGET := ndb_odbcwin32 -LIB_TARGET_ARCHIVES += ndb_odbcwin32 - -ifeq (RELEASE, $(NDB_VERSION)) -WIN_LIBS += /VERSION:2.0x /NODEFAULTLIB:"odbc32" /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /MACHINE:IX86 /OPT:REF /OPT:ICF /DEF:NdbOdbc.def odbc32.lib odbccp32.lib user32.lib -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -WIN_LIBS += /VERSION:2.0x /NODEFAULTLIB:"odbc32" /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /MACHINE:IX86 /OPT:REF /OPT:ICF /DEF:NdbOdbc.def odbc32.lib odbccp32.lib user32.lib -else -WIN_LIBS += /VERSION:2.0x /NODEFAULTLIB:"odbc32" /INCREMENTAL /DLL /DEBUG /SUBSYSTEM:WINDOWS /MACHINE:IX86 /DEF:NdbOdbc.def odbc32.lib odbccp32.lib user32.lib -endif -endif - -else - -LIB_DIRS = \ - driver \ - handles \ - dictionary \ - codegen \ - executor \ - common - -endif - -include Extra.mk -include $(NDB_TOP)/Epilogue.mk - -# yo - -test: - $(MAKE) -j4 - $(MAKE) -C $(NDB_TOP)/tools/ndbsql - $(MAKE) -C $(NDB_TOP)/test/odbc/driver tidy - $(MAKE) -C $(NDB_TOP)/test/odbc/driver - $(MAKE) -C $(NDB_TOP)/test/ndbapi/testOIBasic diff --git a/ndb/src/old_files/client/odbc/NdbOdbc.cpp b/ndb/src/old_files/client/odbc/NdbOdbc.cpp deleted file mode 100755 index 67c6b5e0004..00000000000 --- a/ndb/src/old_files/client/odbc/NdbOdbc.cpp +++ /dev/null @@ -1,78 +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 */ - - -#include -#include - -#include "driver.cpp" - - -BOOL APIENTRY DllMain( HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -BOOL INSTAPI ConfigDSN( - HWND hwndParent, - WORD fRequest, - LPCSTR lpszDriver, - LPCSTR lpszAttributes) -{ - const char* szDSN = "NDB"; - - switch(fRequest) - { - case ODBC_ADD_DSN: - SQLWriteDSNToIni(szDSN, lpszDriver); - break; - - case ODBC_CONFIG_DSN: - break; - - case ODBC_REMOVE_DSN: - SQLRemoveDSNFromIni(szDSN); - break; - } - - return TRUE; -} - - -int FAR PASCAL -DriverConnectProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam) -{ - return FALSE; -} - -void __declspec( dllexport) FAR PASCAL LoadByOrdinal(void); -/* Entry point to cause DM to load using ordinals */ -void __declspec( dllexport) FAR PASCAL LoadByOrdinal(void) -{ -} - diff --git a/ndb/src/old_files/client/odbc/NdbOdbc.def b/ndb/src/old_files/client/odbc/NdbOdbc.def deleted file mode 100755 index 85619b91915..00000000000 --- a/ndb/src/old_files/client/odbc/NdbOdbc.def +++ /dev/null @@ -1,85 +0,0 @@ -LIBRARY NdbOdbc.DLL -VERSION 03.51.00 -EXPORTS -SQLAllocConnect -SQLAllocEnv -SQLAllocHandle -SQLAllocHandleStd -SQLAllocStmt -SQLBindCol -SQLBindParam -SQLBindParameter -SQLBrowseConnect -SQLBulkOperations -SQLCancel -SQLCloseCursor -SQLColAttribute -SQLColAttributes -SQLColumnPrivileges -SQLColumns -SQLConnect -SQLCopyDesc -SQLDataSources -SQLDescribeCol -SQLDescribeParam -SQLDisconnect -SQLDriverConnect -SQLDrivers -SQLEndTran -SQLError -SQLExecDirect -SQLExecute -SQLExtendedFetch -SQLFetch -SQLFetchScroll -SQLForeignKeys -SQLFreeConnect -SQLFreeEnv -SQLFreeHandle -SQLFreeStmt -SQLGetConnectAttr -SQLGetConnectOption -SQLGetCursorName -SQLGetData -SQLGetDescField -SQLGetDescRec -SQLGetDiagField -SQLGetDiagRec -SQLGetEnvAttr -SQLGetFunctions -SQLGetInfo -SQLGetStmtAttr -SQLGetStmtOption -SQLGetTypeInfo -SQLMoreResults -SQLNativeSql -SQLNumParams -SQLNumResultCols -SQLParamData -SQLParamOptions -SQLPrepare -SQLPrimaryKeys -SQLProcedureColumns -SQLProcedures -SQLPutData -SQLRowCount -SQLSetConnectAttr -SQLSetConnectOption -SQLSetCursorName -SQLSetDescField -SQLSetDescRec -SQLSetEnvAttr -SQLSetParam -SQLSetPos -SQLSetScrollOptions -SQLSetStmtAttr -SQLSetStmtOption -SQLSpecialColumns -SQLStatistics -SQLTablePrivileges -SQLTables -SQLTransact -DllMain -DriverConnectProc -ConfigDSN -LoadByOrdinal diff --git a/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp b/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp deleted file mode 100644 index 6be78b62bd9..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp +++ /dev/null @@ -1,229 +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 */ - -#include -#include -#include -#include "CodeGen.hpp" -#include "Code_root.hpp" - -#include -#include "SimpleParser.hpp" - -void -CodeGen::prepare(Ctx& ctx) -{ - parse(ctx); - if (! ctx.ok()) - return; - analyze(ctx); - if (! ctx.ok()) - return; - describe(ctx); -} - -void -CodeGen::execute(Ctx& ctx) -{ - DescArea& ipd = m_stmtArea.descArea(Desc_usage_IPD); - if (m_stmtArea.m_unbound) { - analyze(ctx); - if (! ctx.ok()) - return; - describe(ctx); - if (! ctx.ok()) - return; - if (m_stmtArea.m_unbound) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "%u input parameters have unbound SQL type", m_stmtArea.m_unbound); - return; - } - ipd.setBound(true); - } - if (! ipd.isBound()) { - ctx_log2(("IPD changed between executes - reanalyze")); - // jdbc can change parameter length at each execute - analyze(ctx); - if (! ctx.ok()) - return; - describe(ctx); - if (! ctx.ok()) - return; - freeExec(ctx); - codegen(ctx); - if (! ctx.ok()) - return; - alloc(ctx); - if (! ctx.ok()) - return; - ipd.setBound(true); - } - if (m_stmtArea.m_execTree == 0) { - codegen(ctx); - if (! ctx.ok()) - return; - alloc(ctx); - if (! ctx.ok()) - return; - } - Executor executor(m_stmtArea); - executor.execute(ctx); -} - -void -CodeGen::fetch(Ctx& ctx) -{ - // XXX parameter types are not checked any more - ctx_assert(! m_stmtArea.m_unbound); - Executor executor(m_stmtArea); - executor.fetch(ctx); -} - -void -CodeGen::parse(Ctx& ctx) -{ - Plan_root* planRoot = new Plan_root(m_stmtArea); - SimpleParser simpleParser(ctx, m_stmtArea, planRoot); - simpleParser.yyparse(); - if (! ctx.ok()) - return; - planRoot->m_paramList.resize(1 + simpleParser.paramNumber()); - ctx_log2(("CodeGen: parse done - plan tree follows")); - if (ctx.logLevel() >= 2) - planRoot->print(ctx); - m_stmtArea.m_planTree = planRoot; -} - -void -CodeGen::analyze(Ctx& ctx) -{ - Plan_root* planRoot = static_cast(m_stmtArea.m_planTree); - ctx_assert(planRoot != 0); - Plan_base::Ctl ctl(0); - planRoot->analyze(ctx, ctl); // returns itself - if (! ctx.ok()) - return; - ctx_log2(("CodeGen: analyze done - plan tree follows")); - if (ctx.logLevel() >= 2) - planRoot->print(ctx); -} - -void -CodeGen::describe(Ctx& ctx) -{ - Plan_root* planRoot = static_cast(m_stmtArea.m_planTree); - ctx_assert(planRoot != 0); - planRoot->describe(ctx); - ctx_log2(("CodeGen: describe done")); -} - -void -CodeGen::codegen(Ctx& ctx) -{ - Plan_root* planRoot = static_cast(m_stmtArea.m_planTree); - ctx_assert(planRoot != 0); - Plan_base::Ctl ctl(0); - Exec_root* execRoot = static_cast(planRoot->codegen(ctx, ctl)); - if (! ctx.ok()) - return; - ctx_assert(execRoot != 0); - ctx_log2(("CodeGen: codegen done - code tree follows")); - if (ctx.logLevel() >= 2) - execRoot->print(ctx); - m_stmtArea.m_execTree = execRoot; -} - -void -CodeGen::alloc(Ctx& ctx) -{ - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - Exec_base::Ctl ctl(0); - execRoot->alloc(ctx, ctl); - if (! ctx.ok()) - return; - ctx_log2(("CodeGen: alloc done")); -} - -void -CodeGen::close(Ctx& ctx) -{ - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - if (execRoot != 0) { - execRoot->close(ctx); - ctx_log2(("CodeGen: close done")); - } -} - -void -CodeGen::free(Ctx& ctx) -{ - freePlan(ctx); - freeExec(ctx); -} - -void -CodeGen::freePlan(Ctx & ctx) -{ - if (m_stmtArea.m_planTree != 0) { - Plan_root* planRoot = static_cast(m_stmtArea.m_planTree); - ctx_assert(planRoot != 0); - unsigned count = 1 + planRoot->m_nodeList.size(); - planRoot->freeNodeList(); - delete planRoot; - m_stmtArea.m_planTree = 0; - ctx_log3(("CodeGen: freed %u plan tree nodes", count)); - } -} - -void -CodeGen::freeExec(Ctx & ctx) -{ - if (m_stmtArea.m_execTree != 0) { - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - unsigned count = 1 + execRoot->m_nodeList.size(); - execRoot->freeNodeList(); - delete execRoot; - m_stmtArea.m_execTree = 0; - ctx_log3(("CodeGen: freed %u exec tree nodes", count)); - } -} - -// odbc support - -void -CodeGen::sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind) -{ - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - execRoot->sqlGetData(ctx, columnNumber, targetType, targetValue, bufferLength, strlen_or_Ind); -} - -void -CodeGen::sqlParamData(Ctx& ctx, SQLPOINTER* value) -{ - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - execRoot->sqlParamData(ctx, value); -} - -void -CodeGen::sqlPutData(Ctx& ctx, SQLPOINTER data, SQLINTEGER strlen_or_Ind) -{ - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - execRoot->sqlPutData(ctx, data, strlen_or_Ind); -} diff --git a/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp b/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp deleted file mode 100644 index ae61dab0c2a..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp +++ /dev/null @@ -1,69 +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 ODBC_CODEGEN_CodeGen_hpp -#define ODBC_CODEGEN_CodeGen_hpp - -#include - -class StmtArea; -class SqlField; -class ExtField; - -/** - * @class CodeGen - * @brief Compiles SQL text into ExecTree::Code - */ -class CodeGen { -public: - CodeGen(StmtArea& stmtArea); - ~CodeGen(); - // parse and analyze SQL statement - void prepare(Ctx& ctx); - // these are passed to Executor - void execute(Ctx& ctx); - void fetch(Ctx& ctx); - // close statement (mainly scan) - void close(Ctx& ctx); - // free data structures - void free(Ctx& ctx); - // odbc support - void sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind); - void sqlParamData(Ctx& ctx, SQLPOINTER* value); - void sqlPutData(Ctx& ctx, SQLPOINTER data, SQLINTEGER strlen_or_Ind); -private: - void parse(Ctx& ctx); - void analyze(Ctx& ctx); - void describe(Ctx& ctx); - void codegen(Ctx& ctx); - void alloc(Ctx& ctx); - void freePlan(Ctx& ctx); - void freeExec(Ctx& ctx); - StmtArea& m_stmtArea; -}; - -inline -CodeGen::CodeGen(StmtArea& stmtArea) : - m_stmtArea(stmtArea) -{ -} - -inline -CodeGen::~CodeGen() -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_base.cpp b/ndb/src/old_files/client/odbc/codegen/Code_base.cpp deleted file mode 100644 index dc02e071156..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_base.cpp +++ /dev/null @@ -1,167 +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 */ - -#include -#include "Code_base.hpp" -#include "Code_root.hpp" - -// Plan_base - -Plan_base::~Plan_base() -{ -} - -StmtArea& -Plan_base::stmtArea() const -{ - ctx_assert(m_root != 0); - return m_root->m_stmtArea; -} - -DescArea& -Plan_base::descArea(DescUsage u) const -{ - return stmtArea().descArea(u); -} - -ConnArea& -Plan_base::connArea() const -{ - return stmtArea().connArea(); -} - -DictCatalog& -Plan_base::dictCatalog() const -{ - return connArea().dictCatalog(); -} - -DictSchema& -Plan_base::dictSchema() const -{ - return connArea().dictSchema(); -} - -Ndb* -Plan_base::ndbObject() const -{ - Ndb* ndb = connArea().ndbObject(); - ctx_assert(ndb != 0); - return ndb; -} - -NdbSchemaCon* -Plan_base::ndbSchemaCon() const -{ - NdbSchemaCon* ndbSchemaCon = connArea().ndbSchemaCon(); - ctx_assert(ndbSchemaCon != 0); - return ndbSchemaCon; -} - -NdbConnection* -Plan_base::ndbConnection() const -{ - NdbConnection* ndbConnection = connArea().ndbConnection(); - ctx_assert(ndbConnection != 0); - return ndbConnection; -} - -void -Plan_base::printList(Ctx& ctx, Plan_base* a[], unsigned n) -{ - for (unsigned i = 0; i < n; i++) { - if (a[i] == 0) - ctx.print(" -"); - else - a[i]->print(ctx); - } -} - -// Exec_base - -Exec_base::Code::~Code() -{ -} - -Exec_base::Data::~Data() -{ -} - -Exec_base::~Exec_base() -{ - delete m_code; // remove when code becomes shared - m_code = 0; - delete m_data; - m_data = 0; -} - -StmtArea& -Exec_base::stmtArea() const -{ - ctx_assert(m_root != 0); - return m_root->m_stmtArea; -} - -DescArea& -Exec_base::descArea(DescUsage u) const -{ - return stmtArea().descArea(u); -} - -ConnArea& -Exec_base::connArea() const -{ - return stmtArea().connArea(); -} - -DictSchema& -Exec_base::dictSchema() const -{ - return connArea().dictSchema(); -} - -Ndb* -Exec_base::ndbObject() const -{ - Ndb* ndb = connArea().ndbObject(); - ctx_assert(ndb != 0); - return ndb; -} - -NdbSchemaCon* -Exec_base::ndbSchemaCon() const -{ - NdbSchemaCon* ndbSchemaCon = connArea().ndbSchemaCon(); - ctx_assert(ndbSchemaCon != 0); - return ndbSchemaCon; -} - -NdbConnection* -Exec_base::ndbConnection() const -{ - NdbConnection* ndbConnection = connArea().ndbConnection(); - ctx_assert(ndbConnection != 0); - return ndbConnection; -} - -void -Exec_base::printList(Ctx& ctx, Exec_base* a[], unsigned n) -{ - for (unsigned i = 0; i < n; i++) { - ctx_assert(a[i] != 0); - a[i]->print(ctx); - } -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_base.hpp b/ndb/src/old_files/client/odbc/codegen/Code_base.hpp deleted file mode 100644 index c67c0ca7adb..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_base.hpp +++ /dev/null @@ -1,237 +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 ODBC_CODEGEN_Code_base_hpp -#define ODBC_CODEGEN_Code_base_hpp - -#include -#include -#include -#include -#include -#include - -class Ctx; -class ConnArea; -class StmtArea; -class DescArea; -class DictCatalog; -class DictSchema; -class ResultArea; -class ResultSet; -class SpecRow; -class Ndb; -class NdbSchemaCon; -class NdbConnection; -class NdbOperation; -class NdbScanFilter; - -class Plan_root; -class Plan_table; -class Plan_column; -class Plan_expr; -class Plan_expr_param; -class Plan_pred; -class Plan_dml_row; -class Plan_dml_column; -class Plan_ddl_column; -class Plan_ddl_constr; -class Plan_idx_column; -class Exec_root; -class Exec_base; -class Exec_query; -class Exec_expr; -class Exec_expr_row; -class Exec_expr_param; - -/** - * @class Plan_base - * @brief Base class for plan trees - */ -class Plan_base : public PlanTree { -public: - Plan_base(Plan_root* root); - virtual ~Plan_base() = 0; - // get references to StmtArea via Plan_root - StmtArea& stmtArea() const; - DescArea& descArea(DescUsage u) const; - ConnArea& connArea() const; - // catalogs - DictCatalog& dictCatalog() const; - DictSchema& dictSchema() const; - // ndb - Ndb* ndbObject() const; - NdbSchemaCon* ndbSchemaCon() const; - NdbConnection* ndbConnection() const; - // containers for Plan classes - typedef std::vector TableVector; - typedef std::vector ColumnVector; - typedef std::vector DmlColumnVector; - typedef std::vector DdlColumnVector; - typedef std::vector DdlConstrVector; - typedef std::vector IdxColumnVector; - typedef std::vector ExprVector; - typedef std::list ExprList; - typedef std::vector ExprListVector; - typedef std::list PredList; - typedef std::set TableSet; - typedef std::vector ParamVector; - // control area on the stack XXX needs to be designed - struct Ctl { - Ctl(Ctl* up); - Ctl* m_up; // up the stack - // analyze - TableVector m_tableList; // resolve column names - bool m_topand; // in top-level where clause - bool m_extra; // anything but single pk=expr - bool m_aggrok; // aggregate allowed - bool m_aggrin; // within aggregate args - bool m_const; // only constants in set clause - PredList m_topcomp; // top level comparisons - Plan_dml_row *m_dmlRow; // row type to convert to - Plan_table* m_topTable; // top level table for interpreted progs - bool m_having; // in having-predicate - // codegen - Exec_root* m_execRoot; // root of Exec tree - const Exec_query* m_execQuery; // pass to column - }; - // semantic analysis and optimization - virtual Plan_base* analyze(Ctx& ctx, Ctl& ctl) = 0; - // generate "executable" code - virtual Exec_base* codegen(Ctx& ctx, Ctl& ctl) = 0; - // misc - virtual void print(Ctx& ctx) = 0; -protected: - Plan_root* m_root; - void printList(Ctx& ctx, Plan_base* a[], unsigned n); -}; - -inline -Plan_base::Plan_base(Plan_root* root) : - m_root(root) -{ - ctx_assert(m_root != 0); -} - -inline -Plan_base::Ctl::Ctl(Ctl* up) : - m_up(up), - m_tableList(1), // 1-based - m_topand(false), - m_extra(false), - m_aggrok(false), - m_aggrin(false), - m_dmlRow(0), - m_topTable(0), - m_having(false), - m_execRoot(0), - m_execQuery(0) -{ -} - -/** - * @class Exec_base - * @brief Base class for exec trees - */ -class Exec_base : public ExecTree { -public: - class Code : public ExecTree::Code { - public: - virtual ~Code() = 0; - }; - class Data : public ExecTree::Data { - public: - virtual ~Data() = 0; - }; - Exec_base(Exec_root* root); - virtual ~Exec_base() = 0; - // get references to StmtArea via Exec_root - virtual StmtArea& stmtArea() const; - DescArea& descArea(DescUsage u) const; - ConnArea& connArea() const; - // catalogs - DictSchema& dictSchema() const; - // ndb - Ndb* ndbObject() const; - NdbSchemaCon* ndbSchemaCon() const; - NdbConnection* ndbConnection() const; - // containers for Exec classes - typedef std::vector ExprVector; - typedef std::vector ParamVector; - // control area on the stack - struct Ctl { - Ctl(Ctl* up); - Ctl* m_up; // up the stack - const Exec_query* m_query; // pass Data - ExprVector m_exprList; // pass Data - NdbOperation* m_scanOp; // scan operation - bool m_postEval; // for rownum - unsigned m_groupIndex; // for group by - bool m_groupInit; // first in group - Exec_expr_row* m_sortRow; // from sort to group by - NdbScanFilter* m_scanFilter; // scan filter - }; - // allocate and deallocate Data instances - virtual void alloc(Ctx& ctx, Ctl& ctl) = 0; - virtual void close(Ctx& ctx) = 0; - // set Code and Data - void setCode(const Code& code); - void setData(Data& data); - // misc - virtual void print(Ctx& ctx) = 0; -protected: - const Code* m_code; - Data* m_data; - Exec_root* m_root; - void printList(Ctx& ctx, Exec_base* a[], unsigned n); -}; - -inline -Exec_base::Exec_base(Exec_root* root) : - m_code(0), - m_data(0), - m_root(root) -{ - ctx_assert(m_root != 0); -} - -inline void -Exec_base::setCode(const Code& code) -{ - ctx_assert(m_code == 0); - m_code = &code; -} - -inline void -Exec_base::setData(Data& data) -{ - ctx_assert(m_data == 0); - m_data = &data; -} - -inline -Exec_base::Ctl::Ctl(Ctl* up) : - m_up(up), - m_scanOp(0), - m_postEval(false), - m_groupIndex(0), - m_groupInit(false), - m_sortRow(0), - m_scanFilter(0) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_column.cpp deleted file mode 100644 index c4c0480a5e7..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_column.cpp +++ /dev/null @@ -1,72 +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 */ - -#include -#include -#include -#include -#include "Code_column.hpp" -#include "Code_table_list.hpp" -#include "Code_table.hpp" - -// Plan_column - -Plan_column::~Plan_column() -{ -} - -void -Plan_column::analyzeColumn(Ctx& ctx, Plan_base::Ctl& ctl) -{ - if (m_resTable != 0) // done on previous pass - return; - if (! (ctl.m_tableList.size() > 1)) { - ctx.pushStatus(Sqlstate::_42000, Error::Gen, "column %s not allowed here", getPrintName()); - return; - } - unsigned resCount = 0; - for (unsigned i = 1; i < ctl.m_tableList.size(); i++) { - Plan_table* table = ctl.m_tableList[i]; - ctx_assert(table != 0); - int ret = table->resolveColumn(ctx, this); - if (ret < 0) - return; - if (ret) - resCount++; - } - if (resCount == 0) { - // XXX try to strip "schema name" from table name - for (unsigned i = 1; i < ctl.m_tableList.size(); i++) { - Plan_table* table = ctl.m_tableList[i]; - ctx_assert(table != 0); - int ret = table->resolveColumn(ctx, this, true); - if (ret < 0) - return; - if (ret) - resCount++; - } - } - if (resCount == 0) { - ctx.pushStatus(Sqlstate::_42S22, Error::Gen, "column %s not found", getPrintName()); - return; - } - if (resCount > 1) { - ctx.pushStatus(Error::Gen, "column %s is ambiguous", getPrintName()); - return; - } - // copy SQL type - m_sqlType = dictColumn().sqlType(); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_column.hpp deleted file mode 100644 index af0dcea690d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_column.hpp +++ /dev/null @@ -1,122 +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 ODBC_CODEGEN_Code_column_hpp -#define ODBC_CODEGEN_Code_column_hpp - -#include -#include -#include "Code_base.hpp" - -class DictColumn; -class Plan_table; - -/** - * @class Plan_column - * @brief Abstract base class for columns - */ -class Plan_column { -public: - enum Type { - Type_expr = 1, - Type_dml = 2, - Type_ddl = 3, // new columns in create table - Type_idx = 4 // old columns in create index - }; - Plan_column(Type type, const BaseString& name); - virtual ~Plan_column() = 0; - void analyzeColumn(Ctx& ctx, Plan_base::Ctl& ctl); - // attributes - const BaseString& getName() const; - const BaseString& getCname() const; - const char* getPrintName() const; - void setCname(const BaseString& cname); - const DictColumn& dictColumn() const; - const SqlType& sqlType() const; -protected: - friend class Plan_table; - friend class Plan_comp_op; - Type m_type; - BaseString m_name; - BaseString m_cname; - BaseString m_printName; - DictColumn* m_dictColumn; - /** - * Resolve to table and operational position (for example - * column number in scan query). - */ - Plan_table* m_resTable; - unsigned m_resPos; - SqlType m_sqlType; -}; - -inline -Plan_column::Plan_column(Type type, const BaseString& name) : - m_type(type), - m_name(name), - m_printName(name), - m_dictColumn(0), - m_resTable(0), - m_resPos(0) -{ -} - -inline const BaseString& -Plan_column::getName() const -{ - return m_name; -} - -inline const BaseString& -Plan_column::getCname() const -{ - return m_cname; -} - -inline const char* -Plan_column::getPrintName() const -{ - return m_printName.c_str(); -} - -inline void -Plan_column::setCname(const BaseString& cname) -{ - m_cname.assign(cname); - if (m_cname.empty()) - m_printName.assign(m_name); - else { - m_printName.assign(m_cname); - m_printName.append("."); - m_printName.append(m_name); - } -} - -inline const DictColumn& -Plan_column::dictColumn() const -{ - ctx_assert(m_dictColumn != 0); - return *m_dictColumn; -} - -inline const SqlType& -Plan_column::sqlType() const -{ - ctx_assert(m_sqlType.type() != SqlType::Undef); - return m_sqlType; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp b/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp deleted file mode 100644 index 7782ed1ea2a..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp +++ /dev/null @@ -1,485 +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 */ - -#include -#include "Code_pred.hpp" -#include "Code_comp_op.hpp" -#include "Code_expr_conv.hpp" -#include "Code_expr_column.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -// Comp_op - -const char* -Comp_op::name() const -{ - switch (m_opcode) { - case Eq: - return "="; - case Noteq: - return "!="; - case Lt: - return "<"; - case Lteq: - return "<="; - case Gt: - return ">"; - case Gteq: - return ">="; - case Like: - return "like"; - case Notlike: - return "not like"; - case Isnull: - return "is null"; - case Isnotnull: - return "is not null"; - } - ctx_assert(false); - return ""; -} - -unsigned -Comp_op::arity() const -{ - switch (m_opcode) { - case Eq: - case Noteq: - case Lt: - case Lteq: - case Gt: - case Gteq: - case Like: - case Notlike: - return 2; - case Isnull: - case Isnotnull: - return 1; - } - ctx_assert(false); - return 0; -} - -// Plan_comp_op - -Plan_comp_op::~Plan_comp_op() -{ -} - -Plan_base* -Plan_comp_op::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - const unsigned arity = m_op.arity(); - // analyze operands - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - m_expr[i]->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // for each operand, find type to convert to - SqlType con[1 + 2]; - if (arity == 1) { - const SqlType& t1 = m_expr[1]->sqlType(); - switch (t1.type()) { - case SqlType::Char: - case SqlType::Varchar: - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - case SqlType::Real: - case SqlType::Double: - case SqlType::Datetime: - case SqlType::Null: - case SqlType::Unbound: - con[1] = t1; - break; - default: - break; - } - if (con[1].type() == SqlType::Undef) { - char b1[40]; - t1.print(b1, sizeof(b1)); - ctx.pushStatus(Error::Gen, "type mismatch in comparison: %s %s", b1, m_op.name()); - return 0; - } - } else if (arity == 2) { - const SqlType& t1 = m_expr[1]->sqlType(); - const SqlType& t2 = m_expr[2]->sqlType(); - switch (t1.type()) { - case SqlType::Char: - switch (t2.type()) { - case SqlType::Char: - case SqlType::Varchar: - case SqlType::Null: - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - con[1] = con[2] = t2; - break; - default: - break; - } - break; - case SqlType::Varchar: - switch (t2.type()) { - case SqlType::Char: - case SqlType::Varchar: - case SqlType::Null: - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - con[1] = con[2] = t2; - break; - default: - break; - } - break; - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - switch (t2.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - // conversion would mask primary key optimization - con[1] = t1; - con[2] = t2; - break; - case SqlType::Real: - case SqlType::Double: - con[1].setType(ctx, SqlType::Double); - con[2] = con[1]; - break; - case SqlType::Null: - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - con[1] = con[2] = t2; - break; - default: - break; - } - break; - case SqlType::Real: - case SqlType::Double: - switch (t2.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - case SqlType::Real: - case SqlType::Double: - con[1].setType(ctx, SqlType::Double); - con[2] = con[1]; - break; - case SqlType::Null: - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - con[1] = con[2] = t2; - break; - default: - break; - } - break; - case SqlType::Datetime: - switch (t2.type()) { - case SqlType::Datetime: - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - con[1] = con[2] = t2; - break; - default: - break; - } - break; - case SqlType::Null: - switch (t2.type()) { - case SqlType::Char: - case SqlType::Varchar: - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - case SqlType::Real: - case SqlType::Double: - case SqlType::Datetime: - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - con[1] = con[2] = t2; - break; - default: - break; - } - break; - case SqlType::Unbound: - con[1] = con[2] = t1; - break; - default: - break; - } - if (con[1].type() == SqlType::Undef || con[2].type() == SqlType::Undef) { - char b1[40], b2[40]; - t1.print(b1, sizeof(b1)); - t2.print(b2, sizeof(b2)); - ctx.pushStatus(Error::Gen, "type mismatch in comparison: %s %s %s", b1, m_op.name(), b2); - return 0; - } - } else { - ctx_assert(false); - return 0; - } - if (! ctx.ok()) - return 0; - // insert required conversions - for (unsigned i = 1; i <= arity; i++) { - if (con[i].type() == SqlType::Unbound) { - continue; - } - Plan_expr_conv* exprConv = new Plan_expr_conv(m_root, con[i]); - m_root->saveNode(exprConv); - exprConv->setExpr(m_expr[i]); - m_expr[i] = static_cast(exprConv->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_expr[i] != 0); - } - // look for column=expr - if (ctl.m_topand && m_op.m_opcode == Comp_op::Eq) { - ctx_assert(arity == 2); - for (unsigned i = 1, j = 2; i <= 2; i++, j--) { - if (m_expr[i]->type() != Plan_expr::TypeColumn) - continue; - Plan_expr_column* column = static_cast(m_expr[i]); - if (! column->resolveEq(ctx, m_expr[j])) - ctl.m_extra = true; - } - } else { - ctl.m_extra = true; - } - // save top level comparison on list - if (ctl.m_topand) { - ctl.m_topcomp.push_back(this); - } - // table dependencies are union from operands - m_tableSet.clear(); - for (unsigned i = 1; i <= arity; i++) { - const TableSet& ts = m_expr[i]->tableSet(); - m_tableSet.insert(ts.begin(), ts.end()); - } - // set of tables for which interpreter cannot be used - m_noInterp.clear(); - // convenient -#undef ustype -#define ustype(b, n) (((b) ? 1 : 0) * 100 + (n)) - if (arity == 1) { - for (unsigned i = 1; i <= 1; i++) { - const SqlType t1 = m_expr[i]->sqlType(); - switch (m_op.m_opcode) { - case Comp_op::Isnull: - case Comp_op::Isnotnull: - if (m_expr[i]->type() == Plan_expr::TypeColumn) { - switch (ustype(t1.unSigned(), t1.type())) { - // all types accepted now - default: - { - Plan_expr_column* column = static_cast(m_expr[i]); - ctx_assert(column->m_resTable != 0); - m_interpColumn[i] = column; - continue; // ok - } - break; - } - } - break; - default: - break; - } - const TableSet& ts = m_expr[i]->tableSet(); - m_noInterp.insert(ts.begin(), ts.end()); - } - } else if (arity == 2) { - for (unsigned i = 1, j = 2; i <= 2; i++, j--) { - const SqlType t1 = m_expr[i]->sqlType(); - switch (m_op.m_opcode) { - case Comp_op::Like: - case Comp_op::Notlike: - if (i == 2) // col like val but not val like col - break; - /*FALLTHRU*/ - case Comp_op::Eq: - case Comp_op::Noteq: - case Comp_op::Lt: - case Comp_op::Lteq: - case Comp_op::Gt: - case Comp_op::Gteq: - if (m_expr[i]->type() == Plan_expr::TypeColumn) { - switch (ustype(t1.unSigned(), t1.type())) { - case ustype(false, SqlType::Char): - case ustype(false, SqlType::Varchar): - case ustype(true, SqlType::Smallint): - case ustype(true, SqlType::Integer): - case ustype(true, SqlType::Bigint): - { - Plan_expr_column* column = static_cast(m_expr[i]); - ctx_assert(column->m_resTable != 0); - const TableSet& ts = m_expr[j]->tableSet(); - if (ts.find(column->m_resTable) == ts.end()) { - // candidate for column=const - m_interpColumn[i] = column; - continue; // ok - } - } - break; - default: - break; - } - } - break; - default: - break; - } - const TableSet& ts = m_expr[i]->tableSet(); - m_noInterp.insert(ts.begin(), ts.end()); - } - } else { - ctx_assert(false); - return 0; - } -#undef ustype - return this; -} - -Exec_base* -Plan_comp_op::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - const unsigned arity = m_op.arity(); - Exec_comp_op* exec = new Exec_comp_op(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // create code for operands - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - Exec_expr* execExpr = static_cast(m_expr[i]->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - exec->setExpr(i, execExpr); - } - // create the code - Exec_comp_op::Code& code = *new Exec_comp_op::Code(m_op); - // interpreted column=const - if (! ctl.m_having) { - ctx_assert(ctl.m_topTable != 0); - for (unsigned i = 1; i <= arity; i++) { - Plan_expr_column* column = m_interpColumn[i]; - if (column == 0) - continue; - ctx_assert(column->m_resTable != 0); - if (column->m_resTable != ctl.m_topTable) - continue; - ctx_assert(code.m_interpColumn == 0); - code.m_interpColumn = i; - code.m_interpAttrId = column->dictColumn().getAttrId(); - ctx_log2(("can use interpreter on %s", column->getPrintName())); - } - } - exec->setCode(code); - m_exec = exec; - return exec; -} - -void -Plan_comp_op::print(Ctx& ctx) -{ - ctx.print(" [%s", m_op.name()); - Plan_base* a[] = { m_expr[1], m_expr[2] }; - printList(ctx, a, m_op.arity()); - ctx.print("]"); -} - -bool -Plan_comp_op::isGroupBy(const Plan_expr_row* row) const -{ - const unsigned arity = m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - if (! m_expr[i]->isGroupBy(row)) - return false; - } - return true; -} - -// Code_comp_op - -Exec_comp_op::Code::~Code() -{ -} - -Exec_comp_op::Data::~Data() -{ -} - -Exec_comp_op::~Exec_comp_op() -{ -} - -void -Exec_comp_op::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // allocate subexpressions - unsigned arity = code.m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - m_expr[i]->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - Data& data = *new Data; - setData(data); -} - -void -Exec_comp_op::close(Ctx& ctx) -{ - const Code& code = getCode(); - unsigned arity = code.m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - m_expr[i]->close(ctx); - } -} - -void -Exec_comp_op::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [%s", code.m_op.name()); - Exec_base* a[] = { m_expr[1], m_expr[2] }; - printList(ctx, a, code.m_op.arity()); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp b/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp deleted file mode 100644 index 0585ab1dabf..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp +++ /dev/null @@ -1,172 +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 ODBC_CODEGEN_Code_comp_op_hpp -#define ODBC_CODEGEN_Code_comp_op_hpp - -#include -#include -#include "Code_pred.hpp" -#include "Code_expr.hpp" -#include "Code_expr_column.hpp" - -/** - * @class Comp_op - * @brief Comparison operations - */ -struct Comp_op { - enum Opcode { - Eq = 1, // binary - Noteq, - Lt, - Lteq, - Gt, - Gteq, - Like, - Notlike, - Isnull, // unary - Isnotnull - }; - Comp_op(Opcode opcode); - const char* name() const; - unsigned arity() const; - Opcode m_opcode; -}; - -inline -Comp_op::Comp_op(Opcode opcode) : - m_opcode(opcode) -{ -} - -/** - * @class Plan_comp_op - * @brief Comparison operator node in PlanTree - */ -class Plan_comp_op : public Plan_pred { -public: - Plan_comp_op(Plan_root* root, Comp_op op); - virtual ~Plan_comp_op(); - void setExpr(unsigned i, Plan_expr* expr); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - virtual bool isGroupBy(const Plan_expr_row* row) const; -protected: - Comp_op m_op; - Plan_expr* m_expr[1 + 2]; - Plan_expr_column* m_interpColumn[1 + 2]; // candidates -}; - -inline -Plan_comp_op::Plan_comp_op(Plan_root* root, Comp_op op) : - Plan_pred(root, TypeComp), - m_op(op) -{ - m_expr[0] = m_expr[1] = m_expr[2] = 0; - m_interpColumn[0] = m_interpColumn[1] = m_interpColumn[2] = 0; -} - -inline void -Plan_comp_op::setExpr(unsigned i, Plan_expr* expr) -{ - ctx_assert(1 <= i && i <= 2); - m_expr[i] = expr; -} - -/** - * @class Exec_comp_op - * @brief Comparison operator node in ExecTree - */ -class Exec_comp_op : public Exec_pred { -public: - class Code : public Exec_pred::Code { - public: - Code(Comp_op op); - virtual ~Code(); - protected: - friend class Plan_comp_op; - friend class Exec_comp_op; - Comp_op m_op; - unsigned m_interpColumn; // 1 or 2 if interpreted column, 0 if both constant - NdbAttrId m_interpAttrId; - }; - class Data : public Exec_pred::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_comp_op; - }; - Exec_comp_op(Exec_root* root); - virtual ~Exec_comp_op(); - void alloc(Ctx& ctx, Ctl& ctl); - void execInterp(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setExpr(unsigned i, Exec_expr* expr); -protected: - Exec_expr* m_expr[1 + 2]; -}; - -inline -Exec_comp_op::Code::Code(Comp_op op) : - m_op(op), - m_interpColumn(0), - m_interpAttrId((NdbAttrId)-1) -{ -} - -inline -Exec_comp_op::Data::Data() -{ -} - -inline -Exec_comp_op::Exec_comp_op(Exec_root* root) : - Exec_pred(root) -{ - m_expr[0] = m_expr[1] = m_expr[2] = 0; -} - -// children - -inline const Exec_comp_op::Code& -Exec_comp_op::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_comp_op::Data& -Exec_comp_op::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_comp_op::setExpr(unsigned i, Exec_expr* expr) -{ - ctx_assert(1 <= i && i <= 2 && m_expr[i] == 0); - m_expr[i] = expr; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp deleted file mode 100644 index 84f319338a4..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp +++ /dev/null @@ -1,124 +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 */ - -#include -#include "Code_create_index.hpp" -#include "Code_root.hpp" - -// Plan_create_index - -Plan_create_index::~Plan_create_index() -{ -} - -Plan_base* -Plan_create_index::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_create_index); - // analyze the table - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - // analyze the columns - ctl.m_tableList.resize(1 + 1); // indexed from 1 - ctl.m_tableList[1] = m_table; - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_idx_column* column = getColumn(i); - column->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - return this; -} - -void -Plan_create_index::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "CREATE INDEX", SQL_DIAG_CREATE_INDEX); -} - -Exec_base* -Plan_create_index::codegen(Ctx& ctx, Ctl& ctl) -{ - Exec_create_index* exec = new Exec_create_index(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - const unsigned count = countColumn(); - const char** attrList = new const char* [1 + count]; - attrList[0] = 0; // unused - for (unsigned i = 1; i <= count; i++) { - Plan_idx_column* column = getColumn(i); - const char* cname = column->getName().c_str(); - attrList[i] = strcpy(new char[strlen(cname) + 1], cname); - } - Exec_create_index::Code& code = *new Exec_create_index::Code(m_name, m_table->getName(), m_type, count, attrList); - exec->setCode(code); - code.m_fragmentType = m_fragmentType; - code.m_logging = m_logging; - return exec; -} - -void -Plan_create_index::print(Ctx& ctx) -{ - ctx.print(" [create_index name=%s table=%s type=%d", m_name.c_str(), m_table->getName().c_str(), (int)m_type); - ctx.print(" ["); - for (unsigned i = 1; i <= countColumn(); i++) { - Plan_idx_column* column = getColumn(i); - if (i > 1) - ctx.print(" "); - column->print(ctx); - } - ctx.print("]"); -} - -// Exec_create_index - -Exec_create_index::Code::~Code() -{ - for (unsigned i = 1; i <= m_attrCount; i++) { - delete[] m_attrList[i]; - m_attrList[i] = 0; - } - delete[] m_attrList; -} - -Exec_create_index::Data::~Data() -{ -} - -Exec_create_index::~Exec_create_index() -{ -} - -void -Exec_create_index::alloc(Ctx& ctx, Ctl& ctl) -{ - Data& data = *new Data; - setData(data); -} - -void -Exec_create_index::close(Ctx& ctx) -{ -} - -void -Exec_create_index::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [create_index %s]", code.m_tableName.c_str()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp deleted file mode 100644 index ebd757e1118..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp +++ /dev/null @@ -1,203 +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 ODBC_CODEGEN_Code_create_index_hpp -#define ODBC_CODEGEN_Code_create_index_hpp - -#include -#include -#include -#include "Code_ddl.hpp" -#include "Code_table.hpp" -#include "Code_idx_column.hpp" - -class DictTable; -class DictColumn; - -/** - * @class Plan_create_index - * @brief Create table in PlanTree - */ -class Plan_create_index : public Plan_ddl { -public: - Plan_create_index(Plan_root* root, const BaseString& name); - virtual ~Plan_create_index(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void describe(Ctx & ctx); - void print(Ctx& ctx); - // attributes - const BaseString& getName() const; - // children - void setType(NdbDictionary::Object::Type type); - void setTable(Plan_table* table); - unsigned countColumn() const; - void addColumn(Plan_idx_column* column); - Plan_idx_column* getColumn(unsigned i) const; - void setFragmentType(NdbDictionary::Object::FragmentType fragmentType); - void setLogging(bool logging); -protected: - BaseString m_name; - NdbDictionary::Object::Type m_type; - Plan_table* m_table; - IdxColumnVector m_columnList; - NdbDictionary::Object::FragmentType m_fragmentType; - bool m_logging; -}; - -inline -Plan_create_index::Plan_create_index(Plan_root* root, const BaseString& name) : - Plan_ddl(root), - m_name(name), - m_type(NdbDictionary::Object::TypeUndefined), - m_columnList(1), - m_fragmentType(NdbDictionary::Object::FragUndefined), - m_logging(true) -{ -} - -inline const BaseString& -Plan_create_index::getName() const -{ - return m_name; -} - -// children - -inline void -Plan_create_index::setType(NdbDictionary::Object::Type type) -{ - m_type = type; -} - -inline void -Plan_create_index::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline unsigned -Plan_create_index::countColumn() const -{ - return m_columnList.size() - 1; -} - -inline void -Plan_create_index::addColumn(Plan_idx_column* column) -{ - ctx_assert(column != 0); - m_columnList.push_back(column); -} - -inline Plan_idx_column* -Plan_create_index::getColumn(unsigned i) const -{ - ctx_assert(1 <= i && i <= countColumn() && m_columnList[i] != 0); - return m_columnList[i]; -} - -inline void -Plan_create_index::setFragmentType(NdbDictionary::Object::FragmentType fragmentType) -{ - m_fragmentType = fragmentType; -} - -inline void -Plan_create_index::setLogging(bool logging) -{ - m_logging = logging; -} - -/** - * @class Exec_create_index - * @brief Create table in ExecTree - */ -class Exec_create_index : public Exec_ddl { -public: - class Code : public Exec_ddl::Code { - public: - Code(const BaseString& indexName, const BaseString& tableName, NdbDictionary::Object::Type type, unsigned attrCount, const char** attrList); - virtual ~Code(); - protected: - friend class Plan_create_index; - friend class Exec_create_index; - const BaseString m_indexName; - const BaseString m_tableName; - NdbDictionary::Object::Type m_type; - const unsigned m_attrCount; - const char** m_attrList; - NdbDictionary::Object::FragmentType m_fragmentType; - bool m_logging; - }; - class Data : public Exec_ddl::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_create_index; - }; - Exec_create_index(Exec_root* root); - virtual ~Exec_create_index(); - void alloc(Ctx& ctx, Ctl& ctl); - void execute(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_create_index::Code::Code(const BaseString& indexName, const BaseString& tableName, NdbDictionary::Object::Type type, unsigned attrCount, const char** attrList) : - m_indexName(indexName), - m_tableName(tableName), - m_type(type), - m_attrCount(attrCount), - m_attrList(attrList), - m_fragmentType(NdbDictionary::Object::FragUndefined), - m_logging(true) -{ -} - -inline -Exec_create_index::Data::Data() -{ -} - -inline -Exec_create_index::Exec_create_index(Exec_root* root) : - Exec_ddl(root) -{ -} - -// children - -inline const Exec_create_index::Code& -Exec_create_index::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_create_index::Data& -Exec_create_index::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp deleted file mode 100644 index 5b90b658ed7..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp +++ /dev/null @@ -1,162 +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 */ - -#include "Code_create_row.hpp" -#include "Code_root.hpp" - -Plan_create_row::~Plan_create_row() -{ -} - -Plan_base* -Plan_create_row::analyze(Ctx& ctx, Ctl& ctl) -{ - // check for duplicate column name - for (unsigned i = 1, n = countColumn(); i < n; i++) { - const BaseString& a = getColumn(i)->getName(); - for (unsigned i2 = i + 1; i2 <= n; i2++) { - const BaseString& a2 = getColumn(i2)->getName(); - if (strcmp(a.c_str(), a2.c_str()) == 0) { - ctx.pushStatus(Error::Gen, "duplicate column %s", a.c_str()); - return 0; - } - } - } - // move single-column primary key constraint to constraint list - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_ddl_column* column = getColumn(i); - if (column->m_primaryKey) { - Plan_ddl_row* ddlRow = new Plan_ddl_row(m_root); - m_root->saveNode(ddlRow); - ddlRow->addColumn(column); - Plan_ddl_constr* constr = new Plan_ddl_constr(m_root); - m_root->saveNode(constr); - constr->setRow(ddlRow); - addConstr(constr); - column->m_primaryKey = false; // will be set again - } - } - // check primary key constraints - if (countConstr() < 1) { - ctx.pushStatus(Error::Gen, "table must have a primary key"); - return 0; - } - if (countConstr() > 1) { - ctx.pushStatus(Error::Gen, "table can have only one primary key"); - return 0; - } - Plan_ddl_row* ddlRow = getConstr(1)->getRow(); - for (unsigned i = 1, n = ddlRow->countColumn(); i <= n; i++) { - Plan_ddl_column* column = ddlRow->getColumn(i); - const BaseString& a = column->getName(); - bool found = false; - for (unsigned i2 = 1, n2 = countColumn(); i2 <= n2; i2++) { - Plan_ddl_column* column2 = getColumn(i2); - const BaseString& a2 = column2->getName(); - if (strcmp(a.c_str(), a2.c_str()) != 0) - continue; - if (column2->getPrimaryKey()) { - ctx.pushStatus(Error::Gen, "duplicate primary key constraint on %s", a.c_str()); - return 0; - } - column2->setPrimaryKey(); - found = true; - break; - } - if (! found) { - ctx.pushStatus(Error::Gen, "undefined primary key column %s", a.c_str()); - return 0; - } - } - // analyze column types - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - getColumn(i)->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // check TupleId - unsigned tupleId = 0; - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_ddl_column* column = getColumn(i); - if (! column->getTupleId()) - continue; - if (i != 1) { - ctx.pushStatus(Error::Gen, "tuple id column %u is not first column", i); - return 0; - } - if (tupleId != 0) { // cannot happen now since attr name is fixed - ctx.pushStatus(Error::Gen, "duplicate tuple id column %u", i); - return 0; - } - tupleId = i; - } - if (tupleId != 0) { - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_ddl_column* column = getColumn(i); - if (i == tupleId) - continue; - if (! column->getPrimaryKey()) - continue; - ctx.pushStatus(Error::Gen, "cannot have both tuple id and other primary key column %u", i); - return 0; - } - } - // check auto-increment - unsigned autoIncrement = 0; - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_ddl_column* column = getColumn(i); - if (! column->getAutoIncrement()) - continue; - if (autoIncrement != 0) { - ctx.pushStatus(Error::Gen, "duplicate auto-increment column %u", i); - return 0; - } - autoIncrement = i; - } - if (autoIncrement != 0) { - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_ddl_column* column = getColumn(i); - if (i == autoIncrement) - continue; - if (! column->getPrimaryKey()) - continue; - ctx.pushStatus(Error::Gen, "cannot have both auto-increment column and other primary key column %u", i); - return 0; - } - } - return this; -} - -Exec_base* -Plan_create_row::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_create_row::print(Ctx& ctx) -{ - ctx.print(" [create_row"); - for (unsigned i = 1; i <= countColumn(); i++) { - Plan_base* a = m_columnList[i]; - printList(ctx, &a, 1); - } - for (unsigned i = 1; i <= countConstr(); i++) { - Plan_base* a = m_constrList[i]; - printList(ctx, &a, 1); - } -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp deleted file mode 100644 index f03455ff28e..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp +++ /dev/null @@ -1,99 +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 ODBC_CODEGEN_Code_create_row_hpp -#define ODBC_CODEGEN_Code_create_row_hpp - -#include -#include -#include "Code_base.hpp" -#include "Code_ddl_column.hpp" -#include "Code_ddl_constr.hpp" - -/** - * @class Plan_create_row - * @brief Row of columns and constraints in create statement - */ -class Plan_create_row : public Plan_base { -public: - Plan_create_row(Plan_root* root); - virtual ~Plan_create_row(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - unsigned countColumn() const; - void addColumn(Plan_ddl_column* column); - Plan_ddl_column* getColumn(unsigned i) const; - unsigned countConstr() const; - void addConstr(Plan_ddl_constr* constr); - Plan_ddl_constr* getConstr(unsigned i) const; -protected: - DdlColumnVector m_columnList; - DdlConstrVector m_constrList; -}; - -inline -Plan_create_row::Plan_create_row(Plan_root* root) : - Plan_base(root), - m_columnList(1), - m_constrList(1) -{ -} - -// children - -inline unsigned -Plan_create_row::countColumn() const -{ - return m_columnList.size() - 1; -} - -inline void -Plan_create_row::addColumn(Plan_ddl_column* column) -{ - ctx_assert(column != 0); - m_columnList.push_back(column); -} - -inline Plan_ddl_column* -Plan_create_row::getColumn(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_columnList.size() && m_columnList[i] != 0); - return m_columnList[i]; -} - -inline unsigned -Plan_create_row::countConstr() const -{ - return m_constrList.size() - 1; -} - -inline void -Plan_create_row::addConstr(Plan_ddl_constr* constr) -{ - ctx_assert(constr != 0); - m_constrList.push_back(constr); -} - -inline Plan_ddl_constr* -Plan_create_row::getConstr(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_constrList.size() && m_constrList[i] != 0); - return m_constrList[i]; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp b/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp deleted file mode 100644 index 14e4abbd7fe..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp +++ /dev/null @@ -1,137 +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 */ - -#include -#include "Code_create_table.hpp" -#include "Code_root.hpp" - -// Plan_create_table - -Plan_create_table::~Plan_create_table() -{ -} - -Plan_base* -Plan_create_table::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_create_table); - // analyze the create row - ctx_assert(m_createRow != 0); - m_createRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_create_table::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "CREATE TABLE", SQL_DIAG_CREATE_TABLE); -} - -Exec_base* -Plan_create_table::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_createRow != 0); - Exec_create_table* exec = new Exec_create_table(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - const unsigned count = m_createRow->countColumn(); - Exec_create_table::Code::Attr* attrList = new Exec_create_table::Code::Attr[1 + count]; - unsigned tupleId = 0; - unsigned autoIncrement = 0; - for (unsigned i = 1; i <= count; i++) { - Plan_ddl_column* column = m_createRow->getColumn(i); - Exec_create_table::Code::Attr& attr = attrList[i]; - attr.m_attrName.assign(column->getName()); - attr.m_sqlType = column->sqlType(); - attr.m_tupleKey = column->getPrimaryKey(); - attr.m_tupleId = column->getTupleId(); - attr.m_autoIncrement = column->getAutoIncrement(); - if (attr.m_tupleId) - tupleId = i; - if (attr.m_autoIncrement) - autoIncrement = i; - attr.m_defaultValue = 0; - Plan_expr* expr; - if ((expr = column->getDefaultValue()) != 0) { - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - attr.m_defaultValue = execExpr; - } - } - Exec_create_table::Code& code = *new Exec_create_table::Code(m_name, count, attrList, tupleId, autoIncrement); - exec->setCode(code); - code.m_fragmentType = m_fragmentType; - code.m_logging = m_logging; - return exec; -} - -void -Plan_create_table::print(Ctx& ctx) -{ - ctx.print(" [create_table '%s'", m_name.c_str()); - Plan_base* a[] = { m_createRow }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_create_table - -Exec_create_table::Code::~Code() -{ - delete[] m_attrList; -} - -Exec_create_table::Data::~Data() -{ -} - -Exec_create_table::~Exec_create_table() -{ -} - -void -Exec_create_table::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const Code::Attr& attr = code.m_attrList[i]; - if (attr.m_defaultValue != 0) - attr.m_defaultValue->alloc(ctx, ctl); - } - Data& data = *new Data; - setData(data); -} - -void -Exec_create_table::close(Ctx& ctx) -{ - const Code& code = getCode(); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const Code::Attr& attr = code.m_attrList[i]; - if (attr.m_defaultValue != 0) - attr.m_defaultValue->close(ctx); - } -} - -void -Exec_create_table::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [create_table %s]", code.m_tableName.c_str()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp b/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp deleted file mode 100644 index cbb2189d8ce..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp +++ /dev/null @@ -1,178 +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 ODBC_CODEGEN_Code_create_table_hpp -#define ODBC_CODEGEN_Code_create_table_hpp - -#include -#include -#include "Code_ddl.hpp" -#include "Code_ddl_row.hpp" -#include "Code_create_row.hpp" - -class DictTable; -class DictColumn; - -/** - * @class Plan_create_table - * @brief Create table in PlanTree - */ -class Plan_create_table : public Plan_ddl { -public: - Plan_create_table(Plan_root* root, const BaseString& name); - virtual ~Plan_create_table(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void describe(Ctx & ctx); - void print(Ctx& ctx); - // attributes - const BaseString& getName() const; - // children - void setCreateRow(Plan_create_row* createRow); - void setFragmentType(NdbDictionary::Object::FragmentType fragmentType); - void setLogging(bool logging); -protected: - BaseString m_name; - Plan_create_row* m_createRow; - NdbDictionary::Object::FragmentType m_fragmentType; - bool m_logging; -}; - -inline -Plan_create_table::Plan_create_table(Plan_root* root, const BaseString& name) : - Plan_ddl(root), - m_name(name), - m_createRow(0), - m_fragmentType(NdbDictionary::Object::FragUndefined), - m_logging(true) -{ -} - -inline const BaseString& -Plan_create_table::getName() const -{ - return m_name; -} - -// children - -inline void -Plan_create_table::setCreateRow(Plan_create_row* createRow) -{ - ctx_assert(createRow != 0); - m_createRow = createRow; -} - -inline void -Plan_create_table::setFragmentType(NdbDictionary::Object::FragmentType fragmentType) -{ - m_fragmentType = fragmentType; -} - -inline void -Plan_create_table::setLogging(bool logging) -{ - m_logging = logging; -} - -/** - * @class Exec_create_table - * @brief Create table in ExecTree - */ -class Exec_create_table : public Exec_ddl { -public: - class Code : public Exec_ddl::Code { - public: - struct Attr { - Attr() : m_defaultValue(0) {} - BaseString m_attrName; - SqlType m_sqlType; - bool m_tupleKey; - bool m_tupleId; - bool m_autoIncrement; - Exec_expr* m_defaultValue; - }; - Code(const BaseString& tableName, unsigned attrCount, const Attr* attrList, unsigned tupleId, unsigned autoIncrement); - virtual ~Code(); - protected: - friend class Plan_create_table; - friend class Exec_create_table; - const BaseString m_tableName; - const unsigned m_attrCount; - const Attr* const m_attrList; - unsigned m_tupleId; - unsigned m_autoIncrement; - NdbDictionary::Object::FragmentType m_fragmentType; - bool m_logging; - }; - class Data : public Exec_ddl::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_create_table; - }; - Exec_create_table(Exec_root* root); - virtual ~Exec_create_table(); - void alloc(Ctx& ctx, Ctl& ctl); - void execute(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_create_table::Code::Code(const BaseString& tableName, unsigned attrCount, const Attr* attrList, unsigned tupleId, unsigned autoIncrement) : - m_tableName(tableName), - m_attrCount(attrCount), - m_attrList(attrList), - m_tupleId(tupleId), - m_autoIncrement(autoIncrement), - m_fragmentType(NdbDictionary::Object::FragUndefined), - m_logging(true) -{ -} - -inline -Exec_create_table::Data::Data() -{ -} - -inline -Exec_create_table::Exec_create_table(Exec_root* root) : - Exec_ddl(root) -{ -} - -// children - -inline const Exec_create_table::Code& -Exec_create_table::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_create_table::Data& -Exec_create_table::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp b/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp deleted file mode 100644 index 1ff0fcebcbe..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp +++ /dev/null @@ -1,44 +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 */ - -#include -#include -#include "Code_data_type.hpp" - -// Plan_data_type - -Plan_data_type::~Plan_data_type() -{ -} - -Plan_base* -Plan_data_type::analyze(Ctx& ctx, Ctl& ctl) -{ - return this; -} - -Exec_base* -Plan_data_type::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_data_type::print(Ctx& ctx) -{ - ctx.print(" [data_type]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp b/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp deleted file mode 100644 index 735dc05014f..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp +++ /dev/null @@ -1,49 +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 ODBC_CODEGEN_Code_data_type_hpp -#define ODBC_CODEGEN_Code_data_type_hpp - -#include -#include -#include "Code_base.hpp" - -/** - * @class Plan_data_type - * @brief Data type in DDL statement - * - * This is pure plan node. - */ -class Plan_data_type : public Plan_base { -public: - Plan_data_type(Plan_root* root, const SqlType& sqlType); - virtual ~Plan_data_type(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); -private: - friend class Plan_ddl_column; - SqlType m_sqlType; -}; - -inline -Plan_data_type::Plan_data_type(Plan_root* root, const SqlType& sqlType) : - Plan_base(root), - m_sqlType(sqlType) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp deleted file mode 100644 index 2ba4291a0e8..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp +++ /dev/null @@ -1,37 +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 */ - -#include "Code_ddl.hpp" - -// Plan_ddl - -Plan_ddl::~Plan_ddl() -{ -} - -// Exec_ddl - -Exec_ddl::Code::~Code() -{ -} - -Exec_ddl::Data::~Data() -{ -} - -Exec_ddl::~Exec_ddl() -{ -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp deleted file mode 100644 index 1ceca62d55d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp +++ /dev/null @@ -1,63 +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 ODBC_CODEGEN_Code_ddl_hpp -#define ODBC_CODEGEN_Code_ddl_hpp - -#include -#include "Code_stmt.hpp" - -/** - * @class Plan_ddl - * @brief Base class for DDL statements in PlanTree - */ -class Plan_ddl : public Plan_stmt { -public: - Plan_ddl(Plan_root* root); - virtual ~Plan_ddl() = 0; -}; - -inline -Plan_ddl::Plan_ddl(Plan_root* root) : - Plan_stmt(root) -{ -} - -/** - * @class Exec_ddl - * @brief Base class for DDL statements in ExecTree - */ -class Exec_ddl : public Exec_stmt { -public: - class Code : public Exec_stmt::Code { - public: - virtual ~Code() = 0; - }; - class Data : public Exec_stmt::Data { - public: - virtual ~Data() = 0; - }; - Exec_ddl(Exec_root* root); - virtual ~Exec_ddl() = 0; -}; - -inline -Exec_ddl::Exec_ddl(Exec_root* root) : - Exec_stmt(root) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp deleted file mode 100644 index ee037e54c1f..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp +++ /dev/null @@ -1,104 +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 */ - -#include -#include -#include "Code_ddl_column.hpp" -#include "Code_expr_conv.hpp" -#include "Code_root.hpp" - -// Plan_ddl_column - -Plan_ddl_column::~Plan_ddl_column() -{ -} - -Plan_base* -Plan_ddl_column::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_type != 0); - if (! m_type->m_sqlType.nullable()) { - m_nullable = false; - } - m_sqlType = m_type->m_sqlType; - m_sqlType.nullable(m_nullable); - const BaseString& name = getName(); - if (m_unSigned) { - switch (m_sqlType.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - break; - default: - ctx.pushStatus(Error::Gen, "invalid unsigned qualifier on column %s", name.c_str()); - return 0; - } - m_sqlType.unSigned(true); - } - if (strcmp(name.c_str(), "NDB$TID") == 0) { - if (! m_primaryKey) { - ctx.pushStatus(Error::Gen, "column %s must be a primary key", name.c_str()); - return 0; - } - if (sqlType().type() != SqlType::Bigint || ! sqlType().unSigned()) { - ctx.pushStatus(Error::Gen, "tuple id %s must have type BIGINT UNSIGNED", name.c_str()); - return 0; - } - setTupleId(); - } - if (m_autoIncrement) { - if (! m_primaryKey) { - ctx.pushStatus(Error::Gen, "auto-increment column %s must be a primary key", name.c_str()); - return 0; - } - if (sqlType().type() != SqlType::Smallint && sqlType().type() != SqlType::Integer && sqlType().type() != SqlType::Bigint) { - ctx.pushStatus(Error::Gen, "auto-increment column %s must have an integral type", name.c_str()); - return 0; - } - } - if (m_defaultValue != 0) { - if (m_primaryKey) { - ctx.pushStatus(Sqlstate::_42000, Error::Gen, "default value not allowed on primary key column %s", name.c_str()); - return 0; - } - m_defaultValue->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - // insert conversion node - Plan_expr_conv* exprConv = new Plan_expr_conv(m_root, sqlType()); - m_root->saveNode(exprConv); - exprConv->setExpr(m_defaultValue); - Plan_expr* expr = static_cast(exprConv->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(expr != 0); - m_defaultValue = expr; - } - return this; -} - -Exec_base* -Plan_ddl_column::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_ddl_column::print(Ctx& ctx) -{ - ctx.print(" [ddl_column %s key=%d id=%d]", getPrintName(), m_primaryKey, m_tupleId); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp deleted file mode 100644 index 7d089d37440..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp +++ /dev/null @@ -1,150 +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 ODBC_CODEGEN_Code_ddl_column_hpp -#define ODBC_CODEGEN_Code_ddl_column_hpp - -#include -#include "Code_column.hpp" -#include "Code_data_type.hpp" -#include "Code_expr.hpp" - -class DictColumn; -class Plan_table; - -/** - * @class Plan_ddl_column - * @brief Column in DDL statement - */ -class Plan_ddl_column : public Plan_base, public Plan_column { -public: - Plan_ddl_column(Plan_root* root, const BaseString& name); - virtual ~Plan_ddl_column(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // attributes - void setNotNull(); - void setUnSigned(); - void setPrimaryKey(); - bool getPrimaryKey() const; - void setTupleId(); - bool getTupleId() const; - void setAutoIncrement(); - bool getAutoIncrement() const; - // children - void setType(Plan_data_type* type); - void setDefaultValue(Plan_expr* defaultValue); - Plan_expr* getDefaultValue() const; -protected: - friend class Plan_create_row; - Plan_data_type* m_type; - Plan_expr* m_defaultValue; - bool m_nullable; - bool m_unSigned; - bool m_primaryKey; - bool m_tupleId; - bool m_autoIncrement; -}; - -inline -Plan_ddl_column::Plan_ddl_column(Plan_root* root, const BaseString& name) : - Plan_base(root), - Plan_column(Type_ddl, name), - m_type(0), - m_defaultValue(0), - m_nullable(true), - m_unSigned(false), - m_primaryKey(false), - m_tupleId(false), - m_autoIncrement(false) -{ -} - -inline void -Plan_ddl_column::setNotNull() -{ - m_nullable = false; -} - -inline void -Plan_ddl_column::setUnSigned() -{ - m_unSigned = true; -} - -inline void -Plan_ddl_column::setPrimaryKey() -{ - m_nullable = false; - m_primaryKey = true; -} - -inline bool -Plan_ddl_column::getPrimaryKey() const -{ - return m_primaryKey; -} - -inline void -Plan_ddl_column::setTupleId() -{ - m_nullable = false; - m_tupleId = true; -} - -inline bool -Plan_ddl_column::getTupleId() const -{ - return m_tupleId; -} - -inline void -Plan_ddl_column::setAutoIncrement() -{ - m_nullable = false; - m_autoIncrement = true; -} - -inline bool -Plan_ddl_column::getAutoIncrement() const -{ - return m_autoIncrement; -} - -// children - -inline void -Plan_ddl_column::setType(Plan_data_type* type) -{ - ctx_assert(type != 0); - m_type = type; -} - -inline void -Plan_ddl_column::setDefaultValue(Plan_expr* defaultValue) -{ - ctx_assert(defaultValue != 0); - m_defaultValue = defaultValue; -} - -inline Plan_expr* -Plan_ddl_column::getDefaultValue() const -{ - return m_defaultValue; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp deleted file mode 100644 index 78c23e38d97..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp +++ /dev/null @@ -1,51 +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 */ - -#include -#include -#include "Code_ddl_constr.hpp" - -// Plan_ddl_constr - -Plan_ddl_constr::~Plan_ddl_constr() -{ -} - -Plan_base* -Plan_ddl_constr::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_ddlRow != 0); - m_ddlRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_ddl_constr::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_ddl_constr::print(Ctx& ctx) -{ - ctx.print(" [ddl_constr"); - Plan_base* a[] = { m_ddlRow }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp deleted file mode 100644 index ea7808b37cb..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp +++ /dev/null @@ -1,65 +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 ODBC_CODEGEN_Code_ddl_constr_hpp -#define ODBC_CODEGEN_Code_ddl_constr_hpp - -#include -#include "Code_ddl_row.hpp" - -/** - * @class Plan_ddl_constr - * @brief Constraint in DDL statement - * - * Only unnamed primary key constraint exists. - */ -class Plan_ddl_constr : public Plan_base { -public: - Plan_ddl_constr(Plan_root* root); - virtual ~Plan_ddl_constr(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setRow(Plan_ddl_row* ddlRow); - Plan_ddl_row* getRow() const; -protected: - Plan_ddl_row* m_ddlRow; -}; - -inline -Plan_ddl_constr::Plan_ddl_constr(Plan_root* root) : - Plan_base(root) -{ -} - -// children - -inline void -Plan_ddl_constr::setRow(Plan_ddl_row* ddlRow) -{ - ctx_assert(ddlRow != 0); - m_ddlRow = ddlRow; -} - -inline Plan_ddl_row* -Plan_ddl_constr::getRow() const -{ - ctx_assert(m_ddlRow != 0); - return m_ddlRow; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp deleted file mode 100644 index 87589ebbaa0..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp +++ /dev/null @@ -1,54 +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 */ - -#include "Code_ddl_row.hpp" -#include "Code_ddl_column.hpp" -#include "Code_ddl_constr.hpp" - -Plan_ddl_row::~Plan_ddl_row() -{ -} - -Plan_base* -Plan_ddl_row::analyze(Ctx& ctx, Ctl& ctl) -{ - // analyze the columns - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_ddl_column* column = getColumn(i); - column->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // node was not replaced - return this; -} - -Exec_base* -Plan_ddl_row::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_ddl_row::print(Ctx& ctx) -{ - ctx.print(" [ddl_row"); - for (unsigned i = 1, n = countColumn(); i <= n; i++) { - Plan_base* a = m_columnList[i]; - printList(ctx, &a, 1); - } -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp deleted file mode 100644 index ac3eded1b2e..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp +++ /dev/null @@ -1,72 +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 ODBC_CODEGEN_Code_ddl_row_hpp -#define ODBC_CODEGEN_Code_ddl_row_hpp - -#include -#include "Code_base.hpp" -#include "Code_ddl_column.hpp" - -/** - * @class Plan_ddl_row - * @brief Row of columns in create statement - */ -class Plan_ddl_row : public Plan_base { -public: - Plan_ddl_row(Plan_root* root); - virtual ~Plan_ddl_row(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - unsigned countColumn() const; - void addColumn(Plan_ddl_column* column); - Plan_ddl_column* getColumn(unsigned i) const; -protected: - DdlColumnVector m_columnList; -}; - -inline -Plan_ddl_row::Plan_ddl_row(Plan_root* root) : - Plan_base(root), - m_columnList(1) -{ -} - -// children - -inline unsigned -Plan_ddl_row::countColumn() const -{ - return m_columnList.size() - 1; -} - -inline void -Plan_ddl_row::addColumn(Plan_ddl_column* column) -{ - ctx_assert(column != 0); - m_columnList.push_back(column); -} - -inline Plan_ddl_column* -Plan_ddl_row::getColumn(unsigned i) const -{ - ctx_assert(1 <= i && i <= countColumn() && m_columnList[i] != 0); - return m_columnList[i]; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp deleted file mode 100644 index 35b3daa1aca..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp +++ /dev/null @@ -1,205 +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 */ - -#include -#include "Code_delete.hpp" -#include "Code_delete_lookup.hpp" -#include "Code_delete_index.hpp" -#include "Code_delete_scan.hpp" -#include "Code_query_filter.hpp" -#include "Code_query_lookup.hpp" -#include "Code_query_index.hpp" -#include "Code_query_scan.hpp" -#include "Code_query_range.hpp" -#include "Code_query_repeat.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -Plan_delete::~Plan_delete() -{ -} - -Plan_base* -Plan_delete::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_delete); - // analyze the table - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - // set name resolution scope - ctl.m_tableList.resize(1 + 1); // indexed from 1 - ctl.m_tableList[1] = m_table; - Plan_dml* stmt = 0; - if (m_pred != 0) { - // analyze the predicate - ctl.m_topand = true; - ctl.m_extra = false; - m_pred = static_cast(m_pred->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_pred != 0); - // check for key match - Plan_table::Index* indexBest = 0; - for (unsigned i = 0; i <= m_table->indexCount(); i++) { - Plan_table::Index& index = m_table->m_indexList[i]; - TableSet tsDone; - m_table->resolveSet(ctx, index, tsDone); - if (! ctx.ok()) - return 0; - if (! index.m_keyFound) - continue; - // prefer smaller rank, less unused keys - int k; - (k = (indexBest == 0)) || - (k = (indexBest->m_rank - index.m_rank)) || - (k = (indexBest->m_keyCountUnused - index.m_keyCountUnused)); - if (k > 0) - indexBest = &index; - } - if (indexBest != 0) { - const bool exactKey = indexBest->m_rank <= 1 ? m_table->exactKey(ctx, indexBest) : false; - const bool direct = ! ctl.m_extra && exactKey; - ctx_log3(("delete direct=%d: extra=%d exact=%d", direct, ctl.m_extra, exactKey)); - if (indexBest->m_rank == 0) { - // primary key - Plan_delete_lookup* deleteLookup = new Plan_delete_lookup(m_root); - m_root->saveNode(deleteLookup); - deleteLookup->setTable(m_table); - if (direct) { - // key match with no extra conditions - Plan_query_repeat* queryRepeat = new Plan_query_repeat(m_root, 1); - m_root->saveNode(queryRepeat); - deleteLookup->setQuery(queryRepeat); - } else { - // key match with extra conditions - Plan_query_lookup* queryLookup = new Plan_query_lookup(m_root); - m_root->saveNode(queryLookup); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - queryLookup->setTable(m_table); - queryFilter->setQuery(queryLookup); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - deleteLookup->setQuery(queryFilter); - } - stmt = deleteLookup; - } else if (indexBest->m_rank == 1) { - // hash index - Plan_delete_index* deleteIndex = new Plan_delete_index(m_root); - m_root->saveNode(deleteIndex); - deleteIndex->setTable(m_table, indexBest); - if (direct) { - // key match with no extra conditions - Plan_query_repeat* queryRepeat = new Plan_query_repeat(m_root, 1); - m_root->saveNode(queryRepeat); - deleteIndex->setQuery(queryRepeat); - } else { - // key match with extra conditions - Plan_query_index* queryIndex = new Plan_query_index(m_root); - m_root->saveNode(queryIndex); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - queryIndex->setTable(m_table, indexBest); - queryFilter->setQuery(queryIndex); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - deleteIndex->setQuery(queryFilter); - } - stmt = deleteIndex; - } else if (indexBest->m_rank == 2) { - // ordered index - Plan_delete_scan* deleteScan = new Plan_delete_scan(m_root); - m_root->saveNode(deleteScan); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - Plan_query_range* queryRange = new Plan_query_range(m_root); - m_root->saveNode(queryRange); - queryRange->setTable(m_table, indexBest); - queryRange->setExclusive(); - queryFilter->setQuery(queryRange); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - const TableSet& ts2 = m_pred->noInterp(); - ctx_assert(ts2.size() <= 1); - if (ts2.size() == 0) { - queryRange->setInterp(m_pred); - } - deleteScan->setQuery(queryFilter); - stmt = deleteScan; - } else { - ctx_assert(false); - } - } else { - // scan delete with filter - Plan_delete_scan* deleteScan = new Plan_delete_scan(m_root); - m_root->saveNode(deleteScan); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - Plan_query_scan* queryScan = new Plan_query_scan(m_root); - m_root->saveNode(queryScan); - queryScan->setTable(m_table); - queryScan->setExclusive(); - queryFilter->setQuery(queryScan); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - // interpeter - const TableSet& ts2 = m_pred->noInterp(); - ctx_assert(ts2.size() <= 1); - if (ts2.size() == 0) { - queryScan->setInterp(m_pred); - } - deleteScan->setQuery(queryFilter); - stmt = deleteScan; - } - } else { - // scan delete without filter - Plan_delete_scan* deleteScan = new Plan_delete_scan(m_root); - m_root->saveNode(deleteScan); - Plan_query_scan* queryScan = new Plan_query_scan(m_root); - m_root->saveNode(queryScan); - queryScan->setTable(m_table); - queryScan->setExclusive(); - deleteScan->setQuery(queryScan); - stmt = deleteScan; - } - // set base for column position offsets - m_table->m_resOff = 1; - return stmt; -} - -void -Plan_delete::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "DELETE WHERE", SQL_DIAG_DELETE_WHERE); -} - -Exec_base* -Plan_delete::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_delete::print(Ctx& ctx) -{ - ctx.print(" [delete"); - Plan_base* a[] = { m_table, m_pred }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp deleted file mode 100644 index c7fa245497b..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp +++ /dev/null @@ -1,69 +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 ODBC_CODEGEN_Code_delete_hpp -#define ODBC_CODEGEN_Code_delete_hpp - -#include -#include "Code_base.hpp" -#include "Code_dml.hpp" -#include "Code_table.hpp" -#include "Code_query.hpp" -#include "Code_pred.hpp" - -/** - * @class Plan_delete - * @brief Delete in PlanTree - */ -class Plan_delete : public Plan_dml { -public: - Plan_delete(Plan_root* root); - virtual ~Plan_delete(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); - void setPred(Plan_pred* pred); -protected: - Plan_table* m_table; - Plan_pred* m_pred; -}; - -inline -Plan_delete::Plan_delete(Plan_root* root) : - Plan_dml(root), - m_table(0), - m_pred(0) -{ -} - -inline void -Plan_delete::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline void -Plan_delete::setPred(Plan_pred* pred) -{ - ctx_assert(pred != 0); - m_pred = pred; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp deleted file mode 100644 index 8f2c3be2848..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp +++ /dev/null @@ -1,164 +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 */ - -#include -#include -#include "Code_expr.hpp" -#include "Code_delete_index.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -Plan_delete_index::~Plan_delete_index() -{ -} - -Plan_base* -Plan_delete_index::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_delete_index::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "DELETE WHERE", SQL_DIAG_DELETE_WHERE); -} - -Exec_base* -Plan_delete_index::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the query - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // set up - ctx_assert(m_table != 0 && m_index != 0); - const BaseString& tableName = m_table->getName(); - ctx_assert(m_index->m_dictIndex != 0); - const DictIndex& dictIndex = *m_index->m_dictIndex; - const BaseString& indexName = dictIndex.getName(); - const unsigned keyCount = m_index->m_keyCount; - // create the code - Exec_delete_index::Code& code = *new Exec_delete_index::Code(keyCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - code.m_indexName = strcpy(new char[indexName.length() + 1], indexName.c_str()); - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictIndex.getColumn(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = k - 1; // index column order - } - // matching expressions - ctx_assert(m_index->m_keyFound); - const ExprVector& keyEq = m_index->m_keyEq; - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // create the exec - Exec_delete_index* exec = new Exec_delete_index(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_delete_index::print(Ctx& ctx) -{ - ctx.print(" [delete_index"); - Plan_base* a[] = { m_query, m_table }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_delete_index - -Exec_delete_index::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; -} - -Exec_delete_index::Data::~Data() -{ -} - -Exec_delete_index::~Exec_delete_index() -{ -} - -void -Exec_delete_index::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - // create data - Data& data = *new Data; - setData(data); -} - -void -Exec_delete_index::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); -} - -void -Exec_delete_index::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [delete_index"); - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - printList(ctx, (Exec_base**)&code.m_keyMatch[1], code.m_keyCount); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp deleted file mode 100644 index 1aaaa18abcb..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp +++ /dev/null @@ -1,156 +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 ODBC_CODEGEN_Code_delete_index_hpp -#define ODBC_CODEGEN_Code_delete_index_hpp - -#include -#include "Code_dml.hpp" -#include "Code_query.hpp" -#include "Code_table.hpp" - -/** - * @class Plan_delete_index - * @brief Delete by primary key - */ -class Plan_delete_index : public Plan_dml { -public: - Plan_delete_index(Plan_root* root); - virtual ~Plan_delete_index(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setTable(Plan_table* table, Plan_table::Index* index); -protected: - Plan_query* m_query; - Plan_table* m_table; - Plan_table::Index* m_index; -}; - -inline -Plan_delete_index::Plan_delete_index(Plan_root* root) : - Plan_dml(root), - m_query(0), - m_table(0) -{ -} - -inline void -Plan_delete_index::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_delete_index::setTable(Plan_table* table, Plan_table::Index* index) -{ - ctx_assert(table != 0 && index != 0 && index == &table->m_indexList[index->m_pos] && index->m_pos != 0); - m_table = table; - m_index = index; -} - -/** - * @class Exec_delete_index - * @brief Delete by primary key - */ -class Exec_delete_index : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(unsigned keyCount); - virtual ~Code(); - protected: - friend class Plan_delete_index; - friend class Exec_delete_index; - const char* m_tableName; - const char* m_indexName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_delete_index; - }; - Exec_delete_index(Exec_root* root); - virtual ~Exec_delete_index(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -protected: - Exec_query* m_query; -}; - -inline -Exec_delete_index::Code::Code(unsigned keyCount) : - m_tableName(0), - m_indexName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_keyMatch(0) -{ -} - -inline -Exec_delete_index::Data::Data() -{ -} - -inline -Exec_delete_index::Exec_delete_index(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_delete_index::Code& -Exec_delete_index::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_delete_index::Data& -Exec_delete_index::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_delete_index::setQuery(Exec_query* query) -{ - ctx_assert(query != 0 && m_query == 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp deleted file mode 100644 index 4a6dec64654..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp +++ /dev/null @@ -1,162 +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 */ - -#include -#include -#include "Code_expr.hpp" -#include "Code_delete_lookup.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -Plan_delete_lookup::~Plan_delete_lookup() -{ -} - -Plan_base* -Plan_delete_lookup::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_delete_lookup::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "DELETE WHERE", SQL_DIAG_DELETE_WHERE); -} - -Exec_base* -Plan_delete_lookup::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the query - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // set up - ctx_assert(m_table != 0); - const BaseString& tableName = m_table->getName(); - const DictTable& dictTable = m_table->dictTable(); - const unsigned keyCount = dictTable.keyCount(); - // create the code - Exec_delete_lookup::Code& code = *new Exec_delete_lookup::Code(keyCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictTable.getKey(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = keyColumn->getAttrId(); - } - // matching expressions - const Plan_table::Index& index = m_table->m_indexList[0]; - ctx_assert(index.m_keyFound); - const ExprVector& keyEq = index.m_keyEq; - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // create the exec - Exec_delete_lookup* exec = new Exec_delete_lookup(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_delete_lookup::print(Ctx& ctx) -{ - ctx.print(" [delete_lookup"); - Plan_base* a[] = { m_query, m_table }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_delete_lookup - -Exec_delete_lookup::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; -} - -Exec_delete_lookup::Data::~Data() -{ -} - -Exec_delete_lookup::~Exec_delete_lookup() -{ -} - -void -Exec_delete_lookup::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - // create data - Data& data = *new Data; - setData(data); -} - -void -Exec_delete_lookup::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); -} - -void -Exec_delete_lookup::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [delete_lookup"); - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - printList(ctx, (Exec_base**)&code.m_keyMatch[1], code.m_keyCount); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp deleted file mode 100644 index 4138baefa4c..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp +++ /dev/null @@ -1,152 +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 ODBC_CODEGEN_Code_delete_lookup_hpp -#define ODBC_CODEGEN_Code_delete_lookup_hpp - -#include -#include "Code_dml.hpp" -#include "Code_query.hpp" -#include "Code_table.hpp" - -/** - * @class Plan_delete_lookup - * @brief Delete by primary key - */ -class Plan_delete_lookup : public Plan_dml { -public: - Plan_delete_lookup(Plan_root* root); - virtual ~Plan_delete_lookup(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setTable(Plan_table* table); -protected: - Plan_query* m_query; - Plan_table* m_table; -}; - -inline -Plan_delete_lookup::Plan_delete_lookup(Plan_root* root) : - Plan_dml(root), - m_query(0), - m_table(0) -{ -} - -inline void -Plan_delete_lookup::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_delete_lookup::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -/** - * @class Exec_delete_lookup - * @brief Delete by primary key - */ -class Exec_delete_lookup : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(unsigned keyCount); - virtual ~Code(); - protected: - friend class Plan_delete_lookup; - friend class Exec_delete_lookup; - char* m_tableName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_delete_lookup; - }; - Exec_delete_lookup(Exec_root* root); - virtual ~Exec_delete_lookup(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -protected: - Exec_query* m_query; -}; - -inline -Exec_delete_lookup::Code::Code(unsigned keyCount) : - m_tableName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_keyMatch(0) -{ -} - -inline -Exec_delete_lookup::Data::Data() -{ -} - -inline -Exec_delete_lookup::Exec_delete_lookup(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_delete_lookup::Code& -Exec_delete_lookup::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_delete_lookup::Data& -Exec_delete_lookup::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_delete_lookup::setQuery(Exec_query* query) -{ - ctx_assert(query != 0 && m_query == 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp deleted file mode 100644 index fed7244a026..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp +++ /dev/null @@ -1,110 +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 */ - -#include -#include "Code_delete_scan.hpp" -#include "Code_root.hpp" - -Plan_delete_scan::~Plan_delete_scan() -{ -} - -Plan_base* -Plan_delete_scan::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_delete_scan::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "DELETE WHERE", SQL_DIAG_DELETE_WHERE); -} - -Exec_base* -Plan_delete_scan::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // create the code - Exec_delete_scan* exec = new Exec_delete_scan(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - Exec_delete_scan::Code& code = *new Exec_delete_scan::Code; - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_delete_scan::print(Ctx& ctx) -{ - ctx.print(" [delete_scan"); - Plan_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_delete_scan - -Exec_delete_scan::Code::~Code() -{ -} - -Exec_delete_scan::Data::~Data() -{ -} - -Exec_delete_scan::~Exec_delete_scan() -{ -} - -void -Exec_delete_scan::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // create data - Data& data = *new Data; - setData(data); -} - -void -Exec_delete_scan::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); -} - -void -Exec_delete_scan::print(Ctx& ctx) -{ - ctx.print(" [delete_scan"); - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} - diff --git a/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp deleted file mode 100644 index eb013a8257e..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp +++ /dev/null @@ -1,130 +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 ODBC_CODEGEN_Code_delete_scan_hpp -#define ODBC_CODEGEN_Code_delete_scan_hpp - -#include -#include "Code_dml.hpp" -#include "Code_query.hpp" - -/** - * @class Plan_delete_scan - * @brief Scan delete - */ -class Plan_delete_scan : public Plan_dml { -public: - Plan_delete_scan(Plan_root* root); - virtual ~Plan_delete_scan(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); -protected: - Plan_query* m_query; -}; - -inline -Plan_delete_scan::Plan_delete_scan(Plan_root* root) : - Plan_dml(root), - m_query(0) -{ -} - -inline void -Plan_delete_scan::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -/** - * @class Exec_delete_scan - * @brief Scan delete - */ -class Exec_delete_scan : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(); - virtual ~Code(); - protected: - friend class Exec_delete_scan; - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_delete_scan; - }; - Exec_delete_scan(Exec_root* root); - virtual ~Exec_delete_scan(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -protected: - Exec_query* m_query; -}; - -inline -Exec_delete_scan::Code::Code() -{ -} - -inline -Exec_delete_scan::Data::Data() -{ -} - -inline -Exec_delete_scan::Exec_delete_scan(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_delete_scan::Code& -Exec_delete_scan::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_delete_scan::Data& -Exec_delete_scan::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_delete_scan::setQuery(Exec_query* query) -{ - ctx_assert(query != 0 && m_query == 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp b/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp deleted file mode 100644 index 44fd4478646..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp +++ /dev/null @@ -1,51 +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 */ - -#include -#include "Code_dml.hpp" - -// Plan_dml - -Plan_dml::~Plan_dml() -{ -} - -// Exec_dml - -Exec_dml::Code::~Code() -{ -} - -Exec_dml::Data::~Data() -{ -} - -Exec_dml::~Exec_dml() -{ -} - -void -Exec_dml::execute(Ctx& ctx, Ctl& ctl) -{ - execImpl(ctx, ctl); - if (m_topLevel) { - if (ctx.ok()) { - if (stmtArea().getRowCount() == 0) { - ctx.setCode(SQL_NO_DATA); - } - } - } -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp b/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp deleted file mode 100644 index 0618f583984..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp +++ /dev/null @@ -1,67 +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 ODBC_CODEGEN_Code_dml_hpp -#define ODBC_CODEGEN_Code_dml_hpp - -#include -#include -#include "Code_stmt.hpp" - -/** - * @class Plan_dml - * @brief Base class for DML statements in PlanTree - */ -class Plan_dml : public Plan_stmt { -public: - Plan_dml(Plan_root* root); - virtual ~Plan_dml() = 0; -}; - -inline -Plan_dml::Plan_dml(Plan_root* root) : - Plan_stmt(root) -{ -} - -/** - * @class Exec_dml - * @brief Base class for DML statements in ExecTree - */ -class Exec_dml : public Exec_stmt { -public: - class Code : public Exec_stmt::Code { - public: - virtual ~Code() = 0; - }; - class Data : public Exec_stmt::Data, public ResultArea { - public: - virtual ~Data() = 0; - }; - Exec_dml(Exec_root* root); - virtual ~Exec_dml() = 0; - void execute(Ctx& ctx, Ctl& ctl); -protected: - virtual void execImpl(Ctx& ctx, Ctl& ctl) = 0; -}; - -inline -Exec_dml::Exec_dml(Exec_root* root) : - Exec_stmt(root) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp deleted file mode 100644 index 808e2ac8c4b..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp +++ /dev/null @@ -1,47 +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 */ - -#include -#include -#include "Code_dml_column.hpp" - -// Plan_dml_column - -Plan_dml_column::~Plan_dml_column() -{ -} - -Plan_base* -Plan_dml_column::analyze(Ctx& ctx, Ctl& ctl) -{ - analyzeColumn(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_dml_column::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_dml_column::print(Ctx& ctx) -{ - ctx.print(" [dml_column %s]", getPrintName()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp deleted file mode 100644 index 0fb33944a3a..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp +++ /dev/null @@ -1,46 +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 ODBC_CODEGEN_Code_dml_column_hpp -#define ODBC_CODEGEN_Code_dml_column_hpp - -#include -#include "Code_column.hpp" - -class DictColumn; -class Plan_table; - -/** - * @class Plan_dml_column - * @brief Column in query expression - */ -class Plan_dml_column : public Plan_base, public Plan_column { -public: - Plan_dml_column(Plan_root* root, const BaseString& name); - virtual ~Plan_dml_column(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); -}; - -inline -Plan_dml_column::Plan_dml_column(Plan_root* root, const BaseString& name) : - Plan_base(root), - Plan_column(Type_dml, name) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp deleted file mode 100644 index ceb63a9f7b9..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp +++ /dev/null @@ -1,56 +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 */ - -#include "Code_dml_row.hpp" -#include "Code_dml_column.hpp" - -Plan_dml_row::~Plan_dml_row() -{ -} - -Plan_base* -Plan_dml_row::analyze(Ctx& ctx, Ctl& ctl) -{ - unsigned size = getSize(); - // analyze the columns - for (unsigned i = 1; i <= size; i++) { - Plan_dml_column* column = getColumn(i); - column->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // node was not replaced - return this; -} - -Exec_base* -Plan_dml_row::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_dml_row::print(Ctx& ctx) -{ - unsigned size = getSize(); - ctx.print(" [dml_row"); - for (unsigned i = 1; i <= size; i++) { - Plan_base* a = m_columnList[i]; - a == 0 ? ctx.print(" -") : a->print(ctx); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp deleted file mode 100644 index 6c7e46ba9af..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp +++ /dev/null @@ -1,76 +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 ODBC_CODEGEN_Code_dml_row_hpp -#define ODBC_CODEGEN_Code_dml_row_hpp - -#include -#include -#include -#include "Code_base.hpp" -#include "Code_dml_column.hpp" - -class Plan_dml_column; - -/** - * @class Plan_dml_row - * @brief Row of lvalue columns in insert or update - */ -class Plan_dml_row : public Plan_base { -public: - Plan_dml_row(Plan_root* root); - virtual ~Plan_dml_row(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - unsigned getSize() const; - void addColumn(Plan_dml_column* column); - Plan_dml_column* getColumn(unsigned i) const; -protected: - DmlColumnVector m_columnList; -}; - -inline -Plan_dml_row::Plan_dml_row(Plan_root* root) : - Plan_base(root), - m_columnList(1) -{ -} - -// children - -inline unsigned -Plan_dml_row::getSize() const -{ - return m_columnList.size() - 1; -} - -inline void -Plan_dml_row::addColumn(Plan_dml_column* column) -{ - ctx_assert(column != 0); - m_columnList.push_back(column); -} - -inline Plan_dml_column* -Plan_dml_row::getColumn(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_columnList.size() && m_columnList[i] != 0); - return m_columnList[i]; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp deleted file mode 100644 index b6bae88e270..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp +++ /dev/null @@ -1,87 +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 */ - -#include -#include "Code_drop_index.hpp" -#include "Code_root.hpp" - -// Plan_drop_index - -Plan_drop_index::~Plan_drop_index() -{ -} - -Plan_base* -Plan_drop_index::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_drop_index); - return this; -} - -void -Plan_drop_index::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "DROP INDEX", SQL_DIAG_DROP_INDEX); -} - -Exec_base* -Plan_drop_index::codegen(Ctx& ctx, Ctl& ctl) -{ - Exec_drop_index* exec = new Exec_drop_index(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - Exec_drop_index::Code& code = *new Exec_drop_index::Code(m_name, m_tableName); - exec->setCode(code); - return exec; -} - -void -Plan_drop_index::print(Ctx& ctx) -{ - ctx.print(" [drop_index %s]", m_name.c_str()); -} - -// Exec_drop_index - -Exec_drop_index::Code::~Code() -{ -} - -Exec_drop_index::Data::~Data() -{ -} - -Exec_drop_index::~Exec_drop_index() -{ -} - -void -Exec_drop_index::alloc(Ctx& ctx, Ctl& ctl) -{ - Data& data = *new Data; - setData(data); -} - -void -Exec_drop_index::close(Ctx& ctx) -{ -} - -void -Exec_drop_index::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [drop_index %s]", code.m_indexName.c_str()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp deleted file mode 100644 index 99891c9a52f..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp +++ /dev/null @@ -1,136 +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 ODBC_CODEGEN_Code_drop_index_hpp -#define ODBC_CODEGEN_Code_drop_index_hpp - -#include -#include -#include -#include "Code_ddl.hpp" - -class DictTable; -class DictColumn; - -/** - * @class Plan_drop_index - * @brief Drop index in PlanTree - */ -class Plan_drop_index : public Plan_ddl { -public: - Plan_drop_index(Plan_root* root, const BaseString& name); - Plan_drop_index(Plan_root* root, const BaseString& name, const BaseString& tableName); - virtual ~Plan_drop_index(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void describe(Ctx & ctx); - void print(Ctx& ctx); - // attributes - const BaseString& getName() const; -protected: - BaseString m_name; - BaseString m_tableName; -}; - -inline -Plan_drop_index::Plan_drop_index(Plan_root* root, const BaseString& name) : - Plan_ddl(root), - m_name(name) -{ -} - -inline -Plan_drop_index::Plan_drop_index(Plan_root* root, const BaseString& name, const BaseString& tableName) : - Plan_ddl(root), - m_name(name), - m_tableName(tableName) -{ -} - -inline const BaseString& -Plan_drop_index::getName() const -{ - return m_name; -} - -/** - * @class Exec_drop_index - * @brief Drop index in ExecTree - */ -class Exec_drop_index : public Exec_ddl { -public: - class Code : public Exec_ddl::Code { - public: - Code(const BaseString& indexName, const BaseString& tableName); - virtual ~Code(); - protected: - friend class Exec_drop_index; - const BaseString m_indexName; - const BaseString m_tableName; - }; - class Data : public Exec_ddl::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_drop_index; - }; - Exec_drop_index(Exec_root* root); - virtual ~Exec_drop_index(); - void alloc(Ctx& ctx, Ctl& ctl); - void execute(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_drop_index::Code::Code(const BaseString& indexName, const BaseString& tableName) : - m_indexName(indexName), - m_tableName(tableName) -{ -} - -inline -Exec_drop_index::Data::Data() -{ -} - -inline -Exec_drop_index::Exec_drop_index(Exec_root* root) : - Exec_ddl(root) -{ -} - -// children - -inline const Exec_drop_index::Code& -Exec_drop_index::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_drop_index::Data& -Exec_drop_index::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp deleted file mode 100644 index f20bf9fdae0..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp +++ /dev/null @@ -1,87 +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 */ - -#include -#include "Code_drop_table.hpp" -#include "Code_root.hpp" - -// Plan_drop_table - -Plan_drop_table::~Plan_drop_table() -{ -} - -Plan_base* -Plan_drop_table::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_drop_table); - return this; -} - -void -Plan_drop_table::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "DROP TABLE", SQL_DIAG_DROP_TABLE); -} - -Exec_base* -Plan_drop_table::codegen(Ctx& ctx, Ctl& ctl) -{ - Exec_drop_table* exec = new Exec_drop_table(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - Exec_drop_table::Code& code = *new Exec_drop_table::Code(m_name); - exec->setCode(code); - return exec; -} - -void -Plan_drop_table::print(Ctx& ctx) -{ - ctx.print(" [drop_table %s]", m_name.c_str()); -} - -// Exec_drop_table - -Exec_drop_table::Code::~Code() -{ -} - -Exec_drop_table::Data::~Data() -{ -} - -Exec_drop_table::~Exec_drop_table() -{ -} - -void -Exec_drop_table::alloc(Ctx& ctx, Ctl& ctl) -{ - Data& data = *new Data; - setData(data); -} - -void -Exec_drop_table::close(Ctx& ctx) -{ -} - -void -Exec_drop_table::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [drop_table %s]", code.m_tableName.c_str()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp deleted file mode 100644 index 849a472ed94..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp +++ /dev/null @@ -1,124 +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 ODBC_CODEGEN_Code_drop_table_hpp -#define ODBC_CODEGEN_Code_drop_table_hpp - -#include -#include -#include -#include "Code_ddl.hpp" - -class DictTable; -class DictColumn; - -/** - * @class Plan_drop_table - * @brief Drop table in PlanTree - */ -class Plan_drop_table : public Plan_ddl { -public: - Plan_drop_table(Plan_root* root, const BaseString& name); - virtual ~Plan_drop_table(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void describe(Ctx & ctx); - void print(Ctx& ctx); - // attributes - const BaseString& getName() const; -protected: - BaseString m_name; -}; - -inline -Plan_drop_table::Plan_drop_table(Plan_root* root, const BaseString& name) : - Plan_ddl(root), - m_name(name) -{ -} - -inline const BaseString& -Plan_drop_table::getName() const -{ - return m_name; -} - -/** - * @class Exec_drop_table - * @brief Drop table in ExecTree - */ -class Exec_drop_table : public Exec_ddl { -public: - class Code : public Exec_ddl::Code { - public: - Code(const BaseString& tableName); - virtual ~Code(); - protected: - friend class Exec_drop_table; - const BaseString m_tableName; - }; - class Data : public Exec_ddl::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_drop_table; - }; - Exec_drop_table(Exec_root* root); - virtual ~Exec_drop_table(); - void alloc(Ctx& ctx, Ctl& ctl); - void execute(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_drop_table::Code::Code(const BaseString& tableName) : - m_tableName(tableName) -{ -} - -inline -Exec_drop_table::Data::Data() -{ -} - -inline -Exec_drop_table::Exec_drop_table(Exec_root* root) : - Exec_ddl(root) -{ -} - -// children - -inline const Exec_drop_table::Code& -Exec_drop_table::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_drop_table::Data& -Exec_drop_table::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp deleted file mode 100644 index 4afa75986a0..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp +++ /dev/null @@ -1,79 +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 */ - -#include "Code_expr.hpp" -#include "Code_expr_row.hpp" - -// Plan_expr - -Plan_expr::~Plan_expr() -{ -} - -bool -Plan_expr::isEqual(const Plan_expr* expr) const -{ - return false; -} - -bool -Plan_expr::isAnyEqual(const Plan_expr_row* row) const -{ - ctx_assert(row != 0); - const unsigned size = row->getSize(); - for (unsigned i = 1; i <= size; i++) { - if (isEqual(row->getExpr(i))) - return true; - } - return false; -} - -bool -Plan_expr::isGroupBy(const Plan_expr_row* row) const -{ - return false; -} - -// Exec_expr - -Exec_expr::Code::~Code() -{ -} - -Exec_expr::Data::~Data() -{ -} - -Exec_expr::~Exec_expr() -{ -} - -SqlField& -Exec_expr::Data::groupField(const SqlType& sqlType, unsigned i, bool initFlag) -{ - if (m_groupField.size() == 0) { - m_groupField.resize(1); - } - if (initFlag) { - //unsigned i2 = m_groupField.size(); - //ctx_assert(i == i2); - const SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - const SqlField sqlField(sqlSpec); - m_groupField.push_back(sqlField); - } - ctx_assert(i != 0 && i < m_groupField.size()); - return m_groupField[i]; -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp deleted file mode 100644 index b6f07471b4d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp +++ /dev/null @@ -1,219 +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 ODBC_CODEGEN_Code_expr_hpp -#define ODBC_CODEGEN_Code_expr_hpp - -#include -#include -#include "Code_base.hpp" - -class Ctx; -class Plan_expr_row; -class Exec_expr; - -/** - * @class Plan_expr - * @brief Base class for expressions in PlanTree - */ -class Plan_expr : public Plan_base { -public: - // type is convenient since RTTI cannot be used - enum Type { - TypeUndefined = 0, - TypeColumn, - TypeConst, - TypeConv, - TypeFunc, - TypeOp, - TypeParam, - TypeValue - }; - Plan_expr(Plan_root* root, Type type); - virtual ~Plan_expr() = 0; - Type type() const; - const SqlType& sqlType() const; // data type set by analyze - const TableSet& tableSet() const; - const BaseString& getAlias() const; - bool isAggr() const; - bool isBound() const; - bool isAnyEqual(const Plan_expr_row* row) const; - virtual bool isEqual(const Plan_expr* expr) const; - virtual bool isGroupBy(const Plan_expr_row* row) const; -protected: - friend class Plan_expr_row; - friend class Plan_expr_op; - friend class Plan_expr_func; - friend class Plan_comp_op; - const Type m_type; - SqlType m_sqlType; // subclass must set - BaseString m_alias; // for row expression alias - TableSet m_tableSet; // depends on these tables - bool m_isAggr; // contains an aggregate expression - bool m_isBound; // only constants and aggregates - Exec_expr* m_exec; // XXX wrong move -}; - -inline -Plan_expr::Plan_expr(Plan_root* root, Type type) : - Plan_base(root), - m_type(type), - m_isAggr(false), - m_isBound(false), - m_exec(0) -{ -} - -inline Plan_expr::Type -Plan_expr::type() const -{ - return m_type; -} - -inline const SqlType& -Plan_expr::sqlType() const -{ - ctx_assert(m_sqlType.type() != SqlType::Undef); - return m_sqlType; -} - -inline const Plan_base::TableSet& -Plan_expr::tableSet() const -{ - return m_tableSet; -} - -inline const BaseString& -Plan_expr::getAlias() const -{ - return m_alias; -} - -inline bool -Plan_expr::isAggr() const -{ - return m_isAggr; -} - -inline bool -Plan_expr::isBound() const -{ - return m_isBound; -} - -/** - * @class Exec_expr - * @brief Base class for expressions in ExecTree - */ -class Exec_expr : public Exec_base { -public: - /** - * Exec_expr::Code includes reference to SqlSpec which - * specifies data type and access method. - */ - class Code : public Exec_base::Code { - public: - Code(const SqlSpec& sqlSpec); - virtual ~Code() = 0; - const SqlSpec& sqlSpec() const; - protected: - friend class Exec_expr; - const SqlSpec& m_sqlSpec; // subclass must contain - }; - /** - * Exec_expr::Data includes reference to SqlField which - * contains specification and data address. - */ - class Data : public Exec_base::Data { - public: - Data(const SqlField& sqlField); - virtual ~Data() = 0; - const SqlField& sqlField() const; - const SqlField& groupField(unsigned i) const; - protected: - friend class Exec_expr; - const SqlField& m_sqlField; // subclass must contain - // group-by data - typedef std::vector GroupField; - GroupField m_groupField; - SqlField& groupField(const SqlType& sqlType, unsigned i, bool initFlag); - }; - Exec_expr(Exec_root* root); - virtual ~Exec_expr() = 0; - /** - * Evaluate the expression. Must be implemented by all - * subclasses. Check ctx.ok() for errors. - */ - virtual void evaluate(Ctx& ctx, Ctl& ctl) = 0; - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_expr::Code::Code(const SqlSpec& sqlSpec) : - m_sqlSpec(sqlSpec) -{ -} - -inline const SqlSpec& -Exec_expr::Code::sqlSpec() const { - return m_sqlSpec; -} - -inline -Exec_expr::Data::Data(const SqlField& sqlField) : - m_sqlField(sqlField) -{ -} - -inline const SqlField& -Exec_expr::Data::sqlField() const -{ - return m_sqlField; -} - -inline const SqlField& -Exec_expr::Data::groupField(unsigned i) const -{ - ctx_assert(i != 0 && i < m_groupField.size()); - return m_groupField[i]; -} - -inline -Exec_expr::Exec_expr(Exec_root* root) : - Exec_base(root) -{ -} - -// children - -inline const Exec_expr::Code& -Exec_expr::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr::Data& -Exec_expr::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp deleted file mode 100644 index 17a9a502d4c..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp +++ /dev/null @@ -1,160 +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 */ - -#include -#include -#include -#include -#include "Code_query.hpp" -#include "Code_table.hpp" -#include "Code_expr_column.hpp" -#include "Code_root.hpp" - -// Plan_expr_column - -Plan_expr_column::~Plan_expr_column() -{ -} - -Plan_base* -Plan_expr_column::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - analyzeColumn(ctx, ctl); - if (! ctx.ok()) - return 0; - Plan_expr::m_sqlType = Plan_column::m_sqlType; - // depends on one table - m_tableSet.insert(m_resTable); - // not constant as set-value - ctl.m_const = false; - // set alias name - m_alias = m_name; - return this; -} - -Exec_base* -Plan_expr_column::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - // connect column to query column - const Exec_query* execQuery = ctl.m_execQuery; - ctx_assert(execQuery != 0); - const Exec_query::Code& codeQuery = execQuery->getCode(); - const SqlSpec sqlSpec(Plan_expr::m_sqlType, SqlSpec::Reference); - // offset in final output row - ctx_assert(m_resTable != 0 && m_resTable->m_resOff != 0 && m_resPos != 0); - unsigned resOff = m_resTable->m_resOff + (m_resPos - 1); - // create the code - Exec_expr_column* exec = new Exec_expr_column(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - Exec_expr_column::Code& code = *new Exec_expr_column::Code(sqlSpec, resOff); - exec->setCode(code); - m_exec = exec; - return exec; -} - -bool -Plan_expr_column::resolveEq(Ctx& ctx, Plan_expr* expr) -{ - ctx_assert(m_resTable != 0 && expr != 0); - return m_resTable->resolveEq(ctx, this, expr); -} - -void -Plan_expr_column::print(Ctx& ctx) -{ - ctx.print(" [expr_column %s]", getPrintName()); -} - -bool -Plan_expr_column::isEqual(const Plan_expr* expr) const -{ - ctx_assert(expr != 0); - if (expr->type() != Plan_expr::TypeColumn) - return false; - const Plan_expr_column* expr2 = static_cast(expr); - ctx_assert(m_resTable != 0 && expr2->m_resTable != 0); - if (m_resTable != expr2->m_resTable) - return false; - ctx_assert(m_dictColumn != 0 && expr2->m_dictColumn != 0); - if (m_dictColumn != expr2->m_dictColumn) - return false; - return true; -} - -bool -Plan_expr_column::isGroupBy(const Plan_expr_row* row) const -{ - if (isAnyEqual(row)) - return true; - return false; -} - -// Exec_expr_column - -Exec_expr_column::Code::~Code() -{ -} - -Exec_expr_column::Data::~Data() -{ -} - -Exec_expr_column::~Exec_expr_column() -{ -} - -void -Exec_expr_column::alloc(Ctx& ctx, Ctl& ctl) -{ - if (m_data != 0) - return; - const Code& code = getCode(); - // connect column to query column - ctx_assert(ctl.m_query != 0); - const SqlRow& sqlRow = ctl.m_query->getData().sqlRow(); - SqlField& sqlField = sqlRow.getEntry(code.m_resOff); - // create the data - Data& data = *new Data(sqlField); - setData(data); -} - -void -Exec_expr_column::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - if (ctl.m_groupIndex != 0) { - SqlField& out = data.groupField(code.sqlSpec().sqlType(), ctl.m_groupIndex, ctl.m_groupInit); - data.sqlField().copy(ctx, out); - } -} - -void -Exec_expr_column::close(Ctx& ctx) -{ - Data& data = getData(); - data.m_groupField.clear(); -} - -void -Exec_expr_column::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [column %d]", code.m_resOff); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp deleted file mode 100644 index 2ce7c441e45..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp +++ /dev/null @@ -1,120 +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 ODBC_CODEGEN_Code_expr_column_hpp -#define ODBC_CODEGEN_Code_expr_column_hpp - -#include -#include "Code_column.hpp" -#include "Code_expr.hpp" - -class DictColumn; -class Plan_table; - -/** - * @class Plan_expr_column - * @brief Column in query expression - */ -class Plan_expr_column : public Plan_expr, public Plan_column { -public: - Plan_expr_column(Plan_root* root, const BaseString& name); - virtual ~Plan_expr_column(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - bool resolveEq(Ctx& ctx, Plan_expr* expr); - void print(Ctx& ctx); - bool isEqual(const Plan_expr* expr) const; - bool isGroupBy(const Plan_expr_row* row) const; -}; - -inline -Plan_expr_column::Plan_expr_column(Plan_root* root, const BaseString& name) : - Plan_expr(root, TypeColumn), - Plan_column(Type_expr, name) -{ -} - -/** - * @class Exec_expr_column - * @brief Column in query expression - */ -class Exec_expr_column : public Exec_expr { -public: - class Code : public Exec_expr::Code { - public: - Code(const SqlSpec& sqlSpec, unsigned resOff); - virtual ~Code(); - protected: - friend class Exec_expr_column; - SqlSpec m_sqlSpec; - unsigned m_resOff; - }; - class Data : public Exec_expr::Data { - public: - Data(SqlField& sqlField); - virtual ~Data(); - protected: - friend class Exec_expr_column; - // set reference to SqlField in query - }; - Exec_expr_column(Exec_root* root); - virtual ~Exec_expr_column(); - void alloc(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_expr_column::Code::Code(const SqlSpec& sqlSpec, unsigned resOff) : - Exec_expr::Code(m_sqlSpec), - m_sqlSpec(sqlSpec), - m_resOff(resOff) -{ -} - -inline -Exec_expr_column::Data::Data(SqlField& sqlField) : - Exec_expr::Data(sqlField) -{ -} - -inline -Exec_expr_column::Exec_expr_column(Exec_root* root) : - Exec_expr(root) -{ -} - -// children - -inline const Exec_expr_column::Code& -Exec_expr_column::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_column::Data& -Exec_expr_column::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp deleted file mode 100644 index 564d307a4f8..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp +++ /dev/null @@ -1,138 +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 */ - -#include "Code_expr_const.hpp" -#include "Code_root.hpp" - -// Plan_expr_const - -Plan_expr_const::~Plan_expr_const() -{ -} - -Plan_base* -Plan_expr_const::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - // convert data type - m_lexType.convert(ctx, m_sqlType, m_string.length()); - if (! ctx.ok()) - return 0; - // depends on no tables - // set alias name - m_alias = m_string; - // node was not changed - return this; -} - -Exec_base* -Plan_expr_const::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - // convert data - SqlSpec sqlSpec(m_sqlType, SqlSpec::Physical); - SqlField sqlField(sqlSpec); - LexSpec lexSpec(m_lexType); - lexSpec.convert(ctx, m_string, sqlField); - if (! ctx.ok()) - return 0; - // create code - Exec_expr_const* exec = new Exec_expr_const(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - Exec_expr_const::Code& code = *new Exec_expr_const::Code(sqlField); - exec->setCode(code); - m_exec = exec; - return exec; -} - -void -Plan_expr_const::print(Ctx& ctx) -{ - ctx.print(" [const %s]", m_string.c_str()); -} - -bool -Plan_expr_const::isEqual(const Plan_expr* expr) const -{ - ctx_assert(expr != 0); - if (expr->type() != Plan_expr::TypeConst) - return false; - const Plan_expr_const* expr2 = static_cast(expr); - if (strcmp(m_string.c_str(), expr2->m_string.c_str()) != 0) - return false; - return true; -} - -bool -Plan_expr_const::isGroupBy(const Plan_expr_row* row) const -{ - return true; -} - -// Exec_expr_const - -Exec_expr_const::Code::~Code() -{ -} - -Exec_expr_const::Data::~Data() -{ -} - -Exec_expr_const::~Exec_expr_const() -{ -} - -void -Exec_expr_const::alloc(Ctx& ctx, Ctl& ctl) -{ - if (m_data != 0) - return; - // copy the value for const correctness reasons - SqlField sqlField(getCode().m_sqlField); - Data& data = *new Data(sqlField); - setData(data); -} - -void -Exec_expr_const::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - if (ctl.m_groupIndex != 0) { - SqlField& out = data.groupField(code.sqlSpec().sqlType(), ctl.m_groupIndex, ctl.m_groupInit); - data.sqlField().copy(ctx, out); - } -} - -void -Exec_expr_const::close(Ctx& ctx) -{ - Data& data = getData(); - data.m_groupField.clear(); -} - -void -Exec_expr_const::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" ["); - char buf[500]; - code.m_sqlField.print(buf, sizeof(buf)); - ctx.print("%s", buf); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp deleted file mode 100644 index 2e26c637a23..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp +++ /dev/null @@ -1,120 +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 ODBC_CODEGEN_Code_expr_const_hpp -#define ODBC_CODEGEN_Code_expr_const_hpp - -#include -#include -#include "Code_expr.hpp" - -/** - * @class Plan_expr_const - * @brief Constant expression value in PlanTree - */ -class Plan_expr_const : public Plan_expr { -public: - Plan_expr_const(Plan_root* root, LexType lexType, const char* value); - virtual ~Plan_expr_const(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - bool isEqual(const Plan_expr* expr) const; - bool isGroupBy(const Plan_expr_row* row) const; -protected: - // lexical type and token set by the parser - LexType m_lexType; - BaseString m_string; -}; - -inline -Plan_expr_const::Plan_expr_const(Plan_root* root, LexType lexType, const char* value) : - Plan_expr(root, TypeConst), - m_lexType(lexType), - m_string(value) -{ -} - -/** - * @class Exec_expr_const - * @brief Constant expression value in ExecTree - */ -class Exec_expr_const : public Exec_expr { -public: - class Code : public Exec_expr::Code { - public: - Code(const SqlField& sqlField); - virtual ~Code(); - protected: - friend class Exec_expr_const; - const SqlField m_sqlField; - }; - class Data : public Exec_expr::Data { - public: - Data(SqlField& sqlField); - virtual ~Data(); - protected: - friend class Exec_expr_const; - SqlField m_sqlField; - }; - Exec_expr_const(Exec_root* root); - virtual ~Exec_expr_const(); - void alloc(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_expr_const::Code::Code(const SqlField& sqlField) : - Exec_expr::Code(m_sqlField.sqlSpec()), - m_sqlField(sqlField) -{ -} - -inline -Exec_expr_const::Data::Data(SqlField& sqlField) : - Exec_expr::Data(m_sqlField), - m_sqlField(sqlField) -{ -} - -inline -Exec_expr_const::Exec_expr_const(Exec_root* root) : - Exec_expr(root) -{ -} - -// children - -inline const Exec_expr_const::Code& -Exec_expr_const::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_const::Data& -Exec_expr_const::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp deleted file mode 100644 index bc89482fedc..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp +++ /dev/null @@ -1,273 +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 */ - -#include "Code_expr.hpp" -#include "Code_expr_conv.hpp" -#include "Code_root.hpp" - -// Plan_expr_conv - -Plan_expr_conv::~Plan_expr_conv() -{ -} - -Plan_base* -Plan_expr_conv::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - const SqlType& t1 = sqlType(); - ctx_assert(m_expr != 0); - m_expr->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - const SqlType& t2 = m_expr->sqlType(); - if (t2.type() == SqlType::Unbound) { - return m_expr; - } - if (t1.equal(t2)) { - return m_expr; - } - // XXX move to runtime or make table-driven - bool ok = false; - if (t2.type() == SqlType::Null) { - ok = true; - } else if (t1.type() == SqlType::Char) { - if (t2.type() == SqlType::Char) { - ok = true; - } else if (t2.type() == SqlType::Varchar) { - ok = true; - } else if (t2.type() == SqlType::Binary) { - ok = true; - } else if (t2.type() == SqlType::Varbinary) { - ok = true; - } - } else if (t1.type() == SqlType::Varchar) { - if (t2.type() == SqlType::Char) { - ok = true; - } else if (t2.type() == SqlType::Varchar) { - ok = true; - } else if (t2.type() == SqlType::Binary) { - ok = true; - } else if (t2.type() == SqlType::Varbinary) { - ok = true; - } - } else if (t1.type() == SqlType::Binary) { - if (t2.type() == SqlType::Char) { - ok = true; - } else if (t2.type() == SqlType::Varchar) { - ok = true; - } else if (t2.type() == SqlType::Binary) { - ok = true; - } else if (t2.type() == SqlType::Varbinary) { - ok = true; - } - } else if (t1.type() == SqlType::Varbinary) { - if (t2.type() == SqlType::Char) { - ok = true; - } else if (t2.type() == SqlType::Varchar) { - ok = true; - } else if (t2.type() == SqlType::Binary) { - ok = true; - } else if (t2.type() == SqlType::Varbinary) { - ok = true; - } - } else if (t1.type() == SqlType::Smallint) { - if (t2.type() == SqlType::Smallint) { - ok = true; - } else if (t2.type() == SqlType::Integer) { - ok = true; - } else if (t2.type() == SqlType::Bigint) { - ok = true; - } else if (t2.type() == SqlType::Real) { - ok = true; - } else if (t2.type() == SqlType::Double) { - ok = true; - } - } else if (t1.type() == SqlType::Integer) { - if (t2.type() == SqlType::Smallint) { - ok = true; - } else if (t2.type() == SqlType::Integer) { - ok = true; - } else if (t2.type() == SqlType::Bigint) { - ok = true; - } else if (t2.type() == SqlType::Real) { - ok = true; - } else if (t2.type() == SqlType::Double) { - ok = true; - } - } else if (t1.type() == SqlType::Bigint) { - if (t2.type() == SqlType::Smallint) { - ok = true; - } else if (t2.type() == SqlType::Integer) { - ok = true; - } else if (t2.type() == SqlType::Bigint) { - ok = true; - } else if (t2.type() == SqlType::Real) { - ok = true; - } else if (t2.type() == SqlType::Double) { - ok = true; - } - } else if (t1.type() == SqlType::Real) { - if (t2.type() == SqlType::Smallint) { - ok = true; - } else if (t2.type() == SqlType::Integer) { - ok = true; - } else if (t2.type() == SqlType::Bigint) { - ok = true; - } else if (t2.type() == SqlType::Real) { - ok = true; - } else if (t2.type() == SqlType::Double) { - ok = true; - } - } else if (t1.type() == SqlType::Double) { - if (t2.type() == SqlType::Smallint) { - ok = true; - } else if (t2.type() == SqlType::Integer) { - ok = true; - } else if (t2.type() == SqlType::Bigint) { - ok = true; - } else if (t2.type() == SqlType::Real) { - ok = true; - } else if (t2.type() == SqlType::Double) { - ok = true; - } - } else if (t1.type() == SqlType::Datetime) { - if (t2.type() == SqlType::Datetime) { - ok = true; - } - } - if (! ok) { - char b1[40], b2[40]; - t1.print(b1, sizeof(b1)); - t2.print(b2, sizeof(b2)); - ctx.pushStatus(Error::Gen, "cannot convert %s to %s", b2, b1); - return 0; - } - // depend on same tables - const TableSet& ts = m_expr->tableSet(); - m_tableSet.insert(ts.begin(), ts.end()); - // set alias - m_alias = m_expr->getAlias(); - return this; -} - -Exec_base* -Plan_expr_conv::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - Exec_expr_conv* exec = new Exec_expr_conv(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // create code for subexpression - ctx_assert(m_expr != 0); - Exec_expr* execExpr = static_cast(m_expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - exec->setExpr(execExpr); - // create the code - SqlSpec sqlSpec(sqlType(), SqlSpec::Physical); - Exec_expr_conv::Code& code = *new Exec_expr_conv::Code(sqlSpec); - exec->setCode(code); - m_exec = exec; - return exec; -} - -void -Plan_expr_conv::print(Ctx& ctx) -{ - ctx.print(" [expr_conv "); - char buf[100]; - m_sqlType.print(buf, sizeof(buf)); - ctx.print("%s", buf); - Plan_base* a[] = { m_expr }; - printList(ctx, a, 1); - ctx.print("]"); -} - -bool -Plan_expr_conv::isEqual(const Plan_expr* expr) const -{ - ctx_assert(expr != 0); - if (expr->type() != Plan_expr::TypeConv) - return false; - const Plan_expr_conv* expr2 = static_cast(expr); - if (! m_sqlType.equal(expr2->m_sqlType)) - return false; - ctx_assert(m_expr != 0 && expr2->m_expr != 0); - if (! m_expr->isEqual(expr2->m_expr)) - return false; - return true; -} - -bool -Plan_expr_conv::isGroupBy(const Plan_expr_row* row) const -{ - if (isAnyEqual(row)) - return true; - ctx_assert(m_expr != 0); - if (m_expr->isGroupBy(row)) - return true; - return false; -} - -// Code_expr_conv - -Exec_expr_conv::Code::~Code() -{ -} - -Exec_expr_conv::Data::~Data() -{ -} - -Exec_expr_conv::~Exec_expr_conv() -{ -} - -void -Exec_expr_conv::alloc(Ctx& ctx, Ctl& ctl) -{ - if (m_data != 0) - return; - const Code& code = getCode(); - // allocate subexpression - ctx_assert(m_expr != 0); - m_expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - SqlField sqlField(code.m_sqlSpec); - Data& data = *new Data(sqlField); - setData(data); -} - -void -Exec_expr_conv::close(Ctx& ctx) -{ - ctx_assert(m_expr != 0); - m_expr->close(ctx); - Data& data = getData(); - data.m_groupField.clear(); -} - -void -Exec_expr_conv::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [expr_conv"); - Exec_base* a[] = { m_expr }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp deleted file mode 100644 index 3294960c7b3..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp +++ /dev/null @@ -1,141 +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 ODBC_CODEGEN_Code_expr_conv_hpp -#define ODBC_CODEGEN_Code_expr_conv_hpp - -#include -#include -#include "Code_expr.hpp" - -/** - * @class Plan_expr_conv - * @brief Data type conversion in PlanTree - * - * Inserted to convert value to another compatible type. - */ -class Plan_expr_conv : public Plan_expr { -public: - Plan_expr_conv(Plan_root* root, const SqlType& sqlType); - virtual ~Plan_expr_conv(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - bool isEqual(const Plan_expr* expr) const; - bool isGroupBy(const Plan_expr_row* row) const; - // children - void setExpr(Plan_expr* expr); -protected: - Plan_expr* m_expr; -}; - -inline -Plan_expr_conv::Plan_expr_conv(Plan_root* root, const SqlType& sqlType) : - Plan_expr(root, TypeConv), - m_expr(0) -{ - ctx_assert(sqlType.type() != SqlType::Undef); - m_sqlType = sqlType; -} - -inline void -Plan_expr_conv::setExpr(Plan_expr* expr) -{ - ctx_assert(expr != 0); - m_expr = expr; -} - -/** - * @class Exec_expr_conv - * @brief Data type conversion in ExecTree - */ -class Exec_expr_conv : public Exec_expr { -public: - class Code : public Exec_expr::Code { - public: - Code(const SqlSpec& spec); - virtual ~Code(); - protected: - friend class Exec_expr_conv; - const SqlSpec m_sqlSpec; - }; - class Data : public Exec_expr::Data { - public: - Data(const SqlField& sqlField); - virtual ~Data(); - protected: - friend class Exec_expr_conv; - SqlField m_sqlField; - }; - Exec_expr_conv(Exec_root* root); - virtual ~Exec_expr_conv(); - void alloc(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setExpr(Exec_expr* expr); -protected: - Exec_expr* m_expr; -}; - -inline -Exec_expr_conv::Code::Code(const SqlSpec& sqlSpec) : - Exec_expr::Code(m_sqlSpec), - m_sqlSpec(sqlSpec) -{ -} - -inline -Exec_expr_conv::Data::Data(const SqlField& sqlField) : - Exec_expr::Data(m_sqlField), - m_sqlField(sqlField) -{ -} - -inline -Exec_expr_conv::Exec_expr_conv(Exec_root* root) : - Exec_expr(root), - m_expr(0) -{ -} - -// children - -inline const Exec_expr_conv::Code& -Exec_expr_conv::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_conv::Data& -Exec_expr_conv::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_expr_conv::setExpr(Exec_expr* expr) -{ - ctx_assert(m_expr == 0 && expr != 0); - m_expr = expr; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp deleted file mode 100644 index 96b461a72d9..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp +++ /dev/null @@ -1,401 +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 */ - -#include "Code_expr.hpp" -#include "Code_expr_func.hpp" -#include "Code_expr_conv.hpp" -#include "Code_root.hpp" -#include "PortDefs.h" - - -// Expr_func - -static const struct { const char* alias; const char* name; } -expr_func_alias[] = { - { "SUBSTRING", "SUBSTR" }, - { 0, 0 } -}; - -static const Expr_func -expr_func[] = { - Expr_func(Expr_func::Substr, "SUBSTR", false ), - Expr_func(Expr_func::Left, "LEFT", false ), - Expr_func(Expr_func::Right, "RIGHT", false ), - Expr_func(Expr_func::Count, "COUNT", true ), - Expr_func(Expr_func::Max, "MAX", true ), - Expr_func(Expr_func::Min, "MIN", true ), - Expr_func(Expr_func::Sum, "SUM", true ), - Expr_func(Expr_func::Avg, "AVG", true ), - Expr_func(Expr_func::Rownum, "ROWNUM", false ), - Expr_func(Expr_func::Sysdate, "SYSDATE", false ), - Expr_func(Expr_func::Undef, 0, false ) -}; - -const Expr_func& -Expr_func::find(const char* name) -{ - for (unsigned i = 0; expr_func_alias[i].alias != 0; i++) { - if (strcasecmp(expr_func_alias[i].alias, name) == 0) { - name = expr_func_alias[i].name; - break; - } - } - const Expr_func* p; - for (p = expr_func; p->m_name != 0; p++) { - if (strcasecmp(p->m_name, name) == 0) - break; - } - return *p; -} - -// Plan_expr_func - -Plan_expr_func::~Plan_expr_func() -{ - delete[] m_conv; - m_conv = 0; -} - -Plan_base* -Plan_expr_func::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - ctx_assert(m_narg == 0 || m_args != 0); - // aggregate check - if (m_func.m_aggr) { - if (! ctl.m_aggrok) { - ctx.pushStatus(Error::Gen, "%s: invalid use of aggregate function", m_func.m_name); - return 0; - } - if (ctl.m_aggrin) { - // XXX actually possible with group-by but too hard - ctx.pushStatus(Error::Gen, "%s: nested aggregate function", m_func.m_name); - return 0; - } - ctl.m_aggrin = true; - m_isAggr = true; - m_isBound = true; - } - // analyze argument expressions - if (m_func.m_code != Expr_func::Rownum) - m_isBound = true; - for (unsigned i = 1; i <= m_narg; i++) { - Plan_expr* expr = m_args->getExpr(i); - expr = static_cast(expr->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(expr != 0); - if (expr->m_isAggr) - m_isAggr = true; - if (! m_func.m_aggr && ! expr->m_isBound) - m_isBound = false; - } - if (m_func.m_aggr) - ctl.m_aggrin = false; - // find result type and conversion types - SqlType res; - const Expr_func::Code fc = m_func.m_code; - const char* const invalidArgCount = "%s: argument count %u is invalid"; - const char* const invalidArgType = "%s: argument %u has invalid type"; - if (fc == Expr_func::Substr || fc == Expr_func::Left || fc == Expr_func::Right) { - if ((m_narg != (unsigned)2) && (m_narg != (unsigned)(fc == Expr_func::Substr ? 3 : 2))) { - ctx.pushStatus(Error::Gen, invalidArgCount, m_func.m_name, m_narg); - return 0; - } - const SqlType& t1 = m_args->getExpr(1)->sqlType(); - switch (t1.type()) { - case SqlType::Char: - { - // XXX convert to varchar for now to get length right - SqlType tx(SqlType::Varchar, t1.length()); - res = m_conv[1] = tx; - } - break; - case SqlType::Varchar: - case SqlType::Unbound: - res = m_conv[1] = t1; - break; - default: - ctx.pushStatus(Error::Gen, invalidArgType, m_func.m_name, 1); - return 0; - } - for (unsigned i = 2; i <= m_narg; i++) { - const SqlType& t2 = m_args->getExpr(i)->sqlType(); - switch (t2.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - case SqlType::Unbound: - m_conv[i] = t2; - break; - default: - ctx.pushStatus(Error::Gen, invalidArgType, m_func.m_name, i); - return 0; - } - } - } else if (fc == Expr_func::Count) { - ctx_assert(m_args != 0); - if (m_args->getAsterisk()) { - ctx_assert(m_narg == 0); - } else { - if (m_narg != 1) { - ctx.pushStatus(Error::Gen, invalidArgCount, m_func.m_name, m_narg); - return 0; - } - m_conv[1] = m_args->getExpr(1)->sqlType(); - } - res.setType(ctx, SqlType::Bigint); - } else if (fc == Expr_func::Min || fc == Expr_func::Max) { - if (m_narg != 1) { - ctx.pushStatus(Error::Gen, invalidArgCount, m_func.m_name, m_narg); - return 0; - } - const SqlType& t1 = m_args->getExpr(1)->sqlType(); - res = m_conv[1] = t1; - } else if (fc == Expr_func::Sum) { - if (m_narg != 1) { - ctx.pushStatus(Error::Gen, invalidArgCount, m_func.m_name, m_narg); - return 0; - } - const SqlType& t1 = m_args->getExpr(1)->sqlType(); - switch (t1.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - res.setType(ctx, SqlType::Bigint); - m_conv[1] = res; - break; - case SqlType::Real: - case SqlType::Double: - res.setType(ctx, SqlType::Double); - m_conv[1] = res; - break; - case SqlType::Unbound: - res = m_conv[1] = t1; - break; - default: - ctx.pushStatus(Error::Gen, invalidArgType, m_func.m_name, 1); - return 0; - } - } else if (fc == Expr_func::Avg) { - if (m_narg != 1) { - ctx.pushStatus(Error::Gen, invalidArgCount, m_func.m_name, m_narg); - return 0; - } - const SqlType& t1 = m_args->getExpr(1)->sqlType(); - switch (t1.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - case SqlType::Real: - case SqlType::Double: - res.setType(ctx, SqlType::Double); - m_conv[1] = res; - break; - case SqlType::Unbound: - res = m_conv[1] = t1; - break; - default: - ctx.pushStatus(Error::Gen, invalidArgType, m_func.m_name, 1); - return 0; - } - } else if (fc == Expr_func::Rownum) { - ctx_assert(m_narg == 0 && m_args == 0); - res.setType(ctx, SqlType::Bigint); - } else if (fc == Expr_func::Sysdate) { - ctx_assert(m_narg == 0 && m_args == 0); - res.setType(ctx, SqlType::Datetime); - } else { - ctx_assert(false); - } - // insert required conversions - for (unsigned i = 1; i <= m_narg; i++) { - if (m_conv[i].type() == SqlType::Unbound) { - // parameter type not yet bound - continue; - } - Plan_expr_conv* exprConv = new Plan_expr_conv(m_root, m_conv[i]); - m_root->saveNode(exprConv); - exprConv->setExpr(m_args->getExpr(i)); - Plan_expr* expr = static_cast(exprConv->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - m_args->setExpr(i, expr); - } - // set result type - m_sqlType = res; - // set table dependencies - for (unsigned i = 1; i <= m_narg; i++) { - const TableSet& ts = m_args->getExpr(i)->tableSet(); - m_tableSet.insert(ts.begin(), ts.end()); - } - // set alias name - m_alias.assign(m_func.m_name); - if (m_narg == 0) { - if (fc == Expr_func::Count) - m_alias.append("(*)"); - } else { - m_alias.append("("); - for (unsigned i = 1; i <= m_narg; i++) { - if (i > 1) - m_alias.append(","); - m_alias.append(m_args->getExpr(i)->getAlias()); - } - m_alias.append(")"); - } - return this; -} - -Exec_base* -Plan_expr_func::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - Exec_expr_func* exec = new Exec_expr_func(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - SqlSpec sqlSpec(sqlType(), SqlSpec::Physical); - Exec_expr_func::Code& code = *new Exec_expr_func::Code(m_func, sqlSpec); - exec->setCode(code); - code.m_narg = m_narg; - code.m_args = new Exec_expr* [1 + m_narg]; - for (unsigned i = 0; i <= m_narg; i++) - code.m_args[i] = 0; - // create code for arguments - for (unsigned i = 1; i <= m_narg; i++) { - Plan_expr* expr = m_args->getExpr(i); - ctx_assert(expr != 0); - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_args[i] = execExpr; - } - m_exec = exec; - return exec; -} - -void -Plan_expr_func::print(Ctx& ctx) -{ - ctx.print(" [%s", m_func.m_name); - Plan_base* a[] = { m_args }; - printList(ctx, a, sizeof(a)/sizeof(a[1])); - ctx.print("]"); -} - -bool -Plan_expr_func::isEqual(const Plan_expr* expr) const -{ - ctx_assert(expr != 0); - if (expr->type() != Plan_expr::TypeFunc) - return false; - const Plan_expr_func* expr2 = static_cast(expr); - if (m_func.m_code != expr2->m_func.m_code) - return false; - if (m_narg != expr2->m_narg) - return false; - ctx_assert(m_args != 0 && expr2->m_args != 0); - for (unsigned i = 1; i <= m_narg; i++) { - if (! m_args->getExpr(i)->isEqual(expr2->m_args->getExpr(i))) - return false; - } - return true; -} - -bool -Plan_expr_func::isGroupBy(const Plan_expr_row* row) const -{ - if (m_func.m_aggr) - return true; - switch (m_func.m_code) { - case Expr_func::Substr: - case Expr_func::Left: - case Expr_func::Right: - ctx_assert(m_narg >= 1); - if (m_args->getExpr(1)->isGroupBy(row)) - return true; - break; - case Expr_func::Sysdate: - return true; - default: - break; - } - if (isAnyEqual(row)) - return true; - return false; -} - -// Exec_expr_func - -Exec_expr_func::Code::~Code() -{ - delete[] m_args; - m_args = 0; -} - -Exec_expr_func::Data::~Data() -{ -} - -Exec_expr_func::~Exec_expr_func() -{ -} - -void -Exec_expr_func::alloc(Ctx& ctx, Ctl& ctl) -{ - if (m_data != 0) - return; - const Code& code = getCode(); - // allocate arguments - for (unsigned i = 1; i <= code.m_narg; i++) { - ctx_assert(code.m_args != 0 && code.m_args[i] != 0); - code.m_args[i]->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - SqlField sqlField(code.m_sqlSpec); - Data& data = *new Data(sqlField); - setData(data); - ctx_assert(ctl.m_groupIndex == 0); - init(ctx, ctl); -} - -void -Exec_expr_func::close(Ctx& ctx) -{ - const Code& code = getCode(); - Data& data = getData(); - for (unsigned i = 1; i <= code.m_narg; i++) { - ctx_assert(code.m_args != 0 && code.m_args[i] != 0); - code.m_args[i]->close(ctx); - } - data.m_groupField.clear(); - Ctl ctl(0); - init(ctx, ctl); -} - -void -Exec_expr_func::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [%s", code.m_func.m_name); - for (unsigned i = 1; i <= code.m_narg; i++) { - Exec_base* a[] = { code.m_args[i] }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp deleted file mode 100644 index 856d7529875..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp +++ /dev/null @@ -1,193 +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 ODBC_CODEGEN_Code_expr_func_hpp -#define ODBC_CODEGEN_Code_expr_func_hpp - -#include -#include -#include "Code_expr.hpp" -#include "Code_expr_row.hpp" - -/** - * @class Expr_func - * @brief Specifies a function - */ -struct Expr_func { - enum Code { - Undef = 0, - Substr, - Left, - Right, - Count, - Max, - Min, - Sum, - Avg, - Rownum, - Sysdate - }; - Expr_func(Code code, const char* name, bool aggr); - Code m_code; - const char* m_name; - bool m_aggr; - static const Expr_func& find(const char* name); -}; - -inline -Expr_func::Expr_func(Code code, const char* name, bool aggr) : - m_code(code), - m_name(name), - m_aggr(aggr) -{ -} - -/** - * @class Plan_expr_func - * @brief Function node in an expression in PlanTree - */ -class Plan_expr_func : public Plan_expr { -public: - Plan_expr_func(Plan_root* root, const Expr_func& func); - virtual ~Plan_expr_func(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - bool isEqual(const Plan_expr* expr) const; - bool isGroupBy(const Plan_expr_row* row) const; - // children - void setArgs(Plan_expr_row* args); -protected: - const Expr_func& m_func; - Plan_expr_row* m_args; - unsigned m_narg; - SqlType* m_conv; // temp work area -}; - -inline -Plan_expr_func::Plan_expr_func(Plan_root* root, const Expr_func& func) : - Plan_expr(root, TypeFunc), - m_func(func), - m_args(0), - m_narg(0), - m_conv(0) -{ -} - -inline void -Plan_expr_func::setArgs(Plan_expr_row* args) -{ - if (args == 0) { - m_args = 0; - m_narg = 0; - } else { - m_args = args; - m_narg = m_args->getSize(); - delete[] m_conv; - m_conv = new SqlType[1 + m_narg]; - } -} - -/** - * @class Exec_expr_func - * @brief Function node in an expression in ExecTree - */ -class Exec_expr_func : public Exec_expr { -public: - class Code : public Exec_expr::Code { - public: - Code(const Expr_func& func, const SqlSpec& spec); - virtual ~Code(); - protected: - friend class Plan_expr_func; - friend class Exec_expr_func; - const Expr_func& m_func; - const SqlSpec m_sqlSpec; - unsigned m_narg; - Exec_expr** m_args; // XXX pointers for now - }; - class Data : public Exec_expr::Data { - public: - Data(const SqlField& sqlField); - virtual ~Data(); - protected: - friend class Exec_expr_func; - SqlField m_sqlField; - struct Acc { // accumulators etc - SqlBigint m_count; // current row count - union { - SqlBigint m_bigint; - SqlDouble m_double; - SqlDatetime m_sysdate; - }; - }; - // group-by extra accumulators (default in entry 0) - typedef std::vector GroupAcc; - GroupAcc m_groupAcc; - }; - Exec_expr_func(Exec_root* root); - virtual ~Exec_expr_func(); - void alloc(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -protected: - void init(Ctx &ctx, Ctl& ctl); // initialize values -}; - -inline -Exec_expr_func::Code::Code(const Expr_func& func, const SqlSpec& sqlSpec) : - Exec_expr::Code(m_sqlSpec), - m_func(func), - m_sqlSpec(sqlSpec), - m_args(0) -{ -} - -inline -Exec_expr_func::Data::Data(const SqlField& sqlField) : - Exec_expr::Data(m_sqlField), - m_sqlField(sqlField), - m_groupAcc(1) -{ -} - -inline -Exec_expr_func::Exec_expr_func(Exec_root* root) : - Exec_expr(root) -{ -} - -// children - -inline const Exec_expr_func::Code& -Exec_expr_func::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_func::Data& -Exec_expr_func::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp deleted file mode 100644 index 7e8314c1741..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp +++ /dev/null @@ -1,424 +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 */ - -#include "Code_expr.hpp" -#include "Code_expr_op.hpp" -#include "Code_expr_conv.hpp" -#include "Code_root.hpp" - -// Expr_op - -const char* -Expr_op::name() const -{ - switch (m_opcode) { - case Add: - return "+"; - case Subtract: - return "-"; - case Multiply: - return "*"; - case Divide: - return "/"; - case Plus: - return "+"; - case Minus: - return "-"; - } - ctx_assert(false); - return ""; -} - -unsigned -Expr_op::arity() const -{ - switch (m_opcode) { - case Add: - case Subtract: - case Multiply: - case Divide: - return 2; - case Plus: - case Minus: - return 1; - } - ctx_assert(false); - return 0; -} - -// Plan_expr_op - -Plan_expr_op::~Plan_expr_op() -{ -} - -Plan_base* -Plan_expr_op::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - unsigned arity = m_op.arity(); - // analyze operands - m_isAggr = false; - m_isBound = true; - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - m_expr[i]->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - if (m_expr[i]->m_isAggr) - m_isAggr = true; - if (! m_expr[i]->m_isBound) - m_isBound = false; - } - // find result type and conversion types (currently same) - SqlType res; - SqlType con[1 + 2]; - if (arity == 1) { - const SqlType& t1 = m_expr[1]->sqlType(); - switch (t1.type()) { - case SqlType::Char: - case SqlType::Varchar: - break; - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - res.setType(ctx, SqlType::Bigint); - con[1] = res; - break; - case SqlType::Real: - case SqlType::Double: - res.setType(ctx, SqlType::Double); - con[1] = res; - break; - case SqlType::Null: - res.setType(ctx, SqlType::Null); - con[1] = res; - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = res; - default: - break; - } - if (con[1].type() == SqlType::Undef) { - char b1[40]; - t1.print(b1, sizeof(b1)); - ctx.pushStatus(Error::Gen, "type mismatch in operation: %s %s", m_op.name(), b1); - return 0; - } - } else if (arity == 2) { - const SqlType& t1 = m_expr[1]->sqlType(); - const SqlType& t2 = m_expr[2]->sqlType(); - switch (t1.type()) { - case SqlType::Char: // handle char types as in oracle - switch (t2.type()) { - case SqlType::Char: - res.setType(ctx, SqlType::Char, t1.length() + t2.length()); - con[1] = t1; - con[2] = t2; - break; - case SqlType::Varchar: - res.setType(ctx, SqlType::Varchar, t1.length() + t2.length()); - con[1] = t1; - con[2] = t2; - break; - case SqlType::Null: - res.setType(ctx, SqlType::Varchar, t1.length()); - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = con[2] = res; - break; - default: - break; - } - break; - case SqlType::Varchar: - switch (t2.type()) { - case SqlType::Char: - res.setType(ctx, SqlType::Varchar, t1.length() + t2.length()); - con[1] = t1; - con[2] = t2; - break; - case SqlType::Varchar: - res.setType(ctx, SqlType::Varchar, t1.length() + t2.length()); - con[1] = t1; - con[2] = t2; - break; - case SqlType::Null: - res.setType(ctx, SqlType::Varchar, t1.length()); - con[1] = t1; - con[2] = t2; - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = con[2] = res; - break; - default: - break; - } - break; - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - switch (t2.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - res.setType(ctx, SqlType::Bigint); - con[1] = con[2] = res; - if (t1.unSigned() || t2.unSigned()) { - con[1].unSigned(true); - con[2].unSigned(true); - } - break; - case SqlType::Real: - case SqlType::Double: - res.setType(ctx, SqlType::Double); - con[1] = con[2] = res; - break; - case SqlType::Null: - res.setType(ctx, SqlType::Null); - con[1] = con[2] = res; - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = con[2] = res; - break; - default: - break; - } - break; - case SqlType::Real: - case SqlType::Double: - switch (t2.type()) { - case SqlType::Smallint: - case SqlType::Integer: - case SqlType::Bigint: - case SqlType::Real: - case SqlType::Double: - res.setType(ctx, SqlType::Double); - con[1] = con[2] = res; - break; - case SqlType::Null: - res.setType(ctx, SqlType::Null); - con[1] = con[2] = res; - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = con[2] = res; - break; - default: - break; - } - break; - case SqlType::Null: - switch (t2.type()) { - case SqlType::Char: - case SqlType::Varchar: - res.setType(ctx, SqlType::Varchar, t2.length()); - con[1] = con[2] = res; - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = con[2] = res; - break; - default: - res.setType(ctx, SqlType::Null); - con[1] = con[2] = res; - break; - } - break; - case SqlType::Unbound: - res.setType(ctx, SqlType::Unbound); - con[1] = con[2] = res; - break; - default: - break; - } - if (con[1].type() == SqlType::Undef || con[2].type() == SqlType::Undef) { - char b1[40], b2[40]; - t1.print(b1, sizeof(b1)); - t2.print(b2, sizeof(b2)); - ctx.pushStatus(Error::Gen, "type mismatch in operation: %s %s %s", b1, m_op.name(), b2); - return 0; - } - } else { - ctx_assert(false); - return 0; - } - if (! ctx.ok()) - return 0; - // insert required conversions - for (unsigned i = 1; i <= arity; i++) { - if (con[i].type() == SqlType::Undef) { - ctx.pushStatus(Error::Gen, "mismatched types in operation"); - return 0; - } - if (con[i].type() == SqlType::Unbound) { - // parameter type not yet bound - continue; - } - Plan_expr_conv* exprConv = new Plan_expr_conv(m_root, con[i]); - m_root->saveNode(exprConv); - exprConv->setExpr(m_expr[i]); - m_expr[i] = static_cast(exprConv->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_expr[i] != 0); - } - // set result type - m_sqlType = res; - // table dependencies are union from operands - for (unsigned i = 1; i <= arity; i++) { - const TableSet& ts = m_expr[i]->tableSet(); - m_tableSet.insert(ts.begin(), ts.end()); - } - // set alias name XXX misses operator precedence - if (arity == 1) { - m_alias.assign(m_op.name()); - m_alias.append(m_expr[1]->m_alias); - } else if (arity == 2) { - m_alias.assign(m_expr[1]->m_alias); - m_alias.append(m_op.name()); - m_alias.append(m_expr[2]->m_alias); - } - return this; -} - -Exec_base* -Plan_expr_op::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - unsigned arity = m_op.arity(); - Exec_expr_op* exec = new Exec_expr_op(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // create code for operands - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - Exec_expr* execExpr = static_cast(m_expr[i]->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - exec->setExpr(i, execExpr); - } - // create the code - SqlSpec sqlSpec(sqlType(), SqlSpec::Physical); - Exec_expr_op::Code& code = *new Exec_expr_op::Code(m_op, sqlSpec); - exec->setCode(code); - m_exec = exec; - return exec; -} - -void -Plan_expr_op::print(Ctx& ctx) -{ - ctx.print(" [%s", m_op.name()); - Plan_base* a[] = { m_expr[1], m_expr[2] }; - printList(ctx, a, m_op.arity()); - ctx.print("]"); -} - -bool -Plan_expr_op::isEqual(const Plan_expr* expr) const -{ - ctx_assert(expr != 0); - if (expr->type() != Plan_expr::TypeOp) - return false; - const Plan_expr_op* expr2 = static_cast(expr); - if (m_op.m_opcode != expr2->m_op.m_opcode) - return false; - const unsigned arity = m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - if (! m_expr[i]->isEqual(expr2->m_expr[i])) - return false; - } - return true; -} - -bool -Plan_expr_op::isGroupBy(const Plan_expr_row* row) const -{ - if (isAnyEqual(row)) - return true; - const unsigned arity = m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - if (! m_expr[i]->isGroupBy(row)) - return false; - } - return true; -} - -// Code_expr_op - -Exec_expr_op::Code::~Code() -{ -} - -Exec_expr_op::Data::~Data() -{ -} - -Exec_expr_op::~Exec_expr_op() -{ -} - -void -Exec_expr_op::alloc(Ctx& ctx, Ctl& ctl) -{ - if (m_data != 0) - return; - const Code& code = getCode(); - // allocate subexpressions - unsigned arity = code.m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - m_expr[i]->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - SqlField sqlField(code.m_sqlSpec); - Data& data = *new Data(sqlField); - setData(data); -} - -void -Exec_expr_op::close(Ctx& ctx) -{ - const Code& code = getCode(); - unsigned arity = code.m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_expr[i] != 0); - m_expr[i]->close(ctx); - } - Data& data = getData(); - data.m_groupField.clear(); -} - -void -Exec_expr_op::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [%s", code.m_op.name()); - Exec_base* a[] = { m_expr[1], m_expr[2] }; - printList(ctx, a, code.m_op.arity()); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp deleted file mode 100644 index f9686cad151..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp +++ /dev/null @@ -1,166 +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 ODBC_CODEGEN_Code_expr_op_hpp -#define ODBC_CODEGEN_Code_expr_op_hpp - -#include -#include -#include "Code_expr.hpp" - -/** - * @class Expr_op - * @brief Arithmetic and string operators - */ -struct Expr_op { - enum Opcode { - Add = 1, // binary - Subtract, - Multiply, - Divide, - Plus, // unary - Minus - }; - Expr_op(Opcode opcode); - const char* name() const; - unsigned arity() const; - Opcode m_opcode; -}; - -inline -Expr_op::Expr_op(Opcode opcode) : - m_opcode(opcode) -{ -} - -/** - * @class Plan_expr_op - * @brief Operator node in an expression in PlanTree - */ -class Plan_expr_op : public Plan_expr { -public: - Plan_expr_op(Plan_root* root, Expr_op op); - virtual ~Plan_expr_op(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - bool isEqual(const Plan_expr* expr) const; - bool isGroupBy(const Plan_expr_row* row) const; - // children - void setExpr(unsigned i, Plan_expr* expr); -protected: - Expr_op m_op; - Plan_expr* m_expr[1 + 2]; -}; - -inline -Plan_expr_op::Plan_expr_op(Plan_root* root, Expr_op op) : - Plan_expr(root, TypeOp), - m_op(op) -{ - m_expr[0] = m_expr[1] = m_expr[2] = 0; -} - -inline void -Plan_expr_op::setExpr(unsigned i, Plan_expr* expr) -{ - ctx_assert(1 <= i && i <= 2 && expr != 0); - m_expr[i] = expr; -} - -/** - * @class Exec_expr_op - * @brief Operator node in an expression in ExecTree - */ -class Exec_expr_op : public Exec_expr { -public: - class Code : public Exec_expr::Code { - public: - Code(Expr_op op, const SqlSpec& spec); - virtual ~Code(); - protected: - friend class Exec_expr_op; - Expr_op m_op; - const SqlSpec m_sqlSpec; - }; - class Data : public Exec_expr::Data { - public: - Data(const SqlField& sqlField); - virtual ~Data(); - protected: - friend class Exec_expr_op; - SqlField m_sqlField; - }; - Exec_expr_op(Exec_root* root); - virtual ~Exec_expr_op(); - void alloc(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setExpr(unsigned i, Exec_expr* expr); -protected: - Exec_expr* m_expr[1 + 2]; -}; - -inline -Exec_expr_op::Code::Code(Expr_op op, const SqlSpec& sqlSpec) : - Exec_expr::Code(m_sqlSpec), - m_op(op), - m_sqlSpec(sqlSpec) -{ -} - -inline -Exec_expr_op::Data::Data(const SqlField& sqlField) : - Exec_expr::Data(m_sqlField), - m_sqlField(sqlField) -{ -} - -inline -Exec_expr_op::Exec_expr_op(Exec_root* root) : - Exec_expr(root) -{ - m_expr[0] = m_expr[1] = m_expr[2] = 0; -} - -// children - -inline const Exec_expr_op::Code& -Exec_expr_op::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_op::Data& -Exec_expr_op::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_expr_op::setExpr(unsigned i, Exec_expr* expr) -{ - ctx_assert(1 <= i && i <= 2 && m_expr[i] == 0); - m_expr[i] = expr; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp deleted file mode 100644 index 93892cae5e6..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp +++ /dev/null @@ -1,279 +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 */ - -#include "Code_expr_param.hpp" -#include "Code_root.hpp" - -// Plan_expr_param - -Plan_expr_param::~Plan_expr_param() -{ -} - -Plan_base* -Plan_expr_param::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - ctx_assert(m_paramNumber != 0); - ctx_assert(m_paramNumber < m_root->m_paramList.size()); - m_root->m_paramList[m_paramNumber] = this; - m_sqlType.setType(ctx, SqlType::Unbound); - // check if type is bound now - DescArea& ipd = descArea(Desc_usage_IPD); - if (m_paramNumber <= ipd.getCount()) { - DescRec& rec = ipd.getRecord(m_paramNumber); - OdbcData descData; - rec.getField(ctx, SQL_DESC_TYPE, descData); - if (descData.type() != OdbcData::Undef) { - SQLSMALLINT desc_TYPE = descData.smallint(); - // XXX wrong but fixes sun.jdbc.odbc - if (desc_TYPE == SQL_CHAR) - desc_TYPE = SQL_VARCHAR; - if (desc_TYPE == SQL_CHAR) { - rec.getField(ctx, SQL_DESC_LENGTH, descData); - if (descData.type() != OdbcData::Undef) { - unsigned desc_LENGTH = descData.uinteger(); - m_sqlType.setType(ctx, SqlType::Char, desc_LENGTH); - } - } else if (desc_TYPE == SQL_VARCHAR) { - rec.getField(ctx, SQL_DESC_LENGTH, descData); - if (descData.type() != OdbcData::Undef) { - unsigned desc_LENGTH = descData.uinteger(); - m_sqlType.setType(ctx, SqlType::Varchar, desc_LENGTH); - } - } else if (desc_TYPE == SQL_BINARY) { - rec.getField(ctx, SQL_DESC_LENGTH, descData); - if (descData.type() != OdbcData::Undef) { - unsigned desc_LENGTH = descData.uinteger(); - m_sqlType.setType(ctx, SqlType::Binary, desc_LENGTH); - } - } else if (desc_TYPE == SQL_VARBINARY) { - rec.getField(ctx, SQL_DESC_LENGTH, descData); - if (descData.type() != OdbcData::Undef) { - unsigned desc_LENGTH = descData.uinteger(); - m_sqlType.setType(ctx, SqlType::Varbinary, desc_LENGTH); - } else { - // XXX BLOB hack - unsigned desc_LENGTH = FAKE_BLOB_SIZE; - m_sqlType.setType(ctx, SqlType::Varbinary, desc_LENGTH); - } - } else if (desc_TYPE == SQL_SMALLINT) { - m_sqlType.setType(ctx, SqlType::Smallint); - } else if (desc_TYPE == SQL_INTEGER) { - m_sqlType.setType(ctx, SqlType::Integer); - } else if (desc_TYPE == SQL_BIGINT) { - m_sqlType.setType(ctx, SqlType::Bigint); - } else if (desc_TYPE == SQL_REAL) { - m_sqlType.setType(ctx, SqlType::Real); - } else if (desc_TYPE == SQL_DOUBLE) { - m_sqlType.setType(ctx, SqlType::Double); - } else if (desc_TYPE == SQL_TYPE_TIMESTAMP) { - m_sqlType.setType(ctx, SqlType::Datetime); - // XXX BLOB hack - } else if (desc_TYPE == SQL_LONGVARBINARY) { - m_sqlType.setType(ctx, SqlType::Varbinary, (unsigned)FAKE_BLOB_SIZE); - } else { - ctx.pushStatus(Error::Gen, "parameter %u unsupported SQL type %d", m_paramNumber, (int)desc_TYPE); - return 0; - } - char buf[100]; - m_sqlType.print(buf, sizeof(buf)); - ctx_log2(("parameter %u SQL type bound to %s", m_paramNumber, buf)); - } - } - return this; -} - -void -Plan_expr_param::describe(Ctx& ctx) -{ - DescArea& ipd = descArea(Desc_usage_IPD); - if (ipd.getCount() < m_paramNumber) - ipd.setCount(ctx, m_paramNumber); - // XXX describe if possible - DescRec& rec = ipd.getRecord(m_paramNumber); -} - -Exec_base* -Plan_expr_param::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - SqlSpec sqlSpec(m_sqlType, SqlSpec::Physical); - // create code - Exec_expr_param* exec = new Exec_expr_param(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - ctx_assert(m_paramNumber != 0); - Exec_expr_param::Code& code = *new Exec_expr_param::Code(sqlSpec, m_paramNumber); - exec->setCode(code); - m_exec = exec; - return exec; -} - -void -Plan_expr_param::print(Ctx& ctx) -{ - ctx.print(" [param %u]", m_paramNumber); -} - -bool -Plan_expr_param::isEqual(const Plan_expr* expr) const -{ - ctx_assert(expr != 0); - if (expr->type() != Plan_expr::TypeParam) - return false; - const Plan_expr_param* expr2 = static_cast(expr); - // params are not equal ever - return false; -} - -bool -Plan_expr_param::isGroupBy(const Plan_expr_row* row) const -{ - // params are constants - return true; -} - -// Exec_expr_param - -Exec_expr_param::Code::~Code() -{ -} - -Exec_expr_param::Data::~Data() -{ - delete m_extField; - m_extField = 0; -} - -Exec_expr_param::~Exec_expr_param() -{ -} - -void -Exec_expr_param::alloc(Ctx& ctx, Ctl& ctl) -{ - if (m_data != 0) - return; - const Code& code = getCode(); - SqlField sqlField(code.sqlSpec()); - Data& data = *new Data(sqlField); - setData(data); -} - -void -Exec_expr_param::bind(Ctx& ctx) -{ - const Code& code = getCode(); - Data& data = getData(); - DescArea& apd = descArea(Desc_usage_APD); - if (apd.getCount() < code.m_paramNumber) { - ctx_log1(("parameter %u is not bound", code.m_paramNumber)); - return; - } - const unsigned paramNumber = code.m_paramNumber; - DescRec& rec = apd.getRecord(paramNumber); - OdbcData descData; - // create type - rec.getField(ctx, SQL_DESC_TYPE, descData); - if (descData.type() == OdbcData::Undef) { - ctx.pushStatus(Error::Gen, "parameter %u external type not defined", paramNumber); - return; - } - ExtType extType; - SQLSMALLINT desc_TYPE = descData.smallint(); - switch (desc_TYPE) { - case SQL_C_CHAR: - case SQL_C_SHORT: // for sun.jdbc.odbc - case SQL_C_SSHORT: - case SQL_C_USHORT: - case SQL_C_LONG: // for sun.jdbc.odbc - case SQL_C_SLONG: - case SQL_C_ULONG: - case SQL_C_SBIGINT: - case SQL_C_UBIGINT: - case SQL_C_FLOAT: - case SQL_C_DOUBLE: - case SQL_C_TYPE_TIMESTAMP: - case SQL_C_BINARY: // XXX BLOB hack - break; - default: - ctx.pushStatus(Error::Gen, "parameter %u unsupported external type %d", paramNumber, (int)desc_TYPE); - return; - } - extType.setType(ctx, static_cast(desc_TYPE)); - ExtSpec extSpec(extType); - // create data field - rec.getField(ctx, SQL_DESC_DATA_PTR, descData); - if (descData.type() == OdbcData::Undef) { - ctx.pushStatus(Error::Gen, "parameter %u data address not defined", paramNumber); - return; - } - SQLPOINTER desc_DATA_PTR = descData.pointer(); - rec.getField(ctx, SQL_DESC_OCTET_LENGTH, descData); - if (descData.type() == OdbcData::Undef) { - ctx.pushStatus(Error::Gen, "parameter %u data length not defined", paramNumber); - return; - } - SQLINTEGER desc_OCTET_LENGTH = descData.integer(); - rec.getField(ctx, SQL_DESC_INDICATOR_PTR, descData); - if (descData.type() == OdbcData::Undef) { - ctx.pushStatus(Error::Gen, "parameter %u indicator address not defined", paramNumber); - return; - } - SQLINTEGER* desc_INDICATOR_PTR = descData.integerPtr(); - ctx_log4(("parameter %u bind to 0x%x %d 0x%x", paramNumber, (unsigned)desc_DATA_PTR, (int)desc_OCTET_LENGTH, (unsigned)desc_INDICATOR_PTR)); - ExtField& extField = *new ExtField(extSpec, desc_DATA_PTR, desc_OCTET_LENGTH, desc_INDICATOR_PTR, paramNumber); - data.m_atExec = false; - if (desc_INDICATOR_PTR != 0 && *desc_INDICATOR_PTR < 0) { - if (*desc_INDICATOR_PTR == SQL_NULL_DATA) { - ; - } else if (*desc_INDICATOR_PTR == SQL_DATA_AT_EXEC) { - data.m_atExec = true; - } else if (*desc_INDICATOR_PTR <= SQL_LEN_DATA_AT_EXEC(0)) { - data.m_atExec = true; - } - } - delete data.m_extField; - data.m_extField = &extField; -} - -void -Exec_expr_param::evaluate(Ctx& ctx, Ctl& ctl) -{ - if (ctl.m_postEval) - return; - const Code& code = getCode(); - Data& data = getData(); - if (data.m_atExec) - return; - ctx_assert(data.m_extField != 0); - data.m_sqlField.copyin(ctx, *data.m_extField); -} - -void -Exec_expr_param::close(Ctx& ctx) -{ - Data& data = getData(); - data.m_extPos = -1; -} - -void -Exec_expr_param::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [param %u]", code.m_paramNumber); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp deleted file mode 100644 index 783e5c087b4..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp +++ /dev/null @@ -1,136 +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 ODBC_CODEGEN_Code_expr_param_hpp -#define ODBC_CODEGEN_Code_expr_param_hpp - -#include -#include -#include "Code_expr.hpp" - -/** - * @class Plan_expr_param - * @brief Constant expression value in PlanTree - */ -class Plan_expr_param : public Plan_expr { -public: - Plan_expr_param(Plan_root* root, unsigned paramNumber); - virtual ~Plan_expr_param(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - bool isEqual(const Plan_expr* expr) const; - bool isGroupBy(const Plan_expr_row* row) const; -protected: - const unsigned m_paramNumber; -}; - -inline -Plan_expr_param::Plan_expr_param(Plan_root* root, unsigned paramNumber) : - Plan_expr(root, TypeParam), - m_paramNumber(paramNumber) -{ -} - -/** - * @class Exec_expr_param - * @brief Constant expression value in ExecTree - */ -class Exec_expr_param : public Exec_expr { -public: - class Code : public Exec_expr::Code { - public: - Code(const SqlSpec& sqlSpec, unsigned paramNumber); - virtual ~Code(); - protected: - friend class Plan_expr_param; - friend class Exec_expr_param; - const SqlSpec m_sqlSpec; - const unsigned m_paramNumber; - }; - class Data : public Exec_expr::Data { - public: - Data(SqlField& sqlField); - virtual ~Data(); - ExtField* extField() const; - protected: - friend class Exec_expr_param; - friend class Exec_root; - SqlField m_sqlField; - ExtField* m_extField; // input binding - bool m_atExec; // data at exec - int m_extPos; // position for SQLPutData (-1 before first call) - }; - Exec_expr_param(Exec_root* root); - virtual ~Exec_expr_param(); - void alloc(Ctx& ctx, Ctl& ctl); - void bind(Ctx& ctx); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_expr_param::Code::Code(const SqlSpec& sqlSpec, unsigned paramNumber) : - Exec_expr::Code(m_sqlSpec), - m_sqlSpec(sqlSpec), - m_paramNumber(paramNumber) -{ -} - -inline -Exec_expr_param::Data::Data(SqlField& sqlField) : - Exec_expr::Data(m_sqlField), - m_sqlField(sqlField), - m_extField(0), - m_atExec(false), - m_extPos(-1) -{ -} - -inline ExtField* -Exec_expr_param::Data::extField() const -{ - return m_extField; -} - -inline -Exec_expr_param::Exec_expr_param(Exec_root* root) : - Exec_expr(root) -{ -} - -// children - -inline const Exec_expr_param::Code& -Exec_expr_param::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_param::Data& -Exec_expr_param::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp deleted file mode 100644 index da1751d41d1..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp +++ /dev/null @@ -1,204 +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 */ - -#include -#include "Code_expr_row.hpp" -#include "Code_expr.hpp" -#include "Code_expr_conv.hpp" -#include "Code_dml_row.hpp" -#include "Code_root.hpp" - -// Plan_expr_row - -Plan_expr_row::~Plan_expr_row() -{ -} - -Plan_base* -Plan_expr_row::analyze(Ctx& ctx, Ctl& ctl) -{ - unsigned size = getSize(); - // analyze subexpressions - m_anyAggr = false; - m_allBound = true; - for (unsigned i = 1; i <= size; i++) { - Plan_expr* expr1 = getExpr(i); - Plan_expr* expr2 = static_cast(expr1->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - setExpr(i, expr2); - if (expr2->isAggr()) - m_anyAggr = true; - if (! expr2->isBound()) - m_allBound = false; - } - // insert conversions if requested XXX ugly hack - if (ctl.m_dmlRow != 0) { - if (ctl.m_dmlRow->getSize() > getSize()) { - ctx.pushStatus(Sqlstate::_21S01, Error::Gen, "not enough values (%u > %u)", ctl.m_dmlRow->getSize(), getSize()); - return 0; - } - if (ctl.m_dmlRow->getSize() < getSize()) { - ctx.pushStatus(Sqlstate::_21S01, Error::Gen, "too many values (%u < %u)", ctl.m_dmlRow->getSize(), getSize()); - return 0; - } - for (unsigned i = 1; i <= size; i++) { - const SqlType& sqlType = ctl.m_dmlRow->getColumn(i)->sqlType(); - Plan_expr_conv* exprConv = new Plan_expr_conv(m_root, sqlType); - m_root->saveNode(exprConv); - exprConv->setExpr(getExpr(i)); - Plan_expr* expr = static_cast(exprConv->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(expr != 0); - setExpr(i, expr); - } - } - // set aliases - m_aliasList.resize(1 + size); - for (unsigned i = 1; i <= size; i++) { - if (m_aliasList[i].empty()) { - setAlias(i, getExpr(i)->getAlias()); - } - } - // node was not replaced - return this; -} - -Exec_base* -Plan_expr_row::codegen(Ctx& ctx, Ctl& ctl) -{ - unsigned size = getSize(); - Exec_expr_row* exec = new Exec_expr_row(ctl.m_execRoot, size); - ctl.m_execRoot->saveNode(exec); - SqlSpecs sqlSpecs(size); - // create code for subexpressions - for (unsigned i = 1; i <= size; i++) { - Plan_expr* planExpr = getExpr(i); - Exec_expr* execExpr = static_cast(planExpr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - exec->setExpr(i, execExpr); - const SqlSpec sqlSpec(execExpr->getCode().sqlSpec(), SqlSpec::Reference); - sqlSpecs.setEntry(i, sqlSpec); - } - // create alias list - Exec_expr_row::Code::Alias* aliasList = new Exec_expr_row::Code::Alias[1 + size]; - strcpy(aliasList[0], "?"); - for (unsigned i = 1; i <= size; i++) { - const char* s = m_aliasList[i].c_str(); - if (strlen(s) == 0) - s = getExpr(i)->getAlias().c_str(); - unsigned n = strlen(s); - if (n >= sizeof(Exec_expr_row::Code::Alias)) - n = sizeof(Exec_expr_row::Code::Alias) - 1; - strncpy(aliasList[i], s, n); - aliasList[i][n] = 0; - } - // create the code - Exec_expr_row::Code& code = *new Exec_expr_row::Code(sqlSpecs, aliasList); - exec->setCode(code); - return exec; -} - -void -Plan_expr_row::print(Ctx& ctx) -{ - const unsigned size = getSize(); - ctx.print(" [expr_row"); - for (unsigned i = 1; i <= size; i++) { - Plan_base* a = m_exprList[i]; - a == 0 ? ctx.print(" -") : a->print(ctx); - } - ctx.print("]"); -} - -bool -Plan_expr_row::isAllGroupBy(const Plan_expr_row* row) const -{ - const unsigned size = getSize(); - for (unsigned i = 1; i <= size; i++) { - if (! getExpr(i)->isGroupBy(row)) - return false; - } - return true; -} - -// Exec_expr_row - -Exec_expr_row::Code::~Code() -{ - delete[] m_aliasList; -} - -Exec_expr_row::Data::~Data() -{ -} - -Exec_expr_row::~Exec_expr_row() -{ - delete[] m_expr; -} - -void -Exec_expr_row::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate subexpressions - for (unsigned i = 1; i <= m_size; i++) { - getExpr(i)->alloc(ctx, ctl); - } - // construct SqlRow of references - const Code& code = getCode(); - SqlRow sqlRow(getCode().m_sqlSpecs); - for (unsigned i = 1; i <= m_size; i++) { - const Exec_expr::Data& dataExpr = getExpr(i)->getData(); - const SqlSpec& sqlSpec = code.m_sqlSpecs.getEntry(i); - const SqlField sqlField(sqlSpec, &dataExpr.sqlField()); - sqlRow.setEntry(i, sqlField); - } - // create the data - Data& data = *new Data(sqlRow); - setData(data); -} - -void -Exec_expr_row::evaluate(Ctx& ctx, Ctl& ctl) -{ - for (unsigned i = 1; i <= m_size; i++) { - getExpr(i)->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - } -} - -void -Exec_expr_row::close(Ctx& ctx) -{ - for (unsigned i = 1; i <= m_size; i++) { - getExpr(i)->close(ctx); - } -} - -void -Exec_expr_row::print(Ctx& ctx) -{ - ctx.print(" [expr_row"); - for (unsigned i = 1; i <= m_size; i++) { - getExpr(i)->print(ctx); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp deleted file mode 100644 index 94527931dba..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp +++ /dev/null @@ -1,272 +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 ODBC_CODEGEN_Code_expr_row_hpp -#define ODBC_CODEGEN_Code_expr_row_hpp - -#include -#include -#include -#include "Code_base.hpp" -#include "Code_expr.hpp" - -class Plan_expr; - -/** - * @class Plan_expr_row - * @brief Row of expressions in PlanTree - * - * Used for select, value, and order by rows. - */ -class Plan_expr_row : public Plan_base { -public: - Plan_expr_row(Plan_root* root); - virtual ~Plan_expr_row(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setAsterisk(); - bool getAsterisk() const; - unsigned getSize() const; - Plan_expr* getExpr(unsigned i) const; - void setExpr(unsigned i, Plan_expr* expr); - void addExpr(Plan_expr* expr); - void addExpr(Plan_expr* expr, const BaseString& alias); - void setAlias(unsigned i, const BaseString& alias); - void addExpr(Plan_expr* expr, bool asc); - bool anyAggr() const; - bool allBound() const; - bool isAllGroupBy(const Plan_expr_row* row) const; -protected: - friend class Plan_query; - friend class Plan_query_sort; - bool m_asterisk; // early plan node type - ExprVector m_exprList; - typedef std::vector AliasList; - AliasList m_aliasList; - typedef std::vector AscList; - AscList m_ascList; - bool m_anyAggr; // at least one aggreate - bool m_allBound; // all bound -}; - -inline -Plan_expr_row::Plan_expr_row(Plan_root* root) : - Plan_base(root), - m_asterisk(false), - m_exprList(1), - m_aliasList(1), - m_ascList(1), - m_anyAggr(false), - m_allBound(false) -{ -} - -// children - -inline void -Plan_expr_row::setAsterisk() -{ - m_asterisk = true; -} - -inline bool -Plan_expr_row::getAsterisk() const -{ - return m_asterisk; -} - -inline unsigned -Plan_expr_row::getSize() const -{ - ctx_assert(m_exprList.size() >= 1); - return m_exprList.size() - 1; -} - -inline void -Plan_expr_row::addExpr(Plan_expr* expr) -{ - ctx_assert(expr != 0); - addExpr(expr, expr->m_alias); -} - -inline void -Plan_expr_row::addExpr(Plan_expr* expr, const BaseString& alias) -{ - ctx_assert(expr != 0); - m_exprList.push_back(expr); - m_aliasList.push_back(alias); -} - -inline void -Plan_expr_row::addExpr(Plan_expr* expr, bool asc) -{ - ctx_assert(expr != 0); - m_exprList.push_back(expr); - m_ascList.push_back(asc); -} - -inline void -Plan_expr_row::setExpr(unsigned i, Plan_expr* expr) -{ - ctx_assert(1 <= i && i < m_exprList.size() && expr != 0); - m_exprList[i] = expr; -} - -inline Plan_expr* -Plan_expr_row::getExpr(unsigned i) const -{ - ctx_assert(1 <= i && i < m_exprList.size() && m_exprList[i] != 0); - return m_exprList[i]; -} - -inline void -Plan_expr_row::setAlias(unsigned i, const BaseString& alias) -{ - ctx_assert(1 <= i && i < m_aliasList.size()); - m_aliasList[i] = alias; -} - -inline bool -Plan_expr_row::anyAggr() const -{ - return m_anyAggr; -} - -inline bool -Plan_expr_row::allBound() const -{ - return m_allBound; -} - -/** - * @class Expr_expr_row - * @brief Row of expressions in ExecTree - */ -class Exec_expr_row : public Exec_base { -public: - class Code : public Exec_base::Code { - public: - typedef char Alias[40]; - Code(const SqlSpecs& sqlSpecs, const Alias* aliasList); - virtual ~Code(); - const SqlSpecs& sqlSpecs() const; - const char* getAlias(unsigned i) const; - protected: - friend class Exec_expr_row; - const SqlSpecs m_sqlSpecs; - const Alias* m_aliasList; - }; - class Data : public Exec_base::Data { - public: - Data(const SqlRow& sqlRow); - virtual ~Data(); - const SqlRow& sqlRow() const; - protected: - friend class Exec_expr_row; - SqlRow m_sqlRow; - }; - Exec_expr_row(Exec_root* root, unsigned size); - virtual ~Exec_expr_row(); - void alloc(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - Exec_expr* getExpr(unsigned i) const; - void setExpr(unsigned i, Exec_expr* expr); -protected: - Exec_expr** m_expr; // numbered from 1 - unsigned m_size; -}; - -inline -Exec_expr_row::Code::Code(const SqlSpecs& sqlSpecs, const Alias* aliasList) : - m_sqlSpecs(sqlSpecs), - m_aliasList(aliasList) -{ -} - -inline const SqlSpecs& -Exec_expr_row::Code::sqlSpecs() const -{ - return m_sqlSpecs; -} - -inline const char* -Exec_expr_row::Code::getAlias(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_sqlSpecs.count() && m_aliasList != 0); - return m_aliasList[i]; -} - -inline -Exec_expr_row::Data::Data(const SqlRow& sqlRow) : - m_sqlRow(sqlRow) -{ -} - -inline const SqlRow& -Exec_expr_row::Data::sqlRow() const -{ - return m_sqlRow; -} - -inline -Exec_expr_row::Exec_expr_row(Exec_root* root, unsigned size) : - Exec_base(root), - m_expr(new Exec_expr* [1 + size]), - m_size(size) -{ - m_expr[0] = (Exec_expr*)-1; - for (unsigned i = 1; i <= m_size; i++) - m_expr[i] = 0; -} - -// children - -inline const Exec_expr_row::Code& -Exec_expr_row::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_expr_row::Data& -Exec_expr_row::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline Exec_expr* -Exec_expr_row::getExpr(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_size && m_expr != 0 && m_expr[i] != 0); - return m_expr[i]; -} - -inline void -Exec_expr_row::setExpr(unsigned i, Exec_expr* expr) -{ - ctx_assert(1 <= i && i <= m_size && m_expr != 0 && m_expr[i] == 0); - m_expr[i] = expr; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp deleted file mode 100644 index 584ffef3e01..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp +++ /dev/null @@ -1,49 +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 */ - -#include -#include -#include "Code_idx_column.hpp" -#include "Code_expr_conv.hpp" -#include "Code_root.hpp" - -// Plan_idx_column - -Plan_idx_column::~Plan_idx_column() -{ -} - -Plan_base* -Plan_idx_column::analyze(Ctx& ctx, Ctl& ctl) -{ - analyzeColumn(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_idx_column::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_idx_column::print(Ctx& ctx) -{ - ctx.print(" [idx_column %s]", getPrintName()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp deleted file mode 100644 index 209ed705b48..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp +++ /dev/null @@ -1,50 +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 ODBC_CODEGEN_Code_idx_column_hpp -#define ODBC_CODEGEN_Code_idx_column_hpp - -#include -#include "Code_column.hpp" -#include "Code_data_type.hpp" -#include "Code_expr.hpp" - -class DictColumn; -class Plan_table; - -/** - * @class Plan_idx_column - * @brief Column in create index statement - */ -class Plan_idx_column : public Plan_base, public Plan_column { -public: - Plan_idx_column(Plan_root* root, const BaseString& name); - virtual ~Plan_idx_column(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); -protected: - friend class Plan_create_row; -}; - -inline -Plan_idx_column::Plan_idx_column(Plan_root* root, const BaseString& name) : - Plan_base(root), - Plan_column(Type_idx, name) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp b/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp deleted file mode 100644 index c442186c181..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp +++ /dev/null @@ -1,253 +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 */ - -#include -#include -#include -#include "Code_insert.hpp" -#include "Code_query_repeat.hpp" -#include "Code_query_project.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -// Plan_insert - -Plan_insert::~Plan_insert() -{ -} - -Plan_base* -Plan_insert::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_insert); - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - // handle MySql syntax - if (m_mysqlRow != 0) { - setDmlRow(m_mysqlRow->m_dmlRow); - setExprRow(m_mysqlRow->m_exprRow); - m_mysqlRow = 0; - } - if (m_dmlRow == 0) { - // construct column list - setDmlRow(new Plan_dml_row(m_root)); - m_root->saveNode(m_dmlRow); - const DictTable& dictTable = m_table->dictTable(); - unsigned n = dictTable.getSize(); - for (unsigned i = 1; i <= n; i++) { - DictColumn* dictColumn = dictTable.getColumn(i); - Plan_dml_column* column = new Plan_dml_column(m_root, dictColumn->getName()); - m_root->saveNode(column); - m_dmlRow->addColumn(column); - } - } - // set name resolution scope - ctl.m_tableList.resize(1 + 1); // indexed from 1 - ctl.m_tableList[1] = m_table; - // analyze the dml columns - m_dmlRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctl.m_dmlRow = m_dmlRow; // row type to convert to - if (m_query != 0) { - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } else if (m_select == 0) { - // analyze the expression row - m_exprRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - // transform the row into query - Plan_query_repeat* queryRepeat = new Plan_query_repeat(m_root, 1); - m_root->saveNode(queryRepeat); - Plan_query_project* queryProject = new Plan_query_project(m_root); - m_root->saveNode(queryProject); - queryProject->setQuery(queryRepeat); - queryProject->setRow(m_exprRow); - setQuery(queryProject); - } else { - // analyze the select into query - Plan_query* query = static_cast(m_select->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - setQuery(query); - } - return this; -} - -void -Plan_insert::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "INSERT", SQL_DIAG_INSERT); -} - -Exec_base* -Plan_insert::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the query - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // set up - ctx_assert(m_table != 0); - const BaseString& tableName = m_table->getName(); - const DictTable& dictTable = m_table->dictTable(); - const ColumnVector& columns = m_table->dmlColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_insert::Code& code = *new Exec_insert::Code(); - code.m_insertOp = m_insertOp; - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - code.m_attrCount = attrCount; - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_isKey = new bool[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - code.m_tupleId = dictTable.tupleId(); // maybe 0 - code.m_autoIncrement = dictTable.autoIncrement(); // maybe 0 - unsigned k; - if ((k = code.m_tupleId) != 0 || (k = code.m_autoIncrement) != 0) { - const DictColumn& dictColumn = *dictTable.getColumn(k); - code.m_idType = dictColumn.sqlType(); - } - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - code.m_attrId[i] = dictColumn.getAttrId(); - code.m_isKey[i] = dictColumn.isKey(); - } - // default values XXX a mess - code.m_defaultCount = 0; - for (unsigned j = 1; j <= dictTable.getSize(); j++) { - const DictColumn& dictColumn = *dictTable.getColumn(j); - if (dictColumn.getDefaultValue() != 0 && ! code.findAttrId(dictColumn.getAttrId())) - code.m_defaultCount++; - } - if (code.m_defaultCount != 0) { - code.m_defaultId = new NdbAttrId[1 + code.m_defaultCount]; - for (unsigned i = 0, j = 1; j <= dictTable.getSize(); j++) { - const DictColumn& dictColumn = *dictTable.getColumn(j); - if (dictColumn.getDefaultValue() != 0 && ! code.findAttrId(dictColumn.getAttrId())) - code.m_defaultId[++i] = dictColumn.getAttrId(); - } - SqlSpecs sqlSpecs(code.m_defaultCount); - for (unsigned i = 0, j = 1; j <= dictTable.getSize(); j++) { - const DictColumn& dictColumn = *dictTable.getColumn(j); - if (dictColumn.getDefaultValue() != 0 && ! code.findAttrId(dictColumn.getAttrId())) { - SqlSpec sqlSpec(dictColumn.sqlType(), SqlSpec::Physical); - sqlSpecs.setEntry(++i, sqlSpec); - } - } - code.m_defaultValue = new SqlRow(sqlSpecs); - for (unsigned i = 0, j = 1; j <= dictTable.getSize(); j++) { - const DictColumn& dictColumn = *dictTable.getColumn(j); - if (dictColumn.getDefaultValue() != 0 && ! code.findAttrId(dictColumn.getAttrId())) { - const char* defaultValue = dictColumn.getDefaultValue(); - ExtType extType(ExtType::Char); - ExtSpec extSpec(extType); - SQLINTEGER ind = SQL_NTS; - ExtField extField(extSpec, (SQLPOINTER)defaultValue, 0, &ind); - SqlField& f = code.m_defaultValue->getEntry(++i); - f.copyin(ctx, extField); - if (! ctx.ok()) - return 0; - } - } - } - // create the exec - Exec_insert* exec = new Exec_insert(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_insert::print(Ctx& ctx) -{ - ctx.print(" [%s", m_insertOp == Insert_op_insert ? "insert" : "write"); - Plan_base* a[] = { m_table, m_dmlRow, m_exprRow, m_query }; - printList(ctx, a, 4); - ctx.print("]"); -} - -// Exec_insert - -Exec_insert::Code::~Code() -{ - delete[] m_tableName; - delete[] m_attrId; - delete[] m_isKey; - delete[] m_defaultId; - delete m_defaultValue; -} - -bool -Exec_insert::Code::findAttrId(NdbAttrId attrId) const -{ - for (unsigned i = 1; i <= m_attrCount; i++) { - if (m_attrId[i] == attrId) - return true; - } - return false; -} - -Exec_insert::Data::~Data() -{ -} - -Exec_insert::~Exec_insert() -{ -} - -void -Exec_insert::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the query - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - // create data - Data& data = *new Data(); - setData(data); -} - -void -Exec_insert::close(Ctx& ctx) -{ -} - -void -Exec_insert::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx_assert(m_query != 0); - ctx.print(" [insert"); - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - ctx.print(" table=%s", code.m_tableName); - m_query->print(ctx); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp b/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp deleted file mode 100644 index 748b092e33a..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp +++ /dev/null @@ -1,229 +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 ODBC_CODEGEN_Code_insert_hpp -#define ODBC_CODEGEN_Code_insert_hpp - -#include -#include "Code_base.hpp" -#include "Code_dml.hpp" -#include "Code_dml_row.hpp" -#include "Code_expr_row.hpp" -#include "Code_select.hpp" -#include "Code_query.hpp" -#include "Code_table.hpp" -#include "Code_set_row.hpp" - -enum Insert_op { - Insert_op_undef = 0, - Insert_op_insert = 1, - Insert_op_write = 2 -}; - -/** - * @class Plan_insert - * @brief Insert in PlanTree - * - * Insert. Becomes directly executable. - */ -class Plan_insert : public Plan_dml { -public: - Plan_insert(Plan_root* root, Insert_op insertOp); - virtual ~Plan_insert(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); - Plan_dml_row* getDmlRow() const; - void setDmlRow(Plan_dml_row* dmlRow); - void setExprRow(Plan_expr_row* exprRow); - void setSelect(Plan_select* select); - void setQuery(Plan_query* query); - void setMysqlRow(Plan_set_row* mysqlRow); -protected: - Insert_op m_insertOp; - Plan_table* m_table; - Plan_dml_row* m_dmlRow; - Plan_expr_row* m_exprRow; - Plan_select* m_select; - Plan_query* m_query; - Plan_set_row* m_mysqlRow; -}; - -inline -Plan_insert::Plan_insert(Plan_root* root, Insert_op insertOp) : - Plan_dml(root), - m_insertOp(insertOp), - m_table(0), - m_dmlRow(0), - m_exprRow(0), - m_select(0), - m_query(0), - m_mysqlRow(0) -{ -} - -// children - -inline void -Plan_insert::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline void -Plan_insert::setDmlRow(Plan_dml_row* dmlRow) -{ - ctx_assert(dmlRow != 0); - m_dmlRow = dmlRow; -} - -inline Plan_dml_row* -Plan_insert::getDmlRow() const -{ - ctx_assert(m_dmlRow != 0); - return m_dmlRow; -} - -inline void -Plan_insert::setExprRow(Plan_expr_row* exprRow) -{ - ctx_assert(exprRow != 0); - m_exprRow = exprRow; -} - -inline void -Plan_insert::setSelect(Plan_select* select) -{ - ctx_assert(select != 0); - m_select = select; -} - -inline void -Plan_insert::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_insert::setMysqlRow(Plan_set_row* mysqlRow) -{ - ctx_assert(mysqlRow != 0); - m_mysqlRow = mysqlRow; -} - -/** - * @class Exec_insert - * @brief Executable insert - */ -class Exec_insert : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(); - virtual ~Code(); - protected: - friend class Plan_insert; - friend class Exec_insert; - Insert_op m_insertOp; - char* m_tableName; - unsigned m_attrCount; - NdbAttrId* m_attrId; - bool* m_isKey; - unsigned m_tupleId; // position of tuple id - unsigned m_autoIncrement; // position of ai key - SqlType m_idType; // type of tuple id or ai key - unsigned m_defaultCount; - NdbAttrId* m_defaultId; - SqlRow* m_defaultValue; - bool findAttrId(NdbAttrId attrId) const; - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_insert; - }; - Exec_insert(Exec_root* root); - virtual ~Exec_insert(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -private: - Exec_query* m_query; -}; - -inline -Exec_insert::Code::Code() : - m_insertOp(Insert_op_undef), - m_tableName(0), - m_attrCount(0), - m_attrId(0), - m_isKey(0), - m_tupleId(0), - m_autoIncrement(0), - m_defaultCount(0), - m_defaultId(0), - m_defaultValue(0) -{ -} - -inline -Exec_insert::Data::Data() -{ -} - -inline -Exec_insert::Exec_insert(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_insert::Code& -Exec_insert::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_insert::Data& -Exec_insert::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_insert::setQuery(Exec_query* query) -{ - ctx_assert(m_query == 0 && query != 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp b/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp deleted file mode 100644 index fe7cac7606e..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp +++ /dev/null @@ -1,70 +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 */ - -#include "Code_pred.hpp" -#include "Code_pred_op.hpp" -#include "Code_root.hpp" - -// Plan_pred - -Plan_pred::~Plan_pred() -{ -} - -bool -Plan_pred::isGroupBy(const Plan_expr_row* row) const -{ - return false; -} - -Plan_pred* -Plan_pred::opAnd(Plan_pred* pred2) -{ - Plan_pred_op* predAnd = new Plan_pred_op(m_root, Pred_op::And); - m_root->saveNode(predAnd); - predAnd->setPred(1, this); - predAnd->setPred(2, pred2); - return predAnd; -} - -// Exec_pred - -Exec_pred::Code::~Code() -{ -} - -Exec_pred::Data::~Data() -{ -} - -Exec_pred::~Exec_pred() -{ -} - -Pred_value& -Exec_pred::Data::groupValue(unsigned i, bool initFlag) -{ - if (m_groupValue.size() == 0) { - m_groupValue.resize(1); - } - if (initFlag) { - //unsigned i2 = m_groupValue.size(); - //ctx_assert(i == i2); - m_groupValue.push_back(Pred_value_unknown); - } - ctx_assert(i != 0 && i < m_groupValue.size()); - return m_groupValue[i]; -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp b/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp deleted file mode 100644 index a77c1161fa1..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp +++ /dev/null @@ -1,172 +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 ODBC_CODEGEN_Code_pred_hpp -#define ODBC_CODEGEN_Code_pred_hpp - -#include -#include -#include "Code_base.hpp" - -enum Pred_value { - Pred_value_unknown = -1, - Pred_value_false = 0, - Pred_value_true = 1 -}; - -class Ctx; -class Plan_expr_row; -class Exec_pred; - -/** - * @class Plan_pred - * @brief Base class for predicates in PlanTree - * - * Predicate represents a boolean value. - */ -class Plan_pred : public Plan_base { -public: - // type is convenient since RTTI cannot be used - enum Type { - TypeUndefined = 0, - TypeComp = 1, - TypeOp = 2 - }; - Plan_pred(Plan_root* root, Type type); - virtual ~Plan_pred() = 0; - Type type() const; - const TableSet& tableSet() const; - const TableSet& noInterp() const; - virtual bool isGroupBy(const Plan_expr_row* row) const; - // helpers - Plan_pred* opAnd(Plan_pred* pred2); -protected: - const Type m_type; - TableSet m_tableSet; // depends on these tables - TableSet m_noInterp; // cannot use interpreted TUP program on these tables - Exec_pred* m_exec; // probably stupid -}; - -inline -Plan_pred::Plan_pred(Plan_root* root, Type type) : - Plan_base(root), - m_type(type), - m_exec(0) -{ -} - -inline Plan_pred::Type -Plan_pred::type() const -{ - return m_type; -} - -inline const Plan_pred::TableSet& -Plan_pred::tableSet() const -{ - return m_tableSet; -} - -inline const Plan_pred::TableSet& -Plan_pred::noInterp() const -{ - return m_noInterp; -} - -/** - * @class Exec_pred - * @brief Base class for predicates in ExecTree - */ -class Exec_pred : public Exec_base { -public: - class Code : public Exec_base::Code { - public: - Code(); - virtual ~Code() = 0; - protected: - friend class Exec_pred; - }; - class Data : public Exec_base::Data { - public: - Data(); - virtual ~Data() = 0; - Pred_value getValue() const; - Pred_value groupValue(unsigned i) const; - protected: - friend class Exec_pred; - Pred_value m_value; // the value - // group-by data - typedef std::vector GroupValue; - GroupValue m_groupValue; - Pred_value& groupValue(unsigned i, bool initFlag); - }; - Exec_pred(Exec_root* root); - virtual ~Exec_pred() = 0; - virtual void execInterp(Ctx& ctx, Ctl& ctl) = 0; - virtual void evaluate(Ctx& ctx, Ctl& ctl) = 0; - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_pred::Code::Code() -{ -} - -inline -Exec_pred::Data::Data() : - m_value(Pred_value_unknown) -{ -} - -inline Pred_value -Exec_pred::Data::getValue() const -{ - return m_value; -} - -inline Pred_value -Exec_pred::Data::groupValue(unsigned i) const -{ - ctx_assert(i != 0 && i < m_groupValue.size()); - return m_groupValue[i]; -} - -inline -Exec_pred::Exec_pred(Exec_root* root) : - Exec_base(root) -{ -} - -// children - -inline const Exec_pred::Code& -Exec_pred::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_pred::Data& -Exec_pred::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp b/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp deleted file mode 100644 index 29736e45818..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp +++ /dev/null @@ -1,188 +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 */ - -#include "Code_pred.hpp" -#include "Code_pred_op.hpp" -#include "Code_root.hpp" - -// Pred_op - -const char* -Pred_op::name() const -{ - switch (m_opcode) { - case And: - return "and"; - case Or: - return "or"; - case Not: - return "not"; - } - ctx_assert(false); - return ""; -} - -unsigned -Pred_op::arity() const -{ - switch (m_opcode) { - case And: - case Or: - return 2; - case Not: - return 1; - } - ctx_assert(false); - return 0; -} - -// Plan_pred_op - -Plan_pred_op::~Plan_pred_op() -{ -} - -Plan_base* -Plan_pred_op::analyze(Ctx& ctx, Ctl& ctl) -{ - m_exec = 0; - unsigned arity = m_op.arity(); - // check if we remain in top-level AND-clause - const bool topand = ctl.m_topand; - if (m_op.m_opcode != Pred_op::And) - ctl.m_topand = false; - // analyze sub-predicates - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_pred[i] != 0); - m_pred[i]->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // save top level predicate on list - if (topand && ! ctl.m_topand) { - ctl.m_topcomp.push_back(this); - } - ctl.m_topand = topand; - // table dependencies are union from operands - m_tableSet.clear(); - for (unsigned i = 1; i <= arity; i++) { - const TableSet& ts = m_pred[i]->tableSet(); - m_tableSet.insert(ts.begin(), ts.end()); - } - // set of tables for which interpreter cannot be used - m_noInterp.clear(); - for (unsigned i = 1; i <= arity; i++) { - const TableSet& ts = m_pred[i]->noInterp(); - m_noInterp.insert(ts.begin(), ts.end()); - } - return this; -} - -Exec_base* -Plan_pred_op::codegen(Ctx& ctx, Ctl& ctl) -{ - if (m_exec != 0) - return m_exec; - unsigned arity = m_op.arity(); - Exec_pred_op* exec = new Exec_pred_op(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // create code for operands - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_pred[i] != 0); - Exec_pred* execPred = static_cast(m_pred[i]->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execPred != 0); - exec->setPred(i, execPred); - } - // create the code - Exec_pred_op::Code& code = *new Exec_pred_op::Code(m_op); - exec->setCode(code); - m_exec = exec; - return exec; -} - -void -Plan_pred_op::print(Ctx& ctx) -{ - ctx.print(" [%s", m_op.name()); - Plan_base* a[] = { m_pred[1], m_pred[2] }; - printList(ctx, a, m_op.arity()); - ctx.print("]"); -} - -bool -Plan_pred_op::isGroupBy(const Plan_expr_row* row) const -{ - const unsigned arity = m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_pred[i] != 0); - if (! m_pred[i]->isGroupBy(row)) - return false; - } - return true; -} - -// Code_pred_op - -Exec_pred_op::Code::~Code() -{ -} - -Exec_pred_op::Data::~Data() -{ -} - -Exec_pred_op::~Exec_pred_op() -{ -} - -void -Exec_pred_op::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // allocate sub-predicates - unsigned arity = code.m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_pred[i] != 0); - m_pred[i]->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - Data& data = *new Data; - setData(data); -} - -void -Exec_pred_op::close(Ctx& ctx) -{ - const Code& code = getCode(); - unsigned arity = code.m_op.arity(); - for (unsigned i = 1; i <= arity; i++) { - ctx_assert(m_pred[i] != 0); - m_pred[i]->close(ctx); - } -} - -void -Exec_pred_op::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [%s", code.m_op.name()); - Exec_base* a[] = { m_pred[1], m_pred[2] }; - printList(ctx, a, code.m_op.arity()); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp b/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp deleted file mode 100644 index 9130bc3cb81..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp +++ /dev/null @@ -1,158 +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 ODBC_CODEGEN_Code_pred_op_hpp -#define ODBC_CODEGEN_Code_pred_op_hpp - -#include -#include -#include "Code_pred.hpp" - -/** - * @class Pred_op - * @brief Boolean operators - */ -struct Pred_op { - enum Opcode { - And = 1, // binary - Or, - Not // unary - }; - Pred_op(Opcode opcode); - const char* name() const; - unsigned arity() const; - Opcode m_opcode; -}; - -inline -Pred_op::Pred_op(Opcode opcode) : - m_opcode(opcode) -{ -} - -/** - * @class Plan_pred_op - * @brief Operator node in a predicate in PlanTree - */ -class Plan_pred_op : public Plan_pred { -public: - Plan_pred_op(Plan_root* root, Pred_op op); - virtual ~Plan_pred_op(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - bool isGroupBy(const Plan_expr_row* row) const; - // children - void setPred(unsigned i, Plan_pred* pred); -protected: - friend class Plan_pred; - Pred_op m_op; - Plan_pred* m_pred[1 + 2]; -}; - -inline -Plan_pred_op::Plan_pred_op(Plan_root* root, Pred_op op) : - Plan_pred(root, TypeOp), - m_op(op) -{ - m_pred[0] = m_pred[1] = m_pred[2] = 0; -} - -inline void -Plan_pred_op::setPred(unsigned i, Plan_pred* pred) -{ - ctx_assert(1 <= i && i <= m_op.arity() && pred != 0); - m_pred[i] = pred; -} - -/** - * @class Exec_pred_op - * @brief Operator node in a predicate in ExecTree - */ -class Exec_pred_op : public Exec_pred { -public: - class Code : public Exec_pred::Code { - public: - Code(Pred_op op); - virtual ~Code(); - protected: - friend class Exec_pred_op; - Pred_op m_op; - }; - class Data : public Exec_pred::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_pred_op; - }; - Exec_pred_op(Exec_root* root); - virtual ~Exec_pred_op(); - void alloc(Ctx& ctx, Ctl& ctl); - void execInterp(Ctx& ctx, Ctl& ctl); - void evaluate(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setPred(unsigned i, Exec_pred* pred); -protected: - Exec_pred* m_pred[1 + 2]; -}; - -inline -Exec_pred_op::Code::Code(Pred_op op) : - m_op(op) -{ -} - -inline -Exec_pred_op::Data::Data() -{ -} - -inline -Exec_pred_op::Exec_pred_op(Exec_root* root) : - Exec_pred(root) -{ - m_pred[0] = m_pred[1] = m_pred[2] = 0; -} - -// children - -inline const Exec_pred_op::Code& -Exec_pred_op::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_pred_op::Data& -Exec_pred_op::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_pred_op::setPred(unsigned i, Exec_pred* pred) -{ - ctx_assert(1 <= i && i <= 2 && m_pred[i] == 0); - m_pred[i] = pred; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query.cpp deleted file mode 100644 index 9e983942601..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query.cpp +++ /dev/null @@ -1,299 +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 */ - -#include -#include "Code_query.hpp" -#include "Code_query_project.hpp" -#include "Code_query_count.hpp" - -// Plan_query - -Plan_query::~Plan_query() -{ -} - -Plan_expr_row* -Plan_query::getRow() -{ - ctx_assert(false); - return 0; -} - -void -Plan_query::describe(Ctx& ctx) -{ - const Plan_expr_row* exprRow = getRow(); - const unsigned count = exprRow->getSize(); - // create IRD - DescArea& ird = descArea(Desc_usage_IRD); - ird.setCount(ctx, count); - for (unsigned i = 1; i <= count; i++) { - DescRec& rec = ird.getRecord(i); - const Plan_expr* expr = exprRow->m_exprList[i]; - const SqlType& sqlType = expr->sqlType(); - // data type - SQLSMALLINT desc_TYPE = sqlType.type(); - rec.setField(SQL_DESC_TYPE, desc_TYPE); - SQLSMALLINT desc_CONCISE_TYPE = desc_TYPE; - rec.setField(SQL_DESC_CONCISE_TYPE, desc_CONCISE_TYPE); - SQLSMALLINT desc_DESC_DATETIME_INTERVAL_CODE = 0; - rec.setField(SQL_DESC_DATETIME_INTERVAL_CODE, desc_DESC_DATETIME_INTERVAL_CODE); - // nullable - SQLSMALLINT desc_NULLABLE = sqlType.nullable() ? SQL_NULLABLE : SQL_NO_NULLS; - rec.setField(SQL_DESC_NULLABLE, desc_NULLABLE); - // unsigned - SQLSMALLINT desc_UNSIGNED; - switch (sqlType.type()) { - case SQL_SMALLINT: - case SQL_INTEGER: - case SQL_BIGINT: - desc_UNSIGNED = sqlType.unSigned() ? SQL_TRUE : SQL_FALSE; - break; - default: - desc_UNSIGNED = SQL_TRUE; // thus spake microsoft - break; - } - rec.setField(SQL_DESC_UNSIGNED, desc_UNSIGNED); - // sizes - SQLUINTEGER desc_LENGTH = sqlType.length(); - rec.setField(SQL_DESC_LENGTH, desc_LENGTH); - SQLINTEGER desc_OCTET_LENGTH = sqlType.size(); - rec.setField(SQL_DESC_OCTET_LENGTH, desc_OCTET_LENGTH); - SQLINTEGER desc_DISPLAY_SIZE = sqlType.displaySize(); - rec.setField(SQL_DESC_DISPLAY_SIZE, desc_DISPLAY_SIZE); - // name - ctx_assert(i < exprRow->m_aliasList.size()); - const char* desc_NAME = exprRow->m_aliasList[i].c_str(); - rec.setField(SQL_DESC_NAME, desc_NAME); - } - ctx_log3(("describe %u columns done", count)); - stmtArea().setFunction(ctx, "SELECT CURSOR", SQL_DIAG_SELECT_CURSOR); -} - -// Exec_query - -Exec_query::Code::~Code() -{ -} - -Exec_query::Data::~Data() -{ - delete m_extRow; - m_extRow = 0; - delete[] m_extPos; - m_extPos = 0; -} - -Exec_query::~Exec_query() -{ -} - -const Exec_query* -Exec_query::getRawQuery() const -{ - ctx_assert(false); - return 0; -} - -void -Exec_query::bind(Ctx& ctx) -{ - const Code& code = getCode(); - const SqlSpecs& sqlSpecs = code.sqlSpecs(); - const unsigned count = sqlSpecs.count(); - // read ARD - DescArea& ard = descArea(Desc_usage_ARD); - const unsigned ardCount = ard.getCount(); - // create specification row - ExtSpecs extSpecs(count); - for (unsigned i = 1; i <= count; i++) { - ExtType extType; - if (i <= ardCount) { - OdbcData descData; - DescRec& rec = ard.getRecord(i); - // check for unbound column - rec.getField(ctx, SQL_DESC_DATA_PTR, descData); - SQLPOINTER desc_DATA_PTR = descData.type() != OdbcData::Undef ? descData.pointer() : 0; - if (desc_DATA_PTR == 0) { - extType.setType(ctx, ExtType::Unbound); - } else { - rec.getField(ctx, SQL_DESC_TYPE, descData); - if (descData.type() == OdbcData::Undef) { - ctx.pushStatus(Error::Gen, "query column %u: external type not defined", i); - return; - } - SQLSMALLINT desc_TYPE = descData.smallint(); - if (desc_TYPE == SQL_C_DEFAULT) { - if (i <= code.m_sqlSpecs.count()) - desc_TYPE = code.m_sqlSpecs.getEntry(i).sqlType().sqlcdefault(ctx); - } - switch (desc_TYPE) { - case SQL_C_CHAR: - case SQL_C_BINARY: - case SQL_C_SHORT: // for sun.jdbc.odbc - case SQL_C_SSHORT: - case SQL_C_USHORT: - case SQL_C_LONG: // for sun.jdbc.odbc - case SQL_C_SLONG: - case SQL_C_ULONG: - case SQL_C_SBIGINT: - case SQL_C_UBIGINT: - case SQL_C_FLOAT: - case SQL_C_DOUBLE: - case SQL_C_TYPE_TIMESTAMP: - break; - default: - ctx.pushStatus(Error::Gen, "query column %u: unsupported external type %d", i, (int)desc_TYPE); - return; - } - extType.setType(ctx, static_cast(desc_TYPE)); - } - } else { - extType.setType(ctx, ExtType::Unbound); - } - const ExtSpec extSpec(extType); - extSpecs.setEntry(i, extSpec); - } - // create data row - ExtRow& extRow = *new ExtRow(extSpecs); - unsigned boundCount = 0; - for (unsigned i = 1; i <= count; i++) { - const ExtSpec& extSpec = extSpecs.getEntry(i); - if (extSpec.extType().type() != ExtType::Unbound) { - OdbcData descData; - DescRec& rec = ard.getRecord(i); - rec.getField(ctx, SQL_DESC_DATA_PTR, descData); - SQLPOINTER desc_DATA_PTR = descData.type() != OdbcData::Undef ? descData.pointer() : 0; - rec.getField(ctx, SQL_DESC_OCTET_LENGTH, descData); - SQLINTEGER desc_OCTET_LENGTH = descData.type() != OdbcData::Undef ? descData.integer() : 0; - rec.getField(ctx, SQL_DESC_INDICATOR_PTR, descData); - SQLINTEGER* desc_INDICATOR_PTR = descData.type() != OdbcData::Undef ? descData.integerPtr() : 0; - ctx_log4(("column %u: bind to 0x%x %d 0x%x", i, (unsigned)desc_DATA_PTR, (int)desc_OCTET_LENGTH, (unsigned)desc_INDICATOR_PTR)); - ExtField extField(extSpec, desc_DATA_PTR, desc_OCTET_LENGTH, desc_INDICATOR_PTR, i); - extRow.setEntry(i, extField); - boundCount++; - } else { - ExtField extField(extSpec, i); - extRow.setEntry(i, extField); - } - } - Data& data = getData(); - delete data.m_extRow; - data.m_extRow = &extRow; - ctx_log3(("bound %u out of %u columns", boundCount, count)); -} - -// execute and fetch - -void -Exec_query::execute(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - execImpl(ctx, ctl); - if (! ctx.ok()) - return; - data.initState(); - if (m_topLevel) { - stmtArea().setRowCount(ctx, data.getCount()); - } -} - -bool -Exec_query::fetch(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - if (data.fetch(ctx, ctl)) { - if (m_topLevel) { - stmtArea().setRowCount(ctx, data.getCount()); - } - if (data.m_extRow != 0) { - data.sqlRow().copyout(ctx, *data.m_extRow); - if (! ctx.ok()) - return false; - } - if (data.m_extPos != 0) { - const unsigned count = code.sqlSpecs().count(); - for (unsigned i = 0; i <= count; i++) { - data.m_extPos[i] = 0; - } - } - return true; - } - if (m_topLevel) { - stmtArea().setRowCount(ctx, data.getCount()); - if (ctx.ok()) { - ctx.setCode(SQL_NO_DATA); - } - } - return false; -} - -// odbc support - -void -Exec_query::sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind) -{ - const Code& code = getCode(); - Data& data = getData(); - const SqlSpecs& sqlSpecs = code.m_sqlSpecs; - const unsigned count = sqlSpecs.count(); - if (columnNumber == 0 || columnNumber > count) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "column index %u is not within 1 to %u", (unsigned)columnNumber, count); - return; - } - // create positions array on first use - if (data.m_extPos == 0) { - data.m_extPos = new int[1 + count]; - for (unsigned i = 0; i <= count; i++) { - data.m_extPos[i] = 0; - } - } - if (targetType == SQL_ARD_TYPE) { - // get type from ARD - DescArea& ard = descArea(Desc_usage_ARD); - const unsigned ardCount = ard.getCount(); - if (columnNumber <= ardCount) { - OdbcData descData; - DescRec& rec = ard.getRecord(columnNumber); - rec.getField(ctx, SQL_DESC_CONCISE_TYPE, descData); - if (descData.type() != OdbcData::Undef) { - targetType = descData.smallint(); - } - } - if (targetType == SQL_ARD_TYPE) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "output column %u type not bound - cannot use SQL_ARD_TYPE", (unsigned)columnNumber); - return; - } - } - ExtType extType; - if (targetValue != 0) { - extType.setType(ctx, static_cast(targetType)); - // check if supported - if (! ctx.ok()) - return; - } else { - extType.setType(ctx, ExtType::Unbound); - } - ExtSpec extSpec(extType); - ExtField extField(extSpec, targetValue, bufferLength, strlen_or_Ind, columnNumber); - // copy out and update position - extField.setPos(data.m_extPos[columnNumber]); - const SqlRow& sqlRow = data.sqlRow(); - const SqlField& sqlField = sqlRow.getEntry(columnNumber); - sqlField.copyout(ctx, extField); - data.m_extPos[columnNumber] = extField.getPos(); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query.hpp deleted file mode 100644 index 97f98f859ff..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query.hpp +++ /dev/null @@ -1,155 +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 ODBC_CODEGEN_Code_query_hpp -#define ODBC_CODEGEN_Code_query_hpp - -#include -#include -#include -#include "Code_stmt.hpp" - -class Plan_expr_row; -class Plan_table; -class Exec_expr_row; - -/** - * @class Plan_query - * @brief Base class for queries in PlanTree - */ -class Plan_query : public Plan_stmt { -public: - Plan_query(Plan_root* root); - virtual ~Plan_query() = 0; - void describe(Ctx& ctx); - virtual Plan_expr_row* getRow(); -}; - -inline -Plan_query::Plan_query(Plan_root* root) : - Plan_stmt(root) -{ -} - -/** - * @class Exec_query - * @brief Base class for executable queries. - * - * Executable queriable statement. - */ -class Exec_query : public Exec_stmt { -public: - class Code : public Exec_stmt::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code() = 0; - const SqlSpecs& sqlSpecs() const; - protected: - friend class Exec_query; - const SqlSpecs& m_sqlSpecs; // subclass must contain - }; - class Data : public Exec_stmt::Data, public ResultSet { - public: - Data(Exec_query* node, const SqlRow& sqlRow); - virtual ~Data() = 0; - const SqlRow& sqlRow() const; - ExtRow* extRow() const; - bool fetchImpl(Ctx& ctx, Ctl& ctl); - protected: - friend class Exec_query; - Exec_query* const m_node; - ExtRow* m_extRow; // output bindings - int* m_extPos; // positions for SQLGetData - }; - Exec_query(Exec_root* root); - virtual ~Exec_query() = 0; - void bind(Ctx& ctx); - void execute(Ctx& ctx, Ctl& ctl); - bool fetch(Ctx& ctx, Ctl& ctl); - // children - const Code& getCode() const; - Data& getData() const; - virtual const Exec_query* getRawQuery() const; - // odbc support - void sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind); -protected: - friend class Data; - virtual void execImpl(Ctx& ctx, Ctl& ctl) = 0; - virtual bool fetchImpl(Ctx& ctx, Ctl& ctl) = 0; -}; - -inline -Exec_query::Code::Code(const SqlSpecs& sqlSpecs) : - m_sqlSpecs(sqlSpecs) -{ -} - -inline const SqlSpecs& -Exec_query::Code::sqlSpecs() const -{ - return m_sqlSpecs; -} - -inline -Exec_query::Data::Data(Exec_query* node, const SqlRow& sqlRow) : - ResultSet(sqlRow), - m_node(node), - m_extRow(0), - m_extPos(0) -{ -} - -inline const SqlRow& -Exec_query::Data::sqlRow() const -{ - return static_cast(m_dataRow); -} - -inline ExtRow* -Exec_query::Data::extRow() const -{ - return m_extRow; -} - -inline bool -Exec_query::Data::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - return m_node->fetchImpl(ctx, ctl); -} - -inline -Exec_query::Exec_query(Exec_root* root) : - Exec_stmt(root) -{ -} - -// children - -inline const Exec_query::Code& -Exec_query::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query::Data& -Exec_query::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp deleted file mode 100644 index f52c41df802..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp +++ /dev/null @@ -1,177 +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 */ - -#include -#include -#include -#include "Code_query_count.hpp" -#include "Code_column.hpp" -#include "Code_expr_row.hpp" -#include "Code_root.hpp" - -// Plan_query_count - -Plan_query_count::~Plan_query_count() -{ -} - -Plan_expr_row* -Plan_query_count::getRow() -{ - ctx_assert(m_exprRow != 0); - return m_exprRow; -} - -Plan_base* -Plan_query_count::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_exprRow != 0); - ctl.m_aggrok = true; - ctl.m_aggrin = false; - m_exprRow->analyze(ctx, ctl); - ctl.m_aggrok = false; - if (! ctx.ok()) - return 0; - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_count::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // create code for the row based on query code - ctx_assert(m_exprRow != 0); - ctl.m_execQuery = execQuery; - Exec_expr_row* execRow = static_cast(m_exprRow->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execRow != 0); - Exec_query_count* exec = new Exec_query_count(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // re-use SqlSpecs from the row - const SqlSpecs& sqlSpecs = execRow->getCode().sqlSpecs(); - Exec_query_count::Code& code = *new Exec_query_count::Code(sqlSpecs); - exec->setCode(code); - exec->setQuery(execQuery); - exec->setRow(execRow); - return exec; -} - -void -Plan_query_count::print(Ctx& ctx) -{ - ctx.print(" [query_count"); - Plan_base* a[] = { m_query, m_exprRow }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - ctx.print("]"); -} - -// Exec_query_count - -Exec_query_count::Code::~Code() -{ -} - -Exec_query_count::Data::~Data() -{ -} - -Exec_query_count::~Exec_query_count() -{ -} - -const Exec_query* -Exec_query_count::getRawQuery() const -{ - ctx_assert(m_query != 0); - return m_query; -} - -void -Exec_query_count::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - // allocate the row based on subquery data - ctx_assert(m_exprRow != 0); - ctl.m_query = m_query; - m_exprRow->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // re-use SqlRow from the expression row - const SqlRow& sqlRow = m_exprRow->getData().sqlRow(); - Data& data = *new Data(this, sqlRow); - setData(data); -} - -void -Exec_query_count::execImpl(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - // zero counters - ctx_assert(m_exprRow != 0); - m_exprRow->close(ctx); - data.m_done = false; - // execute the subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); -} - -bool -Exec_query_count::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - // returns one row only - if (data.m_done) - return false; - ctx_assert(m_query != 0 && m_exprRow != 0); - while (m_query->fetch(ctx, ctl)) { - // accumulate values - m_exprRow->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - } - data.m_done = true; - return true; -} - -void -Exec_query_count::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); - ctx_assert(m_exprRow != 0); - m_exprRow->close(ctx); -} - -void -Exec_query_count::print(Ctx& ctx) -{ - ctx.print(" [query_count"); - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp deleted file mode 100644 index a094eba4519..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp +++ /dev/null @@ -1,162 +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 ODBC_CODEGEN_Code_query_count_hpp -#define ODBC_CODEGEN_Code_query_count_hpp - -#include -#include "Code_query.hpp" -#include "Code_expr_row.hpp" -#include "Code_root.hpp" - -class Ctx; - -/** - * @class Plan_query_count - * @brief Select count and other aggregates (no group by) - */ -class Plan_query_count : public Plan_query { -public: - Plan_query_count(Plan_root* root); - virtual ~Plan_query_count(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setRow(Plan_expr_row* exprRow); -protected: - Plan_expr_row* getRow(); - Plan_query* m_query; - Plan_expr_row* m_exprRow; -}; - -inline -Plan_query_count::Plan_query_count(Plan_root* root) : - Plan_query(root), - m_query(0), - m_exprRow(0) -{ -} - -// children - -inline void -Plan_query_count::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_query_count::setRow(Plan_expr_row* exprRow) -{ - ctx_assert(exprRow != 0); - m_exprRow = exprRow; -} - -/** - * @class Exec_query_count - * @brief Select count and other aggregates (no group by) - */ -class Exec_query_count : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code(); - protected: - friend class Exec_query_count; - // sets reference to Sqlspecs from the row - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_count* node, const SqlRow& sqlRow); - virtual ~Data(); - protected: - friend class Exec_query_count; - // sets reference to SqlRow from the row - bool m_done; // returns one row - }; - Exec_query_count(Exec_root* root); - virtual ~Exec_query_count(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); - void setRow(Exec_expr_row* exprRow); - const Exec_query* getRawQuery() const; -protected: - Exec_query* m_query; - Exec_expr_row* m_exprRow; -}; - -inline -Exec_query_count::Code::Code(const SqlSpecs& sqlSpecs) : - Exec_query::Code(sqlSpecs) -{ -} - -inline -Exec_query_count::Data::Data(Exec_query_count* node, const SqlRow& sqlRow) : - Exec_query::Data(node, sqlRow) -{ -} - -inline -Exec_query_count::Exec_query_count(Exec_root* root) : - Exec_query(root), - m_query(0), - m_exprRow(0) -{ -} - -// children - -inline const Exec_query_count::Code& -Exec_query_count::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_count::Data& -Exec_query_count::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_count::setQuery(Exec_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Exec_query_count::setRow(Exec_expr_row* exprRow) -{ - ctx_assert(m_exprRow == 0 && exprRow != 0); - m_exprRow = exprRow; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp deleted file mode 100644 index 4cbfbfe812d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp +++ /dev/null @@ -1,204 +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 */ - -#include -#include "Code_query_distinct.hpp" -#include "Code_root.hpp" - -// Plan_query_distinct - -Plan_query_distinct::~Plan_query_distinct() -{ -} - -Plan_expr_row* -Plan_query_distinct::getRow() -{ - ctx_assert(m_query != 0); - return m_query->getRow(); -} - -Plan_base* -Plan_query_distinct::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_distinct::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // the exec node - Exec_query_distinct* exec = new Exec_query_distinct(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // re-use SqlSpecs from subquery - const Exec_query::Code& codeQuery = execQuery->getCode(); - const SqlSpecs& sqlSpecs = codeQuery.sqlSpecs(); - Exec_query_distinct::Code& code = *new Exec_query_distinct::Code(sqlSpecs); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_query_distinct::print(Ctx& ctx) -{ - ctx.print(" [query_distinct"); - Plan_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_query_distinct - -Exec_query_distinct::Code::~Code() -{ -} - -Exec_query_distinct::Data::~Data() -{ - for (DistinctList::iterator i = m_groupList.begin(); i != m_groupList.end(); i++) { - delete (*i).first; - } -} - -Exec_query_distinct::~Exec_query_distinct() -{ -} - -const Exec_query* -Exec_query_distinct::getRawQuery() const -{ - ctx_assert(m_query != 0); - return m_query->getRawQuery(); -} - -void -Exec_query_distinct::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - Data& data = *new Data(this, getCode().sqlSpecs()); - setData(data); -} - -void -Exec_query_distinct::execImpl(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); -} - -bool -DistinctLess::operator()(const SqlRow* s1, const SqlRow* s2) const -{ - ctx_assert(s1 != 0 && s2 != 0); - const SqlRow& r1 = *s1; - const SqlRow& r2 = *s2; - for (unsigned i = 1; i <= r1.count(); i++) { - const SqlField& f1 = r1.getEntry(i); - const SqlField& f2 = r2.getEntry(i); - // nulls last is default in oracle - const bool f1null = f1.sqlNull(); - const bool f2null = f2.sqlNull(); - if (f1null && f2null) - continue; - if (! f1null && f2null) - return true; - if (f1null && ! f2null) - return false; - if (f1.less(f2)) - return true; - if (f2.less(f1)) - return false; - } - return false; -} - -bool -Exec_query_distinct::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - ctx_assert(m_query != 0); - if (! data.m_grouped) { - // read and group all rows - while (m_query->fetch(ctx, ctl)) { - const SqlRow* dataRow = &m_query->getData().sqlRow(); - DistinctList::iterator i = data.m_groupList.find(dataRow); - if (i != data.m_groupList.end()) - continue; - unsigned index = data.m_count++; - dataRow = dataRow->copy(); - const DistinctList::value_type groupPair(dataRow, index); - data.m_groupList.insert(groupPair); - data.m_groupVector.push_back(dataRow); - } - if (! ctx.ok()) - return false; - data.m_index = 0; - data.m_grouped = true; - } - ctx_assert(data.m_count == data.m_groupVector.size()); - if (data.m_index < data.m_count) { - const SqlRow* currRow = data.m_groupVector[data.m_index]; - // make our SqlRow reference to it - for (unsigned i = 1; i <= data.m_sqlRow.count(); i++) { - const SqlField& currField = currRow->getEntry(i); - SqlSpec sqlSpec(currField.sqlSpec(), SqlSpec::Reference); - SqlField sqlField(sqlSpec, &currField); - data.m_sqlRow.setEntry(i, sqlField); - } - data.m_index++; - return true; - } - return false; -} - -void -Exec_query_distinct::close(Ctx& ctx) -{ - Data& data = getData(); - ctx_assert(m_query != 0); - m_query->close(ctx); - data.m_grouped = false; - data.m_count = 0; - for (DistinctList::iterator i = data.m_groupList.begin(); i != data.m_groupList.end(); i++) { - delete (*i).first; - } - data.m_groupList.clear(); - data.m_groupVector.clear(); -} - -void -Exec_query_distinct::print(Ctx& ctx) -{ - ctx.print(" [query_distinct"); - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp deleted file mode 100644 index 62c46bda901..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp +++ /dev/null @@ -1,165 +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 ODBC_CODEGEN_Code_query_distinct_hpp -#define ODBC_CODEGEN_Code_query_distinct_hpp - -#include -#include -#include "Code_query.hpp" -#include "Code_expr_row.hpp" -#include "Code_pred.hpp" - -/** - * @class Plan_query_distinct - * @brief Group-by node in PlanTree - */ -class Plan_query_distinct : public Plan_query { -public: - Plan_query_distinct(Plan_root* root); - virtual ~Plan_query_distinct(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - Plan_expr_row* getRow(); -protected: - Plan_query* m_query; -}; - -inline -Plan_query_distinct::Plan_query_distinct(Plan_root* root) : - Plan_query(root), - m_query(0) -{ -} - -// children - -inline void -Plan_query_distinct::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -/** - * Distinct preserves order of input rows so we use 2 data structures: - * map = index and vector = row (index >= 0). - */ - -class Exec_query_distinct; - -struct DistinctLess : std::binary_function { - bool operator()(const SqlRow* s1, const SqlRow* s2) const; -}; - -typedef std::map DistinctList; - -typedef std::vector DistinctVector; - -/** - * @class Exec_query_distinct - * @brief Group-by node in ExecTree - */ -class Exec_query_distinct : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code(); - protected: - friend class Exec_query_distinct; - // sets reference to Sqlspecs from subquery - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_distinct* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_distinct; - SqlRow m_sqlRow; // current row - bool m_grouped; // fetch and group-by done - unsigned m_count; - DistinctList m_groupList; - DistinctVector m_groupVector; - unsigned m_index; - }; - Exec_query_distinct(Exec_root* root); - virtual ~Exec_query_distinct(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); - const Exec_query* getRawQuery() const; -protected: - friend class Exec_query; - Exec_query* m_query; -}; - -inline -Exec_query_distinct::Code::Code(const SqlSpecs& sqlSpecs) : - Exec_query::Code(sqlSpecs) -{ -} - -inline -Exec_query_distinct::Data::Data(Exec_query_distinct* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_grouped(false), - m_count(0), - m_index(0) -{ -} - -inline -Exec_query_distinct::Exec_query_distinct(Exec_root* root) : - Exec_query(root), - m_query(0) -{ -} - -// children - -inline const Exec_query_distinct::Code& -Exec_query_distinct::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_distinct::Data& -Exec_query_distinct::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_distinct::setQuery(Exec_query* query) -{ - ctx_assert(m_query == 0 && query != 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp deleted file mode 100644 index 934a24d182d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp +++ /dev/null @@ -1,161 +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 */ - -#include "Code_query_filter.hpp" -#include "Code_query_join.hpp" -#include "Code_query_scan.hpp" -#include "Code_root.hpp" - -// Plan_query_filter - -Plan_query_filter::~Plan_query_filter() -{ -} - -Plan_base* -Plan_query_filter::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_pred != 0); - m_pred->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_filter::codegen(Ctx& ctx, Ctl& ctl) -{ - // generate code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // create code for the predicate based on query code - Exec_pred* execPred = 0; - ctl.m_execQuery = execQuery; - ctx_assert(m_topTable != 0); - ctl.m_topTable = m_topTable; - ctx_assert(m_pred != 0); - execPred = static_cast(m_pred->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execPred != 0); - ctl.m_topTable = 0; - // re-use SqlSpecs from subquery - const Exec_query::Code& codeQuery = execQuery->getCode(); - const SqlSpecs& sqlSpecs = codeQuery.sqlSpecs(); - Exec_query_filter* exec = new Exec_query_filter(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - Exec_query_filter::Code& code = *new Exec_query_filter::Code(sqlSpecs); - exec->setCode(code); - exec->setQuery(execQuery); - exec->setPred(execPred); - return exec; -} - -void -Plan_query_filter::print(Ctx& ctx) -{ - ctx.print(" [query_filter"); - Plan_base* a[] = { m_query, m_pred }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_query_filter - -Exec_query_filter::Code::~Code() -{ -} - -Exec_query_filter::Data::~Data() -{ -} - -Exec_query_filter::~Exec_query_filter() -{ -} - -void -Exec_query_filter::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // allocate the predicate - ctl.m_query = m_query; - ctx_assert(m_pred != 0); - m_pred->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // re-use SqlRow from subquery - Exec_query::Data& dataQuery = m_query->getData(); - Data& data = *new Data(this, dataQuery.sqlRow()); - setData(data); -} - -void -Exec_query_filter::execImpl(Ctx& ctx, Ctl& ctl) -{ - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); -} - -bool -Exec_query_filter::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - // invoke fetch on subquery until predicate is true - ctx_assert(m_query != 0); - while (m_query->fetch(ctx, ctl)) { - ctx_assert(m_pred != 0); - m_pred->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - if (m_pred->getData().getValue() == Pred_value_true) { - ctl.m_postEval = true; - m_pred->evaluate(ctx, ctl); - ctl.m_postEval = false; - return true; - } - } - return false; -} - -void -Exec_query_filter::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); - ctx_assert(m_pred != 0); - m_pred->close(ctx); -} - -void -Exec_query_filter::print(Ctx& ctx) -{ - ctx.print(" [query_filter"); - Exec_base* a[] = { m_query, m_pred }; - printList(ctx, a, 2); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp deleted file mode 100644 index 60cbf0f86a7..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp +++ /dev/null @@ -1,162 +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 ODBC_CODEGEN_Code_query_filter_hpp -#define ODBC_CODEGEN_Code_query_filter_hpp - -#include -#include "Code_query.hpp" -#include "Code_table_list.hpp" -#include "Code_pred.hpp" - -/** - * @class Plan_query_filter - * @brief Filter node in PlanTree - */ -class Plan_query_filter : public Plan_query { -public: - Plan_query_filter(Plan_root* root); - virtual ~Plan_query_filter(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setPred(Plan_pred* pred); -protected: - friend class Plan_select; - friend class Plan_update; - friend class Plan_delete; - Plan_query* m_query; - Plan_pred* m_pred; - Plan_table* m_topTable; // top level table for interpreted progs -}; - -inline -Plan_query_filter::Plan_query_filter(Plan_root* root) : - Plan_query(root), - m_query(0), - m_pred(0), - m_topTable(0) -{ -} - -// children - -inline void -Plan_query_filter::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_query_filter::setPred(Plan_pred* pred) -{ - ctx_assert(pred != 0); - m_pred = pred; -} - -/** - * @class Exec_query_filter - * @brief Filter node in ExecTree - */ -class Exec_query_filter : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code(); - protected: - friend class Exec_query_filter; - // sets reference to SqlSpecs from subquery - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_filter* node, const SqlRow& sqlRow); - virtual ~Data(); - protected: - friend class Exec_query_filter; - // sets reference to SqlRow from subquery - }; - Exec_query_filter(Exec_root* root); - virtual ~Exec_query_filter(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); - void setPred(Exec_pred* pred); -protected: - Exec_query* m_query; - Exec_pred* m_pred; -}; - -inline -Exec_query_filter::Code::Code(const SqlSpecs& sqlSpecs) : - Exec_query::Code(sqlSpecs) -{ -} - -inline -Exec_query_filter::Data::Data(Exec_query_filter* node, const SqlRow& sqlRow) : - Exec_query::Data(node, sqlRow) -{ -} - -inline -Exec_query_filter::Exec_query_filter(Exec_root* root) : - Exec_query(root), - m_query(0), - m_pred(0) -{ -} - -// children - -inline const Exec_query_filter::Code& -Exec_query_filter::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_filter::Data& -Exec_query_filter::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_filter::setQuery(Exec_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Exec_query_filter::setPred(Exec_pred* pred) -{ - ctx_assert(pred != 0); - m_pred = pred; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp deleted file mode 100644 index c3019efaa85..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp +++ /dev/null @@ -1,301 +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 */ - -#include -#include "Code_query_group.hpp" -#include "Code_root.hpp" - -// Plan_query_group - -Plan_query_group::~Plan_query_group() -{ -} - -Plan_expr_row* -Plan_query_group::getRow() -{ - ctx_assert(m_dataRow != 0); - return m_dataRow; -} - -Plan_base* -Plan_query_group::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_dataRow != 0); - m_dataRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_groupRow != 0); - m_groupRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - if (m_havingPred != 0) { - ctl.m_having = true; - m_havingPred->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctl.m_having = false; - } - return this; -} - -Exec_base* -Plan_query_group::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // create code for the rows based on query code - ctl.m_execQuery = execQuery; - ctx_assert(m_dataRow != 0); - Exec_expr_row* execDataRow = static_cast(m_dataRow->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execDataRow != 0); - ctx_assert(m_groupRow != 0); - Exec_expr_row* execGroupRow = static_cast(m_groupRow->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execGroupRow != 0); - Exec_pred* execHavingPred = 0; - if (m_havingPred != 0) { - ctl.m_having = true; - execHavingPred = static_cast(m_havingPred->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execHavingPred != 0); - ctl.m_having = false; - } - // the exec node - Exec_query_group* exec = new Exec_query_group(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // re-use SqlSpecs from data row - const SqlSpecs& sqlSpecs = execDataRow->getCode().sqlSpecs(); - Exec_query_group::Code& code = *new Exec_query_group::Code(sqlSpecs); - exec->setCode(code); - exec->setQuery(execQuery); - exec->setDataRow(execDataRow); - exec->setGroupRow(execGroupRow); - if (execHavingPred != 0) - exec->setHavingPred(execHavingPred); - return exec; -} - -void -Plan_query_group::print(Ctx& ctx) -{ - ctx.print(" [query_group"); - Plan_base* a[] = { m_query, m_dataRow, m_groupRow }; - printList(ctx, a, 3); - ctx.print("]"); -} - -// Exec_query_group - -Exec_query_group::Code::~Code() -{ -} - -Exec_query_group::Data::~Data() -{ - for (GroupList::iterator i = m_groupList.begin(); i != m_groupList.end(); i++) { - delete (*i).first; - } -} - -Exec_query_group::~Exec_query_group() -{ -} - -const Exec_query* -Exec_query_group::getRawQuery() const -{ - ctx_assert(m_query != 0); - return m_query; -} - -void -Exec_query_group::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // allocate rows based on subquery data - ctl.m_query = m_query; - ctx_assert(m_dataRow != 0); - m_dataRow->alloc(ctx, ctl); - if (! ctx.ok()) - return; - ctx_assert(m_groupRow != 0); - m_groupRow->alloc(ctx, ctl); - if (! ctx.ok()) - return; - if (m_havingPred != 0) { - m_havingPred->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - Data& data = *new Data(this, getCode().sqlSpecs()); - setData(data); -} - -void -Exec_query_group::execImpl(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); -} - -bool -GroupLess::operator()(const SqlRow* s1, const SqlRow* s2) const -{ - ctx_assert(s1 != 0 && s2 != 0); - const SqlRow& r1 = *s1; - const SqlRow& r2 = *s2; - for (unsigned i = 1; i <= r1.count(); i++) { - const SqlField& f1 = r1.getEntry(i); - const SqlField& f2 = r2.getEntry(i); - // nulls last is default in oracle - const bool f1null = f1.sqlNull(); - const bool f2null = f2.sqlNull(); - if (f1null && f2null) - continue; - if (! f1null && f2null) - return true; - if (f1null && ! f2null) - return false; - if (f1.less(f2)) - return true; - if (f2.less(f1)) - return false; - } - return false; -} - -bool -Exec_query_group::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - ctx_assert(m_query != 0 && m_groupRow != 0); - if (! data.m_grouped) { - // read and group all rows - while (m_query->fetch(ctx, ctl)) { - // evaluate and insert group-by values - m_groupRow->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - const SqlRow* groupRow = 0; - unsigned index = 0; - bool init; - GroupList::iterator i = data.m_groupList.find(&m_groupRow->getData().sqlRow()); - if (i == data.m_groupList.end()) { - groupRow = m_groupRow->getData().sqlRow().copy(); - index = ++data.m_count; - const GroupList::value_type groupPair(groupRow, index); - data.m_groupList.insert(groupPair); - init = true; - } else { - groupRow = (*i).first; - index = (*i).second; - ctx_assert(groupRow != 0 && index != 0); - init = false; - } - // evaluate rows saving expression values at index position - ctl.m_groupIndex = index; - ctl.m_groupInit = init; - m_dataRow->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - if (m_havingPred != 0) { - m_havingPred->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - } - if (ctl.m_sortRow != 0) { - ctl.m_sortRow->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - } - ctl.m_groupIndex = 0; - } - if (! ctx.ok()) - return false; - data.m_iterator = data.m_groupList.begin(); - data.m_grouped = true; - } - while (data.m_iterator != data.m_groupList.end()) { - const SqlRow* groupRow = (*data.m_iterator).first; - const unsigned index = (*data.m_iterator).second; - ctx_assert(groupRow != 0 && index != 0); - if (m_havingPred != 0) { - Pred_value v = m_havingPred->getData().groupValue(index); - if (v != Pred_value_true) { - data.m_iterator++; - continue; - } - } - // make our SqlRow reference to the saved values - for (unsigned i = 1; i <= data.m_sqlRow.count(); i++) { - const SqlField& currField = m_dataRow->getExpr(i)->getData().groupField(index); - SqlSpec sqlSpec(currField.sqlSpec(), SqlSpec::Reference); - SqlField sqlField(sqlSpec, &currField); - data.m_sqlRow.setEntry(i, sqlField); - } - // send group index up for possible order by - ctl.m_groupIndex = index; - data.m_iterator++; - return true; - } - return false; -} - -void -Exec_query_group::close(Ctx& ctx) -{ - Data& data = getData(); - ctx_assert(m_query != 0); - m_query->close(ctx); - ctx_assert(m_dataRow != 0); - m_dataRow->close(ctx); - ctx_assert(m_groupRow != 0); - m_groupRow->close(ctx); - if (m_havingPred != 0) - m_havingPred->close(ctx); - data.m_grouped = false; - data.m_count = 0; - for (GroupList::iterator i = data.m_groupList.begin(); i != data.m_groupList.end(); i++) { - delete (*i).first; - } - data.m_groupList.clear(); -} - -void -Exec_query_group::print(Ctx& ctx) -{ - ctx.print(" [query_group"); - Exec_base* a[] = { m_query, m_dataRow, m_groupRow }; - printList(ctx, a, 3); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp deleted file mode 100644 index e79022c5284..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp +++ /dev/null @@ -1,221 +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 ODBC_CODEGEN_Code_query_group_hpp -#define ODBC_CODEGEN_Code_query_group_hpp - -#include -#include -#include "Code_query.hpp" -#include "Code_expr_row.hpp" -#include "Code_pred.hpp" - -/** - * @class Plan_query_group - * @brief Group-by node in PlanTree - */ -class Plan_query_group : public Plan_query { -public: - Plan_query_group(Plan_root* root); - virtual ~Plan_query_group(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setDataRow(Plan_expr_row* dataRow); - void setGroupRow(Plan_expr_row* groupRow); - void setHavingPred(Plan_pred* havingPred); - Plan_expr_row* getRow(); -protected: - Plan_query* m_query; - Plan_expr_row* m_dataRow; - Plan_expr_row* m_groupRow; - Plan_pred* m_havingPred; -}; - -inline -Plan_query_group::Plan_query_group(Plan_root* root) : - Plan_query(root), - m_query(0), - m_dataRow(0), - m_groupRow(0), - m_havingPred(0) -{ -} - -// children - -inline void -Plan_query_group::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_query_group::setDataRow(Plan_expr_row* dataRow) -{ - ctx_assert(dataRow != 0); - m_dataRow = dataRow; -} - -inline void -Plan_query_group::setGroupRow(Plan_expr_row* groupRow) -{ - ctx_assert(groupRow != 0); - m_groupRow = groupRow; -} - -inline void -Plan_query_group::setHavingPred(Plan_pred* havingPred) -{ - ctx_assert(havingPred != 0); - m_havingPred = havingPred; -} - -/** - * Group-by uses a std::map. Key is values grouped by. Data is unique index - * (starting at 1) into arrays in expression data. - */ - -class Exec_query_group; - -struct GroupLess : std::binary_function { - bool operator()(const SqlRow* s1, const SqlRow* s2) const; -}; - -typedef std::map GroupList; - -/** - * @class Exec_query_group - * @brief Group-by node in ExecTree - */ -class Exec_query_group : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code(); - protected: - friend class Exec_query_group; - // sets reference to Sqlspecs from subquery - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_group* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_group; - SqlRow m_sqlRow; // current row - bool m_grouped; // fetch and group-by done - unsigned m_count; - GroupList m_groupList; - GroupList::iterator m_iterator; - }; - Exec_query_group(Exec_root* root); - virtual ~Exec_query_group(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); - void setDataRow(Exec_expr_row* dataRow); - void setGroupRow(Exec_expr_row* groupRow); - void setHavingPred(Exec_pred* havingPred); - const Exec_query* getRawQuery() const; -protected: - friend class Exec_query; - Exec_query* m_query; - Exec_expr_row* m_dataRow; - Exec_expr_row* m_groupRow; - Exec_pred* m_havingPred; -}; - -inline -Exec_query_group::Code::Code(const SqlSpecs& sqlSpecs) : - Exec_query::Code(sqlSpecs) -{ -} - -inline -Exec_query_group::Data::Data(Exec_query_group* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_grouped(false), - m_count(0) -{ -} - -inline -Exec_query_group::Exec_query_group(Exec_root* root) : - Exec_query(root), - m_query(0), - m_dataRow(0), - m_groupRow(0), - m_havingPred(0) -{ -} - -// children - -inline const Exec_query_group::Code& -Exec_query_group::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_group::Data& -Exec_query_group::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_group::setQuery(Exec_query* query) -{ - ctx_assert(m_query == 0 && query != 0); - m_query = query; -} - -inline void -Exec_query_group::setDataRow(Exec_expr_row* dataRow) -{ - ctx_assert(m_dataRow == 0 && dataRow != 0); - m_dataRow = dataRow; -} - -inline void -Exec_query_group::setGroupRow(Exec_expr_row* groupRow) -{ - ctx_assert(m_groupRow == 0 && groupRow != 0); - m_groupRow = groupRow; -} - -inline void -Exec_query_group::setHavingPred(Exec_pred* havingPred) -{ - ctx_assert(m_havingPred == 0 && havingPred != 0); - m_havingPred = havingPred; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp deleted file mode 100644 index ee19d6123cc..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp +++ /dev/null @@ -1,186 +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 */ - -#include -#include -#include -#include "Code_query_index.hpp" -#include "Code_column.hpp" -#include "Code_expr.hpp" -#include "Code_root.hpp" - -// Plan_query_index - -Plan_query_index::~Plan_query_index() -{ -} - -Plan_base* -Plan_query_index::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_index::codegen(Ctx& ctx, Ctl& ctl) -{ - // set up - ctx_assert(m_table != 0 && m_index != 0); - const BaseString& tableName = m_table->getName(); - ctx_assert(m_index->m_dictIndex != 0); - const DictIndex& dictIndex = *m_index->m_dictIndex; - const BaseString& indexName = dictIndex.getName(); - const unsigned keyCount = m_index->m_keyCount; - const ColumnVector& columns = m_table->exprColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_query_index::Code& code = *new Exec_query_index::Code(keyCount, attrCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - code.m_indexName = strcpy(new char[indexName.length() + 1], indexName.c_str()); - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictIndex.getColumn(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = k - 1; // index column order - } - // matching expressions - ctx_assert(m_index->m_keyFound); - const ExprVector& keyEq = m_index->m_keyEq; - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // queried attributes - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - const SqlType& sqlType = dictColumn.sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_sqlSpecs.setEntry(i, sqlSpec); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_query_index* exec = new Exec_query_index(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - return exec; -} - -void -Plan_query_index::print(Ctx& ctx) -{ - ctx.print(" [query_index"); - Plan_base* a[] = { m_table }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_query_index - -Exec_query_index::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; - delete[] m_attrId; -} - -Exec_query_index::Data::~Data() -{ - delete[] m_recAttr; -} - -Exec_query_index::~Exec_query_index() -{ -} - -void -Exec_query_index::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // create data - Data& data = *new Data(this, code.sqlSpecs()); - setData(data); - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - // needed for isNULL - data.m_recAttr = new NdbRecAttr* [1 + code.m_attrCount]; - for (unsigned i = 0; i <= code.m_attrCount; i++) { - data.m_recAttr[i] = 0; - } -} - -void -Exec_query_index::close(Ctx& ctx) -{ - Data& data = getData(); - if (data.m_con != 0) { - Ndb* const ndb = ndbObject(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - data.m_done = true; - ctx_log2(("lookup closed at statement close")); - } -} - -void -Exec_query_index::print(Ctx& ctx) -{ - ctx.print(" [query_index"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" keyId="); - for (unsigned i = 1; i <= code.m_keyCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_keyId[i]); - } - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - ctx.print(" table=%s", code.m_tableName); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp deleted file mode 100644 index 87affd50580..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp +++ /dev/null @@ -1,160 +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 ODBC_CODEGEN_Code_query_index_hpp -#define ODBC_CODEGEN_Code_query_index_hpp - -#include -#include "Code_query.hpp" -#include "Code_table.hpp" - -class Ctx; -class StmtArea; -class NdbConnection; -class NdbOperation; -class NdbRecAttr; - -/** - * @class Plan_query_index - * @brief Full select (no where clause) - */ -class Plan_query_index : public Plan_query { -public: - Plan_query_index(Plan_root* root); - virtual ~Plan_query_index(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table, Plan_table::Index* index); -protected: - Plan_table* m_table; - Plan_table::Index* m_index; -}; - -inline -Plan_query_index::Plan_query_index(Plan_root* root) : - Plan_query(root), - m_table(0), - m_index(0) -{ -} - -// children - -inline void -Plan_query_index::setTable(Plan_table* table, Plan_table::Index* index) -{ - ctx_assert(table != 0 && index != 0 && index == &table->m_indexList[index->m_pos] && index->m_pos != 0); - m_table = table; - m_index = index; -} - -/** - * @class Exec_query_index - * @brief Full select (no where clause) - */ -class Exec_query_index : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(unsigned keyCount, unsigned attrCount); - virtual ~Code(); - protected: - friend class Plan_query_index; - friend class Exec_query_index; - const char* m_tableName; - const char* m_indexName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - unsigned m_attrCount; - SqlSpecs m_sqlSpecs; - NdbAttrId* m_attrId; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_index* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_index; - SqlRow m_sqlRow; - NdbConnection* m_con; - NdbOperation* m_op; - NdbRecAttr** m_recAttr; - bool m_done; // returns one row - }; - Exec_query_index(Exec_root* root); - virtual ~Exec_query_index(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_query_index::Code::Code(unsigned keyCount, unsigned attrCount) : - Exec_query::Code(m_sqlSpecs), - m_tableName(0), - m_indexName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_attrCount(attrCount), - m_sqlSpecs(attrCount), - m_attrId(0) -{ -} - -inline -Exec_query_index::Data::Data(Exec_query_index* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_con(0), - m_op(0), - m_recAttr(0), - m_done(false) -{ -} - -inline -Exec_query_index::Exec_query_index(Exec_root* root) : - Exec_query(root) -{ -} - -// children - -inline const Exec_query_index::Code& -Exec_query_index::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_index::Data& -Exec_query_index::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp deleted file mode 100644 index 89aafe13610..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp +++ /dev/null @@ -1,192 +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 */ - -#include "Code_query.hpp" -#include "Code_query_join.hpp" -#include "Code_query_scan.hpp" -#include "Code_root.hpp" - -// Plan_query_join - -Plan_query_join::~Plan_query_join() -{ -} - -Plan_base* -Plan_query_join::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_inner != 0); - m_inner->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_outer != 0); - m_outer->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_join::codegen(Ctx& ctx, Ctl& ctl) -{ - // generate code for subqueries - ctx_assert(m_inner != 0); - Exec_query* execInner = static_cast(m_inner->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execInner != 0); - ctx_assert(m_outer != 0); - ctl.m_execQuery = execInner; - Exec_query* execOuter = static_cast(m_outer->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execOuter != 0); - // combine sql specs from subqueries - const SqlSpecs& specsInner = execInner->getCode().sqlSpecs(); - const SqlSpecs& specsOuter = execOuter->getCode().sqlSpecs(); - SqlSpecs sqlSpecs(specsInner.count() + specsOuter.count()); - for (unsigned i = 1; i <= specsInner.count(); i++) { - const SqlSpec sqlSpec(specsInner.getEntry(i), SqlSpec::Reference); - sqlSpecs.setEntry(i, sqlSpec); - } - for (unsigned i = 1; i <= specsOuter.count(); i++) { - const SqlSpec sqlSpec(specsOuter.getEntry(i), SqlSpec::Reference); - sqlSpecs.setEntry(specsInner.count() + i, sqlSpec); - } - // create the code - Exec_query_join* exec = new Exec_query_join(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setInner(execInner); - exec->setOuter(execOuter); - Exec_query_join::Code& code = *new Exec_query_join::Code(sqlSpecs); - exec->setCode(code); - return exec; -} - -void -Plan_query_join::print(Ctx& ctx) -{ - ctx.print(" [query_join"); - Plan_base* a[] = { m_inner, m_outer }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_query_join - -Exec_query_join::Code::~Code() -{ -} - -Exec_query_join::Data::~Data() -{ -} - -Exec_query_join::~Exec_query_join() -{ -} - -void -Exec_query_join::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the subqueries - ctx_assert(m_inner != 0); - m_inner->alloc(ctx, ctl); - if (! ctx.ok()) - return; - ctx_assert(m_outer != 0); - ctl.m_query = m_inner; - m_outer->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // combine data rows from subqueries - const Code& code = getCode(); - const SqlRow& rowInner = m_inner->getData().sqlRow(); - const SqlRow& rowOuter = m_outer->getData().sqlRow(); - SqlRow sqlRow(code.m_sqlSpecs); - for (unsigned i = 1; i <= rowInner.count(); i++) { - const SqlSpec& sqlSpec = code.m_sqlSpecs.getEntry(i); - const SqlField sqlField(sqlSpec, &rowInner.getEntry(i)); - sqlRow.setEntry(i, sqlField); - } - for (unsigned i = 1; i <= rowOuter.count(); i++) { - const SqlSpec& sqlSpec = code.m_sqlSpecs.getEntry(rowInner.count() + i); - const SqlField sqlField(sqlSpec, &rowOuter.getEntry(i)); - sqlRow.setEntry(rowInner.count() + i, sqlField); - } - // create the data - Data& data = *new Data(this, sqlRow); - setData(data); -} - -void -Exec_query_join::execImpl(Ctx& ctx, Ctl& ctl) -{ - // execute only inner query - ctx_assert(m_inner != 0); - m_inner->execute(ctx, ctl); -} - -bool -Exec_query_join::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_inner != 0); - ctx_assert(m_outer != 0); - if (getData().getState() == ResultSet::State_init) { - // fetch first row from inner - if (! m_inner->fetch(ctx, ctl)) - return false; - } - while (1) { - if (m_outer->getData().getState() == ResultSet::State_end) { - // execute or re-execute outer - Ctl ctl(0); - m_outer->close(ctx); - if (! ctx.ok()) - return false; - m_outer->execute(ctx, ctl); - if (! ctx.ok()) - return false; - } - if (! m_outer->fetch(ctx, ctl)) { - if (! ctx.ok()) - return false; - // fetch next row from inner - if (! m_inner->fetch(ctx, ctl)) - return false; - } - else - return true; - } -} - -void -Exec_query_join::close(Ctx& ctx) -{ - ctx_assert(m_inner != 0); - m_inner->close(ctx); - ctx_assert(m_outer != 0); - m_outer->close(ctx); -} - -void -Exec_query_join::print(Ctx& ctx) -{ - ctx.print(" [query_join"); - Exec_base* a[] = { m_inner, m_outer }; - printList(ctx, a, 2); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp deleted file mode 100644 index f6ac9205329..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp +++ /dev/null @@ -1,159 +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 ODBC_CODEGEN_Code_query_join_hpp -#define ODBC_CODEGEN_Code_query_join_hpp - -#include -#include "Code_query.hpp" -#include "Code_table_list.hpp" -#include "Code_pred.hpp" - -/** - * @class Plan_query_join - * @brief Filter node in PlanTree - */ -class Plan_query_join : public Plan_query { -public: - Plan_query_join(Plan_root* root); - virtual ~Plan_query_join(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setInner(Plan_query* query); - void setOuter(Plan_query* query); -protected: - Plan_query* m_inner; - Plan_query* m_outer; -}; - -inline -Plan_query_join::Plan_query_join(Plan_root* root) : - Plan_query(root), - m_inner(0), - m_outer(0) -{ -} - -// children - -inline void -Plan_query_join::setInner(Plan_query* query) -{ - ctx_assert(query != 0); - m_inner = query; -} - -inline void -Plan_query_join::setOuter(Plan_query* query) -{ - ctx_assert(query != 0); - m_outer = query; -} - -/** - * @class Exec_query_join - * @brief Filter node in ExecTree - */ -class Exec_query_join : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code(); - protected: - friend class Exec_query_join; - SqlSpecs m_sqlSpecs; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_join* node, const SqlRow& sqlRow); - virtual ~Data(); - protected: - friend class Exec_query_join; - SqlRow m_sqlRow; - }; - Exec_query_join(Exec_root* root); - virtual ~Exec_query_join(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setInner(Exec_query* query); - void setOuter(Exec_query* query); -protected: - Exec_query* m_inner; - Exec_query* m_outer; -}; - -inline -Exec_query_join::Code::Code(const SqlSpecs& sqlSpecs) : - Exec_query::Code(m_sqlSpecs), - m_sqlSpecs(sqlSpecs) -{ -} - -inline -Exec_query_join::Data::Data(Exec_query_join* node, const SqlRow& sqlRow) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlRow) -{ -} - -inline -Exec_query_join::Exec_query_join(Exec_root* root) : - Exec_query(root), - m_inner(0), - m_outer(0) -{ -} - -// children - -inline const Exec_query_join::Code& -Exec_query_join::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_join::Data& -Exec_query_join::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_join::setInner(Exec_query* query) -{ - ctx_assert(query != 0); - m_inner = query; -} - -inline void -Exec_query_join::setOuter(Exec_query* query) -{ - ctx_assert(query != 0); - m_outer = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp deleted file mode 100644 index bad4199190b..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp +++ /dev/null @@ -1,184 +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 */ - -#include -#include -#include -#include "Code_query_lookup.hpp" -#include "Code_column.hpp" -#include "Code_expr.hpp" -#include "Code_root.hpp" - -// Plan_query_lookup - -Plan_query_lookup::~Plan_query_lookup() -{ -} - -Plan_base* -Plan_query_lookup::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_lookup::codegen(Ctx& ctx, Ctl& ctl) -{ - // set up - ctx_assert(m_table != 0); - const BaseString& tableName = m_table->getName(); - const DictTable& dictTable = m_table->dictTable(); - const unsigned keyCount = dictTable.keyCount(); - const ColumnVector& columns = m_table->exprColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_query_lookup::Code& code = *new Exec_query_lookup::Code(keyCount, attrCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictTable.getKey(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = keyColumn->getAttrId(); - } - // matching expressions - const Plan_table::Index& index = m_table->m_indexList[0]; - ctx_assert(index.m_keyFound); - const ExprVector& keyEq = index.m_keyEq; - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // queried attributes - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - const SqlType& sqlType = dictColumn.sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_sqlSpecs.setEntry(i, sqlSpec); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_query_lookup* exec = new Exec_query_lookup(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - return exec; -} - -void -Plan_query_lookup::print(Ctx& ctx) -{ - ctx.print(" [query_lookup"); - Plan_base* a[] = { m_table }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_query_lookup - -Exec_query_lookup::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; - delete[] m_attrId; -} - -Exec_query_lookup::Data::~Data() -{ - delete[] m_recAttr; -} - -Exec_query_lookup::~Exec_query_lookup() -{ -} - -void -Exec_query_lookup::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // create data - Data& data = *new Data(this, code.sqlSpecs()); - setData(data); - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - // needed for isNULL - data.m_recAttr = new NdbRecAttr* [1 + code.m_attrCount]; - for (unsigned i = 0; i <= code.m_attrCount; i++) { - data.m_recAttr[i] = 0; - } -} - -void -Exec_query_lookup::close(Ctx& ctx) -{ - Data& data = getData(); - if (data.m_con != 0) { - Ndb* const ndb = ndbObject(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - data.m_done = true; - ctx_log2(("lookup closed at statement close")); - } -} - -void -Exec_query_lookup::print(Ctx& ctx) -{ - ctx.print(" [query_lookup"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" keyId="); - for (unsigned i = 1; i <= code.m_keyCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_keyId[i]); - } - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - ctx.print(" table=%s", code.m_tableName); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp deleted file mode 100644 index e66623d4030..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp +++ /dev/null @@ -1,155 +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 ODBC_CODEGEN_Code_query_lookup_hpp -#define ODBC_CODEGEN_Code_query_lookup_hpp - -#include -#include "Code_query.hpp" -#include "Code_table.hpp" - -class Ctx; -class StmtArea; -class NdbConnection; -class NdbOperation; -class NdbRecAttr; - -/** - * @class Plan_query_lookup - * @brief Full select (no where clause) - */ -class Plan_query_lookup : public Plan_query { -public: - Plan_query_lookup(Plan_root* root); - virtual ~Plan_query_lookup(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); -protected: - Plan_table* m_table; -}; - -inline -Plan_query_lookup::Plan_query_lookup(Plan_root* root) : - Plan_query(root), - m_table(0) -{ -} - -// children - -inline void -Plan_query_lookup::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -/** - * @class Exec_query_lookup - * @brief Full select (no where clause) - */ -class Exec_query_lookup : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(unsigned keyCount, unsigned attrCount); - virtual ~Code(); - protected: - friend class Plan_query_lookup; - friend class Exec_query_lookup; - char* m_tableName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - unsigned m_attrCount; - SqlSpecs m_sqlSpecs; - NdbAttrId* m_attrId; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_lookup* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_lookup; - SqlRow m_sqlRow; - NdbConnection* m_con; - NdbOperation* m_op; - NdbRecAttr** m_recAttr; - bool m_done; // returns one row - }; - Exec_query_lookup(Exec_root* root); - virtual ~Exec_query_lookup(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_query_lookup::Code::Code(unsigned keyCount, unsigned attrCount) : - Exec_query::Code(m_sqlSpecs), - m_tableName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_attrCount(attrCount), - m_sqlSpecs(attrCount), - m_attrId(0) -{ -} - -inline -Exec_query_lookup::Data::Data(Exec_query_lookup* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_con(0), - m_op(0), - m_recAttr(0), - m_done(false) -{ -} - -inline -Exec_query_lookup::Exec_query_lookup(Exec_root* root) : - Exec_query(root) -{ -} - -// children - -inline const Exec_query_lookup::Code& -Exec_query_lookup::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_lookup::Data& -Exec_query_lookup::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp deleted file mode 100644 index 54043ce3d5d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp +++ /dev/null @@ -1,184 +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 */ - -#include "Code_query_project.hpp" -#include "Code_root.hpp" - -// Plan_query_project - -Plan_query_project::~Plan_query_project() -{ -} - -Plan_base* -Plan_query_project::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_exprRow != 0); - ctl.m_aggrok = true; - ctl.m_aggrin = false; - m_exprRow->analyze(ctx, ctl); - ctl.m_aggrok = false; - if (! ctx.ok()) - return 0; - return this; -} - -Plan_expr_row* -Plan_query_project::getRow() -{ - ctx_assert(m_exprRow != 0); - return m_exprRow; -} - -Exec_base* -Plan_query_project::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // create code for the row based on query code - ctx_assert(m_exprRow != 0); - ctl.m_execQuery = execQuery; - Exec_expr_row* execRow = static_cast(m_exprRow->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execRow != 0); - Exec_query_project* exec = new Exec_query_project(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // re-use SqlSpecs from the row - const SqlSpecs& sqlSpecs = execRow->getCode().sqlSpecs(); - Exec_query_project::Code& code = *new Exec_query_project::Code(sqlSpecs); - code.m_limitOff = m_limitOff; - code.m_limitCnt = m_limitCnt; - exec->setCode(code); - exec->setQuery(execQuery); - exec->setRow(execRow); - return exec; -} - -void -Plan_query_project::print(Ctx& ctx) -{ - ctx.print(" [query_project"); - Plan_base* a[] = { m_query, m_exprRow }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_query_project - -Exec_query_project::Code::~Code() -{ -} - -Exec_query_project::Data::~Data() -{ -} - -Exec_query_project::~Exec_query_project() -{ -} - -const Exec_query* -Exec_query_project::getRawQuery() const -{ - ctx_assert(m_query != 0); - return m_query; -} - -void -Exec_query_project::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // allocate the row based on subquery data - ctx_assert(m_exprRow != 0); - ctl.m_query = m_query; - m_exprRow->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // re-use SqlRow from the expression row - const SqlRow& sqlRow = m_exprRow->getData().sqlRow(); - Data& data = *new Data(this, sqlRow); - setData(data); -} - -void -Exec_query_project::execImpl(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); -} - -bool -Exec_query_project::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - ctx_assert(m_query != 0); - while (1) { - if (! m_query->fetch(ctx, ctl)) - return false; - ctx_assert(m_exprRow != 0); - m_exprRow->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - ctl.m_postEval = true; - m_exprRow->evaluate(ctx, ctl); - ctl.m_postEval = false; - const int n = ++data.m_cnt; - const int o = code.m_limitOff <= 0 ? 0 : code.m_limitOff; - const int c = code.m_limitCnt; - if (n <= o) - continue; - if (c < 0) - break; - if (n - o <= c) - break; - return false; - } - return true; -} - -void -Exec_query_project::close(Ctx& ctx) -{ - Data& data = getData(); - data.m_cnt = 0; - ctx_assert(m_query != 0); - m_query->close(ctx); - ctx_assert(m_exprRow != 0); - m_exprRow->close(ctx); -} - -void -Exec_query_project::print(Ctx& ctx) -{ - ctx.print(" [query_project"); - Exec_base* a[] = { m_query, m_exprRow }; - printList(ctx, a, 2); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp deleted file mode 100644 index 545685ab9df..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp +++ /dev/null @@ -1,178 +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 ODBC_CODEGEN_Code_query_project_hpp -#define ODBC_CODEGEN_Code_query_project_hpp - -#include -#include "Code_query.hpp" -#include "Code_expr_row.hpp" - -/** - * @class Plan_query_project - * @brief Project node in PlanTree - */ -class Plan_query_project : public Plan_query { -public: - Plan_query_project(Plan_root* root); - virtual ~Plan_query_project(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setRow(Plan_expr_row* exprRow); - void setLimit(int off, int cnt); -protected: - Plan_expr_row* getRow(); - Plan_query* m_query; - Plan_expr_row* m_exprRow; - int m_limitOff; - int m_limitCnt; -}; - -inline -Plan_query_project::Plan_query_project(Plan_root* root) : - Plan_query(root), - m_query(0), - m_exprRow(0), - m_limitOff(0), - m_limitCnt(-1) -{ -} - -// children - -inline void -Plan_query_project::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_query_project::setRow(Plan_expr_row* exprRow) -{ - ctx_assert(exprRow != 0); - m_exprRow = exprRow; -} - -inline void -Plan_query_project::setLimit(int off, int cnt) -{ - m_limitOff = off; - m_limitCnt = cnt; -} - -/** - * @class Exec_query_project - * @brief Project node in ExecTree - */ -class Exec_query_project : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs); - virtual ~Code(); - protected: - friend class Plan_query_project; - friend class Exec_query_project; - // sets reference to Sqlspecs from the row - int m_limitOff; - int m_limitCnt; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_project* node, const SqlRow& sqlRow); - virtual ~Data(); - protected: - friend class Exec_query_project; - // sets reference to SqlRow from the row - unsigned m_cnt; - }; - Exec_query_project(Exec_root* root); - virtual ~Exec_query_project(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); - void setRow(Exec_expr_row* exprRow); - const Exec_query* getRawQuery() const; -protected: - friend class Exec_query; - Exec_query* m_query; - Exec_expr_row* m_exprRow; -}; - -inline -Exec_query_project::Code::Code(const SqlSpecs& sqlSpecs) : - Exec_query::Code(sqlSpecs), - m_limitOff(0), - m_limitCnt(-1) -{ -} - -inline -Exec_query_project::Data::Data(Exec_query_project* node, const SqlRow& sqlRow) : - Exec_query::Data(node, sqlRow), - m_cnt(0) -{ -} - -inline -Exec_query_project::Exec_query_project(Exec_root* root) : - Exec_query(root), - m_query(0), - m_exprRow(0) -{ -} - -// children - -inline const Exec_query_project::Code& -Exec_query_project::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_project::Data& -Exec_query_project::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_project::setQuery(Exec_query* query) -{ - ctx_assert(m_query == 0 && query != 0); - m_query = query; -} - -inline void -Exec_query_project::setRow(Exec_expr_row* exprRow) -{ - ctx_assert(m_exprRow == 0 && exprRow != 0); - m_exprRow = exprRow; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp deleted file mode 100644 index 5d29c5af315..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp +++ /dev/null @@ -1,211 +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 */ - -#include -#include -#include -#include "Code_query_range.hpp" -#include "Code_column.hpp" -#include "Code_expr.hpp" -#include "Code_root.hpp" - -// Plan_query_range - -Plan_query_range::~Plan_query_range() -{ -} - -Plan_base* -Plan_query_range::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_range::codegen(Ctx& ctx, Ctl& ctl) -{ - // set up - ctx_assert(m_table != 0 && m_index != 0); - const BaseString& tableName = m_table->getName(); - ctx_assert(m_index->m_dictIndex != 0); - const DictIndex& dictIndex = *m_index->m_dictIndex; - const BaseString& indexName = dictIndex.getName(); - const unsigned keyCount = m_index->m_keyCountUsed; - const ColumnVector& columns = m_table->exprColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_query_range::Code& code = *new Exec_query_range::Code(keyCount, attrCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - code.m_indexName = strcpy(new char[indexName.length() + 1], indexName.c_str()); - code.m_exclusive = m_exclusive; - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictIndex.getColumn(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = k - 1; // index column order - } - // matching expressions - ctx_assert(m_index->m_keyFound); - const ExprVector& keyEq = m_index->m_keyEq; - // check size matches - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // queried attributes - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - const SqlType& sqlType = dictColumn.sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_sqlSpecs.setEntry(i, sqlSpec); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_query_range* exec = new Exec_query_range(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - // interpreter - ctl.m_execQuery = exec; - Exec_pred* execInterp = 0; - ctl.m_topTable = m_table; - if (m_interp != 0) { - execInterp = static_cast(m_interp->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execInterp != 0); - } - ctl.m_topTable = 0; - if (m_interp != 0) - exec->setInterp(execInterp); - return exec; -} - -void -Plan_query_range::print(Ctx& ctx) -{ - ctx.print(" [query_range"); - Plan_base* a[] = { m_table }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_query_range - -Exec_query_range::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; - delete[] m_attrId; -} - -Exec_query_range::Data::~Data() -{ - delete[] m_recAttr; -} - -Exec_query_range::~Exec_query_range() -{ -} - -void -Exec_query_range::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // create data - Data& data = *new Data(this, code.sqlSpecs()); - setData(data); - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } - // needed for isNULL - data.m_recAttr = new NdbRecAttr* [1 + code.m_attrCount]; - for (unsigned i = 0; i <= code.m_attrCount; i++) { - data.m_recAttr[i] = 0; - } - // parallel - data.m_parallel = code.m_exclusive ? 1 : 240; // best supported - // interpreter - if (m_interp != 0) { - //m_interp->alloc(ctx, ctl); XXX - if (! ctx.ok()) - return; - } -} - -void -Exec_query_range::close(Ctx& ctx) -{ - Data& data = getData(); - if (data.m_con != 0) { - Ndb* const ndb = ndbObject(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - data.m_done = true; - ctx_log2(("lookup closed at statement close")); - } - // if (m_interp != 0) - // m_interp->close(ctx); -} - -void -Exec_query_range::print(Ctx& ctx) -{ - ctx.print(" [query_range"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" keyId="); - for (unsigned i = 1; i <= code.m_keyCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_keyId[i]); - } - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - ctx.print(" table=%s", code.m_tableName); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp deleted file mode 100644 index 4438189522c..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp +++ /dev/null @@ -1,186 +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 ODBC_CODEGEN_Code_query_range_hpp -#define ODBC_CODEGEN_Code_query_range_hpp - -#include -#include "Code_query.hpp" -#include "Code_table.hpp" -#include "Code_pred.hpp" - -class Ctx; -class StmtArea; -class NdbConnection; -class NdbOperation; -class NdbRecAttr; - -/* - * Range scan via ordered index. We implement only the case of equality - * on an initial sequence of index keys. - */ - -class Plan_query_range : public Plan_query { -public: - Plan_query_range(Plan_root* root); - virtual ~Plan_query_range(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - void setTable(Plan_table* table, Plan_table::Index* index); - void setInterp(Plan_pred* interp); - void setExclusive(); -protected: - Plan_table* m_table; - Plan_table::Index* m_index; - Plan_pred* m_interp; - bool m_exclusive; -}; - -inline -Plan_query_range::Plan_query_range(Plan_root* root) : - Plan_query(root), - m_table(0), - m_index(0), - m_interp(0), - m_exclusive(false) -{ -} - -inline void -Plan_query_range::setTable(Plan_table* table, Plan_table::Index* index) -{ - ctx_assert(table != 0 && index != 0 && index == &table->m_indexList[index->m_pos] && index->m_pos != 0); - m_table = table; - m_index = index; -} - -inline void -Plan_query_range::setInterp(Plan_pred* interp) -{ - ctx_assert(interp != 0); - m_interp = interp; -} - -inline void -Plan_query_range::setExclusive() -{ - m_exclusive = true; -} - -class Exec_query_range : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(unsigned keyCount, unsigned attrCount); - virtual ~Code(); - protected: - friend class Plan_query_range; - friend class Exec_query_range; - const char* m_tableName; - const char* m_indexName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - unsigned m_attrCount; - SqlSpecs m_sqlSpecs; - NdbAttrId* m_attrId; - bool m_exclusive; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_range* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_range; - SqlRow m_sqlRow; - NdbConnection* m_con; - NdbOperation* m_op; - NdbRecAttr** m_recAttr; - unsigned m_parallel; - bool m_done; // if no match possible due to range - }; - Exec_query_range(Exec_root* root); - virtual ~Exec_query_range(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - const Code& getCode() const; - Data& getData() const; - void setInterp(Exec_pred* interp); -protected: - Exec_pred* m_interp; -}; - -inline -Exec_query_range::Code::Code(unsigned keyCount, unsigned attrCount) : - Exec_query::Code(m_sqlSpecs), - m_tableName(0), - m_indexName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_attrCount(attrCount), - m_sqlSpecs(attrCount), - m_attrId(0), - m_exclusive(false) -{ -} - -inline -Exec_query_range::Data::Data(Exec_query_range* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_con(0), - m_op(0), - m_recAttr(0), - m_parallel(1), - m_done(false) -{ -} - -inline -Exec_query_range::Exec_query_range(Exec_root* root) : - Exec_query(root), - m_interp(0) -{ -} - -inline const Exec_query_range::Code& -Exec_query_range::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_range::Data& -Exec_query_range::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_range::setInterp(Exec_pred* interp) -{ - ctx_assert(interp != 0); - m_interp = interp; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp deleted file mode 100644 index 8b295a97916..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp +++ /dev/null @@ -1,109 +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 */ - -#include "Code_query_repeat.hpp" -#include "Code_root.hpp" - -// Plan_query_repeat - -Plan_query_repeat::~Plan_query_repeat() -{ -} - -Plan_base* -Plan_query_repeat::analyze(Ctx& ctx, Ctl& ctl) -{ - return this; -} - -Exec_base* -Plan_query_repeat::codegen(Ctx& ctx, Ctl& ctl) -{ - Exec_query_repeat* exec = new Exec_query_repeat(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // SqlSpecs is empty - const SqlSpecs sqlSpecs(0); - Exec_query_repeat::Code& code = *new Exec_query_repeat::Code(sqlSpecs, m_forever, m_maxcount); - exec->setCode(code); - return exec; -} - -void -Plan_query_repeat::print(Ctx& ctx) -{ - ctx.print(" [query_repeat"); - if (! m_forever) - ctx.print(" %ld", (long)m_maxcount); - ctx.print("]"); -} - -// Exec_query_repeat - -Exec_query_repeat::Code::~Code() -{ -} - -Exec_query_repeat::Data::~Data() -{ -} - -Exec_query_repeat::~Exec_query_repeat() -{ -} - -void -Exec_query_repeat::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // SqlRow is empty - Data& data = *new Data(this, code.sqlSpecs()); - setData(data); -} - -void -Exec_query_repeat::execImpl(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - data.m_count = 0; -} - -bool -Exec_query_repeat::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - // fetch until count is up - if (code.m_forever || data.m_count < code.m_maxcount) { - data.m_count++; - return true; - } - return false; -} - -void -Exec_query_repeat::close(Ctx& ctx) -{ -} - -void -Exec_query_repeat::print(Ctx& ctx) -{ - const Code& code = getCode(); - ctx.print(" [query_repeat"); - if (! code.m_forever) - ctx.print(" %ld", (long)code.m_maxcount); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp deleted file mode 100644 index 90d6ef55104..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp +++ /dev/null @@ -1,133 +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 ODBC_CODEGEN_Code_query_repeat_hpp -#define ODBC_CODEGEN_Code_query_repeat_hpp - -#include -#include "Code_query.hpp" -#include "Code_expr_row.hpp" - -/** - * @class Plan_query_repeat - * @brief Constant query node in PlanTree - */ -class Plan_query_repeat : public Plan_query { -public: - Plan_query_repeat(Plan_root* root); - Plan_query_repeat(Plan_root* root, CountType maxcount); - virtual ~Plan_query_repeat(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); -private: - bool m_forever; - CountType m_maxcount; -}; - -inline -Plan_query_repeat::Plan_query_repeat(Plan_root* root) : - Plan_query(root), - m_forever(true), - m_maxcount(0) -{ -} - -inline -Plan_query_repeat::Plan_query_repeat(Plan_root* root, CountType maxcount) : - Plan_query(root), - m_forever(false), - m_maxcount(maxcount) -{ -} - -/** - * @class Exec_query_repeat - * @brief Constant query node in ExecTree - */ -class Exec_query_repeat : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs, bool forever, CountType maxcount); - virtual ~Code(); - protected: - friend class Exec_query_repeat; - SqlSpecs m_sqlSpecs; - bool m_forever; - CountType m_maxcount; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_repeat* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_repeat; - SqlRow m_sqlRow; - CountType m_count; - }; - Exec_query_repeat(Exec_root* root); - virtual ~Exec_query_repeat(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_query_repeat::Code::Code(const SqlSpecs& sqlSpecs, bool forever, CountType maxcount) : - Exec_query::Code(m_sqlSpecs), - m_sqlSpecs(sqlSpecs), - m_forever(forever), - m_maxcount(maxcount) -{ -} - -inline -Exec_query_repeat::Data::Data(Exec_query_repeat* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_count(0) -{ -} - -inline -Exec_query_repeat::Exec_query_repeat(Exec_root* root) : - Exec_query(root) -{ -} - -// children - -inline const Exec_query_repeat::Code& -Exec_query_repeat::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_repeat::Data& -Exec_query_repeat::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp deleted file mode 100644 index 1c0f58980e5..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp +++ /dev/null @@ -1,177 +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 */ - -#include -#include -#include -#include -#include "Code_query_scan.hpp" -#include "Code_column.hpp" -#include "Code_root.hpp" - -// Plan_query_scan - -Plan_query_scan::~Plan_query_scan() -{ -} - -Plan_base* -Plan_query_scan::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - if (m_interp != 0) { - m_interp = static_cast(m_interp->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_interp != 0); - } - return this; -} - -Exec_base* -Plan_query_scan::codegen(Ctx& ctx, Ctl& ctl) -{ - // set up - ctx_assert(m_table != 0); - const BaseString& tableName = m_table->getName(); - const DictTable& dictTable = m_table->dictTable(); - const ColumnVector& columns = m_table->exprColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_query_scan::Code& code = *new Exec_query_scan::Code(attrCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - code.m_exclusive = m_exclusive; - // queried attributes - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - const SqlType& sqlType = dictColumn.sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_sqlSpecs.setEntry(i, sqlSpec); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_query_scan* exec = new Exec_query_scan(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - // interpreter - Exec_pred* execInterp = 0; - ctl.m_execQuery = exec; - ctl.m_topTable = m_table; - if (m_interp != 0) { - execInterp = static_cast(m_interp->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execInterp != 0); - } - ctl.m_topTable = 0; - if (m_interp != 0) - exec->setInterp(execInterp); - return exec; -} - -void -Plan_query_scan::print(Ctx& ctx) -{ - ctx.print(" [query_scan"); - Plan_base* a[] = { m_table, m_interp }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_query_scan - -Exec_query_scan::Code::~Code() -{ - delete[] m_tableName; - delete[] m_attrId; -} - -Exec_query_scan::Data::~Data() -{ - delete[] m_recAttr; -} - -Exec_query_scan::~Exec_query_scan() -{ -} - -void -Exec_query_scan::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // create data - Data& data = *new Data(this, code.sqlSpecs()); - // needed for isNULL - data.m_recAttr = new NdbRecAttr* [1 + code.m_attrCount]; - for (unsigned i = 0; i <= code.m_attrCount; i++) { - data.m_recAttr[i] = 0; - } - data.m_parallel = code.m_exclusive ? 1 : 240; // best supported - setData(data); - // interpreter - ctl.m_query = this; - if (m_interp != 0) { - //m_interp->alloc(ctx, ctl); XXX - if (! ctx.ok()) - return; - } -} - -void -Exec_query_scan::close(Ctx& ctx) -{ - Data& data = getData(); - if (data.m_con != 0) { - Ndb* const ndb = ndbObject(); - int ret = data.m_con->stopScan(); - if (ret == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "stopScan"); - } - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("scan closed at statement close")); - } - if (m_interp != 0) - m_interp->close(ctx); -} - -void -Exec_query_scan::print(Ctx& ctx) -{ - ctx.print(" [query_scan"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - ctx.print(" table=%s", code.m_tableName); - } - if (m_interp != 0) - m_interp->print(ctx); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp deleted file mode 100644 index d6d1630ddf8..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp +++ /dev/null @@ -1,174 +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 ODBC_CODEGEN_Code_query_scan_hpp -#define ODBC_CODEGEN_Code_query_scan_hpp - -#include -#include "Code_query.hpp" -#include "Code_table.hpp" -#include "Code_pred.hpp" - -class Ctx; -class StmtArea; -class NdbConnection; -class NdbOperation; -class NdbRecAttr; - -/* - * Table scan. - */ - -class Plan_query_scan : public Plan_query { -public: - Plan_query_scan(Plan_root* root); - virtual ~Plan_query_scan(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - void setTable(Plan_table* table); - void setInterp(Plan_pred* interp); - void setExclusive(); -protected: - Plan_table* m_table; - Plan_pred* m_interp; - bool m_exclusive; // exclusive -}; - -inline -Plan_query_scan::Plan_query_scan(Plan_root* root) : - Plan_query(root), - m_table(0), - m_interp(0), - m_exclusive(false) -{ -} - -inline void -Plan_query_scan::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline void -Plan_query_scan::setInterp(Plan_pred* interp) -{ - ctx_assert(interp != 0); - m_interp = interp; -} - -inline void -Plan_query_scan::setExclusive() -{ - m_exclusive = true; -} - -class Exec_query_scan : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(unsigned attrCount); - virtual ~Code(); - protected: - friend class Plan_query_scan; - friend class Exec_query_scan; - char* m_tableName; - unsigned m_attrCount; - SqlSpecs m_sqlSpecs; - NdbAttrId* m_attrId; - bool m_exclusive; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_scan* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_scan; - SqlRow m_sqlRow; - NdbConnection* m_con; - NdbOperation* m_op; - NdbRecAttr** m_recAttr; - unsigned m_parallel; // parallelism could be runtime option - }; - Exec_query_scan(Exec_root* root); - virtual ~Exec_query_scan(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setInterp(Exec_pred* interp); -protected: - Exec_pred* m_interp; -}; - -inline -Exec_query_scan::Code::Code(unsigned attrCount) : - Exec_query::Code(m_sqlSpecs), - m_tableName(0), - m_attrCount(attrCount), - m_sqlSpecs(attrCount), - m_attrId(0), - m_exclusive(false) -{ -} - -inline -Exec_query_scan::Data::Data(Exec_query_scan* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_con(0), - m_op(0), - m_recAttr(0), - m_parallel(1) -{ -} - -inline -Exec_query_scan::Exec_query_scan(Exec_root* root) : - Exec_query(root), - m_interp(0) -{ -} - -// children - -inline const Exec_query_scan::Code& -Exec_query_scan::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_scan::Data& -Exec_query_scan::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_scan::setInterp(Exec_pred* interp) -{ - ctx_assert(interp != 0); - m_interp = interp; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp deleted file mode 100644 index 4ea6db8c4e2..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp +++ /dev/null @@ -1,239 +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 */ - -#include -#include "Code_query_sort.hpp" -#include "Code_root.hpp" - -// Plan_query_sort - -Plan_query_sort::~Plan_query_sort() -{ -} - -Plan_expr_row* -Plan_query_sort::getRow() -{ - ctx_assert(m_query != 0); - return m_query->getRow(); -} - -Plan_base* -Plan_query_sort::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_sortRow != 0); - m_sortRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_sort::codegen(Ctx& ctx, Ctl& ctl) -{ - // create code for the subquery - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // create code for the row based on query code - ctx_assert(m_sortRow != 0); - ctl.m_execQuery = execQuery->getRawQuery(); - Exec_expr_row* execRow = static_cast(m_sortRow->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execRow != 0); - Exec_query_sort* exec = new Exec_query_sort(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - // re-use SqlSpecs from subquery - const Exec_query::Code& codeQuery = execQuery->getCode(); - const SqlSpecs& sqlSpecs = codeQuery.sqlSpecs(); - // make asc - unsigned size = m_sortRow->getSize(); - bool* asc = new bool[1 + size]; - for (unsigned i = 1; i <= size; i++) { - asc[i] = m_sortRow->m_ascList[i]; - } - Exec_query_sort::Code& code = *new Exec_query_sort::Code(sqlSpecs, asc); - exec->setCode(code); - exec->setQuery(execQuery); - exec->setRow(execRow); - return exec; -} - -void -Plan_query_sort::print(Ctx& ctx) -{ - ctx.print(" [query_sort"); - Plan_base* a[] = { m_query, m_sortRow }; - printList(ctx, a, 2); - ctx.print("]"); -} - -// Exec_query_sort - -Exec_query_sort::Code::~Code() -{ -} - -Exec_query_sort::Data::~Data() -{ - for (unsigned i = 0; i < m_sortList.size(); i++) { - SortItem& sortItem = m_sortList[i]; - delete sortItem.m_dataRow; - delete sortItem.m_sortRow; - } -} - -Exec_query_sort::~Exec_query_sort() -{ -} - -void -Exec_query_sort::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // allocate sort row based on subquery data - ctx_assert(m_sortRow != 0); - ctl.m_query = m_query->getRawQuery(); - m_sortRow->alloc(ctx, ctl); - if (! ctx.ok()) - return; - Data& data = *new Data(this, getCode().sqlSpecs()); - setData(data); -} - -void -Exec_query_sort::execImpl(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_query != 0 && m_sortRow != 0); - ctl.m_sortRow = m_sortRow; - m_query->execute(ctx, ctl); -} - -bool -SortLess::operator()(SortItem s1, SortItem s2) const -{ - const Exec_query_sort::Code& code = m_node->getCode(); - const SqlRow& r1 = *s1.m_sortRow; - const SqlRow& r2 = *s2.m_sortRow; - for (unsigned i = 1; i <= r1.count(); i++) { - const SqlField& f1 = r1.getEntry(i); - const SqlField& f2 = r2.getEntry(i); - // nulls last is default in oracle - bool f1null = f1.sqlNull(); - bool f2null = f2.sqlNull(); - if (f1null && f2null) - continue; - if (! f1null && f2null) - return code.getAsc(i) ? true : false; - if (f1null && ! f2null) - return code.getAsc(i) ? false : true; - if (f1.less(f2)) - return code.getAsc(i) ? true : false; - if (f2.less(f1)) - return code.getAsc(i) ? false : true; - } - return false; -} - -bool -Exec_query_sort::fetchImpl(Ctx& ctx, Ctl& ctl) -{ - Data& data = getData(); - ctx_assert(m_query != 0 && m_sortRow != 0); - ctl.m_sortRow = m_sortRow; - if (! data.m_sorted) { - // read and cache all rows - data.m_count = 0; - while (m_query->fetch(ctx, ctl)) { - const SqlRow* dataRow = m_query->getData().sqlRow().copy(); - const SqlRow* sortRow = 0; - if (ctl.m_groupIndex == 0) { - // evaluate sort row - m_sortRow->evaluate(ctx, ctl); - if (! ctx.ok()) - return false; - sortRow = m_sortRow->getData().sqlRow().copy(); - } else { - // evaluate done by group-by - SqlRow tmpSortRow(m_sortRow->getCode().sqlSpecs()); - for (unsigned i = 1; i <= tmpSortRow.count(); i++) { - tmpSortRow.setEntry(i, m_sortRow->getExpr(i)->getData().groupField(ctl.m_groupIndex)); - } - sortRow = tmpSortRow.copy(); - } - SortItem sortItem(dataRow, sortRow); - data.m_sortList.push_back(sortItem); - data.m_count++; - } - data.m_index = 0; - if (! ctx.ok()) - return false; - // sort the rows XXX use iterated stable_sort - SortLess sortLess(this); - std::sort(data.m_sortList.begin(), data.m_sortList.end(), sortLess); - data.m_sorted = true; - } - if (data.m_index < data.m_count) { - // make our SqlRow reference to current row - const SqlRow& currRow = *data.m_sortList[data.m_index].m_dataRow; - for (unsigned i = 1; i <= data.m_sqlRow.count(); i++) { - const SqlField& currField = currRow.getEntry(i); - SqlSpec sqlSpec(currField.sqlSpec(), SqlSpec::Reference); - SqlField sqlField(sqlSpec, &currField); - data.m_sqlRow.setEntry(i, sqlField); - } - data.m_index++; - return true; - } - return false; -} - -void -Exec_query_sort::close(Ctx& ctx) -{ - Data& data = getData(); - ctx_assert(m_query != 0); - m_query->close(ctx); - data.m_sorted = false; - for (unsigned i = 0; i < data.m_sortList.size(); i++) { - SortItem& sortItem = data.m_sortList[i]; - delete sortItem.m_dataRow; - delete sortItem.m_sortRow; - } - data.m_sortList.clear(); - data.m_count = 0; - data.m_index = 0; -} - -void -Exec_query_sort::print(Ctx& ctx) -{ - ctx.print(" [query_sort"); - Exec_base* a[] = { m_query, m_sortRow }; - printList(ctx, a, 2); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp deleted file mode 100644 index d1aa03d9aef..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp +++ /dev/null @@ -1,208 +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 ODBC_CODEGEN_Code_query_sort_hpp -#define ODBC_CODEGEN_Code_query_sort_hpp - -#include -#include -#include "Code_query.hpp" -#include "Code_expr_row.hpp" - -/** - * @class Plan_query_sort - * @brief Project node in PlanTree - */ -class Plan_query_sort : public Plan_query { -public: - Plan_query_sort(Plan_root* root); - virtual ~Plan_query_sort(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setQuery(Plan_query* query); - void setRow(Plan_expr_row* sortRow); -protected: - Plan_expr_row* getRow(); - Plan_query* m_query; - Plan_expr_row* m_sortRow; -}; - -inline -Plan_query_sort::Plan_query_sort(Plan_root* root) : - Plan_query(root), - m_query(0), - m_sortRow(0) -{ -} - -// children - -inline void -Plan_query_sort::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -inline void -Plan_query_sort::setRow(Plan_expr_row* sortRow) -{ - ctx_assert(sortRow != 0); - m_sortRow = sortRow; -} - -/** - * Item to sort includes data row and sort row. - */ -struct SortItem { - SortItem(const SqlRow* dataRow, const SqlRow* sortRow); - const SqlRow* m_dataRow; // copy of fetched row from subquery - const SqlRow* m_sortRow; // copy of values to sort on -}; - -typedef std::vector SortList; - -class Exec_query_sort; - -struct SortLess : std::binary_function { - SortLess(const Exec_query_sort* node); - const Exec_query_sort* m_node; - bool operator()(SortItem s1, SortItem s2) const; -}; - -inline -SortItem::SortItem(const SqlRow* dataRow, const SqlRow* sortRow) : - m_dataRow(dataRow), - m_sortRow(sortRow) -{ -} - -inline -SortLess::SortLess(const Exec_query_sort* node) : - m_node(node) -{ -} - -/** - * @class Exec_query_sort - * @brief Project node in ExecTree - */ -class Exec_query_sort : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(const SqlSpecs& sqlSpecs, bool* asc); - virtual ~Code(); - bool getAsc(unsigned i) const; - protected: - friend class Exec_query_sort; - const bool* const m_asc; - // sets reference to Sqlspecs from subquery - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_sort* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_sort; - SqlRow m_sqlRow; // current row - bool m_sorted; // fetch and sort done - SortList m_sortList; - unsigned m_count; // number of rows - unsigned m_index; // current fetch index - }; - Exec_query_sort(Exec_root* root); - virtual ~Exec_query_sort(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); - void setRow(Exec_expr_row* sortRow); -protected: - friend class Exec_query; - Exec_query* m_query; - Exec_expr_row* m_sortRow; -}; - -inline -Exec_query_sort::Code::Code(const SqlSpecs& sqlSpecs, bool* asc) : - Exec_query::Code(sqlSpecs), - m_asc(asc) -{ -} - -inline bool -Exec_query_sort::Code::getAsc(unsigned i) const -{ - return m_asc[i]; -} - -inline -Exec_query_sort::Data::Data(Exec_query_sort* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs), - m_sorted(false), - m_count(0), - m_index(0) -{ -} - -inline -Exec_query_sort::Exec_query_sort(Exec_root* root) : - Exec_query(root), - m_query(0), - m_sortRow(0) -{ -} - -// children - -inline const Exec_query_sort::Code& -Exec_query_sort::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_sort::Data& -Exec_query_sort::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_query_sort::setQuery(Exec_query* query) -{ - ctx_assert(m_query == 0 && query != 0); - m_query = query; -} - -inline void -Exec_query_sort::setRow(Exec_expr_row* sortRow) -{ - ctx_assert(m_sortRow == 0 && sortRow != 0); - m_sortRow = sortRow; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp deleted file mode 100644 index affe3dc1264..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp +++ /dev/null @@ -1,130 +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 */ - -#include -#include -#include -#include -#include "Code_query_sys.hpp" -#include "Code_column.hpp" -#include "Code_root.hpp" - -// Plan_query_sys - -Plan_query_sys::~Plan_query_sys() -{ -} - -Plan_base* -Plan_query_sys::analyze(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -Exec_base* -Plan_query_sys::codegen(Ctx& ctx, Ctl& ctl) -{ - // set up - ctx_assert(m_table != 0); - const DictTable& dictTable = m_table->dictTable(); - const ColumnVector& columns = m_table->exprColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_query_sys::Code& code = *new Exec_query_sys::Code(attrCount); - code.m_sysId = dictTable.sysId(); - // queried attributes - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - const SqlType& sqlType = dictColumn.sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_sqlSpecs.setEntry(i, sqlSpec); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_query_sys* exec = new Exec_query_sys(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - return exec; -} - -void -Plan_query_sys::print(Ctx& ctx) -{ - ctx.print(" [query_sys"); - Plan_base* a[] = { m_table }; - printList(ctx, a, 1); - ctx.print("]"); -} - -// Exec_query_sys - -Exec_query_sys::Code::~Code() -{ - delete[] m_attrId; -} - -Exec_query_sys::Data::~Data() -{ -} - -Exec_query_sys::~Exec_query_sys() -{ -} - -void -Exec_query_sys::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // create data - Data& data = *new Data(this, code.sqlSpecs()); - setData(data); -} - -void -Exec_query_sys::close(Ctx& ctx) -{ - Data& data = getData(); - data.m_rowPos = 0; - data.m_tablePos = 0; - data.m_attrPos = 0; - data.m_keyPos = 0; -} - -void -Exec_query_sys::print(Ctx& ctx) -{ - ctx.print(" [query_sys"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - ctx.print(" sysId=%u", (unsigned)code.m_sysId); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp deleted file mode 100644 index 8eb069d0413..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp +++ /dev/null @@ -1,148 +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 ODBC_CODEGEN_Code_query_sys_hpp -#define ODBC_CODEGEN_Code_query_sys_hpp - -#include -#include -#include "Code_query.hpp" -#include "Code_table.hpp" - -class Ctx; -class StmtArea; -class NdbConnection; -class NdbOperation; -class NdbRecAttr; - -/** - * @class Plan_query_sys - * @brief Full select (no where clause) - */ -class Plan_query_sys : public Plan_query { -public: - Plan_query_sys(Plan_root* root); - virtual ~Plan_query_sys(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); -protected: - Plan_table* m_table; -}; - -inline -Plan_query_sys::Plan_query_sys(Plan_root* root) : - Plan_query(root), - m_table(0) -{ -} - -// children - -inline void -Plan_query_sys::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -/** - * @class Exec_query_sys - * @brief Full select (no where clause) - */ -class Exec_query_sys : public Exec_query { -public: - class Code : public Exec_query::Code { - public: - Code(unsigned attrCount); - virtual ~Code(); - protected: - friend class Plan_query_sys; - friend class Exec_query_sys; - DictSys::Id m_sysId; - unsigned m_attrCount; - SqlSpecs m_sqlSpecs; - NdbAttrId* m_attrId; - }; - class Data : public Exec_query::Data { - public: - Data(Exec_query_sys* node, const SqlSpecs& sqlSpecs); - virtual ~Data(); - protected: - friend class Exec_query_sys; - SqlRow m_sqlRow; - // for typeinfo - unsigned m_rowPos; - // for tables and columns - NdbDictionary::Dictionary::List m_objectList; - unsigned m_tablePos; - unsigned m_attrPos; - unsigned m_keyPos; - }; - Exec_query_sys(Exec_root* root); - virtual ~Exec_query_sys(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - bool fetchImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; -}; - -inline -Exec_query_sys::Code::Code(unsigned attrCount) : - Exec_query::Code(m_sqlSpecs), - m_sysId(DictSys::Undef), - m_attrCount(attrCount), - m_sqlSpecs(attrCount), - m_attrId(0) -{ -} - -inline -Exec_query_sys::Data::Data(Exec_query_sys* node, const SqlSpecs& sqlSpecs) : - Exec_query::Data(node, m_sqlRow), - m_sqlRow(sqlSpecs) -{ -} - -inline -Exec_query_sys::Exec_query_sys(Exec_root* root) : - Exec_query(root) -{ -} - -// children - -inline const Exec_query_sys::Code& -Exec_query_sys::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_query_sys::Data& -Exec_query_sys::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_root.cpp b/ndb/src/old_files/client/odbc/codegen/Code_root.cpp deleted file mode 100644 index 4f45bdffdaf..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_root.cpp +++ /dev/null @@ -1,307 +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 */ - -#include -#include "Code_root.hpp" -#include "Code_stmt.hpp" -#include "Code_query.hpp" -#include "Code_expr_param.hpp" -#include "Code_root.hpp" - -// Plan_root - -Plan_root::~Plan_root() -{ -} - -Plan_base* -Plan_root::analyze(Ctx& ctx, Ctl& ctl) -{ - // analyze statement - ctx_assert(m_stmt != 0); - m_stmt = static_cast(m_stmt->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_stmt != 0); - // analyze parameters - ctx_assert(m_paramList.size() > 0); - const unsigned paramCount = m_paramList.size() - 1; - DescArea& ipd = descArea(Desc_usage_IPD); - ipd.setCount(ctx, paramCount); - for (unsigned i = 1; i <= paramCount; i++) { - Plan_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - // analyze the parameter - param->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // must return self - return this; -} - -void -Plan_root::describe(Ctx& ctx) -{ - // describe statement - ctx_assert(m_stmt != 0); - m_stmt->describe(ctx); - // describe parameters - ctx_assert(m_paramList.size() > 0); - const unsigned paramCount = m_paramList.size() - 1; - DescArea& ipd = descArea(Desc_usage_IPD); - ipd.setCount(ctx, paramCount); - unsigned unbound = 0; - for (unsigned i = 1; i <= paramCount; i++) { - Plan_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - // describe the parameter - param->describe(ctx); - // check if SQL type is bound - ctx_assert(param->sqlType().type() != SqlType::Undef); - if (param->sqlType().type() == SqlType::Unbound) - unbound++; - } - if (unbound > 0) - ctx_log2(("%u out of %u params have unbound SQL type", unbound, paramCount)); - m_stmtArea.m_unbound = unbound; -} - -Exec_base* -Plan_root::codegen(Ctx& ctx, Ctl& ctl) -{ - Exec_root* execRoot = new Exec_root(m_stmtArea); - Exec_root::Code& code = *new Exec_root::Code; - execRoot->setCode(code); - // set root in helper struct - ctl.m_execRoot = execRoot; - // generate code for the statement - ctx_assert(m_stmt != 0); - Exec_stmt* execStmt = static_cast(m_stmt->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - execRoot->setStmt(execStmt); - // create parameters list - execRoot->m_paramList.resize(m_paramList.size()); - for (unsigned i = 1; i < m_paramList.size(); i++) { - Plan_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - Exec_expr_param* execParam = static_cast(param->codegen(ctx, ctl)); - ctx_assert(execParam != 0); - execRoot->m_paramList[i] = execParam; - } - return execRoot; -} - -void -Plan_root::print(Ctx& ctx) -{ - ctx.print("[root"); - Plan_base* a[] = { m_stmt }; - printList(ctx, a, 1); - ctx.print("]\n"); -} - -void -Plan_root::saveNode(Plan_base* node) -{ - ctx_assert(node != 0); - m_nodeList.push_back(node); -} - -void -Plan_root::freeNodeList() -{ - for (NodeList::iterator i = m_nodeList.begin(); i != m_nodeList.end(); i++) { - Plan_base* node = *i; - *i = 0; - delete node; - } - m_nodeList.clear(); -} - -// Exec_root - -Exec_root::Code::~Code() -{ -} - -Exec_root::Data::~Data() -{ -} - -Exec_root::~Exec_root() -{ -} - -StmtArea& -Exec_root::stmtArea() const -{ - return m_stmtArea; -} - -void -Exec_root::alloc(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_stmt != 0); - m_stmt->alloc(ctx, ctl); -} - -void -Exec_root::bind(Ctx& ctx) -{ - // bind output cols - ctx_assert(m_stmt != 0); - m_stmt->bind(ctx); - // bind input params - for (unsigned i = 1; i < m_paramList.size(); i++) { - Exec_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - param->bind(ctx); - if (! ctx.ok()) - return; - } -} - -void -Exec_root::execute(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_stmt != 0); - // check if data is needed - for (unsigned i = 1; i < m_paramList.size(); i++) { - Exec_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - Exec_expr_param::Data& paramData = param->getData(); - if (paramData.m_atExec && paramData.m_extPos == -1) { - ctx.setCode(SQL_NEED_DATA); - return; - } - } - m_stmt->execute(ctx, ctl); -} - -void -Exec_root::fetch(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(m_stmt != 0); - Exec_query* query = static_cast(m_stmt); - ctx_assert(query != 0); - query->fetch(ctx, ctl); -} - -void -Exec_root::close(Ctx& ctx) -{ - ctx_assert(m_stmt != 0); - m_stmt->close(ctx); - for (unsigned i = 1; i < m_paramList.size(); i++) { - Exec_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - param->close(ctx); - } -} - -void -Exec_root::print(Ctx& ctx) -{ - ctx.print("[root"); - Exec_base* a[] = { m_stmt }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - ctx.print("]\n"); -} - -void -Exec_root::saveNode(Exec_base* node) -{ - ctx_assert(node != 0); - m_nodeList.push_back(node); -} - -void -Exec_root::freeNodeList() -{ - for (NodeList::iterator i = m_nodeList.begin(); i != m_nodeList.end(); i++) { - Exec_base* node = *i; - *i = 0; - delete node; - } - m_nodeList.clear(); -} - -// odbc support - -void -Exec_root::sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind) -{ - ctx_assert(m_stmt != 0); - Exec_query* query = static_cast(m_stmt); - ctx_assert(query != 0); - query->sqlGetData(ctx, columnNumber, targetType, targetValue, bufferLength, strlen_or_Ind); -} - -void -Exec_root::sqlParamData(Ctx& ctx, SQLPOINTER* value) -{ - ctx_assert(m_paramList.size() > 0); - unsigned count = m_paramList.size() - 1; - for (unsigned i = 1; i <= count; i++) { - Exec_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - Exec_expr_param::Data& paramData = param->getData(); - if (! paramData.m_atExec || paramData.m_extPos >= 0) - continue; - ctx_assert(paramData.m_extField != 0); - ExtField& extField = *paramData.m_extField; - if (value != 0) - *value = extField.m_dataPtr; - m_paramData = i; - ctx.setCode(SQL_NEED_DATA); - return; - } -} - -void -Exec_root::sqlPutData(Ctx& ctx, SQLPOINTER data, SQLINTEGER strlen_or_Ind) -{ - ctx_assert(m_paramList.size() > 0); - unsigned count = m_paramList.size() - 1; - unsigned i = m_paramData; - if (i == 0) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "missing call to SQLParamData"); - return; - } - if (i > count) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "parameter %u out of range 1 to %u", i, count); - return; - } - Exec_expr_param* param = m_paramList[i]; - ctx_assert(param != 0); - Exec_expr_param::Data& paramData = param->getData(); - if (! paramData.m_atExec) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "parameter %u not marked for data-at-exec", i); - return; - } - ctx_assert(paramData.m_extField != 0); - ExtField extField(paramData.m_extField->extSpec(), data, 0, &strlen_or_Ind, i); - if (paramData.m_extPos == -1) - paramData.m_extPos = 0; - extField.setPos(paramData.m_extPos); - // copy in and update position - SqlField& sqlField = paramData.m_sqlField; - sqlField.copyin(ctx, extField); - paramData.m_extPos = extField.getPos(); - ctx_log4(("parameter %u data received", i)); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_root.hpp b/ndb/src/old_files/client/odbc/codegen/Code_root.hpp deleted file mode 100644 index 4f0f96725e3..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_root.hpp +++ /dev/null @@ -1,162 +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 ODBC_CODEGEN_Code_root_hpp -#define ODBC_CODEGEN_Code_root_hpp - -#include -#include -#include "Code_base.hpp" -#include "Code_stmt.hpp" - -class SqlField; -class ExtField; - -/** - * @class Plan_root - * @brief Root node above top level statement node - */ -class Plan_root : public Plan_base { -public: - Plan_root(StmtArea& stmtArea); - virtual ~Plan_root(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setStmt(Plan_stmt* stmt); - // save and free nodes - void saveNode(Plan_base* node); - void freeNodeList(); -private: - friend class CodeGen; - friend class Plan_base; - friend class Plan_expr_param; - StmtArea& m_stmtArea; - Plan_stmt* m_stmt; - ParamVector m_paramList; - typedef std::list NodeList; - NodeList m_nodeList; -}; - -inline -Plan_root::Plan_root(StmtArea& stmtArea) : - Plan_base(this), - m_stmtArea(stmtArea), - m_stmt(0) -{ -} - -inline void -Plan_root::setStmt(Plan_stmt* stmt) -{ - ctx_assert(stmt != 0); - m_stmt = stmt; -} - -/** - * @class Exec_root - * @brief Root node above top level statement node - */ -class Exec_root : public Exec_base { -public: - class Code : public Exec_base::Code { - public: - Code(); - virtual ~Code(); - }; - class Data : public Exec_base::Data { - public: - Data(); - virtual ~Data(); - }; - Exec_root(StmtArea& stmtArea); - virtual ~Exec_root(); - StmtArea& stmtArea() const; - void alloc(Ctx& ctx, Ctl& ctl); - void bind(Ctx& ctx); - void execute(Ctx& ctx, Ctl& ctl); - void fetch(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setStmt(Exec_stmt* stmt); - // save and free nodes - void saveNode(Exec_base* node); - void freeNodeList(); - // odbc support - void sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind); - void sqlParamData(Ctx& ctx, SQLPOINTER* value); - void sqlPutData(Ctx& ctx, SQLPOINTER data, SQLINTEGER strlen_or_Ind); -private: - friend class Plan_root; - friend class Exec_base; - friend class CodeGen; - StmtArea& m_stmtArea; - Exec_stmt* m_stmt; - ParamVector m_paramList; - unsigned m_paramData; // position of SQLParamData - typedef std::list NodeList; - NodeList m_nodeList; -}; - -inline -Exec_root::Code::Code() -{ -} - -inline -Exec_root::Data::Data() -{ -} - -inline -Exec_root::Exec_root(StmtArea& stmtArea) : - Exec_base(this), - m_stmtArea(stmtArea), - m_stmt(0), - m_paramData(0) -{ -} - -// children - -inline const Exec_root::Code& -Exec_root::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_root::Data& -Exec_root::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_root::setStmt(Exec_stmt* stmt) -{ - ctx_assert(stmt != 0); - m_stmt = stmt; - m_stmt->m_topLevel = true; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_select.cpp b/ndb/src/old_files/client/odbc/codegen/Code_select.cpp deleted file mode 100644 index 611b491968d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_select.cpp +++ /dev/null @@ -1,406 +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 */ - -#include -#include -#include -#include "Code_select.hpp" -#include "Code_query_lookup.hpp" -#include "Code_query_index.hpp" -#include "Code_query_scan.hpp" -#include "Code_query_range.hpp" -#include "Code_query_sys.hpp" -#include "Code_query_project.hpp" -#include "Code_query_filter.hpp" -#include "Code_query_join.hpp" -#include "Code_query_count.hpp" -#include "Code_query_sort.hpp" -#include "Code_query_group.hpp" -#include "Code_query_distinct.hpp" -#include "Code_expr_column.hpp" -#include "Code_expr_const.hpp" -#include "Code_pred_op.hpp" -#include "Code_root.hpp" - -Plan_select::~Plan_select() -{ -} - -Plan_base* -Plan_select::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_select); - // analyze tables - ctx_assert(m_tableList != 0); - for (unsigned i = 1; i <= m_tableList->countTable(); i++) { - Plan_table* table = m_tableList->getTable(i); - table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - ctx_assert(m_exprRow != 0); - if (m_exprRow->getAsterisk()) { - // expand unqualified asterisk to table-qualified columns - setRow(new Plan_expr_row(m_root)); - m_root->saveNode(m_exprRow); - for (unsigned i = 1; i <= m_tableList->countTable(); i++) { - const Plan_table* table = m_tableList->getTable(i); - const DictTable& dictTable = table->dictTable(); - for (unsigned i = 1; i <= dictTable.getSize(); i++) { - DictColumn* dictColumn = dictTable.getColumn(i); - Plan_expr_column* column = new Plan_expr_column(m_root, dictColumn->getName()); - m_root->saveNode(column); - column->setCname(table->getCname()); - m_exprRow->addExpr(column); - } - } - } - // set name resolution scope - ctl.m_tableList = m_tableList->m_tableList; - ctx_assert(ctl.m_tableList.size() >= 1 + 1); - ctl.m_aggrin = false; - // analyze select row - ctl.m_aggrok = true; - ctx_assert(m_exprRow != 0); - m_exprRow = static_cast(m_exprRow->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_exprRow != 0); - // analyze group by row - ctl.m_aggrok = false; - if (m_groupRow != 0) { - m_groupRow = static_cast(m_groupRow->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_groupRow != 0); - } - // analyze having predicate - ctl.m_aggrok = true; - if (m_havingPred != 0) { - m_havingPred = static_cast(m_havingPred->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_havingPred != 0); - } - // ana|yze order by row - ctl.m_aggrok = true; - if (m_sortRow != 0) { - m_sortRow = static_cast(m_sortRow->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_sortRow != 0); - } - // analyze the predicate - ctl.m_aggrok = false; - ctl.m_topand = true; - ctl.m_extra = false; - if (m_pred != 0) { - m_pred = static_cast(m_pred->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_pred != 0); - } - // check if group by required - if (m_exprRow->anyAggr() && ! m_exprRow->allBound() && m_groupRow == 0) { - ctx.pushStatus(Error::Gen, "missing GROUP BY clause"); - return 0; - } - // in special cases add "group by 1" - if (m_groupRow == 0) { - bool addgb = false; - if (m_havingPred != 0) { - // allowed by oracle but nearly useless - addgb = true; - } else if (m_exprRow->anyAggr() && m_sortRow != 0) { - // allowed by oracle but useless - ctx_assert(m_exprRow->allBound()); - addgb = true; - } - if (addgb) { - ctx_log2(("adding 'group by 1'")); - m_groupRow = new Plan_expr_row(m_root); - m_root->saveNode(m_groupRow); - LexType type(LexType::Integer); - Plan_expr* expr = new Plan_expr_const(m_root, type, "1"); - m_root->saveNode(expr); - m_groupRow->addExpr(expr); - m_groupRow = static_cast(m_groupRow->analyze(ctx, ctl)); - ctx_assert(ctx.ok()); - ctx_assert(m_groupRow != 0); - } - } - // check group by allowed - if (m_groupRow != 0) { - if (! m_exprRow->isAllGroupBy(m_groupRow)) { - ctx.pushStatus(Error::Gen, "invalid GROUP BY expression in SELECT list"); - return 0; - } - if (m_havingPred != 0) { - if (! m_havingPred->isGroupBy(m_groupRow)) { - ctx.pushStatus(Error::Gen, "invalid GROUP BY expression in HAVING clause"); - return 0; - } - } - if (m_sortRow != 0) { - if (! m_sortRow->isAllGroupBy(m_groupRow)) { - ctx.pushStatus(Error::Gen, "invalid GROUP BY expression in ORDER BY clause"); - return 0; - } - } - } - // log top level predicate - { - unsigned n = 0; - for (PredList::iterator i = ctl.m_topcomp.begin(); i != ctl.m_topcomp.end(); i++) - ctx_log2(("top level pred %u: count tables = %u, not interp = %u", - ++n, - (unsigned)(*i)->tableSet().size(), - (unsigned)(*i)->noInterp().size())); - } - // compose the raw query from lookups and scans - Plan_query* queryRaw = 0; - TableVector tableVector(1); - TableSet tsDone; - while (tableVector.size() < ctl.m_tableList.size()) { - Plan_table* tableBest = 0; - Plan_table::Index* indexBest = 0; - for (unsigned n = 1; n < ctl.m_tableList.size(); n++) { - Plan_table* table = ctl.m_tableList[n]; - if (tsDone.find(table) != tsDone.end()) - continue; - // get system table out of the way - if (table->dictTable().sysId()) { - tableBest = table; - break; - } - // find best match for primary key or index - for (unsigned i = 0; i <= table->indexCount(); i++) { - Plan_table::Index& index = table->m_indexList[i]; - table->resolveSet(ctx, index, tsDone); - if (! ctx.ok()) - return 0; - if (! index.m_keyFound) - continue; - // prefer smaller dependency set, smaller rank, less unused keys - int k; - (k = (indexBest == 0)) || - (k = (indexBest->m_keySet.size() - index.m_keySet.size())) || - (k = (indexBest->m_rank - index.m_rank)) || - (k = (indexBest->m_keyCountUnused - index.m_keyCountUnused)); - if (k > 0) { - tableBest = table; - indexBest = &index; - } - } - } - Plan_query* queryNext = 0; - Plan_table* tableNext = 0; - Plan_query_scan* queryScan = 0; // for pushing interpreted program - Plan_query_range* queryRange = 0; // ditto - if (tableBest == 0) { - // scan first unprocessed table - for (unsigned n = 1; n < ctl.m_tableList.size(); n++) { - Plan_table* table = ctl.m_tableList[n]; - if (tsDone.find(table) != tsDone.end()) - continue; - tableNext = table; - break; - } - ctx_assert(tableNext != 0); - queryScan = new Plan_query_scan(m_root); - m_root->saveNode(queryScan); - queryScan->setTable(tableNext); - queryNext = queryScan; - ctx_log2(("optim: scan %s", tableNext->getPrintName())); - } else if (tableBest->dictTable().sysId()) { - // "scan" system table - tableNext = tableBest; - Plan_query_sys* querySys = new Plan_query_sys(m_root); - m_root->saveNode(querySys); - querySys->setTable(tableNext); - queryNext = querySys; - ctx_log2(("optim: scan %s", tableNext->getPrintName())); - } else if (indexBest->m_keySet.size() > 0) { - // scan first table this one depends on - const TableSet& keySet = indexBest->m_keySet; - for (unsigned n = 1; n < ctl.m_tableList.size(); n++) { - Plan_table* table = ctl.m_tableList[n]; - if (keySet.find(table) == keySet.end()) - continue; - ctx_assert(tsDone.find(table) == tsDone.end()); - tableNext = table; - break; - } - ctx_assert(tableNext != 0); - queryScan = new Plan_query_scan(m_root); - m_root->saveNode(queryScan); - queryScan->setTable(tableNext); - queryNext = queryScan; - ctx_log2(("optim: scan %s for %s", tableNext->getPrintName(), tableBest->getPrintName())); - } else if (indexBest->m_rank == 0) { - // primary key depends only on processed tables - tableNext = tableBest; - Plan_query_lookup* queryLookup = new Plan_query_lookup(m_root); - m_root->saveNode(queryLookup); - queryLookup->setTable(tableNext); - queryNext = queryLookup; - ctx_log2(("optim: lookup %s", tableNext->getPrintName())); - } else if (indexBest->m_rank == 1) { - // hash index key depends only on processed tables - tableNext = tableBest; - Plan_query_index* queryIndex = new Plan_query_index(m_root); - m_root->saveNode(queryIndex); - queryIndex->setTable(tableNext, indexBest); - queryNext = queryIndex; - ctx_log2(("optim: lookup %s via index %s", tableNext->getPrintName(), indexBest->m_dictIndex->getName().c_str())); - } else if (indexBest->m_rank == 2) { - // ordered index key depends only on processed tables - tableNext = tableBest; - queryRange = new Plan_query_range(m_root); - m_root->saveNode(queryRange); - queryRange->setTable(tableNext, indexBest); - queryNext = queryRange; - ctx_log2(("optim: range scan %s via index %s", tableNext->getPrintName(), indexBest->m_dictIndex->getName().c_str())); - } else { - ctx_assert(false); - } - if (queryRaw == 0) { - queryRaw = queryNext; - } else { - Plan_query_join* queryJoin = new Plan_query_join(m_root); - m_root->saveNode(queryJoin); - queryJoin->setInner(queryRaw); - queryJoin->setOuter(queryNext); - queryRaw = queryJoin; - } - tableVector.push_back(tableNext); - tsDone.insert(tableNext); - // push down part of top level predicate to table scan or range scan - Plan_pred* predPush = 0; - Plan_pred* predInterp = 0; - PredList::iterator i = ctl.m_topcomp.begin(); - while (i != ctl.m_topcomp.end()) { - const TableSet& ts = (*i)->tableSet(); - if (! std::includes(tsDone.begin(), tsDone.end(), ts.begin(), ts.end())) { - i++; - continue; - } - predPush = predPush == 0 ? *i : predPush->opAnd(*i); - if (queryScan != 0) { - const TableSet& ts2 = (*i)->noInterp(); - if (ts2.find(tableNext) == ts2.end()) - predInterp = predInterp == 0 ? *i : predInterp->opAnd(*i); - } - if (queryRange != 0) { - const TableSet& ts2 = (*i)->noInterp(); - if (ts2.find(tableNext) == ts2.end()) - predInterp = predInterp == 0 ? *i : predInterp->opAnd(*i); - } - // remove it from top level predicate - PredList::iterator j = i; - i++; - ctl.m_topcomp.erase(j); - } - if (predPush != 0) { - Plan_query_filter* queryPush = new Plan_query_filter(m_root); - m_root->saveNode(queryPush); - queryPush->setQuery(queryRaw); - queryPush->setPred(predPush); - queryPush->m_topTable = tableNext; - queryRaw = queryPush; - } - if (predInterp != 0) { - if (queryScan != 0) - queryScan->setInterp(predInterp); - else if (queryRange != 0) - queryRange->setInterp(predInterp); - else - ctx_assert(false); - } - } - ctx_assert(ctl.m_topcomp.empty()); - // set base for column position offsets - for (unsigned n = 1; n < tableVector.size(); n++) { - Plan_table* table = tableVector[n]; - if (n == 1) { - table->m_resOff = 1; - } else { - Plan_table* tablePrev = tableVector[n - 1]; - table->m_resOff = tablePrev->m_resOff + tablePrev->m_exprColumns.size() - 1; - } - } - // next level up is one of project, count, group by - Plan_query* queryTop; - if (m_groupRow == 0) { - if (! m_exprRow->anyAggr()) { - Plan_query_project* queryProject = new Plan_query_project(m_root); - m_root->saveNode(queryProject); - queryProject->setQuery(queryRaw); - queryProject->setRow(m_exprRow); - queryProject->setLimit(m_limitOff, m_limitCnt); - queryTop = queryProject; - } else { - ctx_assert(m_exprRow->allBound()); - Plan_query_count* queryCount = new Plan_query_count(m_root); - m_root->saveNode(queryCount); - queryCount->setQuery(queryRaw); - queryCount->setRow(m_exprRow); - queryTop = queryCount; - } - } else { - Plan_query_group* queryGroup = new Plan_query_group(m_root); - m_root->saveNode(queryGroup); - queryGroup->setQuery(queryRaw); - queryGroup->setDataRow(m_exprRow); - queryGroup->setGroupRow(m_groupRow); - if (m_havingPred != 0) - queryGroup->setHavingPred(m_havingPred); - queryTop = queryGroup; - } - // optional sort becomes new top level - if (m_sortRow != 0) { - Plan_query_sort* querySort = new Plan_query_sort(m_root); - m_root->saveNode(querySort); - querySort->setQuery(queryTop); - querySort->setRow(m_sortRow); - queryTop = querySort; - } - // optional distinct becomes new top level - if (m_distinct) { - Plan_query_distinct* queryDistinct = new Plan_query_distinct(m_root); - m_root->saveNode(queryDistinct); - queryDistinct->setQuery(queryTop); - queryTop = queryDistinct; - } - // return top node - return queryTop; -} - -Exec_base* -Plan_select::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_select::print(Ctx& ctx) -{ - ctx.print(" [select"); - Plan_base* a[] = { m_tableList, m_exprRow, m_pred, m_groupRow, m_havingPred }; - printList(ctx, a, 5); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_select.hpp b/ndb/src/old_files/client/odbc/codegen/Code_select.hpp deleted file mode 100644 index eaa9b801f29..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_select.hpp +++ /dev/null @@ -1,132 +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 ODBC_CODEGEN_Code_select_hpp -#define ODBC_CODEGEN_Code_select_hpp - -#include -#include "Code_stmt.hpp" -#include "Code_expr_row.hpp" -#include "Code_table_list.hpp" -#include "Code_pred.hpp" - -/** - * @class Plan_select - * @brief General select in PlanTree - * - * General select. An initial PlanTree node. - */ -class Plan_select : public Plan_stmt { -public: - Plan_select(Plan_root* root); - virtual ~Plan_select(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setList(Plan_table_list* tableList); - void setRow(Plan_expr_row* exprRow); - void setPred(Plan_pred* pred); - void setSort(Plan_expr_row* sortRow); - void setDistinct(bool distinct); - void setGroup(Plan_expr_row* groupRow); - void setHaving(Plan_pred* havingPred); - void setLimit(int off, int cnt); -protected: - Plan_table_list* m_tableList; - Plan_expr_row* m_exprRow; - Plan_pred* m_pred; - Plan_expr_row* m_sortRow; - bool m_distinct; - Plan_expr_row* m_groupRow; - Plan_pred* m_havingPred; - int m_limitOff; - int m_limitCnt; -}; - -inline -Plan_select::Plan_select(Plan_root* root) : - Plan_stmt(root), - m_tableList(0), - m_exprRow(0), - m_pred(0), - m_sortRow(0), - m_distinct(false), - m_groupRow(0), - m_havingPred(0), - m_limitOff(0), - m_limitCnt(-1) -{ -} - -// children - -inline void -Plan_select::setList(Plan_table_list* tableList) -{ - ctx_assert(tableList != 0); - m_tableList = tableList; -} - -inline void -Plan_select::setRow(Plan_expr_row* exprRow) -{ - ctx_assert(exprRow != 0); - m_exprRow = exprRow; -} - -inline void -Plan_select::setPred(Plan_pred* pred) -{ - ctx_assert(pred != 0); - m_pred = pred; -} - -inline void -Plan_select::setSort(Plan_expr_row* sortRow) -{ - ctx_assert(sortRow != 0); - m_sortRow = sortRow; -} - -inline void -Plan_select::setDistinct(bool distinct) -{ - m_distinct = distinct; -} - -inline void -Plan_select::setGroup(Plan_expr_row* groupRow) -{ - ctx_assert(groupRow != 0); - m_groupRow = groupRow; -} - -inline void -Plan_select::setHaving(Plan_pred* havingPred) -{ - ctx_assert(havingPred != 0); - m_havingPred = havingPred; -} - -inline void -Plan_select::setLimit(int off, int cnt) -{ - m_limitOff = off; - m_limitCnt = cnt; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp deleted file mode 100644 index dd13ba0c3f7..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp +++ /dev/null @@ -1,44 +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 */ - -#include "Code_set_row.hpp" -#include "Code_dml_column.hpp" - -Plan_set_row::~Plan_set_row() -{ -} - -Plan_base* -Plan_set_row::analyze(Ctx& ctx, Ctl& ctl) -{ - return this; -} - -Exec_base* -Plan_set_row::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_set_row::print(Ctx& ctx) -{ - ctx.print(" [set_row"); - Plan_base* a[] = { m_dmlRow, m_exprRow }; - printList(ctx, a, 2); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp deleted file mode 100644 index 10d62826ac7..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp +++ /dev/null @@ -1,76 +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 ODBC_CODEGEN_Code_set_row_hpp -#define ODBC_CODEGEN_Code_set_row_hpp - -#include -#include -#include -#include "Code_base.hpp" -#include "Code_dml_row.hpp" -#include "Code_expr_row.hpp" -#include "Code_root.hpp" - -/** - * @class Plan_set_row - * @brief Row of column assigments in update - * - * Used only in parse. The column and expression rows are moved - * to the update node immediately after parse. - */ -class Plan_set_row : public Plan_base { -public: - Plan_set_row(Plan_root* root); - virtual ~Plan_set_row(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void addColumn(Plan_dml_column* column); - void addExpr(Plan_expr* expr); -protected: - friend class Plan_update; - friend class Plan_insert; // for MySql - Plan_dml_row* m_dmlRow; - Plan_expr_row* m_exprRow; -}; - -inline -Plan_set_row::Plan_set_row(Plan_root* root) : - Plan_base(root) -{ - m_dmlRow = new Plan_dml_row(root); - root->saveNode(m_dmlRow); - m_exprRow = new Plan_expr_row(root); - root->saveNode(m_exprRow); -} - -// children - -inline void -Plan_set_row::addColumn(Plan_dml_column* column) -{ - m_dmlRow->addColumn(column); -} - -inline void -Plan_set_row::addExpr(Plan_expr* expr) -{ - m_exprRow->addExpr(expr); -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp b/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp deleted file mode 100644 index d790f667b84..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "Code_stmt.hpp" - -// Plan_stmt - -Plan_stmt::~Plan_stmt() -{ -} - -// XXX remove -void -Plan_stmt::describe(Ctx& ctx) -{ - ctx_log1(("unimplemented describe")); -} - -// Exec_stmt - -Exec_stmt::Code::~Code() -{ -} - -Exec_stmt::Data::~Data() -{ -} - -Exec_stmt::~Exec_stmt() -{ -} - -void -Exec_stmt::bind(Ctx& ctx) -{ -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp b/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp deleted file mode 100644 index 20b7fb965fb..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp +++ /dev/null @@ -1,76 +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 ODBC_CODEGEN_Code_stmt_hpp -#define ODBC_CODEGEN_Code_stmt_hpp - -#include -#include -#include "Code_base.hpp" - -class Ctx; - -/** - * @class Plan_stmt - * @brief Base class for statements in PlanTree - * - * A statement is a complete or partial SQL statement which can - * be optimized into executable statements Exec_stmt. - */ -class Plan_stmt : public Plan_base { -public: - Plan_stmt(Plan_root* root); - virtual ~Plan_stmt() = 0; - virtual void describe(Ctx& ctx); -}; - -inline -Plan_stmt::Plan_stmt(Plan_root* root) : - Plan_base(root) -{ -} - -/** - * @class Exec_stmt - * @brief Base class for statements in ExecTree - */ -class Exec_stmt : public Exec_base { -public: - class Code : public Exec_base::Code { - public: - virtual ~Code() = 0; - }; - class Data : public Exec_base::Data { - public: - virtual ~Data() = 0; - }; - Exec_stmt(Exec_root* root); - virtual ~Exec_stmt() = 0; - virtual void bind(Ctx& ctx); - virtual void execute(Ctx& ctx, Ctl& ctl) = 0; -protected: - friend class Exec_root; - bool m_topLevel; -}; - -inline -Exec_stmt::Exec_stmt(Exec_root* root) : - Exec_base(root), - m_topLevel(false) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_table.cpp b/ndb/src/old_files/client/odbc/codegen/Code_table.cpp deleted file mode 100644 index ee3c2a2ed07..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_table.cpp +++ /dev/null @@ -1,254 +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 */ - -#include -#include -#include -#include -#include -#include "Code_table.hpp" -#include "Code_column.hpp" -#include "Code_expr_column.hpp" - -Plan_table::~Plan_table() -{ -} - -Plan_base* -Plan_table::analyze(Ctx& ctx, Ctl& ctl) -{ - if (m_dictTable != 0) // already done - return this; - DictTable* table = dictSchema().findTable(m_name); - if (table == 0) { - table = dictSchema().loadTable(ctx, m_name); - if (table == 0) { - ctx.pushStatus(Sqlstate::_42S02, Error::Gen, "table %s not found", m_name.c_str()); - return 0; - } - } - m_dictTable = table; - // indexes - m_indexList.resize(1 + m_dictTable->indexCount()); - for (unsigned i = 0; i <= indexCount(); i++) { - Index& index = m_indexList[i]; - index.m_pos = i; - if (index.m_pos == 0) { - index.m_keyCount = m_dictTable->keyCount(); - index.m_rank = 0; - } else { - index.m_dictIndex = m_dictTable->getIndex(i); - index.m_keyCount = index.m_dictIndex->getSize(); - if (index.m_dictIndex->getType() == NdbDictionary::Object::UniqueHashIndex) { - index.m_rank = 1; - } else if (index.m_dictIndex->getType() == NdbDictionary::Object::OrderedIndex) { - index.m_rank = 2; - } else { - ctx_assert(false); - } - } - index.m_keyEqList.resize(1 + index.m_keyCount); - } - return this; -} - -int -Plan_table::resolveColumn(Ctx& ctx, Plan_column* column, bool stripSchemaName) -{ - ctx_assert(column != 0); - bool dml, unq; - switch (column->m_type) { - case Plan_column::Type_expr: - dml = false; - unq = false; - break; - case Plan_column::Type_dml: - dml = true; - unq = true; - break; - case Plan_column::Type_idx: - dml = false; - unq = true; - break; - default: - ctx_assert(false); - break; - } - ColumnVector& columns = ! dml ? m_exprColumns : m_dmlColumns; - const BaseString& name = column->m_name; - const BaseString& cname = column->m_cname; - ctx_log3(("resolve %s column %s in table %s", ! dml ? "expr" : "dml", column->getPrintName(), getPrintName())); - // find column in table - DictColumn* dictColumn = dictTable().findColumn(name); - if (dictColumn == 0) - return 0; - // qualified column must match table correlation name - if (! cname.empty()) { - const char* str; - if (! m_cname.empty()) { - str = m_cname.c_str(); - } else { - str = m_name.c_str(); - if (stripSchemaName && strrchr(str, '.') != 0) - str = strrchr(str, '.') + 1; - } - if (strcmp(cname.c_str(), str) != 0) - return 0; - } - // find in positional list or add to it - unsigned resPos; - for (resPos = 1; resPos < columns.size(); resPos++) { - if (strcmp(columns[resPos]->getName().c_str(), name.c_str()) != 0) - continue; - // these columns must be unique - if (unq) { - ctx.pushStatus(Error::Gen, "duplicate column %s", column->getName().c_str()); - return -1; - } - break; - } - if (resPos >= columns.size()) { - columns.push_back(column); - } - ctx_log3(("resolve to attrId %u pos %u", (unsigned)dictColumn->getAttrId(), resPos)); - column->m_dictColumn = dictColumn; - column->m_resTable = this; - column->m_resPos = resPos; - // found - return 1; -} - -bool -Plan_table::resolveEq(Ctx& ctx, Plan_expr_column* column, Plan_expr* expr) -{ - ctx_assert(m_dictTable != 0); - const TableSet& ts = expr->tableSet(); - TableSet::const_iterator i = ts.find(this); - if (i != ts.end()) - return false; - unsigned found = 0; - for (unsigned i = 0; i <= indexCount(); i++) { - Index& index = m_indexList[i]; - for (unsigned n = 1, cnt = 0; n <= index.m_keyCount; n++) { - const DictColumn* dictColumn = 0; - if (index.m_pos == 0) { - ctx_assert(m_dictTable != 0); - dictColumn = m_dictTable->getKey(n); - } else { - ctx_assert(index.m_dictIndex != 0); - dictColumn = index.m_dictIndex->getColumn(n); - } - if (dictColumn != &column->dictColumn()) - continue; - ctx_assert(++cnt == 1); - index.m_keyEqList[n].push_back(expr); - if (index.m_pos == 0) - ctx_log2(("%s: found match to primary key column %s pos %u", getPrintName(), column->getPrintName(), n)); - else - ctx_log2(("%s: found match to index %s column %s pos %u", getPrintName(), index.m_dictIndex->getName().c_str(), column->getPrintName(), n)); - found++; - } - } - return (found != 0); -} - -void -Plan_table::resolveSet(Ctx& ctx, Index& index, const TableSet& tsDone) -{ - index.m_keyFound = false; - ExprVector keyEq; - keyEq.resize(1 + index.m_keyCount); - resolveSet(ctx, index, tsDone, keyEq, 1); -} - -void -Plan_table::resolveSet(Ctx& ctx, Index& index, const TableSet& tsDone, ExprVector& keyEq, unsigned n) -{ - if (n <= index.m_keyCount) { - // building up combinations - ExprList& keyEqList = index.m_keyEqList[n]; - for (ExprList::iterator i = keyEqList.begin(); i != keyEqList.end(); i++) { - keyEq[n] = *i; - resolveSet(ctx, index, tsDone, keyEq, n + 1); - } - if (! keyEqList.empty() || index.m_rank <= 1 || n == 1) - return; - // ordered index with maximal initial key match - } - TableSet keySet; - for (unsigned i = 1; i <= n - 1; i++) { - const TableSet& tableSet = keyEq[i]->tableSet(); - for (TableSet::const_iterator j = tableSet.begin(); j != tableSet.end(); j++) { - if (tsDone.find(*j) == tsDone.end()) - keySet.insert(*j); - } - } - if (! index.m_keyFound || index.m_keySet.size() > keySet.size()) { - index.m_keyFound = true; - index.m_keyEq = keyEq; - index.m_keySet = keySet; - index.m_keyCountUsed = n - 1; - index.m_keyCountUnused = index.m_keyCount - index.m_keyCountUsed; - // set matching size - index.m_keyEq.resize(1 + index.m_keyCountUsed); - } -} - -bool -Plan_table::exactKey(Ctx& ctx, const Index* indexKey) const -{ - ctx_assert(indexKey != 0 && indexKey == &m_indexList[indexKey->m_pos]); - for (unsigned i = 0; i <= indexCount(); i++) { - const Index& index = m_indexList[i]; - const ExprListVector& keyEqList = index.m_keyEqList; - for (unsigned n = 1; n <= index.m_keyCount; n++) { - if (index.m_pos == indexKey->m_pos) { - ctx_assert(keyEqList[n].size() >= 1); - if (keyEqList[n].size() > 1) { - ctx_log2(("index %u not exact: column %u has %u > 1 matches", - indexKey->m_pos, - n, - (unsigned)keyEqList[n].size())); - return false; - } - } else { - if (keyEqList[n].size() > 0) { - ctx_log2(("index %u not exact: index %u column %u has %u > 0 matches", - indexKey->m_pos, - index.m_pos, - n, - (unsigned)keyEqList[n].size())); - return false; - } - } - } - } - ctx_log2(("index %u is exact", indexKey->m_pos)); - return true; -} - -Exec_base* -Plan_table::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_table::print(Ctx& ctx) -{ - ctx.print(" [table %s]", getPrintName()); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_table.hpp b/ndb/src/old_files/client/odbc/codegen/Code_table.hpp deleted file mode 100644 index 8a95b8fa26c..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_table.hpp +++ /dev/null @@ -1,202 +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 ODBC_CODEGEN_Code_table_hpp -#define ODBC_CODEGEN_Code_table_hpp - -#include -#include -#include "Code_base.hpp" - -class DictTable; -class DictColumn; -class DictIndex; -class Plan_query_filter; -class Plan_query_lookup; -class Plan_query_range; -class Plan_column; -class Plan_expr_column; -class Plan_select; -class Plan_delete; -class Plan_delete_lookup; -class Plan_update; -class Plan_update_lookup; - -/** - * @class Plan_table - * @brief Table node in PlanTree - * - * This is a pure Plan node. Final executable nodes have table - * information built-in. - */ -class Plan_table : public Plan_base { -public: - Plan_table(Plan_root* root, const BaseString& name); - virtual ~Plan_table(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // attributes - const BaseString& getName() const; - const BaseString& getCname() const; - const char* getPrintName() const; - void setCname(const BaseString& cname); - const DictTable& dictTable() const; - unsigned indexCount() const; - // resolve - const ColumnVector& exprColumns() const; - const ColumnVector& dmlColumns() const; -protected: - friend class Plan_column; - friend class Plan_query_filter; - friend class Plan_query_lookup; - friend class Plan_query_index; - friend class Plan_query_range; - friend class Plan_expr_column; - friend class Plan_select; - friend class Plan_delete; - friend class Plan_delete_lookup; - friend class Plan_delete_index; - friend class Plan_update; - friend class Plan_update_lookup; - friend class Plan_update_index; - BaseString m_name; - BaseString m_cname; - BaseString m_printName; - DictTable* m_dictTable; - /* - * Resolve column. Returns 1 on found, 0 on not found, and -1 on error. - * Modifies both table and column data. - */ - int resolveColumn(Ctx& ctx, Plan_column* column, bool stripSchemaName = false); - ColumnVector m_exprColumns; - ColumnVector m_dmlColumns; - /* - * Offset for resolved columns in join. This is sum over m_exprColumns - * lengths for all preceding tables. - */ - unsigned m_resOff; - /* - * Each column in primary key and unique hash index has list of - * expressions it is set equal to in the where-clause (at top level). - */ - bool resolveEq(Ctx& ctx, Plan_expr_column* column, Plan_expr* expr); - /* - * Index struct for primary key and indexes. - */ - struct Index { - Index() : - m_pos(0), - m_keyFound(false), - m_dictIndex(0), - m_rank(~0), - m_keyCount(0), - m_keyCountUsed(0) { - } - unsigned m_pos; - ExprListVector m_keyEqList; - bool m_keyFound; - ExprVector m_keyEq; - TableSet m_keySet; - const DictIndex* m_dictIndex; // for index only - unsigned m_rank; // 0-pk 1-hash index 2-ordered index - unsigned m_keyCount; // number of columns - unsigned m_keyCountUsed; // may be less for ordered index - unsigned m_keyCountUnused; // m_keyCount - m_keyCountUsed - }; - typedef std::vector IndexList; // primary key is entry 0 - IndexList m_indexList; - /* - * Find set of additional tables (maybe empty) required to resolve the key - * columns. - */ - void resolveSet(Ctx& ctx, Index& index, const TableSet& tsDone); - void resolveSet(Ctx& ctx, Index& index, const TableSet& tsDone, ExprVector& keyEq, unsigned n); - /* - * Check for exactly one key or index match. - */ - bool exactKey(Ctx& ctx, const Index* indexKey) const; -}; - -inline -Plan_table::Plan_table(Plan_root* root, const BaseString& name) : - Plan_base(root), - m_name(name), - m_printName(name), - m_dictTable(0), - m_exprColumns(1), // 1-based - m_dmlColumns(1), // 1-based - m_resOff(0), - m_indexList(1) -{ -} - -inline const BaseString& -Plan_table::getName() const -{ - return m_name; -} - -inline const BaseString& -Plan_table::getCname() const -{ - return m_cname; -} - -inline const char* -Plan_table::getPrintName() const -{ - return m_printName.c_str(); -} - -inline void -Plan_table::setCname(const BaseString& cname) -{ - m_cname.assign(cname); - m_printName.assign(m_name); - if (! m_cname.empty()) { - m_printName.append(" "); - m_printName.append(m_cname); - } -} - -inline const DictTable& -Plan_table::dictTable() const -{ - ctx_assert(m_dictTable != 0); - return *m_dictTable; -} - -inline unsigned -Plan_table::indexCount() const -{ - ctx_assert(m_indexList.size() > 0); - return m_indexList.size() - 1; -} - -inline const Plan_table::ColumnVector& -Plan_table::exprColumns() const -{ - return m_exprColumns; -} - -inline const Plan_table::ColumnVector& -Plan_table::dmlColumns() const -{ - return m_dmlColumns; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp b/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp deleted file mode 100644 index ea9f4fdc26e..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp +++ /dev/null @@ -1,53 +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 */ - -#include "Code_table_list.hpp" - -Plan_table_list::~Plan_table_list() -{ -} - -Plan_base* -Plan_table_list::analyze(Ctx& ctx, Ctl& ctl) -{ - // analyze the tables - for (unsigned i = 1, n = countTable(); i <= n; i++) { - Plan_table* table = getTable(i); - table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - } - // node was not replaced - return this; -} - -Exec_base* -Plan_table_list::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_table_list::print(Ctx& ctx) -{ - ctx.print(" [table_list"); - for (unsigned i = 1, n = countTable(); i <= n; i++) { - Plan_base* a[] = { m_tableList[i] }; - printList(ctx, a, 1); - } - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp b/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp deleted file mode 100644 index 47989166cac..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp +++ /dev/null @@ -1,73 +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 ODBC_CODEGEN_Code_table_list_hpp -#define ODBC_CODEGEN_Code_table_list_hpp - -#include -#include "Code_base.hpp" -#include "Code_table.hpp" - -/** - * @class Plan_table_list - * @brief List of tables in select statement - */ -class Plan_table_list : public Plan_base { -public: - Plan_table_list(Plan_root* root); - virtual ~Plan_table_list(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - unsigned countTable() const; - void addTable(Plan_table* table); - Plan_table* getTable(unsigned i) const; -protected: - friend class Plan_select; - TableVector m_tableList; -}; - -inline -Plan_table_list::Plan_table_list(Plan_root* root) : - Plan_base(root), - m_tableList(1) -{ -} - -// children - -inline unsigned -Plan_table_list::countTable() const -{ - return m_tableList.size() - 1; -} - -inline void -Plan_table_list::addTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_tableList.push_back(table); -} - -inline Plan_table* -Plan_table_list::getTable(unsigned i) const -{ - ctx_assert(1 <= i && i <= countTable() && m_tableList[i] != 0); - return m_tableList[i]; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update.cpp deleted file mode 100644 index 0b33cd628b4..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update.cpp +++ /dev/null @@ -1,246 +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 */ - -#include -#include -#include -#include "Code_update.hpp" -#include "Code_update_lookup.hpp" -#include "Code_update_index.hpp" -#include "Code_update_scan.hpp" -#include "Code_table.hpp" -#include "Code_query_project.hpp" -#include "Code_query_filter.hpp" -#include "Code_query_scan.hpp" -#include "Code_query_lookup.hpp" -#include "Code_query_index.hpp" -#include "Code_query_range.hpp" -#include "Code_query_repeat.hpp" -#include "Code_root.hpp" - -// Plan_update - -Plan_update::~Plan_update() -{ -} - -Plan_base* -Plan_update::analyze(Ctx& ctx, Ctl& ctl) -{ - stmtArea().stmtInfo().setName(Stmt_name_update); - // analyze the table - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - // get column and expression rows - ctx_assert(m_setRow != 0); - setDmlRow(m_setRow->m_dmlRow); - setExprRow(m_setRow->m_exprRow); - m_setRow = 0; - // implied by parse - ctx_assert(m_dmlRow->getSize() == m_exprRow->getSize()); - // set name resolution scope - ctl.m_tableList.resize(1 + 1); // indexed from 1 - ctl.m_tableList[1] = m_table; - // analyze the rows - m_dmlRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctl.m_dmlRow = m_dmlRow; // row type to convert to - ctl.m_const = true; // set to constants - m_exprRow->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - bool setConst = ctl.m_const; - ctl.m_dmlRow = 0; - Plan_dml* stmt = 0; - // top level query is a project - Plan_query_project* queryProject = new Plan_query_project(m_root); - m_root->saveNode(queryProject); - queryProject->setRow(m_exprRow); - if (m_pred != 0) { - // analyze the predicate - ctl.m_topand = true; - ctl.m_extra = false; - m_pred = static_cast(m_pred->analyze(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(m_pred != 0); - // check for key match - Plan_table::Index* indexBest = 0; - for (unsigned i = 0; i <= m_table->indexCount(); i++) { - Plan_table::Index& index = m_table->m_indexList[i]; - TableSet tsDone; - m_table->resolveSet(ctx, index, tsDone); - if (! ctx.ok()) - return 0; - if (! index.m_keyFound) - continue; - // prefer smaller rank, less unused keys - int k; - (k = (indexBest == 0)) || - (k = (indexBest->m_rank - index.m_rank)) || - (k = (indexBest->m_keyCountUnused - index.m_keyCountUnused)); - if (k > 0) - indexBest = &index; - } - if (indexBest != 0) { - const bool exactKey = indexBest->m_rank <= 1 ? m_table->exactKey(ctx, indexBest) : false; - const bool direct = setConst && ! ctl.m_extra && exactKey; - ctx_log3(("update direct=%d: const=%d extra=%d exact=%d", direct, setConst, ctl.m_extra, exactKey)); - if (indexBest->m_rank == 0) { - // primary key - Plan_update_lookup* updateLookup = new Plan_update_lookup(m_root); - m_root->saveNode(updateLookup); - updateLookup->setTable(m_table); - updateLookup->setDmlRow(m_dmlRow); - if (direct) { - // constant values and exact key match - Plan_query_repeat* queryRepeat = new Plan_query_repeat(m_root, 1); - m_root->saveNode(queryRepeat); - queryProject->setQuery(queryRepeat); - } else { - // more conditions or non-constant values - Plan_query_lookup* queryLookup = new Plan_query_lookup(m_root); - m_root->saveNode(queryLookup); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - queryLookup->setTable(m_table); - queryFilter->setQuery(queryLookup); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - queryProject->setQuery(queryFilter); - } - updateLookup->setQuery(queryProject); - stmt = updateLookup; - } else if (indexBest->m_rank == 1) { - // hash index - Plan_update_index* updateIndex = new Plan_update_index(m_root); - m_root->saveNode(updateIndex); - updateIndex->setTable(m_table, indexBest); - updateIndex->setDmlRow(m_dmlRow); - if (direct) { - // constant values and exact key match - Plan_query_repeat* queryRepeat = new Plan_query_repeat(m_root, 1); - m_root->saveNode(queryRepeat); - queryProject->setQuery(queryRepeat); - } else { - // more conditions or non-constant values - Plan_query_index* queryIndex = new Plan_query_index(m_root); - m_root->saveNode(queryIndex); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - queryIndex->setTable(m_table, indexBest); - queryFilter->setQuery(queryIndex); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - queryProject->setQuery(queryFilter); - } - updateIndex->setQuery(queryProject); - stmt = updateIndex; - } else if (indexBest->m_rank == 2) { - // ordered index - Plan_update_scan* updateScan = new Plan_update_scan(m_root); - m_root->saveNode(updateScan); - updateScan->setTable(m_table); - updateScan->setDmlRow(m_dmlRow); - Plan_query_range* queryRange = new Plan_query_range(m_root); - m_root->saveNode(queryRange); - queryRange->setTable(m_table, indexBest); - queryRange->setExclusive(); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - queryFilter->setQuery(queryRange); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - // interpeter - const TableSet& ts2 = m_pred->noInterp(); - ctx_assert(ts2.size() <= 1); - if (ts2.size() == 0) { - queryRange->setInterp(m_pred); - } - queryProject->setQuery(queryFilter); - updateScan->setQuery(queryProject); - stmt = updateScan; - } else { - ctx_assert(false); - } - } else { - // scan update with filter - Plan_update_scan* updateScan = new Plan_update_scan(m_root); - m_root->saveNode(updateScan); - updateScan->setTable(m_table); - updateScan->setDmlRow(m_dmlRow); - Plan_query_scan* queryScan = new Plan_query_scan(m_root); - m_root->saveNode(queryScan); - queryScan->setTable(m_table); - queryScan->setExclusive(); - Plan_query_filter* queryFilter = new Plan_query_filter(m_root); - m_root->saveNode(queryFilter); - queryFilter->setQuery(queryScan); - queryFilter->setPred(m_pred); - queryFilter->m_topTable = m_table; - // interpeter - const TableSet& ts2 = m_pred->noInterp(); - ctx_assert(ts2.size() <= 1); - if (ts2.size() == 0) { - queryScan->setInterp(m_pred); - } - queryProject->setQuery(queryFilter); - updateScan->setQuery(queryProject); - stmt = updateScan; - } - } else { - // scan update without filter - Plan_update_scan* updateScan = new Plan_update_scan(m_root); - m_root->saveNode(updateScan); - updateScan->setTable(m_table); - updateScan->setDmlRow(m_dmlRow); - Plan_query_scan* queryScan = new Plan_query_scan(m_root); - m_root->saveNode(queryScan); - queryScan->setTable(m_table); - queryScan->setExclusive(); - queryProject->setQuery(queryScan); - updateScan->setQuery(queryProject); - stmt = updateScan; - } - // set base for column position offsets - m_table->m_resOff = 1; - return stmt; -} - -void -Plan_update::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "UPDATE WHERE", SQL_DIAG_UPDATE_WHERE); -} - -Exec_base* -Plan_update::codegen(Ctx& ctx, Ctl& ctl) -{ - ctx_assert(false); - return 0; -} - -void -Plan_update::print(Ctx& ctx) -{ - ctx.print(" [update"); - Plan_base* a[] = { m_table, m_setRow, m_dmlRow, m_exprRow }; - printList(ctx, a, 4); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update.hpp deleted file mode 100644 index 380b651518b..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update.hpp +++ /dev/null @@ -1,102 +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 ODBC_CODEGEN_Code_update_hpp -#define ODBC_CODEGEN_Code_update_hpp - -#include -#include "Code_base.hpp" -#include "Code_dml.hpp" -#include "Code_set_row.hpp" -#include "Code_table.hpp" -#include "Code_pred.hpp" -#include "Code_query.hpp" - -/** - * @class Plan_update - * @brief Update in PlanTree - */ -class Plan_update : public Plan_dml { -public: - Plan_update(Plan_root* root); - virtual ~Plan_update(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); - void setRow(Plan_set_row* setRow); - void setDmlRow(Plan_dml_row* dmlRow); - void setExprRow(Plan_expr_row* exprRow); - void setPred(Plan_pred* pred); -protected: - Plan_table* m_table; - Plan_set_row* m_setRow; - Plan_dml_row* m_dmlRow; - Plan_expr_row* m_exprRow; - Plan_pred* m_pred; -}; - -inline -Plan_update::Plan_update(Plan_root* root) : - Plan_dml(root), - m_table(0), - m_setRow(0), - m_dmlRow(0), - m_exprRow(0), - m_pred(0) -{ -} - -// children - -inline void -Plan_update::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline void -Plan_update::setRow(Plan_set_row* setRow) -{ - ctx_assert(setRow != 0); - m_setRow = setRow; -} - -inline void -Plan_update::setDmlRow(Plan_dml_row* dmlRow) -{ - ctx_assert(dmlRow != 0); - m_dmlRow = dmlRow; -} - -inline void -Plan_update::setExprRow(Plan_expr_row* exprRow) -{ - ctx_assert(exprRow != 0); - m_exprRow = exprRow; -} - -inline void -Plan_update::setPred(Plan_pred* pred) -{ - ctx_assert(pred != 0); - m_pred = pred; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp deleted file mode 100644 index 6f74db0d913..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp +++ /dev/null @@ -1,196 +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 */ - -#include -#include -#include -#include "Code_dml_column.hpp" -#include "Code_expr.hpp" -#include "Code_update_index.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -// Plan_update_index - -Plan_update_index::~Plan_update_index() -{ -} - -Plan_base* -Plan_update_index::analyze(Ctx& ctx, Ctl& ctl) -{ - ctl.m_dmlRow = m_dmlRow; // row type to convert to - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_update_index::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "UPDATE WHERE", SQL_DIAG_UPDATE_WHERE); -} - -Exec_base* -Plan_update_index::codegen(Ctx& ctx, Ctl& ctl) -{ - // generate code for the query - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // set up - ctx_assert(m_table != 0 && m_index != 0); - const BaseString& tableName = m_table->getName(); - ctx_assert(m_index->m_dictIndex != 0); - const DictIndex& dictIndex = *m_index->m_dictIndex; - const BaseString& indexName = dictIndex.getName(); - const unsigned keyCount = m_index->m_keyCount; - const ColumnVector& columns = m_table->dmlColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_update_index::Code& code = *new Exec_update_index::Code(keyCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - code.m_indexName = strcpy(new char[indexName.length() + 1], indexName.c_str()); - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictIndex.getColumn(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = k - 1; // index column order - } - // matching expressions - ctx_assert(m_index->m_keyFound); - const ExprVector& keyEq = m_index->m_keyEq; - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // updated attributes - code.m_attrCount = attrCount; - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_update_index* exec = new Exec_update_index(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_update_index::print(Ctx& ctx) -{ - ctx.print(" [update_index"); - Plan_base* a[] = { m_table, m_query }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - ctx.print("]"); -} - -// Exec_delete - -Exec_update_index::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; - delete[] m_attrId; -} - -Exec_update_index::Data::~Data() -{ -} - -Exec_update_index::~Exec_update_index() -{ -} - -void -Exec_update_index::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // create data - Data& data = *new Data; - setData(data); - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } -} - -void -Exec_update_index::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); -} - -void -Exec_update_index::print(Ctx& ctx) -{ - ctx.print(" [update_index"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" keyId="); - for (unsigned i = 1; i <= code.m_keyCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_keyId[i]); - } - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - } - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp deleted file mode 100644 index bbad822650a..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp +++ /dev/null @@ -1,171 +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 ODBC_CODEGEN_Code_update_index_hpp -#define ODBC_CODEGEN_Code_update_index_hpp - -#include -#include "Code_base.hpp" -#include "Code_dml.hpp" -#include "Code_table.hpp" -#include "Code_query.hpp" - -/** - * @class Plan_update_index - * @brief Update in PlanTree - */ -class Plan_update_index : public Plan_dml { -public: - Plan_update_index(Plan_root* root); - virtual ~Plan_update_index(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table, Plan_table::Index* index); - void setDmlRow(Plan_dml_row* dmlRow); - void setQuery(Plan_query* query); -protected: - Plan_table* m_table; - Plan_table::Index* m_index; - Plan_dml_row* m_dmlRow; - Plan_query* m_query; -}; - -inline -Plan_update_index::Plan_update_index(Plan_root* root) : - Plan_dml(root), - m_table(0), - m_dmlRow(0), - m_query(0) -{ -} - -inline void -Plan_update_index::setTable(Plan_table* table, Plan_table::Index* index) -{ - ctx_assert(table != 0 && index != 0 && index == &table->m_indexList[index->m_pos] && index->m_pos != 0); - m_table = table; - m_index = index; -} - -inline void -Plan_update_index::setDmlRow(Plan_dml_row* dmlRow) -{ - ctx_assert(dmlRow != 0); - m_dmlRow = dmlRow; -} - -inline void -Plan_update_index::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -/** - * @class Exec_update_index - * @brief Insert in ExecTree - */ -class Exec_update_index : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(unsigned keyCount); - virtual ~Code(); - protected: - friend class Plan_update_index; - friend class Exec_update_index; - const char* m_tableName; - const char* m_indexName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - unsigned m_attrCount; - NdbAttrId* m_attrId; - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_update_index; - }; - Exec_update_index(Exec_root* root); - virtual ~Exec_update_index(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -protected: - Exec_query* m_query; -}; - -inline -Exec_update_index::Code::Code(unsigned keyCount) : - m_tableName(0), - m_indexName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_keyMatch(0), - m_attrCount(0), - m_attrId(0) -{ -} - -inline -Exec_update_index::Data::Data() -{ -} - -inline -Exec_update_index::Exec_update_index(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_update_index::Code& -Exec_update_index::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_update_index::Data& -Exec_update_index::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_update_index::setQuery(Exec_query* query) -{ - ctx_assert(query != 0 && m_query == 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp deleted file mode 100644 index 7525fb72692..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp +++ /dev/null @@ -1,194 +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 */ - -#include -#include -#include -#include "Code_dml_column.hpp" -#include "Code_expr.hpp" -#include "Code_update_lookup.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -// Plan_update_lookup - -Plan_update_lookup::~Plan_update_lookup() -{ -} - -Plan_base* -Plan_update_lookup::analyze(Ctx& ctx, Ctl& ctl) -{ - ctl.m_dmlRow = m_dmlRow; // row type to convert to - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_update_lookup::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "UPDATE WHERE", SQL_DIAG_UPDATE_WHERE); -} - -Exec_base* -Plan_update_lookup::codegen(Ctx& ctx, Ctl& ctl) -{ - // generate code for the query - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // set up - ctx_assert(m_table != 0); - const BaseString& tableName = m_table->getName(); - const DictTable& dictTable = m_table->dictTable(); - const unsigned keyCount = dictTable.keyCount(); - const ColumnVector& columns = m_table->dmlColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_update_lookup::Code& code = *new Exec_update_lookup::Code(keyCount); - code.m_tableName = strcpy(new char[tableName.length() + 1], tableName.c_str()); - // key attributes - code.m_keyId = new NdbAttrId[1 + keyCount]; - code.m_keyId[0] = (NdbAttrId)-1; - for (unsigned k = 1; k <= keyCount; k++) { - const DictColumn* keyColumn = dictTable.getKey(k); - const SqlType& sqlType = keyColumn->sqlType(); - SqlSpec sqlSpec(sqlType, SqlSpec::Physical); - code.m_keySpecs.setEntry(k, sqlSpec); - code.m_keyId[k] = keyColumn->getAttrId(); - } - // matching expressions - const Plan_table::Index& index = m_table->m_indexList[0]; - ctx_assert(index.m_keyFound); - const ExprVector& keyEq = index.m_keyEq; - ctx_assert(keyEq.size() == 1 + keyCount); - code.m_keyMatch = new Exec_expr* [1 + keyCount]; - code.m_keyMatch[0] = 0; - for (unsigned k = 1; k <= keyCount; k++) { - Plan_expr* expr = keyEq[k]; - Exec_expr* execExpr = static_cast(expr->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execExpr != 0); - code.m_keyMatch[k] = execExpr; - } - // updated attributes - code.m_attrCount = attrCount; - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_update_lookup* exec = new Exec_update_lookup(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_update_lookup::print(Ctx& ctx) -{ - ctx.print(" [update_lookup"); - Plan_base* a[] = { m_table, m_query }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - ctx.print("]"); -} - -// Exec_delete - -Exec_update_lookup::Code::~Code() -{ - delete[] m_tableName; - delete[] m_keyId; - delete[] m_keyMatch; - delete[] m_attrId; -} - -Exec_update_lookup::Data::~Data() -{ -} - -Exec_update_lookup::~Exec_update_lookup() -{ -} - -void -Exec_update_lookup::alloc(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // create data - Data& data = *new Data; - setData(data); - // allocate matching expressions - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* expr = code.m_keyMatch[k]; - ctx_assert(expr != 0); - expr->alloc(ctx, ctl); - if (! ctx.ok()) - return; - } -} - -void -Exec_update_lookup::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); -} - -void -Exec_update_lookup::print(Ctx& ctx) -{ - ctx.print(" [update_lookup"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" keyId="); - for (unsigned i = 1; i <= code.m_keyCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_keyId[i]); - } - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - } - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp deleted file mode 100644 index fc4341880dd..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp +++ /dev/null @@ -1,167 +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 ODBC_CODEGEN_Code_update_lookup_hpp -#define ODBC_CODEGEN_Code_update_lookup_hpp - -#include -#include "Code_base.hpp" -#include "Code_dml.hpp" -#include "Code_table.hpp" -#include "Code_query.hpp" - -/** - * @class Plan_update_lookup - * @brief Update in PlanTree - */ -class Plan_update_lookup : public Plan_dml { -public: - Plan_update_lookup(Plan_root* root); - virtual ~Plan_update_lookup(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); - void setDmlRow(Plan_dml_row* dmlRow); - void setQuery(Plan_query* query); -protected: - Plan_table* m_table; - Plan_dml_row* m_dmlRow; - Plan_query* m_query; -}; - -inline -Plan_update_lookup::Plan_update_lookup(Plan_root* root) : - Plan_dml(root), - m_table(0), - m_dmlRow(0), - m_query(0) -{ -} - -inline void -Plan_update_lookup::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline void -Plan_update_lookup::setDmlRow(Plan_dml_row* dmlRow) -{ - ctx_assert(dmlRow != 0); - m_dmlRow = dmlRow; -} - -inline void -Plan_update_lookup::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -/** - * @class Exec_update_lookup - * @brief Insert in ExecTree - */ -class Exec_update_lookup : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(unsigned keyCount); - virtual ~Code(); - protected: - friend class Plan_update_lookup; - friend class Exec_update_lookup; - char* m_tableName; - unsigned m_keyCount; - SqlSpecs m_keySpecs; // key types - NdbAttrId* m_keyId; - Exec_expr** m_keyMatch; // XXX pointers for now - unsigned m_attrCount; - NdbAttrId* m_attrId; - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_update_lookup; - }; - Exec_update_lookup(Exec_root* root); - virtual ~Exec_update_lookup(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -protected: - Exec_query* m_query; -}; - -inline -Exec_update_lookup::Code::Code(unsigned keyCount) : - m_tableName(0), - m_keyCount(keyCount), - m_keySpecs(keyCount), - m_keyId(0), - m_keyMatch(0), - m_attrCount(0), - m_attrId(0) -{ -} - -inline -Exec_update_lookup::Data::Data() -{ -} - -inline -Exec_update_lookup::Exec_update_lookup(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_update_lookup::Code& -Exec_update_lookup::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_update_lookup::Data& -Exec_update_lookup::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_update_lookup::setQuery(Exec_query* query) -{ - ctx_assert(query != 0 && m_query == 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp deleted file mode 100644 index 9fac1728469..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp +++ /dev/null @@ -1,146 +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 */ - -#include -#include -#include -#include "Code_dml_column.hpp" -#include "Code_update_scan.hpp" -#include "Code_table.hpp" -#include "Code_root.hpp" - -// Plan_update_scan - -Plan_update_scan::~Plan_update_scan() -{ -} - -Plan_base* -Plan_update_scan::analyze(Ctx& ctx, Ctl& ctl) -{ - ctl.m_dmlRow = m_dmlRow; // row type to convert to - ctx_assert(m_query != 0); - m_query->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - ctx_assert(m_table != 0); - m_table->analyze(ctx, ctl); - if (! ctx.ok()) - return 0; - return this; -} - -void -Plan_update_scan::describe(Ctx& ctx) -{ - stmtArea().setFunction(ctx, "UPDATE WHERE", SQL_DIAG_UPDATE_WHERE); -} - -Exec_base* -Plan_update_scan::codegen(Ctx& ctx, Ctl& ctl) -{ - // generate code for the query - ctx_assert(m_query != 0); - Exec_query* execQuery = static_cast(m_query->codegen(ctx, ctl)); - if (! ctx.ok()) - return 0; - ctx_assert(execQuery != 0); - // set up - ctx_assert(m_table != 0); - const ColumnVector& columns = m_table->dmlColumns(); - ctx_assert(columns.size() > 0); - const unsigned attrCount = columns.size() - 1; - // create the code - Exec_update_scan::Code& code = *new Exec_update_scan::Code(); - // updated attributes - code.m_attrCount = attrCount; - code.m_attrId = new NdbAttrId[1 + attrCount]; - code.m_attrId[0] = (NdbAttrId)-1; - for (unsigned i = 1; i <= attrCount; i++) { - Plan_column* column = columns[i]; - ctx_assert(column != 0); - const DictColumn& dictColumn = column->dictColumn(); - code.m_attrId[i] = dictColumn.getAttrId(); - } - // create the exec - Exec_update_scan* exec = new Exec_update_scan(ctl.m_execRoot); - ctl.m_execRoot->saveNode(exec); - exec->setCode(code); - exec->setQuery(execQuery); - return exec; -} - -void -Plan_update_scan::print(Ctx& ctx) -{ - ctx.print(" [update_scan"); - Plan_base* a[] = { m_table, m_query }; - printList(ctx, a, sizeof(a)/sizeof(a[0])); - ctx.print("]"); -} - -// Exec_delete - -Exec_update_scan::Code::~Code() -{ - delete[] m_attrId; -} - -Exec_update_scan::Data::~Data() -{ -} - -Exec_update_scan::~Exec_update_scan() -{ -} - -void -Exec_update_scan::alloc(Ctx& ctx, Ctl& ctl) -{ - // allocate the subquery - ctx_assert(m_query != 0); - m_query->alloc(ctx, ctl); - if (! ctx.ok()) - return; - // create data - Data& data = *new Data; - setData(data); -} - -void -Exec_update_scan::close(Ctx& ctx) -{ - ctx_assert(m_query != 0); - m_query->close(ctx); -} - -void -Exec_update_scan::print(Ctx& ctx) -{ - ctx.print(" [update_scan"); - if (m_code != 0) { - const Code& code = getCode(); - ctx.print(" attrId="); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - if (i > 1) - ctx.print(","); - ctx.print("%u", (unsigned)code.m_attrId[i]); - } - } - Exec_base* a[] = { m_query }; - printList(ctx, a, 1); - ctx.print("]"); -} diff --git a/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp deleted file mode 100644 index d742883e561..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp +++ /dev/null @@ -1,160 +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 ODBC_CODEGEN_Code_update_scan_hpp -#define ODBC_CODEGEN_Code_update_scan_hpp - -#include -#include "Code_base.hpp" -#include "Code_dml.hpp" -#include "Code_table.hpp" -#include "Code_pred.hpp" -#include "Code_query.hpp" - -/** - * @class Plan_update_scan - * @brief Update in PlanTree - */ -class Plan_update_scan : public Plan_dml { -public: - Plan_update_scan(Plan_root* root); - virtual ~Plan_update_scan(); - Plan_base* analyze(Ctx& ctx, Ctl& ctl); - void describe(Ctx& ctx); - Exec_base* codegen(Ctx& ctx, Ctl& ctl); - void print(Ctx& ctx); - // children - void setTable(Plan_table* table); - void setDmlRow(Plan_dml_row* dmlRow); - void setQuery(Plan_query* query); -protected: - Plan_table* m_table; - Plan_dml_row* m_dmlRow; - Plan_query* m_query; -}; - -inline -Plan_update_scan::Plan_update_scan(Plan_root* root) : - Plan_dml(root), - m_table(0), - m_dmlRow(0), - m_query(0) -{ -} - -// children - -inline void -Plan_update_scan::setTable(Plan_table* table) -{ - ctx_assert(table != 0); - m_table = table; -} - -inline void -Plan_update_scan::setDmlRow(Plan_dml_row* dmlRow) -{ - ctx_assert(dmlRow != 0); - m_dmlRow = dmlRow; -} - -inline void -Plan_update_scan::setQuery(Plan_query* query) -{ - ctx_assert(query != 0); - m_query = query; -} - -/** - * @class Exec_update_scan - * @brief Insert in ExecTree - */ -class Exec_update_scan : public Exec_dml { -public: - class Code : public Exec_dml::Code { - public: - Code(); - virtual ~Code(); - protected: - friend class Plan_update_scan; - friend class Exec_update_scan; - unsigned m_attrCount; - NdbAttrId* m_attrId; - }; - class Data : public Exec_dml::Data { - public: - Data(); - virtual ~Data(); - protected: - friend class Exec_update_scan; - }; - Exec_update_scan(Exec_root* root); - virtual ~Exec_update_scan(); - void alloc(Ctx& ctx, Ctl& ctl); - void execImpl(Ctx& ctx, Ctl& ctl); - void close(Ctx& ctx); - void print(Ctx& ctx); - // children - const Code& getCode() const; - Data& getData() const; - void setQuery(Exec_query* query); -protected: - Exec_query* m_query; -}; - -inline -Exec_update_scan::Code::Code() : - m_attrCount(0), - m_attrId(0) -{ -} - -inline -Exec_update_scan::Data::Data() -{ -} - -inline -Exec_update_scan::Exec_update_scan(Exec_root* root) : - Exec_dml(root), - m_query(0) -{ -} - -// children - -inline const Exec_update_scan::Code& -Exec_update_scan::getCode() const -{ - const Code* code = static_cast(m_code); - return *code; -} - -inline Exec_update_scan::Data& -Exec_update_scan::getData() const -{ - Data* data = static_cast(m_data); - return *data; -} - -inline void -Exec_update_scan::setQuery(Exec_query* query) -{ - ctx_assert(query != 0 && m_query == 0); - m_query = query; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/Makefile b/ndb/src/old_files/client/odbc/codegen/Makefile deleted file mode 100644 index 49e5439556d..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/Makefile +++ /dev/null @@ -1,104 +0,0 @@ -include .defs.mk - -TYPE = * - -NONPIC_ARCHIVE = N - -PIC_ARCHIVE = Y - -ARCHIVE_TARGET = odbccodegen - -SOURCES = \ - SimpleScan.lpp \ - SimpleGram.ypp \ - SimpleParser.cpp \ - CodeGen.cpp \ - Code_base.cpp \ - Code_root.cpp \ - Code_stmt.cpp \ - Code_query.cpp \ - Code_dml.cpp \ - Code_ddl.cpp \ - Code_select.cpp \ - Code_pred.cpp \ - Code_pred_op.cpp \ - Code_comp_op.cpp \ - Code_query_project.cpp \ - Code_query_filter.cpp \ - Code_query_join.cpp \ - Code_query_lookup.cpp \ - Code_query_index.cpp \ - Code_query_scan.cpp \ - Code_query_range.cpp \ - Code_query_sys.cpp \ - Code_query_repeat.cpp \ - Code_query_count.cpp \ - Code_query_sort.cpp \ - Code_query_group.cpp \ - Code_query_distinct.cpp \ - Code_expr_row.cpp \ - Code_expr.cpp \ - Code_expr_op.cpp \ - Code_expr_func.cpp \ - Code_expr_conv.cpp \ - Code_expr_column.cpp \ - Code_expr_const.cpp \ - Code_expr_param.cpp \ - Code_update.cpp \ - Code_update_lookup.cpp \ - Code_update_index.cpp \ - Code_update_scan.cpp \ - Code_set_row.cpp \ - Code_insert.cpp \ - Code_dml_row.cpp \ - Code_dml_column.cpp \ - Code_delete.cpp \ - Code_delete_lookup.cpp \ - Code_delete_index.cpp \ - Code_delete_scan.cpp \ - Code_column.cpp \ - Code_table_list.cpp \ - Code_table.cpp \ - Code_create_table.cpp \ - Code_create_index.cpp \ - Code_create_row.cpp \ - Code_ddl_row.cpp \ - Code_ddl_column.cpp \ - Code_ddl_constr.cpp \ - Code_idx_column.cpp \ - Code_data_type.cpp \ - Code_drop_table.cpp \ - Code_drop_index.cpp - -ifeq ($(NDB_OS),WIN32) -CCFLAGS += -I$(call fixpath,.) - -_libs:: FlexLexer.h unistd.h - -endif - -include ../Extra.mk -include $(NDB_TOP)/Epilogue.mk - -ifeq ($(NDB_OS),LINUX) -FLEXHACK = perl -i -pe 's/\bisatty\b/ouencunbwdb2y1bdc/g' -BISONHACK = perl -i -pe 's/^\s*__attribute__\s*\(\(.*\)\)//' -endif - -ifeq ($(NDB_OS),MACOSX) -FLEXHACK = perl -i -pe 's/\bisatty\b/ouencunbwdb2y1bdc/g' -BISONHACK = perl -i -pe 's/^\s*__attribute__\s*\(\(.*\)\)//' -endif - -ifeq ($(NDB_OS),SOLARIS) -BISONHACK = perl -i -pe 's/^\s*__attribute__\s*\(\(.*\)\)//' -endif - -ifeq ($(NDB_OS),WIN32) -unistd.h: - touch unistd.h - -FlexLexer.h: - cp /usr/include/FlexLexer.h . - -endif diff --git a/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp b/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp deleted file mode 100644 index 07d8017e5ed..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp +++ /dev/null @@ -1,1649 +0,0 @@ -%{ - -#include -#include -#include -#include "CodeGen.hpp" -#include -#include "SimpleParser.hpp" - -/* redefine globals after headers */ -#define yyparse SimpleParser_yyparse -#if YYDEBUG -#define yydebug SimpleParser_yydebug -#endif - -#define YYLEX_PARAM simpleParserPtr -#define YYPARSE_PARAM simpleParserPtr -#define simpleParser (*static_cast(simpleParserPtr)) - -static int yylex(YYSTYPE* lvalp, void* simpleParserPtr); - -#define yyerror(s) simpleParser.parseError(s) - -#if YYDEBUG -// does not work in bison 1.75 -#undef stderr -#define stderr 0 -#define YYFPRINTF simpleParser.ctx().print -#endif - -// scanner states - -#define pushState(sc) simpleParser.pushState(sc) -#define popState() simpleParser.popState() - -#define StateEval SimpleParser_stateEval -#define StateType SimpleParser_stateType -#define StatePhys SimpleParser_statePhys -extern int SimpleParser_stateEval; -extern int SimpleParser_stateType; -extern int SimpleParser_statePhys; - -struct LimitPair { int off; int cnt; }; - -struct PhysAttr { int storage; int logging; }; - -%} - -%defines -%pure-parser -%verbose - -%union { - Plan_root* m_root; - Plan_stmt* m_stmt; - Plan_select* m_select; - Insert_op m_insert_op; - Plan_insert* m_insert; - Plan_update* m_update; - Plan_delete* m_delete; - Plan_create_table* m_create_table; - Plan_create_index* m_create_index; - NdbDictionary::Object::Type m_index_type; - Plan_create_row* m_create_row; - Plan_ddl_row* m_ddl_row; - Plan_ddl_column* m_ddl_column; - Plan_ddl_constr* m_ddl_constr; - Plan_idx_column* m_idx_column; - Plan_data_type* m_data_type; - Plan_drop_table* m_drop_table; - Plan_drop_index* m_drop_index; - Plan_set_row* m_set_row; - Plan_expr_row* m_expr_row; - bool m_asc_desc; - Plan_pred* m_pred; - Pred_op::Opcode m_pred_opcode; - Comp_op::Opcode m_comp_opcode; - Plan_expr* m_expr; - Expr_op::Opcode m_expr_opcode; - Plan_dml_row* m_dml_row; - Plan_dml_column* m_dml_column; - Plan_table* m_table; - Plan_table_list* m_table_list; - const char* m_string; - struct LimitPair* m_limit; - int m_signed_integer; - bool m_distinct; - struct PhysAttr* m_phys_attr; - NdbDictionary::Object::FragmentType m_storage_attr; - bool m_logging_attr; - SqlType::Type m_sql_type; -} - -/* keywords */ -%token - T_AND - T_ASC - T_AUTO_INCREMENT - T_BIGINT - T_BINARY - T_BLOB - T_BY - T_CHAR - T_CLOB - T_CONSTRAINT - T_CREATE - T_DATETIME - T_DEFAULT - T_DELETE - T_DESC - T_DISTINCT - T_DOUBLE - T_DROP - T_FLOAT - T_FOREIGN - T_FROM - T_GROUP - T_HASH - T_HAVING - T_IN - T_INDEX - T_INSERT - T_INT - T_INTEGER - T_INTO - T_IS - T_KEY - T_LARGE - T_LIKE - T_LIMIT - T_LOGGING - T_LONGBLOB - T_LONGCLOB - T_MEDIUM - T_NOLOGGING - T_NOT - T_NULL - T_OFFSET - T_ON - T_OR - T_ORDER - T_PRECISION - T_PRIMARY - T_REAL - T_REFERENCES - T_ROWNUM - T_SELECT - T_SET - T_SINGLE - T_SMALL - T_SMALLINT - T_STORAGE - T_SYSDATE - T_TABLE - T_UNIQUE - T_UNSIGNED - T_UPDATE - T_VALUES - T_VARBINARY - T_VARCHAR - T_WHERE - T_WRITE - -/* identifiers and constants */ -%token - T_IDENTIFIER - T_LINTEGER - T_LDECIMAL - T_LREAL - T_STRING - -/* expressions and predicates */ -%token - T_PLUS - T_MINUS - T_TIMES - T_DIVIDE - T_EQ - T_NOTEQ - T_LT - T_LTEQ - T_GT - T_GTEQ - T_QUES - -/* common special symbols */ -%token - T_PERIOD - T_COMMA - T_PARENLEFT - T_PARENRIGHT - T_ASTERISK - T_ASSIGN - -%type root -%type stmt -%type stmt_select -%type stmt_insert -%type insert_op -%type stmt_update -%type stmt_delete -%type create_table -%type create_index -%type index_type -%type create_row -%type create_column -%type create_constr -%type idx_column -%type data_type -%type ddl_row -%type ddl_column -%type drop_table -%type drop_index -%type asc_desc -%type set_row -%type expr_row -%type sort_row -%type where_clause -%type order_clause -%type pred -%type pred1 -%type pred1_op -%type pred2 -%type pred2_op -%type pred3 -%type pred3_op -%type pred4 -%type comp_op -%type expr -%type expr1 -%type expr1_op -%type expr2 -%type expr2_op -%type expr3 -%type expr3_op -%type expr4 -%type expr_column -%type dml_row -%type dml_column -%type value_row -%type value_expr -%type table -%type table_list -%type dot_identifier -%type limit_clause -%type signed_integer -%type distinct_clause -%type group_clause -%type having_clause -%type phys_attr -%type phys_attr2 -%type storage_attr -%type logging_attr -%type blob_type - -%% - -root: - stmt - { - Plan_root* root = simpleParser.root(); - root->setStmt($1); - } - ; -stmt: - stmt_select - { - $$ = $1; - } - | - stmt_insert - { - $$ = $1; - } - | - stmt_update - { - $$ = $1; - } - | - stmt_delete - { - $$ = $1; - } - | - create_table - { - $$ = $1; - } - | - create_index - { - $$ = $1; - } - | - drop_table - { - $$ = $1; - } - | - drop_index - { - $$ = $1; - } - ; -stmt_select: - T_SELECT distinct_clause expr_row T_FROM table_list where_clause group_clause having_clause order_clause limit_clause - { - Plan_root* root = simpleParser.root(); - Plan_select* stmt = new Plan_select(root); - root->saveNode(stmt); - stmt->setDistinct($2); - stmt->setRow($3); - stmt->setList($5); - if ($6 != 0) - stmt->setPred($6); - if ($7 != 0) - stmt->setGroup($7); - if ($8 != 0) - stmt->setHaving($8); - if ($9 != 0) - stmt->setSort($9); - if ($10 != 0) { - stmt->setLimit($10->off, $10->cnt); - delete $10; - } - $$ = stmt; - } - ; -stmt_insert: - insert_op T_INTO table T_VALUES T_PARENLEFT value_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - Plan_insert* stmt = new Plan_insert(root, $1); - root->saveNode(stmt); - stmt->setTable($3); - stmt->setExprRow($6); - $$ = stmt; - } - | - insert_op T_INTO table T_PARENLEFT dml_row T_PARENRIGHT T_VALUES T_PARENLEFT value_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - Plan_insert* stmt = new Plan_insert(root, $1); - root->saveNode(stmt); - stmt->setTable($3); - stmt->setDmlRow($5); - stmt->setExprRow($9); - $$ = stmt; - } - | - insert_op T_INTO table stmt_select - { - Plan_root* root = simpleParser.root(); - Plan_insert* stmt = new Plan_insert(root, $1); - root->saveNode(stmt); - stmt->setTable($3); - stmt->setSelect($4); - $$ = stmt; - } - | - insert_op T_INTO table T_PARENLEFT dml_row T_PARENRIGHT stmt_select - { - Plan_root* root = simpleParser.root(); - Plan_insert* stmt = new Plan_insert(root, $1); - root->saveNode(stmt); - stmt->setTable($3); - stmt->setDmlRow($5); - stmt->setSelect($7); - $$ = stmt; - } - | - insert_op T_INTO table T_SET set_row - { - Plan_root* root = simpleParser.root(); - Plan_insert* stmt = new Plan_insert(root, $1); - root->saveNode(stmt); - stmt->setTable($3); - stmt->setMysqlRow($5); - $$ = stmt; - } - ; -insert_op: - T_INSERT - { - $$ = Insert_op_insert; - } - | - T_WRITE - { - $$ = Insert_op_write; - } - ; -stmt_update: - T_UPDATE table T_SET set_row where_clause - { - Plan_root* root = simpleParser.root(); - Plan_update* stmt = new Plan_update(root); - root->saveNode(stmt); - stmt->setTable($2); - stmt->setRow($4); - if ($5 != 0) - stmt->setPred($5); - $$ = stmt; - } - ; -stmt_delete: - T_DELETE T_FROM table where_clause - { - Plan_root* root = simpleParser.root(); - Plan_delete* stmt = new Plan_delete(root); - root->saveNode(stmt); - stmt->setTable($3); - if ($4 != 0) - stmt->setPred($4); - $$ = stmt; - } - ; -create_table: - T_CREATE T_TABLE dot_identifier T_PARENLEFT create_row T_PARENRIGHT phys_attr - { - Plan_root* root = simpleParser.root(); - Plan_create_table* stmt = new Plan_create_table(root, $3); - root->saveNode(stmt); - delete[] $3; - stmt->setCreateRow($5); - if ($7->storage != -1) - stmt->setFragmentType((NdbDictionary::Object::FragmentType)$7->storage); - if ($7->logging != -1) - stmt->setLogging($7->logging); - delete $7; - $$ = stmt; - } - ; -create_row: - create_column - { - Plan_root* root = simpleParser.root(); - Plan_create_row* createRow = new Plan_create_row(root); - root->saveNode(createRow); - createRow->addColumn($1); - $$ = createRow; - } - | - create_constr - { - Plan_root* root = simpleParser.root(); - Plan_create_row* createRow = new Plan_create_row(root); - root->saveNode(createRow); - createRow->addConstr($1); - $$ = createRow; - } - | - create_row T_COMMA create_column - { - Plan_create_row* createRow = $1; - createRow->addColumn($3); - $$ = createRow; - } - | - create_row T_COMMA create_constr - { - Plan_create_row* createRow = $1; - createRow->addConstr($3); - $$ = createRow; - } - | - create_row T_COMMA create_ignore - { - $$ = $1; - } - ; -create_column: - T_IDENTIFIER { pushState(StateType); } data_type { popState(); } - { - Plan_root* root = simpleParser.root(); - Plan_ddl_column* ddlColumn = new Plan_ddl_column(root, $1); - root->saveNode(ddlColumn); - delete[] $1; - ddlColumn->setType($3); - simpleParser.curr(ddlColumn); - } - create_column_rest - { - $$ = simpleParser.curr((Plan_ddl_column*)0); - } - ; -data_type: - T_CHAR T_PARENLEFT T_LINTEGER T_PARENRIGHT dummy_binary - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(simpleParser.ctx(), SqlType::Char, atoi($3), true); - delete[] $3; - if (! simpleParser.ctx().ok()) { - YYABORT; - } - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_BINARY T_PARENLEFT T_LINTEGER T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(simpleParser.ctx(), SqlType::Binary, atoi($3), true); - delete[] $3; - if (! simpleParser.ctx().ok()) { - YYABORT; - } - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_VARCHAR T_PARENLEFT T_LINTEGER T_PARENRIGHT dummy_binary - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(simpleParser.ctx(), SqlType::Varchar, atoi($3), true); - delete[] $3; - if (! simpleParser.ctx().ok()) { - YYABORT; - } - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_VARBINARY T_PARENLEFT T_LINTEGER T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(simpleParser.ctx(), SqlType::Varbinary, atoi($3), true); - delete[] $3; - if (! simpleParser.ctx().ok()) { - YYABORT; - } - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_SMALLINT - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Smallint, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_INTEGER - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Integer, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_INT - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Integer, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_BIGINT - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Bigint, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_REAL - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Real, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_FLOAT - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Double, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_DOUBLE T_PRECISION - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Double, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - T_DATETIME - { - Plan_root* root = simpleParser.root(); - SqlType sqlType(SqlType::Datetime, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - | - blob_type - { - Plan_root* root = simpleParser.root(); - SqlType sqlType($1, true); - Plan_data_type* dataType = new Plan_data_type(root, sqlType); - root->saveNode(dataType); - $$ = dataType; - } - ; -dummy_binary: - /* empty */ - | - T_BINARY - ; -blob_type: - T_BLOB - { - $$ = SqlType::Blob; - } - | - T_LONGBLOB - { - $$ = SqlType::Blob; - } - | - T_CLOB - { - $$ = SqlType::Clob; - } - | - T_LONGCLOB - { - $$ = SqlType::Clob; - } - ; -create_column_rest: - /* empty */ - | - data_constr_list - ; -data_constr_list: - data_constr - | - data_constr_list data_constr - ; -data_constr: - T_NULL - | - T_NOT T_NULL - { - Plan_ddl_column* ddlColumn = simpleParser.curr((Plan_ddl_column*)0); - ddlColumn->setNotNull(); - } - | - T_UNSIGNED - { - Plan_ddl_column* ddlColumn = simpleParser.curr((Plan_ddl_column*)0); - ddlColumn->setUnSigned(); - } - | - T_PRIMARY T_KEY - { - Plan_ddl_column* ddlColumn = simpleParser.curr((Plan_ddl_column*)0); - ddlColumn->setPrimaryKey(); - } - | - T_AUTO_INCREMENT - { - Plan_ddl_column* ddlColumn = simpleParser.curr((Plan_ddl_column*)0); - ddlColumn->setAutoIncrement(); - } - | - T_DEFAULT expr - { - Plan_ddl_column* ddlColumn = simpleParser.curr((Plan_ddl_column*)0); - ddlColumn->setDefaultValue($2); - } - ; -create_constr: - T_PRIMARY T_KEY T_PARENLEFT ddl_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - Plan_ddl_constr* ddlConstr = new Plan_ddl_constr(root); - root->saveNode(ddlConstr); - ddlConstr->setRow($4); - $$ = ddlConstr; - } - | - T_CONSTRAINT dot_identifier T_PRIMARY T_KEY T_PARENLEFT ddl_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - Plan_ddl_constr* ddlConstr = new Plan_ddl_constr(root); - root->saveNode(ddlConstr); - ddlConstr->setRow($6); - $$ = ddlConstr; - } - ; -create_ignore: - T_INDEX dot_identifier T_PARENLEFT ddl_row T_PARENRIGHT - | - T_FOREIGN T_KEY T_PARENLEFT ddl_row T_PARENRIGHT T_REFERENCES dot_identifier T_PARENLEFT ddl_row T_PARENRIGHT - ; -ddl_row: - ddl_column - { - Plan_root* root = simpleParser.root(); - Plan_ddl_row* ddlRow = new Plan_ddl_row(root); - root->saveNode(ddlRow); - ddlRow->addColumn($1); - $$ = ddlRow; - } - | - ddl_row T_COMMA ddl_column - { - Plan_ddl_row* ddlRow = $1; - ddlRow->addColumn($3); - $$ = ddlRow; - } - ; -ddl_column: - T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_ddl_column* column = new Plan_ddl_column(root, $1); - root->saveNode(column); - delete[] $1; - $$ = column; - } - ; -create_index: - T_CREATE index_type T_INDEX dot_identifier T_ON table - { - Plan_root* root = simpleParser.root(); - Plan_create_index* stmt = new Plan_create_index(root, $4); - root->saveNode(stmt); - delete[] $4; - stmt->setType($2); - stmt->setTable($6); - simpleParser.curr(stmt); - } - T_PARENLEFT idx_row T_PARENRIGHT phys_attr - { - $$ = simpleParser.curr((Plan_create_index*)0); - if ($11->storage != -1) - $$->setFragmentType((NdbDictionary::Object::FragmentType)$11->storage); - if ($11->logging != -1) - $$->setLogging($11->logging); - delete $11; - } - ; -index_type: - T_HASH - { - $$ = NdbDictionary::Object::HashIndex; - } - | - T_UNIQUE T_HASH - { - $$ = NdbDictionary::Object::UniqueHashIndex; - } - | - /* empty */ - { - $$ = NdbDictionary::Object::OrderedIndex; - } - | - T_UNIQUE - { - $$ = NdbDictionary::Object::UniqueOrderedIndex; - } - ; -idx_row: - idx_column - { - } - | - idx_row T_COMMA idx_column - { - } - ; -idx_column: - T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_idx_column* column = new Plan_idx_column(root, $1); - root->saveNode(column); - delete[] $1; - Plan_create_index* stmt = simpleParser.curr((Plan_create_index*)0); - stmt->addColumn(column); - } - ; -phys_attr: - { pushState(StatePhys); } phys_attr2 { popState(); } - { - $$ = $2; - } - ; -phys_attr2: - /* empty */ - { - $$ = new PhysAttr(); - $$->storage = $$->logging = -1; - } - | - phys_attr2 storage_attr - { - if ($1->storage != -1 && $1->storage != $2) { - simpleParser.ctx().pushStatus(Sqlstate::_42000, Error::Gen, "conflicting STORAGE clauses"); - YYABORT; - } - $$->storage = $2; - } - | - phys_attr2 logging_attr - { - if ($1->logging != -1 && $1->logging != $2) { - simpleParser.ctx().pushStatus(Sqlstate::_42000, Error::Gen, "conflicting LOGGING clauses"); - YYABORT; - } - $$->logging = $2; - } - ; -logging_attr: - T_LOGGING - { - $$ = true; - } - | - T_NOLOGGING - { - $$ = false; - } - ; -storage_attr: - T_STORAGE T_PARENLEFT T_SINGLE T_PARENRIGHT - { - $$ = NdbDictionary::Object::FragSingle; - } - | - T_STORAGE T_PARENLEFT T_SMALL T_PARENRIGHT - { - $$ = NdbDictionary::Object::FragAllSmall; - } - | - T_STORAGE T_PARENLEFT T_MEDIUM T_PARENRIGHT - { - $$ = NdbDictionary::Object::FragAllMedium; - } - | - T_STORAGE T_PARENLEFT T_LARGE T_PARENRIGHT - { - $$ = NdbDictionary::Object::FragAllLarge; - } - ; -drop_table: - T_DROP T_TABLE dot_identifier - { - Plan_root* root = simpleParser.root(); - Plan_drop_table* stmt = new Plan_drop_table(root, $3); - root->saveNode(stmt); - delete[] $3; - $$ = stmt; - } - ; -drop_index: - T_DROP T_INDEX dot_identifier - { - Plan_root* root = simpleParser.root(); - Plan_drop_index* stmt = new Plan_drop_index(root, $3); - root->saveNode(stmt); - delete[] $3; - $$ = stmt; - } - | - T_DROP T_INDEX dot_identifier T_ON dot_identifier - { - Plan_root* root = simpleParser.root(); - Plan_drop_index* stmt = new Plan_drop_index(root, $3, $5); - root->saveNode(stmt); - delete[] $3; - delete[] $5; - $$ = stmt; - } - ; -distinct_clause: - /* empty */ - { - $$ = false; - } - | - T_DISTINCT - { - $$ = true; - } - ; -where_clause: - /* empty */ - { - $$ = 0; - } - | - T_WHERE pred - { - $$ = $2; - } - ; -group_clause: - /* empty */ - { - $$ = 0; - } - | - T_GROUP T_BY value_row - { - $$ = $3; - } - ; -having_clause: - /* empty */ - { - $$ = 0; - } - | - T_HAVING pred - { - $$ = $2; - } - ; -order_clause: - /* empty */ - { - $$ = 0; - } - | - T_ORDER T_BY sort_row - { - $$ = $3; - } - ; -limit_clause: - /* empty */ - { - $$ = 0; - } - | - T_LIMIT signed_integer - { - LimitPair* p = new LimitPair; - p->off = 0; - p->cnt = $2; - $$ = p; - } - | - T_LIMIT signed_integer T_COMMA signed_integer - { - LimitPair* p = new LimitPair; - p->off = $2, - p->cnt = $4; - $$ = p; - } - | - T_LIMIT signed_integer T_OFFSET signed_integer - { - LimitPair* p = new LimitPair; - p->off = $4; - p->cnt = $2; - $$ = p; - } - ; -signed_integer: - T_LINTEGER - { - $$ = atoi($1); - delete[] $1; - } - | - T_MINUS T_LINTEGER - { - $$ = (-1) * atoi($2); - delete[] $2; - } - ; -set_row: - dml_column T_ASSIGN expr - { - Plan_root* root = simpleParser.root(); - Plan_set_row* row = new Plan_set_row(root); - root->saveNode(row); - row->addColumn($1); - row->addExpr($3); - $$ = row; - } - | - set_row T_COMMA dml_column T_ASSIGN expr - { - Plan_set_row* row = $1; - row->addColumn($3); - row->addExpr($5); - $$ = row; - } - ; -dml_row: - dml_column - { - Plan_root* root = simpleParser.root(); - Plan_dml_row* row = new Plan_dml_row(root); - root->saveNode(row); - row->addColumn($1); - $$ = row; - } - | - dml_row T_COMMA dml_column - { - Plan_dml_row* row = $1; - row->addColumn($3); - $$ = row; - } - ; -dml_column: - T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_dml_column* column = new Plan_dml_column(root, $1); - root->saveNode(column); - delete[] $1; - $$ = column; - } - ; -value_row: - value_expr - { - Plan_root* root = simpleParser.root(); - Plan_expr_row* row = new Plan_expr_row(root); - root->saveNode(row); - row->addExpr($1); - $$ = row; - } - | - value_row T_COMMA value_expr - { - Plan_expr_row* row = $1; - row->addExpr($3); - $$ = row; - } - ; -value_expr: - expr - { - $$ = $1; - } - ; -sort_row: - expr asc_desc - { - Plan_root* root = simpleParser.root(); - Plan_expr_row* row = new Plan_expr_row(root); - root->saveNode(row); - row->addExpr($1, $2); - $$ = row; - } - | - sort_row T_COMMA expr asc_desc - { - Plan_expr_row* row = $1; - row->addExpr($3, $4); - $$ = row; - } - ; -asc_desc: - /* empty */ - { - $$ = true; - } - | - T_ASC - { - $$ = true; - } - | - T_DESC - { - $$ = false; - } - ; -expr_row: - T_ASTERISK - { - Plan_root* root = simpleParser.root(); - Plan_expr_row* row = new Plan_expr_row(root); - root->saveNode(row); - row->setAsterisk(); - $$ = row; - } - | - T_TIMES /* XXX fix scanner state */ - { - Plan_root* root = simpleParser.root(); - Plan_expr_row* row = new Plan_expr_row(root); - root->saveNode(row); - row->setAsterisk(); - $$ = row; - } - | - expr - { - Plan_root* root = simpleParser.root(); - Plan_expr_row* row = new Plan_expr_row(root); - root->saveNode(row); - row->addExpr($1); - $$ = row; - } - | - expr T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_expr_row* row = new Plan_expr_row(root); - root->saveNode(row); - row->addExpr($1, BaseString($2)); - $$ = row; - } - | - expr_row T_COMMA expr - { - Plan_expr_row* row = $1; - row->addExpr($3); - $$ = row; - } - | - expr_row T_COMMA expr T_IDENTIFIER - { - Plan_expr_row* row = $1; - row->addExpr($3, BaseString($4)); - $$ = row; - } - ; -pred: - { pushState(StateEval); } pred1 { popState(); } - { - $$ = $2; - } - ; -pred1: - pred2 - { - $$ = $1; - } - | - pred1 pred1_op pred2 - { - Plan_root* root = simpleParser.root(); - Pred_op op($2); - Plan_pred_op* pred = new Plan_pred_op(root, op); - root->saveNode(pred); - pred->setPred(1, $1); - pred->setPred(2, $3); - $$ = pred; - } - ; -pred1_op: - T_OR - { - $$ = Pred_op::Or; - } - ; -pred2: - pred3 - { - $$ = $1; - } - | - pred2 pred2_op pred3 - { - Plan_root* root = simpleParser.root(); - Pred_op op($2); - Plan_pred_op* pred = new Plan_pred_op(root, op); - root->saveNode(pred); - pred->setPred(1, $1); - pred->setPred(2, $3); - $$ = pred; - } - ; -pred2_op: - T_AND - { - $$ = Pred_op::And; - } - ; -pred3: - pred4 - { - $$ = $1; - } - | - pred3_op pred3 - { - Plan_root* root = simpleParser.root(); - Pred_op op($1); - Plan_pred_op* pred = new Plan_pred_op(root, op); - root->saveNode(pred); - pred->setPred(1, $2); - $$ = pred; - } - ; -pred3_op: - T_NOT - { - $$ = Pred_op::Not; - } - ; -pred4: - T_PARENLEFT pred1 T_PARENRIGHT - { - $$ = $2; - } - | - expr1 comp_op expr1 - { - Plan_root* root = simpleParser.root(); - Comp_op op($2); - Plan_comp_op* comp = new Plan_comp_op(root, op); - root->saveNode(comp); - comp->setExpr(1, $1); - comp->setExpr(2, $3); - $$ = comp; - } - | - expr1 T_IS T_NULL - { - Plan_root* root = simpleParser.root(); - Comp_op op(Comp_op::Isnull); - Plan_comp_op* comp = new Plan_comp_op(root, op); - root->saveNode(comp); - comp->setExpr(1, $1); - $$ = comp; - } - | - expr1 T_IS T_NOT T_NULL - { - Plan_root* root = simpleParser.root(); - Comp_op op(Comp_op::Isnotnull); - Plan_comp_op* comp = new Plan_comp_op(root, op); - root->saveNode(comp); - comp->setExpr(1, $1); - $$ = comp; - } - | - expr1 T_IN T_PARENLEFT value_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - Plan_pred* predOut = 0; // hack directly into Or of Eq - Plan_expr* exprLeft = $1; - Plan_expr_row* row = $4; - for (unsigned i = row->getSize(); i >= 1; i--) { - Plan_expr* exprRight = row->getExpr(i); - Plan_comp_op* comp = new Plan_comp_op(root, Comp_op::Eq); - root->saveNode(comp); - comp->setExpr(1, exprLeft); - comp->setExpr(2, exprRight); - if (predOut == 0) { - predOut = comp; - } else { - Plan_pred_op* pred = new Plan_pred_op(root, Pred_op::Or); - root->saveNode(pred); - pred->setPred(1, predOut); - pred->setPred(2, comp); - predOut = pred; - } - } - $$ = predOut; - } - | - expr1 T_NOT T_IN T_PARENLEFT value_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - Plan_pred* predOut = 0; // hack directly into And of Noteq - Plan_expr* exprLeft = $1; - Plan_expr_row* row = $5; - for (unsigned i = row->getSize(); i >= 1; i--) { - Plan_expr* exprRight = row->getExpr(i); - Plan_comp_op* comp = new Plan_comp_op(root, Comp_op::Noteq); - root->saveNode(comp); - comp->setExpr(1, exprLeft); - comp->setExpr(2, exprRight); - if (predOut == 0) { - predOut = comp; - } else { - Plan_pred_op* pred = new Plan_pred_op(root, Pred_op::And); - root->saveNode(pred); - pred->setPred(1, predOut); - pred->setPred(2, comp); - predOut = pred; - } - } - $$ = predOut; - } - ; -comp_op: - T_EQ - { - $$ = Comp_op::Eq; - } - | - T_NOTEQ - { - $$ = Comp_op::Noteq; - } - | - T_LT - { - $$ = Comp_op::Lt; - } - | - T_LTEQ - { - $$ = Comp_op::Lteq; - } - | - T_GT - { - $$ = Comp_op::Gt; - } - | - T_GTEQ - { - $$ = Comp_op::Gteq; - } - | - T_LIKE - { - $$ = Comp_op::Like; - } - | - T_NOT T_LIKE - { - $$ = Comp_op::Notlike; - } - ; -expr: - { pushState(StateEval); } expr1 { popState(); } - { - $$ = $2; - } - ; -expr1: - expr2 - { - $$ = $1; - } - | - expr1 expr1_op expr2 - { - Plan_root* root = simpleParser.root(); - Expr_op op($2); - Plan_expr_op* expr = new Plan_expr_op(root, op); - root->saveNode(expr); - expr->setExpr(1, $1); - expr->setExpr(2, $3); - $$ = expr; - } - ; -expr1_op: - T_PLUS - { - $$ = Expr_op::Add; - } - | - T_MINUS - { - $$ = Expr_op::Subtract; - } - ; -expr2: - expr3 - { - $$ = $1; - } - | - expr2 expr2_op expr3 - { - Plan_root* root = simpleParser.root(); - Expr_op op($2); - Plan_expr_op* expr = new Plan_expr_op(root, op); - root->saveNode(expr); - expr->setExpr(1, $1); - expr->setExpr(2, $3); - $$ = expr; - } - ; -expr2_op: - T_TIMES - { - $$ = Expr_op::Multiply; - } - | - T_DIVIDE - { - $$ = Expr_op::Divide; - } - ; -expr3: - expr4 - { - $$ = $1; - } - | - expr3_op expr3 - { - Plan_root* root = simpleParser.root(); - Expr_op op($1); - Plan_expr_op* expr = new Plan_expr_op(root, op); - root->saveNode(expr); - expr->setExpr(1, $2); - $$ = expr; - } - ; -expr3_op: - T_PLUS - { - $$ = Expr_op::Plus; - } - | - T_MINUS - { - $$ = Expr_op::Minus; - } - ; -expr4: - T_PARENLEFT expr1 T_PARENRIGHT - { - $$ = $2; - } - | - T_IDENTIFIER T_PARENLEFT expr_row T_PARENRIGHT - { - Plan_root* root = simpleParser.root(); - const Expr_func& spec = Expr_func::find($1); - if (spec.m_name == 0) { - simpleParser.ctx().pushStatus(Sqlstate::_42000, Error::Gen, "unknown function %s", $1); - delete[] $1; - YYABORT; - } - Plan_expr_func* func = new Plan_expr_func(root, spec); - root->saveNode(func); - delete[] $1; - func->setArgs($3); - $$ = func; - } - | - T_ROWNUM - { - Plan_root* root = simpleParser.root(); - const Expr_func& spec = Expr_func::find("ROWNUM"); - ctx_assert(spec.m_name != 0); - Plan_expr_func* func = new Plan_expr_func(root, spec); - root->saveNode(func); - func->setArgs(0); - $$ = func; - } - | - T_SYSDATE - { - Plan_root* root = simpleParser.root(); - const Expr_func& spec = Expr_func::find("SYSDATE"); - ctx_assert(spec.m_name != 0); - Plan_expr_func* func = new Plan_expr_func(root, spec); - root->saveNode(func); - func->setArgs(0); - $$ = func; - } - | - expr_column - { - $$ = $1; - } - | - T_STRING - { - Plan_root* root = simpleParser.root(); - LexType lexType(LexType::Char); - Plan_expr_const* expr = new Plan_expr_const(root, lexType, $1); - root->saveNode(expr); - delete[] $1; - $$ = expr; - } - | - T_LINTEGER - { - Plan_root* root = simpleParser.root(); - LexType lexType(LexType::Integer); - Plan_expr_const* expr = new Plan_expr_const(root, lexType, $1); - root->saveNode(expr); - delete[] $1; - $$ = expr; - } - | - T_LDECIMAL - { - Plan_root* root = simpleParser.root(); - LexType lexType(LexType::Float); - Plan_expr_const* expr = new Plan_expr_const(root, lexType, $1); - root->saveNode(expr); - delete[] $1; - $$ = expr; - } - | - T_LREAL - { - Plan_root* root = simpleParser.root(); - LexType lexType(LexType::Float); - Plan_expr_const* expr = new Plan_expr_const(root, lexType, $1); - root->saveNode(expr); - delete[] $1; - $$ = expr; - } - | - T_NULL - { - Plan_root* root = simpleParser.root(); - LexType lexType(LexType::Null); - Plan_expr_const* expr = new Plan_expr_const(root, lexType, ""); - root->saveNode(expr); - $$ = expr; - } - | - T_QUES - { - Plan_root* root = simpleParser.root(); - unsigned paramNumber = simpleParser.paramNumber(); - ctx_assert(paramNumber != 0); - Plan_expr_param* expr = new Plan_expr_param(root, paramNumber); - root->saveNode(expr); - $$ = expr; - } - ; -expr_column: - T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_expr_column* column = new Plan_expr_column(root, $1); - root->saveNode(column); - delete[] $1; - $$ = column; - } - | - T_IDENTIFIER T_PERIOD T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_expr_column* column = new Plan_expr_column(root, $3); - root->saveNode(column); - delete[] $3; - column->setCname($1); - $$ = column; - } - | - T_IDENTIFIER T_PERIOD T_IDENTIFIER T_PERIOD T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - BaseString str; - str.append($1); - str.append("."); - str.append($3); - delete[] $1; - delete[] $3; - Plan_expr_column* column = new Plan_expr_column(root, $5); - root->saveNode(column); - delete[] $5; - column->setCname(str); - $$ = column; - } - ; -table_list: - table - { - Plan_root* root = simpleParser.root(); - Plan_table_list* tableList = new Plan_table_list(root); - root->saveNode(tableList); - tableList->addTable($1); - $$ = tableList; - } - | - table_list T_COMMA table - { - Plan_table_list* tableList = $1; - tableList->addTable($3); - $$ = tableList; - } - ; -table: - dot_identifier - { - Plan_root* root = simpleParser.root(); - Plan_table* table = new Plan_table(root, $1); - root->saveNode(table); - delete[] $1; - $$ = table; - } - | - dot_identifier T_IDENTIFIER - { - Plan_root* root = simpleParser.root(); - Plan_table* table = new Plan_table(root, $1); - root->saveNode(table); - delete[] $1; - table->setCname($2); - delete[] $2; - $$ = table; - } - ; -dot_identifier: - T_IDENTIFIER - { - $$ = $1; - } - | - T_IDENTIFIER T_PERIOD T_IDENTIFIER - { - char* s = new char[strlen($1) + 1 + strlen($3) + 1]; - strcpy(s, $1); - strcat(s, "."); - strcat(s, $3); - delete[] $1; - delete[] $3; - $$ = s; - } - ; - -%% - -static int -yylex(YYSTYPE* lvalp, void* simpleParserPtr) -{ - int ret = simpleParser.yylex(); - *lvalp = simpleParser.yylval(); - return ret; -} - -/* vim: set filetype=yacc: */ diff --git a/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp b/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp deleted file mode 100644 index a2418f49e37..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp +++ /dev/null @@ -1,96 +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 */ - -#include -#include -#include -#include -#include "SimpleParser.hpp" - -SimpleParser::~SimpleParser() -{ -} - -#ifdef NDB_WIN32 -static NdbMutex & parse_mutex = * NdbMutex_Create(); -#else -static NdbMutex parse_mutex = NDB_MUTEX_INITIALIZER; -#endif - -void -SimpleParser::yyparse() -{ - Ctx& ctx = this->ctx(); - NdbMutex_Lock(&parse_mutex); - ctx_log2(("parse: %s", stmtArea().sqlText().c_str())); -#if YYDEBUG - SimpleParser_yydebug = (m_ctx.logLevel() >= 5); -#endif - SimpleParser_yyparse((void*)this); - NdbMutex_Unlock(&parse_mutex); -} - -void -SimpleParser::pushState(int sc) -{ - yy_push_state(sc); - m_stacksize++; -} - -void -SimpleParser::popState() -{ - ctx_assert(m_stacksize > 0); - yy_pop_state(); - m_stacksize--; -} - -void -SimpleParser::parseError(const char* msg) -{ - ctx().pushStatus(Sqlstate::_42000, Error::Gen, "%s at '%*s' position %u", msg, yyleng, yytext, m_parsePos - yyleng); -} - -int -SimpleParser::LexerInput(char* buf, int max_size) -{ - const BaseString& text = stmtArea().sqlText(); - int n = 0; - const char* const t = text.c_str(); - const unsigned m = text.length(); - while (n < max_size && m_textPos < m) { - buf[n++] = t[m_textPos++]; - m_parsePos++; // XXX simple hack - break; - } - return n; -} - -// XXX just a catch-all (scanner should match all input) -void -SimpleParser::LexerOutput(const char* buf, int size) -{ - if (! ctx().ok()) - return; - const char* msg = "unrecognized input"; - ctx().pushStatus(Sqlstate::_42000, Error::Gen, "%s at '%*s' position %u", msg, size, buf, m_parsePos); -} - -void -SimpleParser::LexerError(const char* msg) -{ - ctx().pushStatus(Sqlstate::_42000, Error::Gen, "%s at '%*s' position %u", msg, yyleng, yytext, m_parsePos); -} diff --git a/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp b/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp deleted file mode 100644 index abadae8f905..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp +++ /dev/null @@ -1,161 +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 ODBC_CODEGEN_SimpleParser_hpp -#define ODBC_CODEGEN_SimpleParser_hpp - -#include -#include "Code_root.hpp" -#include "Code_stmt.hpp" -#include "Code_select.hpp" -#include "Code_pred.hpp" -#include "Code_pred_op.hpp" -#include "Code_comp_op.hpp" -#include "Code_expr_row.hpp" -#include "Code_expr.hpp" -#include "Code_expr_op.hpp" -#include "Code_expr_func.hpp" -#include "Code_expr_column.hpp" -#include "Code_expr_const.hpp" -#include "Code_expr_param.hpp" -#include "Code_update.hpp" -#include "Code_set_row.hpp" -#include "Code_insert.hpp" -#include "Code_dml_row.hpp" -#include "Code_dml_column.hpp" -#include "Code_delete.hpp" -#include "Code_table_list.hpp" -#include "Code_table.hpp" -#include "Code_create_table.hpp" -#include "Code_create_index.hpp" -#include "Code_ddl_row.hpp" -#include "Code_ddl_column.hpp" -#include "Code_ddl_constr.hpp" -#include "Code_data_type.hpp" -#include "Code_drop_table.hpp" -#include "Code_drop_index.hpp" - -#include "SimpleGram.tab.hpp" - -class StmtArea; -class Plan_root; - -class SimpleParser : public yyFlexLexer { -public: - SimpleParser(Ctx& ctx, StmtArea& stmtArea, Plan_root* root); - ~SimpleParser(); - Ctx& ctx(); - StmtArea& stmtArea(); - Plan_root* root(); - void yyparse(); // calls real yyparse - int yylex(); // generated by flex - YYSTYPE yylval(); - void pushState(int sc); // push start condition - void popState(); // pop start condition - unsigned paramNumber() const; - void parseError(const char* msg); - // parser helpers - to avoid creating new Plan tree types - Plan_ddl_column* curr(Plan_ddl_column* p); - Plan_create_index* curr(Plan_create_index* p); -protected: - virtual int LexerInput(char* buf, int max_size); - virtual void LexerOutput(const char* buf, int size); - virtual void LexerError(const char* msg); -private: - Ctx& m_ctx; - StmtArea& m_stmtArea; - Plan_root* const m_root; - unsigned m_textPos; // position in sql text - unsigned m_parsePos; // parse position, to report error - YYSTYPE m_yylval; // token value - BaseString m_string; // storage for edited string token - unsigned m_stacksize; // state stack size - unsigned m_paramNumber; // parameter number - // parser helpers - Plan_ddl_column* m_ddl_column; - Plan_create_index* m_create_index; -}; - -extern int SimpleParser_yyparse(void* simpleParserPtr); -#if YYDEBUG -extern int SimpleParser_yydebug; -#endif - -inline -SimpleParser::SimpleParser(Ctx& ctx, StmtArea& stmtArea, Plan_root* root) : - m_ctx(ctx), - m_stmtArea(stmtArea), - m_root(root), - m_textPos(0), - m_parsePos(0), - m_stacksize(0), - m_paramNumber(0), - // parser helpers - m_ddl_column(0) -{ -} - -inline Ctx& -SimpleParser::ctx() -{ - return m_ctx; -} - -inline StmtArea& -SimpleParser::stmtArea() -{ - return m_stmtArea; -} - -inline Plan_root* -SimpleParser::root() -{ - return m_root; -} - -inline YYSTYPE -SimpleParser::yylval() -{ - return m_yylval; -} - -inline unsigned -SimpleParser::paramNumber() const -{ - return m_paramNumber; -} - -// parser helpers - -inline Plan_ddl_column* -SimpleParser::curr(Plan_ddl_column* p) -{ - if (p != 0) - m_ddl_column = p; - ctx_assert(m_ddl_column != 0); - return m_ddl_column; -} - -inline Plan_create_index* -SimpleParser::curr(Plan_create_index* p) -{ - if (p != 0) - m_create_index = p; - ctx_assert(m_create_index != 0); - return m_create_index; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp b/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp deleted file mode 100644 index 29aa876f669..00000000000 --- a/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp +++ /dev/null @@ -1,243 +0,0 @@ -%{ -#include -#include "SimpleParser.hpp" - -struct SqlKeyword { - const char* m_name; - int m_value; - int m_state; - static const SqlKeyword* find(Ctx& ctx, const char* name, int state); -}; - -%} - -%option c++ -%option yyclass="SimpleParser" -%option stack -%option noyywrap - -space [\040\t\n\r\f] -digit [0-9] -letter [A-Za-z_] -special ("$") -identifier ({letter}({letter}|{digit}|{special})*) -integer {digit}++ -decimal (({digit}*\.{digit}+)|({digit}+\.{digit}*)) -real ((({digit}*\.{digit}+)|({digit}+\.{digit}*)|({digit}+))([Ee][-+]?{digit}+)) - -%s StateEval -%s StateType -%s StatePhys -%x StateString -%x StateQuoted - -%% - -{space} { - } -{identifier} { - const SqlKeyword* key = SqlKeyword::find(m_ctx, (char*)yytext, YYSTATE); - if (key != 0) - return key->m_value; - for (unsigned char* a = (unsigned char*)yytext; *a != 0; a++) { - if (islower(*a)) - *a = toupper(*a); - } - m_yylval.m_string = strcpy(new char[yyleng + 1], yytext); - return T_IDENTIFIER; - } -{integer} { - m_yylval.m_string = strcpy(new char[yyleng + 1], yytext); - return T_LINTEGER; - } -{decimal} { - m_yylval.m_string = strcpy(new char[yyleng + 1], yytext); - return T_LDECIMAL; - } -{real} { - m_yylval.m_string = strcpy(new char[yyleng + 1], yytext); - return T_LREAL; - } -"--".* { - } -"/*" { - int c = 0, d; - while (1) { - d = c; - if ((c = yyinput()) == EOF) { - parseError("unterminated comment"); - yyterminate(); - } - if (d == '*' && c == '/') - break; - } - } -{ -"+" return T_PLUS; -"-" return T_MINUS; -"*" return T_TIMES; -"/" return T_DIVIDE; -"=" return T_EQ; -"!=" return T_NOTEQ; -"^=" return T_NOTEQ; -"<>" return T_NOTEQ; -"<" return T_LT; -"<=" return T_LTEQ; -">" return T_GT; -">=" return T_GTEQ; -"?" m_paramNumber++; return T_QUES; -} - -"." return T_PERIOD; -"," return T_COMMA; -"(" return T_PARENLEFT; -")" return T_PARENRIGHT; -"*" return T_ASTERISK; -"=" return T_ASSIGN; - -"'" { - pushState(StateString); - m_string.assign(""); - } -{ -[^']* { - m_string.append(yytext); - } -"''" { - m_string.append("'"); - } -"'" { - m_yylval.m_string = strcpy(new char[m_string.length() + 1], m_string.c_str()); - popState(); - return T_STRING; - } -} - -\" { - pushState(StateQuoted); - m_string.assign(""); - } -{ -[^"]* { - m_string.append(yytext); - } -\\\" { - m_string.append("\""); - } -\" { - m_yylval.m_string = strcpy(new char[m_string.length() + 1], m_string.c_str()); - popState(); - return T_IDENTIFIER; - } -} - -%% - -// scan states -int SimpleParser_stateEval = StateEval; -int SimpleParser_stateType = StateType; -int SimpleParser_statePhys = StatePhys; - -// keep sorted - -static const SqlKeyword sqlKeyword[] = { - { "AND", T_AND, -1 }, - { "ASC", T_ASC, -1 }, - { "AUTO_INCREMENT", T_AUTO_INCREMENT, -1 }, - { "BIGINT", T_BIGINT, StateType }, - { "BINARY", T_BINARY, StateType }, - { "BLOB", T_BLOB, StateType }, - { "BY", T_BY, -1 }, - { "CHAR", T_CHAR, StateType }, - { "CLOB", T_CLOB, StateType }, - { "CONSTRAINT", T_CONSTRAINT, -1 }, - { "CREATE", T_CREATE, -1 }, - { "DATETIME", T_DATETIME, StateType }, - { "DEFAULT", T_DEFAULT, -1 }, - { "DELETE", T_DELETE, -1 }, - { "DESC", T_DESC, -1 }, - { "DISTINCT", T_DISTINCT, -1 }, - { "DOUBLE", T_DOUBLE, StateType }, - { "DROP", T_DROP, -1 }, - { "FLOAT", T_FLOAT, StateType }, - { "FOREIGN", T_FOREIGN, -1 }, - { "FROM", T_FROM, -1 }, - { "GROUP", T_GROUP, -1 }, - { "HASH", T_HASH, -1 }, - { "HAVING", T_HAVING, -1 }, - { "IN", T_IN, -1 }, - { "INDEX", T_INDEX, -1 }, - { "INSERT", T_INSERT, -1 }, - { "INT", T_INT, StateType }, - { "INTEGER", T_INTEGER, StateType }, - { "INTO", T_INTO, -1 }, - { "IS", T_IS, -1 }, - { "KEY", T_KEY, -1 }, - { "LARGE", T_LARGE, StatePhys }, - { "LIKE", T_LIKE, -1 }, - { "LIMIT", T_LIMIT, -1 }, - { "LOGGING", T_LOGGING, StatePhys }, - { "LONGBLOB", T_LONGBLOB, StateType }, - { "LONGCLOB", T_LONGCLOB, StateType }, - { "MEDIUM", T_MEDIUM, StatePhys }, - { "NOLOGGING", T_NOLOGGING, StatePhys }, - { "NOT", T_NOT, -1 }, - { "NULL", T_NULL, -1 }, - { "OFFSET", T_OFFSET, -1 }, - { "ON", T_ON, -1 }, - { "OR", T_OR, -1 }, - { "ORDER", T_ORDER, -1 }, - { "PRECISION", T_PRECISION, StateType }, - { "PRIMARY", T_PRIMARY, -1 }, - { "REAL", T_REAL, StateType }, - { "REFERENCES", T_REFERENCES, -1 }, - { "ROWNUM", T_ROWNUM, -1 }, - { "SELECT", T_SELECT, -1 }, - { "SET", T_SET, -1 }, - { "SINGLE", T_SINGLE, StatePhys }, - { "SMALL", T_SMALL, StatePhys }, - { "SMALLINT", T_SMALLINT, StateType }, - { "STORAGE", T_STORAGE, StatePhys }, - { "SYSDATE", T_SYSDATE, -1 }, - { "TABLE", T_TABLE, -1 }, - { "UNIQUE", T_UNIQUE, -1 }, - { "UNSIGNED", T_UNSIGNED, -1 }, - { "UPDATE", T_UPDATE, -1 }, - { "VALUES", T_VALUES, -1 }, - { "VARBINARY", T_VARBINARY, StateType }, - { "VARCHAR", T_VARCHAR, StateType }, - { "WHERE", T_WHERE, -1 }, - { "WRITE", T_WRITE, -1 } -}; - -static const unsigned sqlKeywordCount = sizeof(sqlKeyword) / sizeof(sqlKeyword[0]); - -const SqlKeyword* -SqlKeyword::find(Ctx& ctx, const char* name, int state) -{ - ctx_log4(("find keyword '%s' lex state = %d", name, state)); - const unsigned maxlen = 99; - char buf[maxlen + 1]; - char* a = buf; - const char* b = name; - while (*b != 0) { - if (a >= buf + maxlen) // will not be found - break; - char c = *b++; - if ('a' <= c && c <= 'z') // locale independent - c -= 'a' - 'A'; - *a++ = c; - } - *a = 0; - for (unsigned i = 0; i < sqlKeywordCount; i++) { - const SqlKeyword* key = &sqlKeyword[i]; - if (strcmp(key->m_name, buf) == 0) { - if (key->m_state != -1 && key->m_state != state) - return 0; - return key; - } - } - return 0; -} - -/* vim: set filetype=lex: */ diff --git a/ndb/src/old_files/client/odbc/common/AttrArea.cpp b/ndb/src/old_files/client/odbc/common/AttrArea.cpp deleted file mode 100644 index ff9e085a7f6..00000000000 --- a/ndb/src/old_files/client/odbc/common/AttrArea.cpp +++ /dev/null @@ -1,91 +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 */ - -#include "AttrArea.hpp" - -// AttrSpec - -// AttrField - -// AttrArea - -AttrArea::AttrArea(const AttrSpec* specList) : - m_specList(specList) -{ -} - -AttrArea::~AttrArea() -{ -} - -const AttrSpec& -AttrArea::findSpec(int id) const -{ - const AttrSpec* p; - for (p = m_specList; p->m_mode != Attr_mode_undef; p++) { - if (p->m_id == id) - break; - } - return *p; -} - -void -AttrArea::setAttr(Ctx& ctx, int id, const OdbcData& data) -{ - const AttrSpec& spec = findSpec(id); - if (spec.m_mode == Attr_mode_undef) { - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "undefined attribute id %d", id); - return; - } - ctx_assert(spec.m_type == data.type()); - ctx_assert(spec.m_set != 0); - spec.m_set(ctx, m_handle, data); - if (! ctx.ok()) - return; - Fields::iterator iter; - if (ctx.logLevel() >= 3) { - char buf[100]; - data.print(buf, sizeof(buf)); - ctx_log3(("attr handle 0x%x set id %d = %s", (unsigned)m_handle, id, buf)); - } - iter = m_fields.find(id); - if (iter != m_fields.end()) { - AttrField& field = (*iter).second; - field.setData(data); - return; - } - AttrField field(spec, data); - m_fields.insert(Fields::value_type(id, field)); -} - -void -AttrArea::getAttr(Ctx& ctx, int id, OdbcData& data) -{ - const AttrSpec& spec = findSpec(id); - if (spec.m_mode == Attr_mode_undef) { - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "undefined attribute id %d", id); - return; - } - Fields::iterator iter; - iter = m_fields.find(id); - if (iter != m_fields.end()) { - AttrField& field = (*iter).second; - data.setValue(field.getData()); - return; - } - ctx_assert(spec.m_default != 0); - spec.m_default(ctx, m_handle, data); -} diff --git a/ndb/src/old_files/client/odbc/common/AttrArea.hpp b/ndb/src/old_files/client/odbc/common/AttrArea.hpp deleted file mode 100644 index 050cce719bf..00000000000 --- a/ndb/src/old_files/client/odbc/common/AttrArea.hpp +++ /dev/null @@ -1,135 +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 ODBC_HANDLES_AttrArea_hpp -#define ODBC_HANDLES_AttrArea_hpp - -#include -#include -#include "OdbcData.hpp" - -class HandleBase; - -enum AttrMode { - Attr_mode_undef, - Attr_mode_readonly, - Attr_mode_writeonly, - Attr_mode_readwrite -}; - -/** - * @struct AttrSpec - * @brief Attribute specifier - * - * Each handle class has a list of attribute specifiers. - */ -struct AttrSpec { - int m_id; // SQL_ATTR_ identifier - OdbcData::Type m_type; // data type - AttrMode m_mode; // access mode, undef indicates end of list - /** - * Callback for checks and side effects. Called before the - * attribute is stored. May set error status. - */ - typedef void CallbackSet(Ctx& ctx, HandleBase* self, const OdbcData& data); - CallbackSet* m_set; - /** - * Callback to set default value. May set error status. - */ - typedef void CallbackDefault(Ctx& ctx, HandleBase* self, OdbcData& data); - CallbackDefault* m_default; -}; - -/** - * @class AttrField - * @brief Attribute value (stored as OdbcData) - */ -class AttrField { -public: - AttrField(const AttrSpec& attrSpec, const OdbcData& data); - AttrField(const AttrField& field); - ~AttrField(); - void setData(const OdbcData& data); - const OdbcData& getData(); -private: - const AttrSpec& m_spec; - OdbcData m_data; -}; - -inline -AttrField::AttrField(const AttrSpec& spec, const OdbcData& data) : - m_spec(spec), - m_data(data) -{ -} - -inline -AttrField::AttrField(const AttrField& field) : - m_spec(field.m_spec), - m_data(field.m_data) -{ -} - -inline -AttrField::~AttrField() -{ -} - -inline void -AttrField::setData(const OdbcData& data) -{ - ctx_assert(m_spec.m_type == data.type()); - m_data.setValue(data); -} - -inline const OdbcData& -AttrField::getData() -{ - ctx_assert(m_data.type() != OdbcData::Undef); - return m_data; -} - -/** - * @class AttrArea - * @brief Handle attributes - * - * Each handle instance has a list of attribute values stored - * under an AttrArea. Callbacks to handle code provide for - * default values, extra checks, and side-effects. - */ -class AttrArea { -public: - AttrArea(const AttrSpec* specList); - ~AttrArea(); - void setHandle(HandleBase* handle); - const AttrSpec& findSpec(int id) const; - void setAttr(Ctx& ctx, int id, const OdbcData& data); - void getAttr(Ctx& ctx, int id, OdbcData& data); -private: - HandleBase* m_handle; - const AttrSpec* const m_specList; - typedef std::map Fields; - Fields m_fields; -}; - -inline void -AttrArea::setHandle(HandleBase* handle) -{ - ctx_assert(handle != 0); - m_handle = handle; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/CodeTree.cpp b/ndb/src/old_files/client/odbc/common/CodeTree.cpp deleted file mode 100644 index ebe4840c5f6..00000000000 --- a/ndb/src/old_files/client/odbc/common/CodeTree.cpp +++ /dev/null @@ -1,37 +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 */ - -#include "CodeTree.hpp" - -// PlanTree - -PlanTree::~PlanTree() -{ -} - -// ExecTree - -ExecTree::Code::~Code() -{ -} - -ExecTree::Data::~Data() -{ -} - -ExecTree::~ExecTree() -{ -} diff --git a/ndb/src/old_files/client/odbc/common/CodeTree.hpp b/ndb/src/old_files/client/odbc/common/CodeTree.hpp deleted file mode 100644 index 1b0ae3199af..00000000000 --- a/ndb/src/old_files/client/odbc/common/CodeTree.hpp +++ /dev/null @@ -1,49 +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 ODBC_CODEGEN_CodeTree_hpp -#define ODBC_CODEGEN_CodeTree_hpp - -#include - -/* - * Intermediary statement evalution plan. Starts as parse tree. Final - * format maps directly to ExecTree. - */ -class PlanTree { -public: - virtual ~PlanTree() = 0; -}; - -/* - * Executable code and runtime data. Currently looks like PlanTree. - * Later may change code format to linear "byte code" and move execution - * to a SQL block in NDB kernel. - */ -class ExecTree { -public: - class Code { - public: - virtual ~Code() = 0; - }; - class Data { - public: - virtual ~Data() = 0; - }; - virtual ~ExecTree() = 0; -}; - -#endif diff --git a/ndb/src/old_files/client/odbc/common/ConnArea.cpp b/ndb/src/old_files/client/odbc/common/ConnArea.cpp deleted file mode 100644 index d4d3be52a3c..00000000000 --- a/ndb/src/old_files/client/odbc/common/ConnArea.cpp +++ /dev/null @@ -1,109 +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 */ - -#include -#include -#include -#include "ConnArea.hpp" - -ConnArea::ConnArea() : - m_state(Free), - m_ndbObject(0), - m_ndbSchemaCon(0), - m_ndbConnection(0), - m_useSchemaCon(0), - m_useConnection(0), - m_autocommit(true), - m_uncommitted(false) -{ - // initialize connection catalog - m_catalog = new DictCatalog(*this); - m_schema = new DictSchema(*this, "NDB"); - m_catalog->addSchema(m_schema); -} - -ConnArea::~ConnArea() -{ - delete m_catalog; -} - -bool -ConnArea::useSchemaCon(Ctx& ctx, bool use) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "not connected"); - return false; - } - Ndb* ndb = m_ndbObject; - ctx_assert(ndb != 0); - NdbSchemaCon* scon = m_ndbSchemaCon; - if (use) { - if (scon == 0) { - ctx_assert(m_useSchemaCon == 0); - scon = ndb->startSchemaTransaction(); - if (scon == 0) { - ctx.pushStatus(ndb, scon, 0, "startSchemaTransaction"); - return false; - } - m_ndbSchemaCon = scon; - } - m_useSchemaCon++; - } else { - ctx_assert(scon != 0 && m_useSchemaCon != 0); - if (--m_useSchemaCon == 0) { - ndb->closeSchemaTransaction(scon); - m_ndbSchemaCon = 0; - } - } - return true; -} - -bool -ConnArea::useConnection(Ctx& ctx, bool use) -{ - ctx_log3(("useConnection: count before=%u on-off=%d", m_useConnection, (int)use)); - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "not connected"); - return false; - } - Ndb* ndb = m_ndbObject; - ctx_assert(ndb != 0); - NdbConnection* tcon = m_ndbConnection; - if (use) { - if (tcon == 0) { - ctx_assert(m_useConnection == 0); - tcon = ndb->startTransaction(); - if (tcon == 0) { - ctx.pushStatus(ndb, tcon, 0, "startTransaction"); - return false; - } - m_ndbConnection = tcon; - m_state = Transacting; - ctx_log2(("transaction opened")); - } - m_useConnection++; - } else { - ctx_assert(tcon != 0 && m_useConnection != 0); - if (--m_useConnection == 0) { - ndb->closeTransaction(tcon); - m_ndbConnection = 0; - m_uncommitted = false; - m_state = Connected; - ctx_log2(("transaction closed")); - } - } - return true; -} diff --git a/ndb/src/old_files/client/odbc/common/ConnArea.hpp b/ndb/src/old_files/client/odbc/common/ConnArea.hpp deleted file mode 100644 index 36367a39bae..00000000000 --- a/ndb/src/old_files/client/odbc/common/ConnArea.hpp +++ /dev/null @@ -1,135 +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 ODBC_COMMON_ConnArea_hpp -#define ODBC_COMMON_ConnArea_hpp - -#include - -class Ctx; -class Ndb; -class NdbSchemaCon; -class NdbConnection; -class DictCatalog; -class DictSchema; - -/** - * @class ConnArea - * @brief Public part of connection handle - */ -class ConnArea { -public: - // state between ODBC function calls - enum State { - Free = 1, // not in use, no Ndb object - Connected = 2, // has Ndb object but no Ndb connection - Transacting = 3 // has Ndb connection - }; - State getState() const; - DictCatalog& dictCatalog() const; - DictSchema& dictSchema() const; - Ndb* ndbObject() const; - NdbSchemaCon* ndbSchemaCon() const; - NdbConnection* ndbConnection() const; - // called from StmtArea - bool useSchemaCon(Ctx& ctx, bool use); - bool useConnection(Ctx& ctx, bool use); - // these just get and set the flag - no semantics - bool autocommit() const; - void autocommit(bool flag); - bool uncommitted() const; - void uncommitted(bool flag); -protected: - ConnArea(); - ~ConnArea(); - State m_state; - DictCatalog* m_catalog; - DictSchema* m_schema; - Ndb* m_ndbObject; - NdbSchemaCon* m_ndbSchemaCon; - NdbConnection* m_ndbConnection; - unsigned m_useSchemaCon; - unsigned m_useConnection; - bool m_autocommit; - bool m_uncommitted; // has uncommitted changes -}; - -inline ConnArea::State -ConnArea::getState() const -{ - return m_state; -} - -inline DictCatalog& -ConnArea::dictCatalog() const -{ - ctx_assert(m_catalog != 0); - return *m_catalog; -} - -inline DictSchema& -ConnArea::dictSchema() const -{ - ctx_assert(m_schema != 0); - return *m_schema; -} - -inline Ndb* -ConnArea::ndbObject() const -{ - ctx_assert(m_ndbObject != 0); - return m_ndbObject; -} - -inline NdbSchemaCon* -ConnArea::ndbSchemaCon() const -{ - ctx_assert(m_ndbSchemaCon != 0); - return m_ndbSchemaCon; -} - -inline NdbConnection* -ConnArea::ndbConnection() const -{ - ctx_assert(m_ndbConnection != 0); - return m_ndbConnection; -} - -inline bool -ConnArea::autocommit() const -{ - return m_autocommit; -} - -inline void -ConnArea::autocommit(bool flag) -{ - m_autocommit = flag; -} - -inline bool -ConnArea::uncommitted() const -{ - return m_uncommitted; -} - -inline void -ConnArea::uncommitted(bool flag) -{ - m_uncommitted = flag; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/Ctx.cpp b/ndb/src/old_files/client/odbc/common/Ctx.cpp deleted file mode 100644 index d6faa5cba77..00000000000 --- a/ndb/src/old_files/client/odbc/common/Ctx.cpp +++ /dev/null @@ -1,355 +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 */ - -#include -#include -#include "DiagArea.hpp" - -// ctor - -Ctx::Ctx() : - m_diagArea(0) // create on demand -{ - const char* p; - if ((p = getenv("NDB_ODBC_TRACE")) != 0) - m_logLevel = atoi(p); - if ((p = getenv("NDB_ODBC_TRACE_FILE")) != 0 && *p != 0) - strcpy(m_szTraceFile, p); -} - -Ctx::~Ctx() -{ - delete m_diagArea; - m_diagArea = 0; -} - -// handle exceptions - -CtxAssert::CtxAssert(const char* file, int line) : - m_file(file), - m_line(line) -{ - const char* p; - if ((p = getenv("NDB_ODBC_DEBUG")) != 0 && atoi(p) != 0) { - char buf[200]; - snprintf(buf, sizeof(buf), "%s, line %d: assert failed\n", m_file, m_line); - if ((p = getenv("NDB_ODBC_TRACE_FILE")) != 0 && *p != 0) { - FILE* pFile = fopen(p, "a"); - fprintf(pFile, buf); - fflush(pFile); - fclose(pFile); - } else { - fprintf(stderr, buf); - fflush(stderr); - } - abort(); - exit(1); - } -} - -void -Ctx::handleEx(CtxAssert& ctxAssert) -{ - pushStatus(Sqlstate::_IM001, Error::Gen, "exception at %s line %d", ctxAssert.m_file, ctxAssert.m_line); -} - -// logging methods - -int Ctx::m_logLevel = 0; -char Ctx::m_szTraceFile[MAX_PATH]; - -void -Ctx::log(const char* fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - if (m_szTraceFile[0]) { - FILE* pFile = fopen(m_szTraceFile, "a"); - fprintf(pFile, "[NdbOdbc] "); - vfprintf(pFile, fmt, ap); - fprintf(pFile, "\n"); - fflush(pFile); - fclose(pFile); - } else { - printf("[NdbOdbc] "); - vprintf(fmt, ap); - printf("\n"); - fflush(stdout); - } - va_end(ap); -} - -void -Ctx::logSqlEnter(const char* sqlFunction) -{ - Ctx& ctx = *this; - snprintf(m_sqlFunction, sizeof(m_sqlFunction), "%s", sqlFunction); - ctx_log3(("%s", m_sqlFunction)); -} - -void -Ctx::logSqlExit() -{ - Ctx& ctx = *this; - if (m_diagArea == 0) { - ctx_log3(("%s ret=%d", m_sqlFunction, getCode())); - return; - } - int logLevel = diagArea().numStatus() != 0 ? 2 : 3; - ctx_logN(logLevel, ("%s ret=%d diag=%d", m_sqlFunction, diagArea().getCode(), diagArea().numStatus())); - for (unsigned i = 1; i <= diagArea().numStatus(); i++) { - OdbcData state; - OdbcData message; - diagArea().getRecord(ctx, i, SQL_DIAG_SQLSTATE, state); - diagArea().getRecord(ctx, i, SQL_DIAG_MESSAGE_TEXT, message); - ctx_logN(logLevel, ("diag %u: %s - %s", i, state.sqlstate().state(), message.sqlchar())); - } -} - -void -Ctx::print(const char* fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - if (m_szTraceFile[0]) { - FILE* pFile = fopen(m_szTraceFile, "a"); - vfprintf(pFile, fmt, ap); - unsigned n = strlen(fmt); - if (n > 0 && fmt[n-1] == '\n') - fflush(pFile); - fclose(pFile); - } else { - vprintf(fmt, ap); - unsigned n = strlen(fmt); - if (n > 0 && fmt[n-1] == '\n') - fflush(stdout); - } - va_end(ap); -} - -void -Ctx::print(int level, const char* fmt, ...) -{ - if (level > m_logLevel) - return; - va_list ap; - va_start(ap, fmt); - if (m_szTraceFile[0]) { - FILE* pFile = fopen(m_szTraceFile, "a"); - vfprintf(pFile, fmt, ap); - unsigned n = strlen(fmt); - if (n > 0 && fmt[n-1] == '\n') - fflush(pFile); - fclose(pFile); - } else { - vprintf(fmt, ap); - unsigned n = strlen(fmt); - if (n > 0 && fmt[n-1] == '\n') - fflush(stdout); - } - va_end(ap); -} - -// diagnostics - -static const unsigned MessageSize = 512; - -DiagArea& -Ctx::diagArea() const -{ - ctx_assert(m_diagArea != 0); - return *m_diagArea; -} - -DiagArea& -Ctx::diagArea() -{ - if (m_diagArea == 0) - m_diagArea = new DiagArea; - return *m_diagArea; -} - -SQLRETURN -Ctx::getCode() const -{ - if (m_diagArea == 0) - return SQL_SUCCESS; - return diagArea().getCode(); -} - -void -Ctx::setCode(SQLRETURN ret) -{ - diagArea().setCode(ret); -} - -void -Ctx::pushStatus(const Sqlstate& state, SQLINTEGER code, const char* fmt, ...) -{ - char message[MessageSize]; - va_list ap; - va_start(ap, fmt); - vsnprintf(message, sizeof(message), fmt, ap); - va_end(ap); - Error error(state); - error.m_status = NdbError::PermanentError; - error.m_classification = NdbError::ApplicationError; - error.m_code = code; - error.m_message = message; - error.m_sqlFunction = m_sqlFunction; - diagArea().pushStatus(error); -} - -void -Ctx::pushStatus(SQLINTEGER code, const char* fmt, ...) -{ - char message[MessageSize]; - va_list ap; - va_start(ap, fmt); - vsnprintf(message, sizeof(message), fmt, ap); - va_end(ap); - Error error(Sqlstate::_IM000); - error.m_status = NdbError::PermanentError; - error.m_classification = NdbError::ApplicationError; - error.m_code = code; - error.m_message = message; - error.m_sqlFunction = m_sqlFunction; - diagArea().pushStatus(error); -} - -void -Ctx::pushStatus(const NdbError& ndbError, const char* fmt, ...) -{ - char message[MessageSize]; - va_list ap; - va_start(ap, fmt); - snprintf(message, sizeof(message), "%s", ndbError.message); - snprintf(message + strlen(message), sizeof(message) - strlen(message), "%s", " - at "); - vsnprintf(message + strlen(message), sizeof(message) - strlen(message), fmt, ap); - va_end(ap); - Error error(Sqlstate::_IM000); - error.m_status = ndbError.status; - error.m_classification = ndbError.classification; - error.m_code = ndbError.code; - error.m_message = message; - error.m_sqlFunction = m_sqlFunction; - diagArea().pushStatus(error); -} - -void -Ctx::pushStatus(const Ndb* ndb, const char* fmt, ...) -{ - char message[MessageSize]; - va_list ap; - va_start(ap, fmt); - vsnprintf(message, sizeof(message), fmt, ap); - va_end(ap); - bool found = false; - if (ndb != 0) { - const NdbError& ndbError = ndb->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (! found) { - pushStatus(Error::Gen, "unknown NDB error"); - } -} - -void -Ctx::pushStatus(const Ndb* ndb, const NdbConnection* tcon, const NdbOperation* op, const char* fmt, ...) -{ - char message[MessageSize]; - va_list ap; - va_start(ap, fmt); - vsnprintf(message, sizeof(message), fmt, ap); - va_end(ap); - bool found = false; - if (op != 0) { - const NdbError& ndbError = op->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (tcon != 0) { - const NdbError& ndbError = tcon->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (ndb != 0) { - const NdbError& ndbError = ndb->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (! found) { - pushStatus(Error::Gen, "unknown NDB error"); - } -} - -void -Ctx::pushStatus(const Ndb* ndb, const NdbSchemaCon* scon, const NdbSchemaOp* op, const char* fmt, ...) -{ - char message[MessageSize]; - va_list ap; - va_start(ap, fmt); - vsnprintf(message, sizeof(message), fmt, ap); - va_end(ap); - bool found = false; - if (op != 0) { - const NdbError& ndbError = op->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (scon != 0) { - const NdbError& ndbError = scon->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (ndb != 0) { - const NdbError& ndbError = ndb->getNdbError(); - if (ndbError.code != 0) { - pushStatus(ndbError, "%s", message); - found = true; - } - } - if (! found) { - pushStatus(Error::Gen, "unknown NDB error"); - } -} - -// check for error - -bool -Ctx::ok() -{ - if (m_diagArea == 0) - return true; - if (diagArea().getCode() == SQL_SUCCESS) - return true; - if (diagArea().getCode() == SQL_SUCCESS_WITH_INFO) - return true; - return false; -} diff --git a/ndb/src/old_files/client/odbc/common/Ctx.hpp b/ndb/src/old_files/client/odbc/common/Ctx.hpp deleted file mode 100644 index d25d45ff0c7..00000000000 --- a/ndb/src/old_files/client/odbc/common/Ctx.hpp +++ /dev/null @@ -1,182 +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 ODBC_COMMON_Ctx_hpp -#define ODBC_COMMON_Ctx_hpp - -#include - -class Ndb; -class NdbConnection; -class NdbOperation; -class NdbSchemaCon; -class NdbSchemaOp; -class NdbError; - -class Sqlstate; -class DiagArea; -class CtxOwner; - -#ifndef MAX_PATH -#define MAX_PATH 1024 -#endif - -/** - * @class Error - * @brief Sql state, error codes, and message - */ -struct Error { - enum { - Gen = NDB_ODBC_ERROR_MIN + 1 // unclassified - }; - explicit Error(const Sqlstate& sqlstate); - const Sqlstate& m_sqlstate; - int m_status; - int m_classification; - int m_code; - const char* m_message; - const char* m_sqlFunction; - bool driverError() const; -}; - -inline -Error::Error(const Sqlstate& sqlstate) : - m_sqlstate(sqlstate), - m_status(0), - m_classification(0), - m_code(0), - m_sqlFunction(0) -{ -} - -inline bool -Error::driverError() const -{ - return NDB_ODBC_ERROR_MIN <= m_code && m_code < NDB_ODBC_ERROR_MAX; -} - -#define ctx_assert(x) \ - do { if (x) break; throw CtxAssert(__FILE__, __LINE__); } while (0) - -/** - * @class Assert - * @brief Assert thrown - */ -class CtxAssert { -public: - CtxAssert(const char* file, int line); - const char* const m_file; - const int m_line; -}; - -/** - * @class Ctx - * @brief Context for one ODBC SQL function - * - * Local to the function (not member of the handle) because methods on - * a handle can call methods on other handles. Created in driver/ - * before method calls and saved under the handle on return. Contains - * diag area for the function. Also used as logger. - */ -class Ctx { -public: - Ctx(); - ~Ctx(); - // handle exceptions - void handleEx(CtxAssert& ctxAssert); - // logging methods - int logLevel() const; - void log(const char* fmt, ...) PRINTFLIKE(2,3); - void logSqlEnter(const char* sqlFunction); - void logSqlExit(); - const char* sqlFunction() const; - void print(const char* fmt, ...) PRINTFLIKE(2,3); - void print(int level, const char* fmt, ...) PRINTFLIKE(3,4); - // diagnostics area. - DiagArea& diagArea() const; - DiagArea& diagArea(); - SQLRETURN getCode() const; - void setCode(SQLRETURN ret); - // push diagnostic record - void pushStatus(const Sqlstate& state, SQLINTEGER code, const char* fmt, ...) PRINTFLIKE(4,5); - void pushStatus(SQLINTEGER code, const char* fmt, ...) PRINTFLIKE(3,4); - void pushStatus(const NdbError& ndbError, const char* fmt, ...) PRINTFLIKE(3,4); - void pushStatus(const Ndb* ndb, const char* fmt, ...) PRINTFLIKE(3,4); - void pushStatus(const Ndb* ndb, const NdbConnection* tcon, const NdbOperation* op, const char* fmt, ...) PRINTFLIKE(5,6); - void pushStatus(const Ndb* ndb, const NdbSchemaCon* scon, const NdbSchemaOp* op, const char* fmt, ...) PRINTFLIKE(5,6); - // check if we should continue executing. - bool ok(); -private: - static int m_logLevel; - static char m_szTraceFile[MAX_PATH]; - char m_sqlFunction[32]; // max needed is 20 - DiagArea* m_diagArea; -}; - -inline int -Ctx::logLevel() const -{ - return m_logLevel; -} - -inline const char* -Ctx::sqlFunction() const -{ - return m_sqlFunction; -} - -// logging macros can be used only when ctx is in scope - -#define ctx_logN(n, x) \ - do { if (ctx.logLevel() < (n)) break; ctx.log x; } while (0) - -#if NDB_ODBC_MAX_LOG_LEVEL >= 0 -#define ctx_log0(x) ctx_logN(0, x) -#else -#define ctx_log0(x) -#endif - -#if NDB_ODBC_MAX_LOG_LEVEL >= 1 -#define ctx_log1(x) ctx_logN(1, x) -#else -#define ctx_log1(x) -#endif - -#if NDB_ODBC_MAX_LOG_LEVEL >= 2 -#define ctx_log2(x) ctx_logN(2, x) -#else -#define ctx_log2(x) -#endif - -#if NDB_ODBC_MAX_LOG_LEVEL >= 3 -#define ctx_log3(x) ctx_logN(3, x) -#else -#define ctx_log3(x) -#endif - -#if NDB_ODBC_MAX_LOG_LEVEL >= 4 -#define ctx_log4(x) ctx_logN(4, x) -#else -#define ctx_log4(x) -#endif - -#if NDB_ODBC_MAX_LOG_LEVEL >= 5 -#define ctx_log5(x) ctx_logN(5, x) -#else -#define ctx_log5(x) -#endif - -#endif diff --git a/ndb/src/old_files/client/odbc/common/DataField.cpp b/ndb/src/old_files/client/odbc/common/DataField.cpp deleted file mode 100644 index 11aae7d893b..00000000000 --- a/ndb/src/old_files/client/odbc/common/DataField.cpp +++ /dev/null @@ -1,3023 +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 */ - -#include "DataField.hpp" - -#ifndef INT_MAX -#define INT_MAX (2147483647) -#endif - -#ifndef INT_MIN -#define INT_MIN (-INT_MAX - 1) -#endif - -#ifndef UINT_MAX -#define UINT_MAX 4294967295U -#endif - -#ifndef FLT_MAX -#define FLT_MAX (3.402823466E+38F) -#endif -#ifndef FLT_MIN -#define FLT_MIN (1.175494351E-38F) -#endif - -#ifdef NDB_WIN32 -#define FMT_I64 "%I64d" -#define FMT_U64 "%I64u" -#else -#define FMT_I64 "%lld" -#define FMT_U64 "%llu" -#endif - -#ifdef NDB_WIN32 -#define strtoll(str, endptr, base) strtoint64(str, endptr, base) -#define strtoull(str, endptr, base) strtouint64(str, endptr, base) - -static Int64 -strtoint64(const char *str, char **endptr, int base) -{ - Int64 x = 0; - while (*str == ' ') - str++; - const char* p = str; - while ('0' <= *p && *p <= '9') - x = 10 * x + *p++ - '0'; - if (p == str) { - *endptr = 0; - return 0; - } - *endptr = (char*)p; - return x; -} - -static Uint64 -strtouint64(const char *str, char **endptr, int base) -{ - Uint64 x = 0; - while (*str == ' ') - str++; - const char* p = str; - while ('0' <= *p && *p <= '9') - x = 10 * x + *p++ - '0'; - if (p == str) { - *endptr = 0; - return 0; - } - *endptr = (char*)p; - return x; -} -#endif - -// LexSpec - -void -LexSpec::convert(Ctx& ctx, const BaseString& value, SqlField& out) -{ - const SqlSpec& sqlSpec = out.sqlSpec(); - const SqlType& sqlType = sqlSpec.sqlType(); - out.alloc(); - if (sqlType.type() == SqlType::Char) { - const SqlChar* s = (const SqlChar*)value.c_str(); - out.sqlChar(s, SQL_NTS); - return; - } - if (sqlType.type() == SqlType::Bigint) { - char* endptr = 0; - SqlBigint n = static_cast(strtoll(value.c_str(), &endptr, 10)); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Error::Gen, "cannot convert '%s' to integer", value.c_str()); - return; - } - out.sqlBigint(n); - return; - } - if (sqlType.type() == SqlType::Double) { - char* endptr = 0; - SqlDouble x = static_cast(strtod(value.c_str(), &endptr)); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Error::Gen, "cannot convert '%s' to number", value.c_str()); - return; - } - out.sqlDouble(x); - return; - } - if (sqlType.type() == SqlType::Null) { - out.u_null.m_nullFlag = true; - return; - } - ctx_assert(false); -} - -// SqlField - -void -SqlField::alloc() -{ - ctx_assert(sqlSpec().store() == SqlSpec::Physical); - const SqlType& sqlType = sqlSpec().sqlType(); - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varchar) - n += 2; - if (n > SqlField_CharSmall) { - u_data.m_sqlChar = new SqlChar[n]; - } - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varbinary) - n += 2; - if (n > SqlField_CharSmall) { - u_data.m_sqlChar = new SqlChar[n]; - } - } -} - -void -SqlField::alloc(const SqlField& sqlField) -{ - alloc(); - const SqlType& sqlType = sqlSpec().sqlType(); - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varchar) - n += 2; - if (n > SqlField_CharSmall) { - memcpy(u_data.m_sqlChar, sqlField.u_data.m_sqlChar, n); - } - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varbinary) - n += 2; - if (n > SqlField_CharSmall) { - memcpy(u_data.m_sqlChar, sqlField.u_data.m_sqlChar, n); - } - } -} - -const void* -SqlField::addr() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->addr(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varchar) - n += 2; - if (n > SqlField_CharSmall) { - return static_cast(u_data.m_sqlChar); - } - return static_cast(u_data.m_sqlCharSmall); - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varbinary) - n += 2; - if (n > SqlField_CharSmall) { - return static_cast(u_data.m_sqlChar); - } - return static_cast(u_data.m_sqlCharSmall); - } - if (sqlType.type() == SqlType::Smallint) { - return static_cast(&u_data.m_sqlSmallint); - } - if (sqlType.type() == SqlType::Integer) { - return static_cast(&u_data.m_sqlInteger); - } - if (sqlType.type() == SqlType::Bigint) { - return static_cast(&u_data.m_sqlBigint); - } - if (sqlType.type() == SqlType::Real) { - return static_cast(&u_data.m_sqlReal); - } - if (sqlType.type() == SqlType::Double) { - return static_cast(&u_data.m_sqlDouble); - } - if (sqlType.type() == SqlType::Datetime) { - return static_cast(&u_data.m_sqlDatetime); - } - ctx_assert(false); // SqlType::Null has no address - return 0; -} - -void* -SqlField::addr() -{ - const SqlType& sqlType = sqlSpec().sqlType(); - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varchar) - n += 2; - if (n > SqlField_CharSmall) { - return static_cast(u_data.m_sqlChar); - } - return static_cast(u_data.m_sqlCharSmall); - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varbinary) - n += 2; - if (n > SqlField_CharSmall) { - return static_cast(u_data.m_sqlChar); - } - return static_cast(u_data.m_sqlCharSmall); - } - if (sqlType.type() == SqlType::Smallint) { - return static_cast(&u_data.m_sqlSmallint); - } - if (sqlType.type() == SqlType::Integer) { - return static_cast(&u_data.m_sqlInteger); - } - if (sqlType.type() == SqlType::Bigint) { - return static_cast(&u_data.m_sqlBigint); - } - if (sqlType.type() == SqlType::Real) { - return static_cast(&u_data.m_sqlReal); - } - if (sqlType.type() == SqlType::Double) { - return static_cast(&u_data.m_sqlDouble); - } - if (sqlType.type() == SqlType::Datetime) { - return static_cast(&u_data.m_sqlDatetime); - } - ctx_assert(false); // SqlType::Null has no address - return 0; -} - -unsigned -SqlField::allocSize() const -{ - const SqlType& sqlType = sqlSpec().sqlType(); - unsigned n = sqlType.size(); - if (sqlType.type() == SqlType::Varchar || sqlType.type() == SqlType::Varbinary) { - n += 2; - } - return n; -} - -void -SqlField::free() -{ - ctx_assert(sqlSpec().store() == SqlSpec::Physical); - const SqlType& sqlType = sqlSpec().sqlType(); - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varchar) - n += 2; - if (n > SqlField_CharSmall) { - delete[] u_data.m_sqlChar; - u_data.m_sqlChar = 0; // safety since dtor used explicitly - } - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned n = sqlType.length(); - if (sqlType.type() == SqlType::Varbinary) - n += 2; - if (n > SqlField_CharSmall) { - delete[] u_data.m_sqlChar; - u_data.m_sqlChar = 0; // safety since dtor used explicitly - } - } -} - -// get - -const SqlChar* -SqlField::sqlChar() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlChar(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Char); - if (sqlType.length() > SqlField_CharSmall) - return u_data.m_sqlChar; - return u_data.m_sqlCharSmall; -} - -const SqlChar* -SqlField::sqlVarchar(unsigned* length) const -{ -#if NDB_VERSION_MAJOR >= 3 - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlVarchar(length); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varchar); - const SqlChar* sqlChar; - unsigned n = sqlType.length(); - if (2 + n > SqlField_CharSmall) - sqlChar = u_data.m_sqlChar; - else - sqlChar = u_data.m_sqlCharSmall; - if (length != 0) - *length = (sqlChar[0] << 8) | sqlChar[1]; // big-endian - return sqlChar + 2; -#else - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlVarchar(length); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varchar); - const SqlChar* sqlChar; - unsigned n = sqlType.length(); - if (n + 2 > SqlField_CharSmall) - sqlChar = u_data.m_sqlChar; - else - sqlChar = u_data.m_sqlCharSmall; - if (length != 0) - *length = (sqlChar[n + 0] << 8) | sqlChar[n + 1]; // big-endian - return sqlChar; -#endif -} - -const SqlChar* -SqlField::sqlBinary() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlChar(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Binary); - if (sqlType.length() > SqlField_CharSmall) - return u_data.m_sqlChar; - return u_data.m_sqlCharSmall; -} - -const SqlChar* -SqlField::sqlVarbinary(unsigned* length) const -{ -#if NDB_VERSION_MAJOR >= 3 - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlVarchar(length); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varbinary); - const SqlChar* sqlChar; - unsigned n = sqlType.length(); - if (2 + n > SqlField_CharSmall) - sqlChar = u_data.m_sqlChar; - else - sqlChar = u_data.m_sqlCharSmall; - if (length != 0) - *length = (sqlChar[0] << 8) | sqlChar[1]; // big-endian - return sqlChar + 2; -#else - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlVarchar(length); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varbinary); - const SqlChar* sqlChar; - unsigned n = sqlType.length(); - if (n + 2 > SqlField_CharSmall) - sqlChar = u_data.m_sqlChar; - else - sqlChar = u_data.m_sqlCharSmall; - if (length != 0) - *length = (sqlChar[n + 0] << 8) | sqlChar[n + 1]; // big-endian - return sqlChar; -#endif -} - -SqlSmallint -SqlField::sqlSmallint() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlSmallint(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Smallint); - return u_data.m_sqlSmallint; -} - -SqlInteger -SqlField::sqlInteger() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlInteger(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Integer); - return u_data.m_sqlInteger; -} - -SqlBigint -SqlField::sqlBigint() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlBigint(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Bigint); - return u_data.m_sqlBigint; -} - -SqlReal -SqlField::sqlReal() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlReal(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Real); - return u_data.m_sqlReal; -} - -SqlDouble -SqlField::sqlDouble() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlDouble(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Double); - return u_data.m_sqlDouble; -} - -SqlDatetime -SqlField::sqlDatetime() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlDatetime(); - } - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Datetime); - return u_data.m_sqlDatetime; -} - -// set - -void -SqlField::sqlChar(const SqlChar* value, int length) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Char); - unsigned n = sqlType.length(); - SqlChar* p = n > SqlField_CharSmall ? u_data.m_sqlChar : u_data.m_sqlCharSmall; - const SqlChar* q = value; - unsigned m = length == SQL_NTS ? strlen((const char*)q) : length; - ctx_assert(m <= n); - for (unsigned i = 0; i < m; i++) - *p++ = *q++; - for (unsigned i = m; i < n; i++) - *p++ = 0x20; // space - u_null.m_nullFlag = false; -} - -void -SqlField::sqlVarchar(const SqlChar* value, int length) -{ -#if NDB_VERSION_MAJOR >= 3 - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varchar); - unsigned n = sqlType.length(); - SqlChar* p = 2 + n > SqlField_CharSmall ? u_data.m_sqlChar : u_data.m_sqlCharSmall; - const SqlChar* q = value; - unsigned m = length == SQL_NTS ? strlen((const char*)q) : length; - ctx_assert(m <= n); - *p++ = (m >> 8) & 0xff; // big-endian - *p++ = (m & 0xff); - for (unsigned i = 0; i < m; i++) - *p++ = *q++; - for (unsigned i = m; i < n; i++) - *p++ = 0x0; // null - u_null.m_nullFlag = false; -#else - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varchar); - unsigned n = sqlType.length(); - SqlChar* p = n + 2 > SqlField_CharSmall ? u_data.m_sqlChar : u_data.m_sqlCharSmall; - const SqlChar* q = value; - unsigned m = length == SQL_NTS ? strlen((const char*)q) : length; - ctx_assert(m <= n); - for (unsigned i = 0; i < m; i++) - *p++ = *q++; - for (unsigned i = m; i < n; i++) - *p++ = 0x0; // null - *p++ = (m >> 8) & 0xff; // big-endian - *p++ = (m & 0xff); - u_null.m_nullFlag = false; -#endif -} - -void -SqlField::sqlBinary(const SqlChar* value, int length) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Binary); - unsigned n = sqlType.length(); - SqlChar* p = n > SqlField_CharSmall ? u_data.m_sqlChar : u_data.m_sqlCharSmall; - const SqlChar* q = value; - unsigned m = length; - ctx_assert(m <= n); - for (unsigned i = 0; i < m; i++) - *p++ = *q++; - for (unsigned i = m; i < n; i++) - *p++ = 0x0; // null - u_null.m_nullFlag = false; -} - -void -SqlField::sqlVarbinary(const SqlChar* value, int length) -{ -#if NDB_VERSION_MAJOR >= 3 - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varbinary); - unsigned n = sqlType.length(); - SqlChar* p = 2 + n > SqlField_CharSmall ? u_data.m_sqlChar : u_data.m_sqlCharSmall; - const SqlChar* q = value; - unsigned m = length; - ctx_assert(m <= n); - *p++ = (m >> 8) & 0xff; // big-endian - *p++ = (m & 0xff); - for (unsigned i = 0; i < m; i++) - *p++ = *q++; - for (unsigned i = m; i < n; i++) - *p++ = 0x0; // null - u_null.m_nullFlag = false; -#else - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Varbinary); - unsigned n = sqlType.length(); - SqlChar* p = n + 2 > SqlField_CharSmall ? u_data.m_sqlChar : u_data.m_sqlCharSmall; - const SqlChar* q = value; - unsigned m = length; - ctx_assert(m <= n); - for (unsigned i = 0; i < m; i++) - *p++ = *q++; - for (unsigned i = m; i < n; i++) - *p++ = 0x0; // null - *p++ = (m >> 8) & 0xff; // big-endian - *p++ = (m & 0xff); - u_null.m_nullFlag = false; -#endif -} - -void -SqlField::sqlSmallint(SqlSmallint value) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Smallint); - u_data.m_sqlSmallint = value; - u_null.m_nullFlag = false; -} - -void -SqlField::sqlInteger(SqlInteger value) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Integer); - u_data.m_sqlInteger = value; - u_null.m_nullFlag = false; -} - -void -SqlField::sqlBigint(SqlBigint value) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Bigint); - u_data.m_sqlBigint = value; - u_null.m_nullFlag = false; -} - -void -SqlField::sqlReal(SqlReal value) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Real); - u_data.m_sqlReal = value; - u_null.m_nullFlag = false; -} - -void -SqlField::sqlDouble(SqlDouble value) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Double); - u_data.m_sqlDouble = value; - u_null.m_nullFlag = false; -} - -void -SqlField::sqlDatetime(SqlDatetime value) -{ - const SqlType& sqlType = sqlSpec().sqlType(); - ctx_assert(sqlType.type() == SqlType::Datetime); - u_data.m_sqlDatetime = value; - u_null.m_nullFlag = false; -} - -// get and and set null - -bool -SqlField::sqlNull() const -{ - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - return u_data.m_sqlField->sqlNull(); - } - return u_null.m_nullFlag; -} - -void -SqlField::sqlNull(bool value) -{ - u_null.m_nullFlag = value; -} - -unsigned -SqlField::trim() const -{ - const SqlType& sqlType = sqlSpec().sqlType(); - unsigned n = 0; - const SqlChar* s = 0; - if (sqlType.type() == SqlType::Char) { - n = sqlType.length(); - s = sqlChar(); - } else if (sqlType.type() == SqlType::Varchar) { - s = sqlVarchar(&n); - } else { - ctx_assert(false); - return 0; - } - while (n > 0 && s[n - 1] == 0x20) - n--; - return n; -} - -void -SqlField::copy(Ctx& ctx, SqlField& out) const -{ - const SqlField& f1 = *this; - SqlField& f2 = out; - const SqlType& t1 = f1.sqlSpec().sqlType(); - const SqlType& t2 = f2.sqlSpec().sqlType(); - ctx_assert(t1.type() == t2.type()); - if (f1.sqlNull()) { - f2.sqlNull(true); - return; - } - if (t1.type() == SqlType::Char) { - f2.sqlChar(f1.sqlChar(), t1.length()); - return; - } - if (t1.type() == SqlType::Varchar) { - unsigned length; - const SqlChar* s1 = f1.sqlVarchar(&length); - f2.sqlVarchar(s1, length); - return; - } - if (t1.type() == SqlType::Binary) { - f2.sqlBinary(f1.sqlBinary(), t1.length()); - return; - } - if (t1.type() == SqlType::Varbinary) { - unsigned length; - const SqlChar* s1 = f1.sqlVarbinary(&length); - f2.sqlVarbinary(s1, length); - return; - } - if (t1.type() == SqlType::Smallint) { - f2.sqlSmallint(f1.sqlSmallint()); - return; - } - if (t1.type() == SqlType::Integer) { - f2.sqlInteger(f1.sqlInteger()); - return; - } - if (t1.type() == SqlType::Bigint) { - f2.sqlBigint(f1.sqlBigint()); - return; - } - if (t1.type() == SqlType::Real) { - f2.sqlReal(f1.sqlReal()); - return; - } - if (t1.type() == SqlType::Double) { - f2.sqlDouble(f1.sqlDouble()); - return; - } - if (t1.type() == SqlType::Datetime) { - f2.sqlDatetime(f1.sqlDatetime()); - return; - } - ctx_assert(false); -} - -bool -SqlField::cast(Ctx& ctx, SqlField& out) const -{ - const SqlField& f1 = *this; - SqlField& f2 = out; - if (f1.sqlNull()) { - f2.sqlNull(true); - return true; - } - const SqlType& t1 = f1.sqlSpec().sqlType(); - const SqlType& t2 = f2.sqlSpec().sqlType(); - if (t1.type() == SqlType::Char) { - if (t2.type() == SqlType::Char) { - unsigned n1 = f1.trim(); - if (n1 > t2.length()) - return false; - f2.sqlChar(f1.sqlChar(), n1); - return true; - } - if (t2.type() == SqlType::Varchar) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlVarchar(f1.sqlChar(), n1); - return true; - } - if (t2.type() == SqlType::Binary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlBinary(f1.sqlChar(), n1); - return true; - } - if (t2.type() == SqlType::Varbinary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlVarbinary(f1.sqlChar(), n1); - return true; - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Varchar) { - if (t2.type() == SqlType::Char) { - unsigned n1 = f1.trim(); - if (n1 > t2.length()) - return false; - f2.sqlChar(f1.sqlVarchar(0), n1); - return true; - } - if (t2.type() == SqlType::Varchar) { - unsigned n1 = f1.trim(); - if (n1 > t2.length()) - return false; - f2.sqlVarchar(f1.sqlVarchar(0), n1); - return true; - } - if (t2.type() == SqlType::Binary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlBinary(f1.sqlVarchar(0), n1); - return true; - } - if (t2.type() == SqlType::Varbinary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlVarbinary(f1.sqlVarchar(0), n1); - return true; - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Binary) { - if (t2.type() == SqlType::Binary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlBinary(f1.sqlBinary(), n1); - return true; - } - if (t2.type() == SqlType::Varbinary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlVarbinary(f1.sqlBinary(), n1); - return true; - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Varbinary) { - if (t2.type() == SqlType::Binary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlBinary(f1.sqlVarbinary(0), n1); - return true; - } - if (t2.type() == SqlType::Varbinary) { - unsigned n1 = t1.length(); - if (n1 > t2.length()) - return false; - f2.sqlVarbinary(f1.sqlVarbinary(0), n1); - return true; - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Smallint) { - if (! t2.unSigned()) { - SqlSmallint x1 = f1.sqlSmallint(); - if (t2.type() == SqlType::Smallint) { - f2.sqlSmallint(x1); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast(x1); - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast(x1); - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast(x1); - f2.sqlReal(x2); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast(x1); - f2.sqlDouble(x2); - return true; - } - } else { - SqlUsmallint x1 = f1.sqlSmallint(); - if (t2.type() == SqlType::Smallint) { - f2.sqlSmallint(x1); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlUinteger x2 = static_cast(x1); - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlUbigint x2 = static_cast(x1); - f2.sqlBigint(x2); - return true; - } - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Integer) { - if (! t2.unSigned()) { - SqlInteger x1 = f1.sqlInteger(); - if (t2.type() == SqlType::Smallint) { - SqlSmallint x2 = static_cast(x1); - if (x1 != static_cast(x2)) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - f2.sqlInteger(x1); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast(x1); - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast(x1); - f2.sqlReal(x2); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast(x1); - f2.sqlDouble(x2); - return true; - } - } else { - SqlUinteger x1 = f1.sqlInteger(); - if (t2.type() == SqlType::Smallint) { - SqlUsmallint x2 = static_cast(x1); - if (x1 != static_cast(x2)) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - f2.sqlInteger(x1); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlUbigint x2 = static_cast(x1); - f2.sqlBigint(x2); - return true; - } - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Bigint) { - if (! t2.unSigned()) { - SqlBigint x1 = f1.sqlBigint(); - if (t2.type() == SqlType::Smallint) { - SqlSmallint x2 = static_cast(x1); - if (x1 != static_cast(x2)) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast(x1); - if (x1 != static_cast(x2)) - return false; - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - f2.sqlBigint(x1); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast(x1); - f2.sqlReal(x2); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast(x1); - f2.sqlDouble(x2); - return true; - } - } else { - SqlUbigint x1 = f1.sqlBigint(); - if (t2.type() == SqlType::Smallint) { - SqlUsmallint x2 = static_cast(x1); - if (x1 != static_cast(x2)) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlUinteger x2 = static_cast(x1); - if (x1 != static_cast(x2)) - return false; - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - f2.sqlBigint(x1); - return true; - } - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Real) { - SqlReal x1 = f1.sqlReal(); - int off = 0; - if (x1 > 0.0 && x1 - floor(x1) >= 0.5) - off = 1; - if (x1 < 0.0 && x1 - floor(x1) <= 0.5) - off = -1; - bool b = (x1 - floor(x1) < 0.5); - if (t2.type() == SqlType::Smallint) { - SqlSmallint x2 = static_cast(x1) + off; - if (fabs(x1 - static_cast(x2)) >= 1.0) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast(x1) + off; - if (fabs(x1 - static_cast(x2)) >= 1.0) - return false; - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast(x1) + off; - if (fabs(x1 - static_cast(x2)) >= 1.0) - return false; - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - f2.sqlReal(x1); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast(x1); - f2.sqlDouble(x2); - return true; - } - ctx_assert(false); - return false; - } - if (t1.type() == SqlType::Double) { - SqlDouble x1 = f1.sqlDouble(); - int off = 0; - if (x1 > 0.0 && x1 - floor(x1) >= 0.5) - off = 1; - if (x1 < 0.0 && x1 - floor(x1) <= 0.5) - off = -1; - bool b = (x1 - floor(x1) < 0.5); - if (t2.type() == SqlType::Smallint) { - SqlSmallint x2 = static_cast(x1) + off; - if (fabs(x1 - static_cast(x2)) >= 1.0) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast(x1) + off; - if (fabs(x1 - static_cast(x2)) >= 1.0) - return false; - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast(x1) + off; - if (fabs(x1 - static_cast(x2)) >= 1.0) - return false; - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast(x1); - if (fabs(x1 - static_cast(x2)) >= 1.0) // XXX - return false; - f2.sqlReal(x1); - return true; - } - if (t2.type() == SqlType::Double) { - f2.sqlDouble(x1); - return true; - } - ctx_assert(false); - return false; - } - ctx_assert(false); - return false; -} - -bool -SqlField::less(const SqlField& sqlField) const -{ - const SqlField& f1 = *this; - const SqlField& f2 = sqlField; - const SqlType& t1 = f1.sqlSpec().sqlType(); - const SqlType& t2 = f2.sqlSpec().sqlType(); - ctx_assert(t1.type() == t2.type()); - if (t1.type() == SqlType::Char) { - const SqlChar* s1 = f1.sqlChar(); - const SqlChar* s2 = f2.sqlChar(); - unsigned n1 = t1.length(); - unsigned n2 = t2.length(); - SqlChar c1 = 0; - SqlChar c2 = 0; - unsigned i = 0; - while (i < n1 || i < n2) { - c1 = i < n1 ? s1[i] : 0x20; - c2 = i < n2 ? s2[i] : 0x20; - if (c1 != c2) - break; - i++; - } - return (c1 < c2); - } - if (t1.type() == SqlType::Varchar) { - unsigned n1, n2; - const SqlChar* s1 = f1.sqlVarchar(&n1); - const SqlChar* s2 = f2.sqlVarchar(&n2); - SqlChar c1 = 0; - SqlChar c2 = 0; - unsigned i = 0; - while (i < n1 || i < n2) { - c1 = i < n1 ? s1[i] : 0x0; - c2 = i < n2 ? s2[i] : 0x0; - if (c1 != c2) - break; - i++; - } - return (c1 < c2); - } - if (t1.type() == SqlType::Smallint) { - ctx_assert(t1.unSigned() == t2.unSigned()); - if (! t1.unSigned()) { - SqlSmallint x1 = f1.sqlSmallint(); - SqlSmallint x2 = f2.sqlSmallint(); - return (x1 < x2); - } else { - SqlUsmallint x1 = f1.sqlSmallint(); - SqlUsmallint x2 = f2.sqlSmallint(); - return (x1 < x2); - } - } - if (t1.type() == SqlType::Integer) { - ctx_assert(t1.unSigned() == t2.unSigned()); - if (! t1.unSigned()) { - SqlInteger x1 = f1.sqlInteger(); - SqlInteger x2 = f2.sqlInteger(); - return (x1 < x2); - } else { - SqlUinteger x1 = f1.sqlInteger(); - SqlUinteger x2 = f2.sqlInteger(); - return (x1 < x2); - } - } - if (t1.type() == SqlType::Bigint) { - ctx_assert(t1.unSigned() == t2.unSigned()); - if (! t1.unSigned()) { - SqlBigint x1 = f1.sqlBigint(); - SqlBigint x2 = f2.sqlBigint(); - return (x1 < x2); - } else { - SqlUbigint x1 = f1.sqlBigint(); - SqlUbigint x2 = f2.sqlBigint(); - return (x1 < x2); - } - } - if (t1.type() == SqlType::Real) { - SqlReal x1 = f1.sqlReal(); - SqlReal x2 = f2.sqlReal(); - return (x1 < x2); - } - if (t1.type() == SqlType::Double) { - SqlDouble x1 = f1.sqlDouble(); - SqlDouble x2 = f2.sqlDouble(); - return (x1 < x2); - } - if (t1.type() == SqlType::Datetime) { - SqlDatetime x1 = f1.sqlDatetime(); - SqlDatetime x2 = f2.sqlDatetime(); - return x1.less(x2); - } - ctx_assert(false); -} - -// copy from external - -static bool -copyin_char_char(Ctx& ctx, char* value, unsigned n, const char* ptr, const SQLINTEGER* ind, int* off, SqlChar* addr, int fieldId) -{ - if (off != 0 && *off >= 0) { - if ((unsigned)*off > n) { - ctx.pushStatus(Sqlstate::_22001, Error::Gen, "input parameter %d truncated (%u > %u)", fieldId, (unsigned)*off, n); - return false; - } - value += *off; - n -= *off; - } - unsigned m; - if (ind == 0 || *ind == SQL_NTS) - m = strlen(ptr); - else - m = *ind; - if (m > n) { - ctx.pushStatus(Sqlstate::_22001, Error::Gen, "input parameter %d truncated (%u > %u)", fieldId, m, n); - return false; - } - for (unsigned i = 0; i < m; i++) - value[i] = ptr[i]; - if (off != 0 && *off >= 0) - *off += m; - for (unsigned i = m; i < n; i++) - value[i] = addr == 0 ? 0x20 : 0x0; - if (addr != 0) { - if (off != 0 && *off >= 0) - m = *off; - addr[0] = (m >> 8) & 0xff; - addr[1] = (m & 0xff); - } - return true; -} - -static bool -copyin_binary_binary(Ctx& ctx, char* value, unsigned n, const char* ptr, const SQLINTEGER* ind, int* off, SqlChar* addr, int fieldId) -{ - if (off != 0 && *off >= 0) { - if ((unsigned)*off > n) { - ctx.pushStatus(Sqlstate::_22001, Error::Gen, "input parameter %d truncated (%u > %u)", fieldId, (unsigned)*off, n); - return false; - } - value += *off; - n -= *off; - } - if (ind == 0) { - ctx.pushStatus(Sqlstate::_22001, Error::Gen, "input parameter %d missing length", fieldId); - return false; - } - if (*ind < 0) { - ctx.pushStatus(Sqlstate::_22001, Error::Gen, "input parameter %d invalid length %d", fieldId, (int)*ind); - return false; - } - unsigned m; - m = *ind; - if (m > n) { - ctx.pushStatus(Sqlstate::_22001, Error::Gen, "input parameter %d truncated (%u > %u)", fieldId, m, n); - return false; - } - for (unsigned i = 0; i < m; i++) - value[i] = ptr[i]; - if (off != 0 && *off >= 0) - *off += m; - for (unsigned i = m; i < n; i++) - value[i] = addr == 0 ? 0x0 : 0x0; // just null - if (addr != 0) { - if (off != 0 && *off >= 0) - m = *off; - addr[0] = (m >> 8) & 0xff; - addr[1] = (m & 0xff); - } - return true; -} - -static bool -copyin_signed_char(Ctx& ctx, SqlBigint* value, const char* ptr, int fieldId) -{ - errno = 0; - char* endptr = 0; - SqlBigint x = strtoll(ptr, &endptr, 10); - if (endptr == 0 || *endptr != 0) { - errno = 0; - endptr = 0; - double y = strtod(ptr, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "input parameter %d value %s not numeric", fieldId, ptr); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "input parameter %d value %s overflow", fieldId, ptr); - return false; - } - // XXX should handle 123.000 - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "input parameter %d value %s truncated", fieldId, ptr); - x = static_cast(y); - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "input parameter %d value %s overflow", fieldId, ptr); - return false; - } - *value = x; - return true; -} - -static bool -copyin_double_char(Ctx& ctx, SqlDouble* value, const char* ptr, int fieldId) -{ - errno = 0; - char* endptr = 0; - double x = strtod(ptr, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "input parameter %d value %s not numeric", fieldId, ptr); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "input parameter %d value %s overflow", fieldId, ptr); - return false; - } - *value = x; - return true; -} - -void -SqlField::copyin(Ctx& ctx, ExtField& extField) -{ - ctx_assert(extField.extSpec().extType().type() != ExtType::Unbound); - ctx_assert(sqlSpec().store() == SqlSpec::Physical); - SQLINTEGER* indPtr = extField.m_indPtr; - const int fieldId = extField.fieldId(); - if (indPtr != 0 && *indPtr == SQL_NULL_DATA) { - sqlNull(true); - return; - } - const SqlType& sqlType = sqlSpec().sqlType(); - const ExtType& extType = extField.extSpec().extType(); - if (extField.m_pos > 0) { - if (sqlType.type() == SqlType::Char && extType.type() == ExtType::Char) - ; - else if (sqlType.type() == SqlType::Varchar && extType.type() == ExtType::Char) - ; - else { - char buf[40]; - sqlType.print(buf, sizeof(buf)); - ctx.pushStatus(Sqlstate::_HY019, Error::Gen, "cannot send %s data in pieces", buf); - return; - } - } - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned length = 0; - char* value = 0; - SqlChar* laddr = 0; // Varchar length address - if (sqlType.type() == SqlType::Char) { - length = sqlType.length(); - if (length > SqlField_CharSmall) - value = reinterpret_cast(u_data.m_sqlChar); - else - value = reinterpret_cast(u_data.m_sqlCharSmall); - laddr = 0; - } else { -#if NDB_VERSION_MAJOR >= 3 - length = sqlType.length(); - if (2 + length > SqlField_CharSmall) - value = reinterpret_cast(u_data.m_sqlChar + 2); - else - value = reinterpret_cast(u_data.m_sqlCharSmall + 2); - laddr = (SqlChar*)value - 2; -#else - length = sqlType.length(); - if (length + 2 > SqlField_CharSmall) - value = reinterpret_cast(u_data.m_sqlChar); - else - value = reinterpret_cast(u_data.m_sqlCharSmall); - laddr = (SqlChar*)value + length; -#endif - } - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast(extField.m_dataPtr); - int* off = 0; - if (extField.m_pos >= 0) - off = &extField.m_pos; - if (! copyin_char_char(ctx, value, length, dataPtr, indPtr, off, laddr, fieldId)) - return; - sqlNull(false); - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - const short* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%hd", *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - const unsigned short* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%hu", *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - const long* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%ld", *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - const unsigned long* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%lu", *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - const SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, FMT_I64, *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - const SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, FMT_U64, *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - const float* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%.7f", (double)*dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - const double* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%.14f", *dataPtr); - if (! copyin_char_char(ctx, value, length, buf, indPtr, 0, laddr, fieldId)) - return; - sqlNull(false); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned length = 0; - char* value = 0; - SqlChar* laddr = 0; // Varbinary length address - if (sqlType.type() == SqlType::Binary) { - length = sqlType.length(); - if (length > SqlField_CharSmall) - value = reinterpret_cast(u_data.m_sqlChar); - else - value = reinterpret_cast(u_data.m_sqlCharSmall); - laddr = 0; - } else { -#if NDB_VERSION_MAJOR >= 3 - length = sqlType.length(); - if (2 + length > SqlField_CharSmall) - value = reinterpret_cast(u_data.m_sqlChar + 2); - else - value = reinterpret_cast(u_data.m_sqlCharSmall + 2); - laddr = (SqlChar*)value - 2; -#else - length = sqlType.length(); - if (length + 2 > SqlField_CharSmall) - value = reinterpret_cast(u_data.m_sqlChar); - else - value = reinterpret_cast(u_data.m_sqlCharSmall); - laddr = (SqlChar*)value + length; -#endif - } - if (extType.type() == ExtType::Binary) { - const char* dataPtr = static_cast(extField.m_dataPtr); - int* off = 0; - if (extField.m_pos >= 0) - off = &extField.m_pos; - if (! copyin_binary_binary(ctx, value, length, dataPtr, indPtr, off, laddr, fieldId)) - return; - sqlNull(false); - return; - } - } - if (sqlType.type() == SqlType::Smallint) { - SqlSmallint value; - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast(extField.m_dataPtr); - SqlBigint x; - if (! copyin_signed_char(ctx, &x, dataPtr, fieldId)) - return; - value = x; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - value = (SqlSmallint)*dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - value = (SqlSmallint)*dataPtr; - sqlSmallint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Integer) { - SqlInteger value; - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast(extField.m_dataPtr); - SqlBigint x; - if (! copyin_signed_char(ctx, &x, dataPtr, fieldId)) - return; - value = x; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - value = (SqlInteger)*dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - value = (SqlInteger)*dataPtr; - sqlInteger(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Bigint) { - SqlBigint value; - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast(extField.m_dataPtr); - SqlBigint x; - if (! copyin_signed_char(ctx, &x, dataPtr, fieldId)) - return; - value = x; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - value = (SqlBigint)*dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - value = (SqlBigint)*dataPtr; - sqlBigint(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Real) { - SqlReal value; - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast(extField.m_dataPtr); - SqlDouble x; - if (! copyin_double_char(ctx, &x, dataPtr, fieldId)) - return; - value = x; - sqlReal(x); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlReal(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Double) { - SqlDouble value; - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast(extField.m_dataPtr); - SqlDouble x; - if (! copyin_double_char(ctx, &x, dataPtr, fieldId)) - return; - value = x; - sqlDouble(x); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - value = *dataPtr; - sqlDouble(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Datetime) { - SqlDatetime value; - if (extType.type() == ExtType::Char) { - // XXX replace sscanf by manual scan or regex - const char* dataPtr = static_cast(extField.m_dataPtr); - int cc = 0; - unsigned yy = 0, mm = 0, dd = 0, HH = 0, MM = 0, SS = 0, ff = 0; - bool setdate = false; - char dummy[10]; - if (sscanf(dataPtr, "%2d%2u-%2u-%2u %2u:%2u:%2u.%4u%1s", &cc, &yy, &mm, &dd, &HH, &MM, &SS, &ff, dummy) == 8) { - ; - } else if (sscanf(dataPtr, "%2d%2u-%2u-%2u %2u:%2u:%2u%1s", &cc, &yy, &mm, &dd, &HH, &MM, &SS, dummy) == 7) { - ; - } else if (sscanf(dataPtr, "%2d%2u-%2u-%2u%1s", &cc, &yy, &mm, &dd, dummy) == 4) { - ; - } else if (sscanf(dataPtr, "%2u:%2u:%2u.%4u%1s", &HH, &MM, &SS, &ff, dummy) == 4) { - setdate = true; - } else if (sscanf(dataPtr, "%2u:%2u:%2u%1s", &HH, &MM, &SS, dummy) == 3) { - setdate = true; - } else { - ctx.pushStatus(Sqlstate::_22008, Error::Gen, "invalid timestamp format '%s'", dataPtr); - return; - } - if (setdate) { - time_t clock = time(0); - struct tm* t = localtime(&clock); - cc = (1900 + t->tm_year) / 100; - yy = (1900 + t->tm_year) % 100; - mm = 1 + t->tm_mon; - dd = t->tm_mday; - } - value.cc(cc); - value.yy(yy); - value.mm(mm); - value.dd(dd); - value.HH(HH); - value.MM(MM); - value.SS(SS); - value.ff(ff); - // XXX write date routines later - if (! value.valid()) { - ctx.pushStatus(Sqlstate::_22008, Error::Gen, "invalid timestamp values '%s'", dataPtr); - return; - } - sqlDatetime(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Timestamp) { - SQL_TIMESTAMP_STRUCT* dataPtr = static_cast(extField.m_dataPtr); - // XXX assume same datatype - value.cc(dataPtr->year / 100); - value.yy(dataPtr->year / 100); - value.mm(dataPtr->month); - value.dd(dataPtr->day); - value.HH(dataPtr->hour); - value.MM(dataPtr->minute); - value.SS(dataPtr->second); - value.ff(dataPtr->fraction); - if (! value.valid()) { - ctx.pushStatus(Sqlstate::_22008, Error::Gen, "invalid timestamp struct"); - return; - } - sqlDatetime(value); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - ctx_assert(false); // SqlType::Null not applicable -} - -// copy to external - -static bool -copyout_char_char(Ctx& ctx, const char* value, unsigned n, char* ptr, unsigned len, SQLINTEGER* ind, int* off) -{ - unsigned n2 = n; - if (off != 0 && *off >= 0) { - ctx_assert((unsigned)*off <= n2); - value += *off; - n2 -= *off; - if (len < n2 + 1) { - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "more data at offset %d, current fetch %u, available %u", *off, len, n2); - n2 = len - 1; - } - } else { - if (len < n + 1) { // room for null byte - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "char value '%.*s' overflow (%u < %u)", (int)n, value, (unsigned)len, (unsigned)(len + 1)); - return false; - } - } - memcpy(ptr, value, n2); - ptr[n2] = 0; - if (off != 0 && *off >= 0) { - if (ind != 0) - *ind = n - *off; - *off += n2; - } else { - if (ind != 0) - *ind = n; - } - return true; -} - -static bool -copyout_binary_binary(Ctx& ctx, const char* value, unsigned n, char* ptr, unsigned len, SQLINTEGER* ind, int* off) -{ - unsigned n2 = n; - if (off != 0 && *off >= 0) { - ctx_assert((unsigned)*off <= n2); - value += *off; - n2 -= *off; - if (len < n2 + 1) { - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "more data at offset %d, current fetch %u, available %u", *off, len, n2); - n2 = len - 1; - } - } else { - if (len < n) { // no room for null byte - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "binary value '%.*s' overflow (%u < %u)", (int)n, value, (unsigned)len, (unsigned)n); - return false; - } - } - memcpy(ptr, value, n2); - ptr[n2] = 0; - if (off != 0 && *off >= 0) { - if (ind != 0) - *ind = n - *off; - *off += n2; - } else { - if (ind != 0) - *ind = n; - } - return true; -} - -static bool -copyout_char_signed(Ctx& ctx, const char* value, unsigned n, long* ptr) -{ - while (n > 0 && value[0] == 0x20) { - value++; - n--; - } - char buf[200]; - if (n >= 200) - n = 200 - 1; - memcpy(buf, value, n); - buf[n] = 0; - errno = 0; - char* endptr = 0; - long x = strtol(buf, &endptr, 10); - if (endptr == 0 || *endptr != 0) { - errno = 0; - endptr = 0; - double y = strtod(buf, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "value %s not numeric", buf); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - // XXX should handle 123.000 - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "value %s truncated", buf); - x = static_cast(y); - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - *ptr = x; - return true; -} - -static bool -copyout_char_bigsigned(Ctx& ctx, const char* value, unsigned n, SQLBIGINT* ptr) -{ - while (n > 0 && value[0] == 0x20) { - value++; - n--; - } - char buf[200]; - if (n >= 200) - n = 200 - 1; - memcpy(buf, value, n); - buf[n] = 0; - errno = 0; - char* endptr = 0; - SQLBIGINT x = strtoll(buf, &endptr, 10); - if (endptr == 0 || *endptr != 0) { - errno = 0; - endptr = 0; - double y = strtod(buf, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "value %s not numeric", buf); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - // XXX should handle 123.000 - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "value %s truncated", buf); - x = static_cast(y); - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - *ptr = x; - return true; -} - -static bool -copyout_char_unsigned(Ctx& ctx, const char* value, unsigned n, unsigned long* ptr) -{ - while (n > 0 && value[0] == 0x20) { - value++; - n--; - } - char buf[200]; - if (n >= 200) - n = 200 - 1; - memcpy(buf, value, n); - buf[n] = 0; - errno = 0; - char* endptr = 0; - unsigned long x = strtoul(buf, &endptr, 10); - if (endptr == 0 || *endptr != 0) { - errno = 0; - endptr = 0; - double y = strtod(buf, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "value %s not numeric", buf); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - // XXX should handle 123.000 - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "value %s truncated", buf); - x = static_cast(y); - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - *ptr = x; - return true; -} - -static bool -copyout_char_bigunsigned(Ctx& ctx, const char* value, unsigned n, SQLUBIGINT* ptr) -{ - while (n > 0 && value[0] == 0x20) { - value++; - n--; - } - char buf[200]; - if (n >= 200) - n = 200 - 1; - memcpy(buf, value, n); - buf[n] = 0; - errno = 0; - char* endptr = 0; - SQLUBIGINT x = strtoull(buf, &endptr, 10); - if (endptr == 0 || *endptr != 0) { - errno = 0; - endptr = 0; - double y = strtod(buf, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "value %s not numeric", buf); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - // XXX should handle 123.000 - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "value %s truncated", buf); - x = static_cast(y); - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - *ptr = x; - return true; -} - -static bool -copyout_char_double(Ctx& ctx, const char* value, unsigned n, double* ptr) -{ - while (n > 0 && value[0] == 0x20) { - value++; - n--; - } - char buf[200]; - if (n >= 200) - n = 200 - 1; - memcpy(buf, value, n); - buf[n] = 0; - errno = 0; - char* endptr = 0; - double x = strtod(value, &endptr); - if (endptr == 0 || *endptr != 0) { - ctx.pushStatus(Sqlstate::_22005, Error::Gen, "value %s not numeric", value); - return false; - } else if (errno != 0) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", value); - return false; - } - *ptr = x; - return true; -} - -static bool -copyout_signed_char(Ctx& ctx, Int64 value, char* ptr, int len, SQLINTEGER* ind) -{ - char buf[100]; - sprintf(buf, FMT_I64, value); - unsigned n = strlen(buf); - if (len <= 0) { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "invalid output buffer length %d", len); - return false; - } - if ((unsigned)len < n + 1) { // room for null byte - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - strcpy(ptr, buf); - if (ind != 0) - *ind = n; - return true; -} - -static bool -copyout_unsigned_char(Ctx& ctx, Uint64 uvalue, char* ptr, int len, SQLINTEGER* ind) -{ - char buf[100]; - sprintf(buf, FMT_U64, uvalue); - unsigned n = strlen(buf); - if (len <= 0) { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "invalid output buffer length %d", len); - return false; - } - if ((unsigned)len < n + 1) { // room for null byte - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - strcpy(ptr, buf); - if (ind != 0) - *ind = n; - return true; -} - -static bool -copyout_double_char(Ctx& ctx, double value, unsigned prec, char* ptr, int len, SQLINTEGER* ind) -{ - char buf[100]; - sprintf(buf, "%.*f", (int)prec, value); - char* p = buf + strlen(buf); - while (p > buf + prec) - *--p = 0; - while (p > buf && *(p - 1) == '0') - *--p = 0; - if (p > buf && *(p - 1) == '.') { - *p++ = '0'; - *p = 0; - } - unsigned n = strlen(buf); - if (len <= 0) { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "invalid output buffer length %d", len); - return false; - } - if ((unsigned)len < n + 1) { // room for null byte - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", buf); - return false; - } - strcpy(ptr, buf); - if (ind != 0) - *ind = n; - return true; -} - -void -SqlField::copyout(Ctx& ctx, ExtField& extField) const -{ - if (extField.extSpec().extType().type() == ExtType::Unbound) { - return; // output buffer may be unbound - } - if (sqlSpec().store() == SqlSpec::Reference) { - ctx_assert(u_data.m_sqlField != 0); - u_data.m_sqlField->copyout(ctx, extField); - return; - } - SQLINTEGER* indPtr = extField.m_indPtr; - if (u_null.m_nullFlag) { - if (extField.m_pos > 0) { // second time from SQLGetData - ctx.setCode(SQL_NO_DATA); - return; - } - if (indPtr == 0) { - ctx.pushStatus(Sqlstate::_22002, Error::Gen, "indicator variable required"); - return; - } - *indPtr = SQL_NULL_DATA; - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - const SqlType& sqlType = sqlSpec().sqlType(); - const ExtType& extType = extField.extSpec().extType(); - if (sqlType.type() == SqlType::Char || sqlType.type() == SqlType::Varchar) { - unsigned n = 0; - const char* value = 0; - if (sqlType.type() == SqlType::Char) { - n = sqlType.length(); - value = reinterpret_cast(sqlChar()); - } else { - value = reinterpret_cast(sqlVarchar(&n)); - } - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (extField.m_dataLen <= 0) { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "invalid output buffer length %d", (int)extField.m_dataLen); - return; - } - int* off = 0; - if (extField.m_pos >= 0) { - off = &extField.m_pos; - if ((unsigned)*off >= n) { - ctx.setCode(SQL_NO_DATA); - return; - } - } - if (! copyout_char_char(ctx, value, n, dataPtr, extField.m_dataLen, indPtr, off)) - return; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - short* dataPtr = static_cast(extField.m_dataPtr); - long x; - if (! copyout_char_signed(ctx, value, n, &x)) - return; - if (x < SHRT_MIN || x > SHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", value); - return; - } - *dataPtr = static_cast(x); - if (indPtr != 0) - *indPtr = sizeof(short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - unsigned long x; - if (! copyout_char_unsigned(ctx, value, n, &x)) - return; - if (x > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", value); - return; - } - *dataPtr = static_cast(x); - if (indPtr != 0) - *indPtr = sizeof(unsigned short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - long* dataPtr = static_cast(extField.m_dataPtr); - if (! copyout_char_signed(ctx, value, n, dataPtr)) - return; - if (indPtr != 0) - *indPtr = sizeof(long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - if (! copyout_char_unsigned(ctx, value, n, dataPtr)) - return; - if (indPtr != 0) - *indPtr = sizeof(unsigned long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - if (! copyout_char_bigsigned(ctx, value, n, dataPtr)) - return; - if (indPtr != 0) - *indPtr = sizeof(SQLBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - if (! copyout_char_bigunsigned(ctx, value, n, dataPtr)) - return; - if (indPtr != 0) - *indPtr = sizeof(SQLUBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - float* dataPtr = static_cast(extField.m_dataPtr); - double x; - if (! copyout_char_double(ctx, value, n, &x)) - return; - if (fabs(x) < FLT_MIN || fabs(x) > FLT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %s overflow", value); - return; - } - *dataPtr = static_cast(x); - if (indPtr != 0) - *indPtr = sizeof(float); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - double* dataPtr = static_cast(extField.m_dataPtr); - double x; - if (! copyout_char_double(ctx, value, n, &x)) - return; - *dataPtr = static_cast(x); - if (indPtr != 0) - *indPtr = sizeof(double); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Binary || sqlType.type() == SqlType::Varbinary) { - unsigned n = 0; - const char* value = 0; - if (sqlType.type() == SqlType::Binary) { - n = sqlType.length(); - value = reinterpret_cast(sqlBinary()); - } else { - value = reinterpret_cast(sqlVarbinary(&n)); - } - if (extType.type() == ExtType::Binary) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (extField.m_dataLen <= 0) { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "invalid output buffer length %d", (int)extField.m_dataLen); - return; - } - int* off = 0; - if (extField.m_pos >= 0) { - off = &extField.m_pos; - if ((unsigned)*off >= n) { - ctx.setCode(SQL_NO_DATA); - return; - } - } - if (! copyout_binary_binary(ctx, value, n, dataPtr, extField.m_dataLen, indPtr, off)) - return; - return; - } - } - if (sqlType.type() == SqlType::Smallint) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - const SqlSmallint value = sqlSmallint(); - const SqlUsmallint uvalue = value; - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (! sqlType.unSigned()) { - if (! copyout_signed_char(ctx, value, dataPtr, extField.m_dataLen, indPtr)) - return; - } else { - if (! copyout_unsigned_char(ctx, uvalue, dataPtr, extField.m_dataLen, indPtr)) - return; - } - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(unsigned short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(unsigned long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(SQLBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(SQLUBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(float); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(double); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Integer) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - const SqlInteger value = sqlInteger(); - const SqlUinteger uvalue = value; - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (! sqlType.unSigned()) { - if (! copyout_signed_char(ctx, value, dataPtr, extField.m_dataLen, indPtr)) - return; - } else { - if (! copyout_unsigned_char(ctx, uvalue, dataPtr, extField.m_dataLen, indPtr)) - return; - } - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - if (value < SHRT_MIN || value > SHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %d overflow", (int)value); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - if (uvalue > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %u overflow", uvalue); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(unsigned short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(unsigned long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(SQLBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(SQLUBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(float); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(double); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Bigint) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - const SqlBigint value = sqlBigint(); - const SqlUbigint uvalue = value; - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (! sqlType.unSigned()) { - if (! copyout_signed_char(ctx, value, dataPtr, extField.m_dataLen, indPtr)) - return; - } else { - if (! copyout_unsigned_char(ctx, uvalue, dataPtr, extField.m_dataLen, indPtr)) - return; - } - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - if (value < SHRT_MIN || value > SHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value " FMT_I64 " overflow", (Int64)value); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - if (uvalue > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value " FMT_U64 " overflow", (Uint64)uvalue); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(unsigned short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - if (value < INT_MIN || value > INT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value " FMT_I64 " overflow", (Int64)value); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - if (uvalue > UINT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value " FMT_U64 " overflow", (Uint64)uvalue); - return; - } - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(unsigned long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(SQLBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(uvalue); - if (indPtr != 0) - *indPtr = sizeof(SQLUBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(float); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(double); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Real) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - const SqlReal value = sqlReal(); - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (! copyout_double_char(ctx, value, 7, dataPtr, extField.m_dataLen, indPtr)) - return; - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // XXX todo - if (indPtr != 0) - *indPtr = sizeof(short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - if (value < 0 || value > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %g overflow", (double)value); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(unsigned short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // XXX todo - if (indPtr != 0) - *indPtr = sizeof(unsigned long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(SQLBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(SQLUBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(float); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(double); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Double) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - SqlDouble value = sqlDouble(); - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - if (! copyout_double_char(ctx, value, 14, dataPtr, extField.m_dataLen, indPtr)) - return; - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Short || extType.type() == ExtType::Sshort) { - short* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // XXX todo - if (indPtr != 0) - *indPtr = sizeof(short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ushort) { - unsigned short* dataPtr = static_cast(extField.m_dataPtr); - if (value < 0 || value > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %g overflow", (double)value); - return; - } - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(unsigned short); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Long || extType.type() == ExtType::Slong) { - long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ulong) { - unsigned long* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // XXX todo - if (indPtr != 0) - *indPtr = sizeof(unsigned long); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Sbigint) { - SQLBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(SQLBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Ubigint) { - SQLUBIGINT* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(SQLUBIGINT); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Float) { - float* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); // big enough - if (indPtr != 0) - *indPtr = sizeof(float); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Double) { - double* dataPtr = static_cast(extField.m_dataPtr); - *dataPtr = static_cast(value); - if (indPtr != 0) - *indPtr = sizeof(double); - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - } - if (sqlType.type() == SqlType::Datetime) { - if (extField.m_pos > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - SqlDatetime value = sqlDatetime(); - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast(extField.m_dataPtr); - char buf[100]; - sprintf(buf, "%02d%02u-%02u-%02u\040%02u:%02u:%02u.%09u", value.cc(), value.yy(), value.mm(), value.dd(), value.HH(), value.MM(), value.SS(), value.ff()); - int n = strlen(buf); - if (extField.m_dataLen < 20) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "buffer too small for timestamp %s", buf); - return; - } - if (extField.m_dataLen < n) { - ctx.pushStatus(Sqlstate::_01004, Error::Gen, "truncating fractional part of timestamp %s", buf); - n = extField.m_dataLen; - } - if (! copyout_char_char(ctx, buf, n, dataPtr, extField.m_dataLen, indPtr, 0)) - return; - if (extField.m_pos >= 0) - extField.m_pos = 1; - return; - } - if (extType.type() == ExtType::Timestamp) { - SQL_TIMESTAMP_STRUCT* dataPtr = static_cast(extField.m_dataPtr); - // XXX assume same datatype - dataPtr->year = value.cc() * 100 + value.yy(); - dataPtr->month = value.mm(); - dataPtr->day = value.dd(); - dataPtr->hour = value.HH(); - dataPtr->minute = value.MM(); - dataPtr->second = value.SS(); - dataPtr->fraction = value.ff(); - return; - } - } - ctx_assert(false); // SqlType::Null not applicable -} - -void -SqlField::print(char* buf, unsigned size) const -{ - Ctx ctx; - unsigned n = sqlSpec().sqlType().displaySize(); - SQLINTEGER ind = 0; - ExtType extType(ExtType::Char); - ExtSpec extSpec(extType); - ExtField extField(extSpec, (SQLPOINTER)buf, size, &ind); - buf[0] = 0; - copyout(ctx, extField); - if (ind == SQL_NULL_DATA) - snprintf(buf, size, "NULL"); -} diff --git a/ndb/src/old_files/client/odbc/common/DataField.hpp b/ndb/src/old_files/client/odbc/common/DataField.hpp deleted file mode 100644 index 65138df25f1..00000000000 --- a/ndb/src/old_files/client/odbc/common/DataField.hpp +++ /dev/null @@ -1,446 +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 ODBC_COMMON_DataField_hpp -#define ODBC_COMMON_DataField_hpp - -#include -#include -#include "DataType.hpp" - -/** - * @class SqlSpec - * @brief Specification of data in SQL format - */ -class SqlSpec { -public: - enum Store { - Undef = 0, - Reference = 1, // reference to read-only SqlField of same type - Physical = 2 // stored within or in allocated storage - }; - SqlSpec(); - SqlSpec(const SqlType& sqlType, Store store); - SqlSpec(const SqlSpec& sqlSpec); - SqlSpec(const SqlSpec& sqlSpec, Store store); - const SqlType& sqlType() const; - const Store store() const; - unsigned size() const; -private: - //SqlSpec& operator=(const SqlSpec& sqlSpec); // disallowed - SqlType m_sqlType; - Store m_store; -}; - -/** - * @class ExtSpec - * @brief Specification of data in external format - */ -class ExtSpec { -public: - ExtSpec(); - ExtSpec(const ExtType& extType); - ExtSpec(const ExtSpec& extSpec); - const ExtType& extType() const; - unsigned size() const; - void setValue(const ExtType& extType); -private: - ExtType m_extType; -}; - -/** - * @class LexSpec - * @brief Specification of lexical data - * - * Used only for converting lexical data to SQL data. - */ -class LexSpec { -public: - LexSpec(); - LexSpec(const LexType& lexType); - /** - * Lexical data is represented as string. Following - * converts it to SQL data. - */ - void convert(Ctx& ctx, const BaseString& value, class SqlField& out); -private: - LexType m_lexType; -}; - -// SqlSpec - -inline -SqlSpec::SqlSpec() : - m_store(Undef) -{ -} - -inline -SqlSpec::SqlSpec(const SqlType& sqlType, Store store) : - m_sqlType(sqlType), - m_store(store) -{ -} - -inline -SqlSpec::SqlSpec(const SqlSpec& sqlSpec) : - m_sqlType(sqlSpec.m_sqlType), - m_store(sqlSpec.m_store) -{ -} - -inline -SqlSpec::SqlSpec(const SqlSpec& sqlSpec, Store store) : - m_sqlType(sqlSpec.m_sqlType), - m_store(store) -{ -} - -inline const SqlType& -SqlSpec::sqlType() const -{ - return m_sqlType; -} - -inline const SqlSpec::Store -SqlSpec::store() const -{ - return m_store; -} - -inline unsigned -SqlSpec::size() const -{ - return sqlType().size(); -} - -// ExtSpec - -inline -ExtSpec::ExtSpec() -{ -} - -inline -ExtSpec::ExtSpec(const ExtType& extType) : - m_extType(extType) -{ -} - -inline -ExtSpec::ExtSpec(const ExtSpec& extSpec) : - m_extType(extSpec.m_extType) -{ -} - -inline const ExtType& -ExtSpec::extType() const -{ - return m_extType; -} - -inline unsigned -ExtSpec::size() const -{ - return m_extType.size(); -} - -inline void -ExtSpec::setValue(const ExtType& extType) -{ - m_extType = extType; -} - -// LexSpec - -inline -LexSpec::LexSpec(const LexType& lexType) : - m_lexType(lexType) -{ -} - -/** - * @class SqlField - * @brief Sql data field accessor - */ -class SqlField { -public: - SqlField(); - SqlField(const SqlSpec& sqlSpec); - SqlField(const SqlSpec& sqlSpec, const SqlField* sqlField); - SqlField(const SqlField& sqlField); - ~SqlField(); - const SqlSpec& sqlSpec() const; - const void* addr() const; // address of data - void* addr(); - unsigned allocSize() const; - const SqlChar* sqlChar() const; // get - const SqlChar* sqlVarchar(unsigned* length) const; - const SqlChar* sqlBinary() const; - const SqlChar* sqlVarbinary(unsigned* length) const; - SqlSmallint sqlSmallint() const; - SqlInteger sqlInteger() const; - SqlBigint sqlBigint() const; - SqlReal sqlReal() const; - SqlDouble sqlDouble() const; - SqlDatetime sqlDatetime() const; - void sqlChar(const char* value, int length); // set - void sqlChar(const SqlChar* value, int length); - void sqlVarchar(const char* value, int length); - void sqlVarchar(const SqlChar* value, int length); - void sqlBinary(const char* value, int length); - void sqlBinary(const SqlChar* value, int length); - void sqlVarbinary(const char* value, int length); - void sqlVarbinary(const SqlChar* value, int length); - void sqlSmallint(SqlSmallint value); - void sqlInteger(SqlInteger value); - void sqlBigint(SqlBigint value); - void sqlReal(SqlReal value); - void sqlDouble(SqlDouble value); - void sqlDatetime(SqlDatetime value); - bool sqlNull() const; // get and set null - void sqlNull(bool value); - unsigned trim() const; // right trimmed length - void copy(Ctx& ctx, SqlField& out) const; - bool cast(Ctx& ctx, SqlField& out) const; - bool less(const SqlField& sqlField) const; - // application input and output - void copyin(Ctx& ctx, class ExtField& extField); - void copyout(Ctx& ctx, class ExtField& extField) const; - // print for debugging - void print(char* buf, unsigned size) const; - // public for forte6 - //enum { CharSmall = 20 }; -#define SqlField_CharSmall 20 // redhat-6.2 (egcs-2.91.66) -private: - friend class LexSpec; - friend class SqlRow; - void alloc(); // allocate Physical - void alloc(const SqlField& sqlField); - void free(); // free Physical - SqlSpec m_sqlSpec; - union Data { - Data(); - Data(const SqlField* sqlField); - const SqlField* m_sqlField; - // Physical - SqlChar* m_sqlChar; // all char types - SqlChar m_sqlCharSmall[SqlField_CharSmall]; - SqlSmallint m_sqlSmallint; - SqlInteger m_sqlInteger; - SqlBigint m_sqlBigint; - SqlReal m_sqlReal; - SqlDouble m_sqlDouble; - SqlDatetime m_sqlDatetime; - } u_data; - union Null { - Null(); - bool m_nullFlag; - } u_null; -}; - -/** - * @class ExtField - * @brief External data field accessor - */ -class ExtField { -public: - ExtField(); - ExtField(const ExtSpec& extSpec, int fieldId = 0); - ExtField(const ExtSpec& extSpec, SQLPOINTER dataPtr, SQLINTEGER dataLen, SQLINTEGER* indPtr, int fieldId = 0); - ~ExtField(); - const ExtSpec& extSpec() const; - void setValue(SQLPOINTER dataPtr, SQLINTEGER dataLen); - void setValue(const ExtSpec& extSpec, SQLPOINTER dataPtr, SQLINTEGER dataLen, SQLINTEGER* indPtr); - int fieldId() const; - void setPos(int pos); - int getPos() const; -private: - friend class SqlField; - friend class Exec_root; - ExtSpec m_extSpec; - SQLPOINTER m_dataPtr; // data buffer - SQLINTEGER m_dataLen; // data buffer length - SQLINTEGER* m_indPtr; // null indicator or length - int m_fieldId; // field id > 0 for error messages - int m_pos; // output position for SQLGetData (if != -1) -}; - -inline int -ExtField::fieldId() const -{ - return m_fieldId; -} - -inline void -ExtField::setPos(int pos) -{ - m_pos = pos; -} - -inline int -ExtField::getPos() const -{ - return m_pos; -} - -// SqlField - -inline -SqlField::SqlField() -{ -} - -inline -SqlField::SqlField(const SqlSpec& sqlSpec) : - m_sqlSpec(sqlSpec) -{ - if (m_sqlSpec.store() == SqlSpec::Physical) - alloc(); -} - -inline -SqlField::SqlField(const SqlSpec& sqlSpec, const SqlField* sqlField) : - m_sqlSpec(sqlSpec), - u_data(sqlField) -{ - ctx_assert(m_sqlSpec.store() == SqlSpec::Reference); -} - -inline -SqlField::SqlField(const SqlField& sqlField) : - m_sqlSpec(sqlField.m_sqlSpec), - u_data(sqlField.u_data), - u_null(sqlField.u_null) -{ - if (m_sqlSpec.store() == SqlSpec::Physical) - alloc(sqlField); -} - -inline -SqlField::Data::Data() -{ -} - -inline -SqlField::Data::Data(const SqlField* sqlField) -{ - m_sqlField = sqlField; -} - -inline -SqlField::Null::Null() -{ -} - -inline -SqlField::~SqlField() -{ - if (m_sqlSpec.store() == SqlSpec::Physical) - free(); -} - -inline const SqlSpec& -SqlField::sqlSpec() const -{ - return m_sqlSpec; -} - -inline void -SqlField::sqlChar(const char* value, int length) -{ - sqlChar(reinterpret_cast(value), length); -} - -inline void -SqlField::sqlVarchar(const char* value, int length) -{ - sqlVarchar(reinterpret_cast(value), length); -} - -inline void -SqlField::sqlBinary(const char* value, int length) -{ - sqlBinary(reinterpret_cast(value), length); -} - -inline void -SqlField::sqlVarbinary(const char* value, int length) -{ - sqlVarbinary(reinterpret_cast(value), length); -} - -// ExtField - -inline -ExtField::ExtField() : - m_dataPtr(0), - m_dataLen(0), - m_indPtr(0), - m_pos(-1) -{ -} - -inline -ExtField::ExtField(const ExtSpec& extSpec, int fieldId) : - m_extSpec(extSpec), - m_dataPtr(0), - m_dataLen(0), - m_indPtr(0), - m_fieldId(fieldId), - m_pos(-1) -{ -} - -inline -ExtField::ExtField(const ExtSpec& extSpec, SQLPOINTER dataPtr, SQLINTEGER dataLen, SQLINTEGER* indPtr, int fieldId) : - m_extSpec(extSpec), - m_dataPtr(dataPtr), - m_dataLen(dataLen), - m_indPtr(indPtr), - m_fieldId(fieldId), - m_pos(-1) -{ -} - -inline -ExtField::~ExtField() -{ -} - -inline const ExtSpec& -ExtField::extSpec() const -{ - return m_extSpec; -} - -inline void -ExtField::setValue(SQLPOINTER dataPtr, SQLINTEGER dataLen) -{ - m_dataPtr = dataPtr; - m_dataLen = dataLen; -} - -inline void -ExtField::setValue(const ExtSpec& extSpec, SQLPOINTER dataPtr, SQLINTEGER dataLen, SQLINTEGER* indPtr) -{ - m_extSpec.setValue(extSpec.extType()); - m_dataPtr = dataPtr; - m_dataLen = dataLen; - m_indPtr = indPtr; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/DataRow.cpp b/ndb/src/old_files/client/odbc/common/DataRow.cpp deleted file mode 100644 index 509f2673e0d..00000000000 --- a/ndb/src/old_files/client/odbc/common/DataRow.cpp +++ /dev/null @@ -1,140 +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 */ - -#include "DataRow.hpp" - -// SqlSpecs - -SqlSpecs::SqlSpecs(unsigned count) : - m_count(count) -{ - m_sqlSpec = new SqlSpec[1 + count]; -} - -SqlSpecs::SqlSpecs(const SqlSpecs& sqlSpecs) : - m_count(sqlSpecs.m_count) -{ - m_sqlSpec = new SqlSpec[1 + m_count]; - for (unsigned i = 1; i <= m_count; i++) { - void* place = static_cast(&m_sqlSpec[i]); - new (place) SqlSpec(sqlSpecs.m_sqlSpec[i]); - } -} - -SqlSpecs::~SqlSpecs() -{ - delete[] m_sqlSpec; -} - -// ExtSpecs - -ExtSpecs::ExtSpecs(unsigned count) : - m_count(count) -{ - m_extSpec = new ExtSpec[1 + count]; -} - -ExtSpecs::ExtSpecs(const ExtSpecs& extSpecs) : - m_count(extSpecs.m_count) -{ - m_extSpec = new ExtSpec[1 + m_count]; - for (unsigned i = 1; i <= m_count; i++) { - void* place = static_cast(&m_extSpec[i]); - new (place) ExtSpec(extSpecs.m_extSpec[i]); - } -} - -ExtSpecs::~ExtSpecs() -{ - delete[] m_extSpec; -} - -// SqlRow - -SqlRow::SqlRow(const SqlSpecs& sqlSpecs) : - m_sqlSpecs(sqlSpecs) -{ - m_sqlField = new SqlField[1 + count()]; - for (unsigned i = 1; i <= count(); i++) { - SqlField sqlField(m_sqlSpecs.getEntry(i)); - setEntry(i, sqlField); - } -} - -SqlRow::SqlRow(const SqlRow& sqlRow) : - m_sqlSpecs(sqlRow.m_sqlSpecs) -{ - m_sqlField = new SqlField[1 + count()]; - for (unsigned i = 1; i <= count(); i++) { - void* place = static_cast(&m_sqlField[i]); - new (place) SqlField(sqlRow.getEntry(i)); - } -} - -SqlRow::~SqlRow() -{ - for (unsigned i = 1; i <= count(); i++) { - m_sqlField[i].~SqlField(); - } - delete[] m_sqlField; -} - -SqlRow* -SqlRow::copy() const -{ - SqlRow* copyRow = new SqlRow(m_sqlSpecs); - for (unsigned i = 1; i <= count(); i++) { - const SqlField* sqlField = &m_sqlField[i]; - while (sqlField->sqlSpec().store() == SqlSpec::Reference) { - sqlField = sqlField->u_data.m_sqlField; - } - copyRow->setEntry(i, *sqlField); - } - return copyRow; -} - -void -SqlRow::copyout(Ctx& ctx, class ExtRow& extRow) const -{ - for (unsigned i = 1; i <= count(); i++) { - const SqlField& sqlField = getEntry(i); - ExtField& extField = extRow.getEntry(i); - sqlField.copyout(ctx, extField); - } -} - -// ExtRow - -ExtRow::ExtRow(const ExtSpecs& extSpecs) : - m_extSpecs(extSpecs) -{ - m_extField = new ExtField[1 + count()]; -} - -ExtRow::ExtRow(const ExtRow& extRow) : - m_extSpecs(extRow.m_extSpecs) -{ - m_extField = new ExtField[1 + count()]; - for (unsigned i = 1; i <= count(); i++) { - void* place = static_cast(&m_extField[i]); - new (place) ExtField(extRow.getEntry(i)); - } -} - -ExtRow::~ExtRow() -{ - delete[] m_extField; -} diff --git a/ndb/src/old_files/client/odbc/common/DataRow.hpp b/ndb/src/old_files/client/odbc/common/DataRow.hpp deleted file mode 100644 index 4a5a1e905b9..00000000000 --- a/ndb/src/old_files/client/odbc/common/DataRow.hpp +++ /dev/null @@ -1,185 +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 ODBC_COMMON_DataRow_hpp -#define ODBC_COMMON_DataRow_hpp - -#include -#include -#include "DataField.hpp" - -class Ctx; - -/** - * @class SqlSpecs - * @brief Specification of row of SQL data - */ -class SqlSpecs { -public: - SqlSpecs(unsigned count); - SqlSpecs(const SqlSpecs& sqlSpecs); - ~SqlSpecs(); - unsigned count() const; - void setEntry(unsigned i, const SqlSpec& sqlSpec); - const SqlSpec& getEntry(unsigned i) const; -private: - SqlSpecs& operator=(const SqlSpecs& sqlSpecs); // disallowed - const unsigned m_count; - SqlSpec* m_sqlSpec; -}; - -inline unsigned -SqlSpecs::count() const -{ - return m_count; -} - -inline void -SqlSpecs::setEntry(unsigned i, const SqlSpec& sqlSpec) -{ - ctx_assert(m_sqlSpec != 0 && 1 <= i && i <= m_count); - void* place = static_cast(&m_sqlSpec[i]); - new (place) SqlSpec(sqlSpec); -} - -inline const SqlSpec& -SqlSpecs::getEntry(unsigned i) const -{ - ctx_assert(m_sqlSpec != 0 && 1 <= i && i <= m_count); - return m_sqlSpec[i]; -} - -/** - * @class ExtSpecs - * @brief Specification of row of external data - */ -class ExtSpecs { -public: - ExtSpecs(unsigned count); - ExtSpecs(const ExtSpecs& extSpecs); - ~ExtSpecs(); - unsigned count() const; - void setEntry(unsigned i, const ExtSpec& extSpec); - const ExtSpec& getEntry(unsigned i) const; -private: - ExtSpecs& operator=(const ExtSpecs& extSpecs); // disallowed - const unsigned m_count; - ExtSpec* m_extSpec; -}; - -inline unsigned -ExtSpecs::count() const -{ - return m_count; -} - -inline void -ExtSpecs::setEntry(unsigned i, const ExtSpec& extSpec) -{ - ctx_assert(m_extSpec != 0 && 1 <= i && i <= m_count); - void* place = static_cast(&m_extSpec[i]); - new (place) ExtSpec(extSpec); -} - -inline const ExtSpec& -ExtSpecs::getEntry(unsigned i) const -{ - ctx_assert(m_extSpec != 0 && 1 <= i && i <= m_count); - return m_extSpec[i]; -} - -/** - * @class SqlRow - * @brief Sql data row - */ -class SqlRow { -public: - SqlRow(const SqlSpecs& sqlSpecs); - SqlRow(const SqlRow& sqlRow); - ~SqlRow(); - unsigned count() const; - void setEntry(unsigned i, const SqlField& sqlField); - SqlField& getEntry(unsigned i) const; - SqlRow* copy() const; - void copyout(Ctx& ctx, class ExtRow& extRow) const; -private: - SqlRow& operator=(const SqlRow& sqlRow); // disallowed - SqlSpecs m_sqlSpecs; - SqlField* m_sqlField; -}; - -inline unsigned -SqlRow::count() const -{ - return m_sqlSpecs.count(); -} - -inline void -SqlRow::setEntry(unsigned i, const SqlField& sqlField) -{ - ctx_assert(1 <= i && i <= count() && m_sqlField != 0); - m_sqlField[i].~SqlField(); - void* place = static_cast(&m_sqlField[i]); - new (place) SqlField(sqlField); -} - -inline SqlField& -SqlRow::getEntry(unsigned i) const -{ - ctx_assert(1 <= i && i <= count() && m_sqlField != 0); - return m_sqlField[i]; -} - -/** - * @class ExtRow - * @brief External data row - */ -class ExtRow { -public: - ExtRow(const ExtSpecs& extSpecs); - ExtRow(const ExtRow& extRow); - ~ExtRow(); - unsigned count() const; - void setEntry(unsigned i, const ExtField& extField); - ExtField& getEntry(unsigned i) const; -private: - ExtRow& operator=(const ExtRow& extRow); // disallowed - ExtSpecs m_extSpecs; - ExtField* m_extField; -}; - -inline unsigned -ExtRow::count() const -{ - return m_extSpecs.count(); -} - -inline void -ExtRow::setEntry(unsigned i, const ExtField& extField) -{ - ctx_assert(1 <= i && i <= count() && m_extField != 0); - void* place = static_cast(&m_extField[i]); - new (place) ExtField(extField); -} - -inline ExtField& -ExtRow::getEntry(unsigned i) const -{ - ctx_assert(1 <= i && i <= count() && m_extField != 0); - return m_extField[i]; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/DataType.cpp b/ndb/src/old_files/client/odbc/common/DataType.cpp deleted file mode 100644 index 96f6a6e0877..00000000000 --- a/ndb/src/old_files/client/odbc/common/DataType.cpp +++ /dev/null @@ -1,551 +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 */ - -#include "DataType.hpp" - -// SqlType - -SqlType::SqlType() : - m_type(Undef) -{ -} - -SqlType::SqlType(Type type, bool nullable) -{ - Ctx ctx; - setType(ctx, type, nullable); - ctx_assert(ctx.ok()); -} - -SqlType::SqlType(Type type, unsigned length, bool nullable) -{ - Ctx ctx; - setType(ctx, type, length, nullable); - ctx_assert(ctx.ok()); -} - -SqlType::SqlType(Type type, unsigned precision, unsigned scale, bool nullable) -{ - Ctx ctx; - setType(ctx, type, precision, scale, nullable); - ctx_assert(ctx.ok()); -} - -SqlType::SqlType(Ctx& ctx, Type type, bool nullable) -{ - setType(ctx, type, nullable); -} - -SqlType::SqlType(Ctx& ctx, Type type, unsigned length, bool nullable) -{ - setType(ctx, type, length, nullable); -} - -SqlType::SqlType(Ctx& ctx, Type type, unsigned precision, unsigned scale, bool nullable) -{ - setType(ctx, type, precision, scale, nullable); -} - -SqlType::SqlType(Ctx& ctx, const NdbDictionary::Column* ndbColumn) -{ - setType(ctx, ndbColumn); -} - -void -SqlType::setType(Ctx& ctx, Type type, bool nullable) -{ - switch (type) { - case Smallint: - case Integer: - case Bigint: - case Real: - case Double: - case Datetime: - break; - case Blob: - setType(ctx, Varbinary, FAKE_BLOB_SIZE, nullable); // XXX BLOB hack - return; - case Clob: - setType(ctx, Varchar, FAKE_BLOB_SIZE, nullable); // XXX BLOB hack - return; - case Null: - case Unbound: - break; - default: - ctx_assert(false); - break; - } - m_type = type; - m_precision = 0; - m_scale = 0; - m_length = 0; - m_nullable = nullable; - m_unSigned = false; -} - -void -SqlType::setType(Ctx& ctx, Type type, unsigned length, bool nullable) -{ - switch (type) { - case Char: - case Varchar: - case Binary: - case Varbinary: - break; - default: - ctx_assert(false); - break; - } - m_type = type; - m_precision = 0; - m_scale = 0; - m_length = length; - m_nullable = nullable; - m_unSigned = false; -} - -void -SqlType::setType(Ctx& ctx, Type type, unsigned precision, unsigned scale, bool nullable) -{ - ctx_assert(false); // not yet -} - -void -SqlType::setType(Ctx& ctx, const NdbDictionary::Column* ndbColumn) -{ - NdbDictionary::Column::Type type = ndbColumn->getType(); - unsigned length = ndbColumn->getLength(); - unsigned precision = ndbColumn->getPrecision(); - unsigned scale = ndbColumn->getScale(); - bool nullable = ndbColumn->getNullable(); - switch (type) { - case NdbDictionary::Column::Undefined: - break; - case NdbDictionary::Column::Int: - if (length == 1) - setType(ctx, Integer, nullable); - else - setType(ctx, Binary, length * sizeof(SqlInteger), nullable); - return; - case NdbDictionary::Column::Unsigned: - if (length == 1) { - setType(ctx, Integer, nullable); - unSigned(true); - } else - setType(ctx, Binary, length * sizeof(SqlUinteger), nullable); - return; - case NdbDictionary::Column::Bigint: - if (length == 1) - setType(ctx, Bigint, nullable); - else - setType(ctx, Binary, length * sizeof(SqlBigint), nullable); - return; - case NdbDictionary::Column::Bigunsigned: - if (length == 1) { - setType(ctx, Bigint, nullable); - unSigned(true); - } else - setType(ctx, Binary, length * sizeof(SqlBigint), nullable); - return; - case NdbDictionary::Column::Float: - if (length == 1) - setType(ctx, Real, nullable); - else - setType(ctx, Binary, length * sizeof(SqlReal), nullable); - return; - case NdbDictionary::Column::Double: - if (length == 1) - setType(ctx, Double, nullable); - else - setType(ctx, Binary, length * sizeof(SqlDouble), nullable); - return; - case NdbDictionary::Column::Decimal: - setType(ctx, Decimal, precision, scale, nullable); - return; - case NdbDictionary::Column::Char: - setType(ctx, Char, length, nullable); - return; - case NdbDictionary::Column::Varchar: - setType(ctx, Varchar, length, nullable); - return; - case NdbDictionary::Column::Binary: - setType(ctx, Binary, length, nullable); - return; - case NdbDictionary::Column::Varbinary: - setType(ctx, Varbinary, length, nullable); - return; - case NdbDictionary::Column::Datetime: - // XXX not yet - break; - case NdbDictionary::Column::Timespec: - setType(ctx, Datetime, nullable); - return; - case NdbDictionary::Column::Blob: - setType(ctx, Blob, nullable); - return; - case NdbDictionary::Column::Clob: - setType(ctx, Clob, nullable); - return; - default: - break; - } - ctx.pushStatus(Error::Gen, "unsupported NDB type %d", (signed)type); -} - -bool -SqlType::equal(const SqlType& sqlType) const -{ - return - m_type == sqlType.m_type && - m_precision == sqlType.m_precision && - m_scale == sqlType.m_scale && - m_length == sqlType.m_length; -} - -unsigned -SqlType::size() const -{ - switch (m_type) { - case Char: - case Varchar: - case Binary: - case Varbinary: - return m_length; - case Smallint: - return sizeof(SqlSmallint); - case Integer: - return sizeof(SqlInteger); - case Bigint: - return sizeof(SqlBigint); - case Real: - return sizeof(SqlReal); - case Double: - return sizeof(SqlDouble); - case Datetime: - return sizeof(SqlDatetime); - case Null: - return 0; - default: - break; - } - ctx_assert(false); - return 0; -} - -unsigned -SqlType::displaySize() const -{ - switch (m_type) { - case Char: - case Varchar: - return m_length; - case Binary: - case Varbinary: - return m_length; - case Smallint: - return m_unSigned ? 5 : 6; - case Integer: - return m_unSigned ? 10 : 11; - case Bigint: - return m_unSigned ? 20 : 21; - case Real: - return 10; - case Double: - return 20; - case Datetime: - return 30; - case Null: - return 0; - default: - break; - } - ctx_assert(false); - return 0; -} - -void -SqlType::getType(Ctx& ctx, NdbDictionary::Column* ndbColumn) const -{ - switch (m_type) { - case Char: - ndbColumn->setType(NdbDictionary::Column::Char); - ndbColumn->setLength(m_length); - break; - case Varchar: - ndbColumn->setType(NdbDictionary::Column::Varchar); - ndbColumn->setLength(m_length); - break; - case Binary: - ndbColumn->setType(NdbDictionary::Column::Binary); - ndbColumn->setLength(m_length); - break; - case Varbinary: - ndbColumn->setType(NdbDictionary::Column::Varbinary); - ndbColumn->setLength(m_length); - break; - case Smallint: - break; // XXX - case Integer: - if (! m_unSigned) - ndbColumn->setType(NdbDictionary::Column::Int); - else - ndbColumn->setType(NdbDictionary::Column::Unsigned); - ndbColumn->setLength(1); - break; - case Bigint: - if (! m_unSigned) - ndbColumn->setType(NdbDictionary::Column::Bigint); - else - ndbColumn->setType(NdbDictionary::Column::Bigunsigned); - ndbColumn->setLength(1); - break; - case Real: - ndbColumn->setType(NdbDictionary::Column::Float); - ndbColumn->setLength(1); - break; - case Double: - ndbColumn->setType(NdbDictionary::Column::Double); - ndbColumn->setLength(1); - break; - case Datetime: - ndbColumn->setType(NdbDictionary::Column::Timespec); - ndbColumn->setLength(1); - break; - default: - ctx_assert(false); - break; - } - ndbColumn->setNullable(m_nullable); -} - -const char* -SqlType::typeName() const -{ - switch (m_type) { - case Char: - return "CHAR"; - case Varchar: - return "VARCHAR"; - case Binary: - return "BINARY"; - case Varbinary: - return "VARBINARY"; - case Smallint: - return "SMALLINT"; - case Integer: - return "INTEGER"; - case Bigint: - return "BIGINT"; - case Real: - return "REAL"; - case Double: - return "FLOAT"; - case Datetime: - return "DATETIME"; - default: - break; - } - return "UNKNOWN"; -} - -void -SqlType::print(char* buf, unsigned size) const -{ - switch (m_type) { - case Char: - snprintf(buf, size, "char(%d)", m_length); - break; - case Varchar: - snprintf(buf, size, "varchar(%d)", m_length); - break; - case Binary: - snprintf(buf, size, "binary(%d)", m_length); - break; - case Varbinary: - snprintf(buf, size, "varbinary(%d)", m_length); - break; - case Smallint: - snprintf(buf, size, "smallint%s", m_unSigned ? " unsigned" : ""); - break; - case Integer: - snprintf(buf, size, "integer%s", m_unSigned ? " unsigned" : ""); - break; - case Bigint: - snprintf(buf, size, "bigint%s", m_unSigned ? " unsigned" : ""); - break; - case Real: - snprintf(buf, size, "real"); - break; - case Double: - snprintf(buf, size, "double"); - break; - case Datetime: - snprintf(buf, size, "datetime"); - break; - case Null: - snprintf(buf, size, "null"); - break; - case Unbound: - snprintf(buf, size, "unbound"); - break; - default: - snprintf(buf, size, "sqltype(%d)", (int)m_type); - break; - } -} - -// ExtType - -ExtType::ExtType() : - m_type(Undef) -{ -} - -ExtType::ExtType(Type type) -{ - Ctx ctx; - setType(ctx, type); - ctx_assert(ctx.ok()); -} - -ExtType::ExtType(Ctx& ctx, Type type) -{ - setType(ctx, type); -} - -void -ExtType::setType(Ctx& ctx, Type type) -{ - switch (type) { - case Char: - case Short: - case Sshort: - case Ushort: - case Long: - case Slong: - case Ulong: - case Sbigint: - case Ubigint: - case Float: - case Double: - case Timestamp: - case Binary: // XXX BLOB hack - case Unbound: - break; - default: - ctx.pushStatus(Error::Gen, "unsupported external type %d", (int)type); - return; - } - m_type = type; -} - -unsigned -ExtType::size() const -{ - ctx_assert(false); - return 0; -} - -// LexType - -LexType::LexType() : - m_type(Undef) -{ -} - -LexType::LexType(Type type) -{ - Ctx ctx; - setType(ctx, type); - ctx_assert(ctx.ok()); -} - -LexType::LexType(Ctx& ctx, Type type) -{ - setType(ctx, type); -} - -void -LexType::setType(Ctx& ctx, Type type) -{ - switch (type) { - case Char: - case Integer: - case Float: - case Null: - break; - default: - ctx_assert(false); - break; - } - m_type = type; -} - -// convert types - -SQLSMALLINT -SqlType::sqlcdefault(Ctx& ctx) const -{ - switch (m_type) { - case Char: - return SQL_C_CHAR; - case Varchar: - return SQL_C_CHAR; - case Binary: - return SQL_C_BINARY; - case Varbinary: - return SQL_C_BINARY; - case Smallint: - return m_unSigned ? SQL_C_USHORT : SQL_C_SSHORT; - case Integer: - return m_unSigned ? SQL_C_ULONG : SQL_C_SLONG; - case Bigint: - return SQL_C_CHAR; - // or maybe this - return m_unSigned ? SQL_C_UBIGINT : SQL_C_SBIGINT; - case Real: - return SQL_C_FLOAT; - case Double: - return SQL_C_DOUBLE; - case Datetime: - return SQL_C_TYPE_TIMESTAMP; - default: - break; - } - return SQL_C_DEFAULT; // no default -} - -void -LexType::convert(Ctx& ctx, SqlType& out, unsigned length) const -{ - switch (m_type) { - case Char: - out.setType(ctx, SqlType::Char, length, true); - return; - case Integer: - out.setType(ctx, SqlType::Bigint, false); - return; - case Float: - out.setType(ctx, SqlType::Double, false); - return; - case Null: - out.setType(ctx, SqlType::Null, true); - return; - default: - break; - } - ctx.pushStatus(Error::Gen, "unsupported lexical to SQL type conversion"); -} diff --git a/ndb/src/old_files/client/odbc/common/DataType.hpp b/ndb/src/old_files/client/odbc/common/DataType.hpp deleted file mode 100644 index e03e445cf05..00000000000 --- a/ndb/src/old_files/client/odbc/common/DataType.hpp +++ /dev/null @@ -1,293 +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 ODBC_COMMON_DataType_hpp -#define ODBC_COMMON_DataType_hpp - -#include -#include -#include -#include -#include - -/** - * Sql data exists in several formats: - * - * - as NDB data at the bottom - * - as SQL data during intermediary processing - * - as external data in user input and output buffers - * - as lexical constants in SQL statement text - * - * Each data format has specific types (e.g. number) and each - * type has specific attributes (e.g. precision). - */ -enum DataFormat { - Undef_format = 0, - Ndb_format = 1, // not used in NDB version >= v2.10 - Sql_format = 2, - Ext_format = 3, - Lex_format = 4 -}; - -#define UndefDataType 990 -#define NullDataType 991 -#define UnboundDataType 992 - -class SqlType; -class ExtType; -class LexType; - -/** - * @class SqlType - * @brief Sql data type - */ -class SqlType { -public: - enum Type { - Undef = UndefDataType, - Char = SQL_CHAR, - Varchar = SQL_VARCHAR, - Longvarchar = SQL_LONGVARCHAR, - Binary = SQL_BINARY, - Varbinary = SQL_VARBINARY, - Longvarbinary = SQL_LONGVARBINARY, - Decimal = SQL_DECIMAL, - Tinyint = SQL_TINYINT, - Smallint = SQL_SMALLINT, - Integer = SQL_INTEGER, - Bigint = SQL_BIGINT, - Real = SQL_REAL, - Double = SQL_DOUBLE, - Date = SQL_DATE, - Datetime = SQL_TYPE_TIMESTAMP, - Blob = SQL_BLOB, - Clob = SQL_CLOB, - Null = NullDataType, // not an ODBC SQL type - Unbound = UnboundDataType // special for placeholders - }; - SqlType(); - SqlType(Type type, bool nullable = true); - SqlType(Type type, unsigned length, bool nullable = true); - SqlType(Type type, unsigned precision, unsigned scale, bool nullable = true); - SqlType(Ctx& ctx, Type type, bool nullable = true); - SqlType(Ctx& ctx, Type type, unsigned length, bool nullable = true); - SqlType(Ctx& ctx, Type type, unsigned precision, unsigned scale, bool nullable = true); - SqlType(Ctx& ctx, const NdbDictionary::Column* ndbColumn); - Type type() const; - void setType(Ctx& ctx, Type type, bool nullable = true); - void setType(Ctx& ctx, Type type, unsigned length, bool nullable = true); - void setType(Ctx& ctx, Type type, unsigned precision, unsigned scale, bool nullable = true); - void setType(Ctx& ctx, const NdbDictionary::Column* ndbColumn); - bool equal(const SqlType& sqlType) const; - unsigned size() const; - unsigned displaySize() const; - const char* typeName() const; - unsigned length() const; - bool nullable() const; - void nullable(bool value); - bool unSigned() const; - void unSigned(bool value); - // forwards compatible - void getType(Ctx& ctx, NdbDictionary::Column* ndbColumn) const; - // type conversion - SQLSMALLINT sqlcdefault(Ctx& ctx) const; - // print for debugging - void print(char* buf, unsigned size) const; -private: - friend class LexType; - Type m_type; - unsigned m_precision; - unsigned m_scale; - unsigned m_length; - bool m_nullable; - bool m_unSigned; // qualifier instead of separate types -}; - -inline SqlType::Type -SqlType::type() const -{ - return m_type; -} - -inline unsigned -SqlType::length() const -{ - return m_length; -} - -inline bool -SqlType::nullable() const -{ - return m_nullable; -} - -inline void -SqlType::nullable(bool value) -{ - m_nullable = value; -} - -inline bool -SqlType::unSigned() const -{ - return m_unSigned; -} - -inline void -SqlType::unSigned(bool value) -{ - ctx_assert(m_type == Smallint || m_type == Integer || m_type == Bigint); - m_unSigned = value; -} - -/** - * Actual SQL datatypes. - */ -typedef unsigned char SqlChar; // Char and Varchar via pointer -typedef Int16 SqlSmallint; -typedef Int32 SqlInteger; -typedef Int64 SqlBigint; -typedef Uint16 SqlUsmallint; -typedef Uint32 SqlUinteger; -typedef Uint64 SqlUbigint; -typedef float SqlReal; -typedef double SqlDouble; - -// datetime cc yy mm dd HH MM SS 00 ff ff ff ff stored as String(12) -struct SqlDatetime { - int cc() const { return *(signed char*)&m_data[0]; } - void cc(int x) { *(signed char*)&m_data[0] = x; } - unsigned yy() const { return *(unsigned char*)&m_data[1]; } - void yy(unsigned x) { *(unsigned char*)&m_data[1] = x; } - unsigned mm() const { return *(unsigned char*)&m_data[2]; } - void mm(unsigned x) { *(unsigned char*)&m_data[2] = x; } - unsigned dd() const { return *(unsigned char*)&m_data[3]; } - void dd(unsigned x) { *(unsigned char*)&m_data[3] = x; } - unsigned HH() const { return *(unsigned char*)&m_data[4]; } - void HH(unsigned x) { *(unsigned char*)&m_data[4] = x; } - unsigned MM() const { return *(unsigned char*)&m_data[5]; } - void MM(unsigned x) { *(unsigned char*)&m_data[5] = x; } - unsigned SS() const { return *(unsigned char*)&m_data[6]; } - void SS(unsigned x) { *(unsigned char*)&m_data[6] = x; } - unsigned ff() const { - const unsigned char* p = (unsigned char*)&m_data[8]; - unsigned x = 0; - x += *p++ << 24; - x += *p++ << 16; - x += *p++ << 8; - x += *p++; - return x; - } - void ff(unsigned x) { - unsigned char* p = (unsigned char*)&m_data[8]; - *p++ = (x >> 24) & 0xff; - *p++ = (x >> 16) & 0xff; - *p++ = (x >> 8) & 0xff; - *p++ = x & 0xff; - } - bool valid() { return true; } // XXX later - bool less(const SqlDatetime t) const { - if (cc() != t.cc()) - return cc() < t.cc(); - if (yy() != t.yy()) - return yy() < t.yy(); - if (mm() != t.mm()) - return mm() < t.mm(); - if (dd() != t.dd()) - return dd() < t.dd(); - if (HH() != t.HH()) - return HH() < t.HH(); - if (MM() != t.MM()) - return MM() < t.MM(); - if (SS() != t.SS()) - return SS() < t.SS(); - if (ff() != t.ff()) - return ff() < t.ff(); - return false; - } -private: - char m_data[12]; // use array to avoid gaps -}; - -/** - * @class ExtType - * @brief External data type - */ -class ExtType { -public: - enum Type { - Undef = UndefDataType, - Char = SQL_C_CHAR, - Short = SQL_C_SHORT, - Sshort = SQL_C_SSHORT, - Ushort = SQL_C_USHORT, - Long = SQL_C_LONG, // for sun.jdbc.odbc - Slong = SQL_C_SLONG, - Ulong = SQL_C_ULONG, - Sbigint = SQL_C_SBIGINT, - Ubigint = SQL_C_UBIGINT, - Float = SQL_C_FLOAT, - Double = SQL_C_DOUBLE, - Timestamp = SQL_C_TYPE_TIMESTAMP, - Binary = SQL_C_BINARY, // XXX BLOB hack - Unbound = UnboundDataType - }; - ExtType(); - ExtType(Type type); - ExtType(Ctx& ctx, Type type); - Type type() const; - void setType(Ctx& ctx, Type type); - unsigned size() const; -private: - Type m_type; -}; - -inline ExtType::Type -ExtType::type() const -{ - return m_type; -} - -/** - * @class LexType - * @class Lexical data type - */ -class LexType { -public: - enum Type { - Undef = UndefDataType, - Char = 1, - Integer = 2, - Float = 3, - Null = 4 - }; - LexType(); - LexType(Type type); - LexType(Ctx& ctx, Type type); - Type type() const; - void setType(Ctx& ctx, Type type); - void convert(Ctx& ctx, SqlType& out, unsigned length = 0) const; -private: - Type m_type; -}; - -inline LexType::Type -LexType::type() const -{ - return m_type; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/DescArea.cpp b/ndb/src/old_files/client/odbc/common/DescArea.cpp deleted file mode 100644 index bad9f23d3ef..00000000000 --- a/ndb/src/old_files/client/odbc/common/DescArea.cpp +++ /dev/null @@ -1,167 +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 */ - -#include -#include "DescArea.hpp" - -// DescField - -// DescRec - -void -DescRec::setField(int id, const OdbcData& data) -{ - Ctx ctx; - setField(ctx, id, data); - ctx_assert(ctx.ok()); -} - -void -DescRec::getField(int id, OdbcData& data) -{ - Ctx ctx; - getField(ctx, id, data); - ctx_assert(ctx.ok()); -} - -void -DescRec::setField(Ctx& ctx, int id, const OdbcData& data) -{ - Fields::iterator iter; - iter = m_fields.find(id); - if (ctx.logLevel() >= 3) { - char buf[100]; - data.print(buf, sizeof(buf)); - ctx_log3(("set %s rec %d id %d = %s", DescArea::nameUsage(m_area->getUsage()), m_num, id, buf)); - } - if (iter != m_fields.end()) { - DescField& field = (*iter).second; - field.setData(data); - m_area->setBound(false); // XXX could compare data values - return; - } - const DescSpec& spec = m_area->findSpec(id); - if (spec.m_pos != Desc_pos_end) { - DescField field(spec, data); - m_fields.insert(Fields::value_type(id, field)); - m_area->setBound(false); - return; - } - ctx_assert(false); -} - -void -DescRec::getField(Ctx& ctx, int id, OdbcData& data) -{ - Fields::iterator iter; - iter = m_fields.find(id); - if (iter != m_fields.end()) { - DescField& field = (*iter).second; - data.setValue(field.getData()); - return; - } - const DescSpec& spec = m_area->findSpec(id); - if (spec.m_pos != Desc_pos_end) { - data.setValue(); - return; // XXX default value - } - ctx_assert(false); -} - -// DescArea - -DescArea::DescArea(HandleBase* handle, const DescSpec* specList) : - m_handle(handle), - m_specList(specList), - m_alloc(Desc_alloc_undef), - m_usage(Desc_usage_undef), - m_bound(true) // no bind necessary since empty -{ - m_header.m_area = this; - m_header.m_num = -1; - DescRec rec; - rec.m_area = this; - rec.m_num = m_recs.size(); - m_recs.push_back(rec); // add bookmark record - SQLSMALLINT count = 0; - getHeader().setField(SQL_DESC_COUNT, count); - m_bound = true; -} - -DescArea::~DescArea() -{ -} - -const DescSpec& -DescArea::findSpec(int id) -{ - const DescSpec* p; - for (p = m_specList; p->m_pos != Desc_pos_end; p++) { - if (p->m_id == id) - break; - } - return *p; -} - -unsigned -DescArea::getCount() const -{ - ctx_assert(m_recs.size() > 0); - return m_recs.size() - 1; -} - -void -DescArea::setCount(Ctx& ctx, unsigned count) -{ - if (m_recs.size() - 1 == count) - return; - ctx_log3(("set %s count %d to %d", - DescArea::nameUsage(m_usage), - (unsigned)(m_recs.size() - 1), - count)); - m_recs.resize(1 + count); - for (unsigned i = 0; i <= count; i++) { - m_recs[i].m_area = this; - m_recs[i].m_num = i; - } - getHeader().setField(SQL_DESC_COUNT, static_cast(count)); -} - -DescRec& -DescArea::pushRecord() -{ - ctx_assert(m_recs.size() > 0); - DescRec rec; - rec.m_area = this; - rec.m_num = m_recs.size(); - m_recs.push_back(rec); - SQLSMALLINT count = m_recs.size() - 1; - getHeader().setField(SQL_DESC_COUNT, count); - return m_recs.back(); -} - -DescRec& -DescArea::getHeader() -{ - return m_header; -} - -DescRec& -DescArea::getRecord(unsigned num) -{ - ctx_assert(num < m_recs.size()); - return m_recs[num]; -} diff --git a/ndb/src/old_files/client/odbc/common/DescArea.hpp b/ndb/src/old_files/client/odbc/common/DescArea.hpp deleted file mode 100644 index e9f552d758d..00000000000 --- a/ndb/src/old_files/client/odbc/common/DescArea.hpp +++ /dev/null @@ -1,266 +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 ODBC_COMMON_DescArea_hpp -#define ODBC_COMMON_DescArea_hpp - -#include -#include -#include -#include "OdbcData.hpp" - -/** - * Descriptor records. Contains: - * -# header, not called a "record" in this context - * -# bookmark record at index position 0 - * -# descriptor records at index positions starting from 1 - * - * These classes are in common/ since the code is general. - * However each area is associated with a HandleDesc. - * - * DescField - field identified by an SQL_DESC_* constant - * DescRec - header or record, a list of fields - * DescArea - header and all records - */ - -class HandleBase; -class DescField; -class DescRec; -class DescArea; - -enum DescPos { - Desc_pos_undef = 0, - Desc_pos_header, - Desc_pos_record, - Desc_pos_end -}; - -enum DescMode { - Desc_mode_undef = 0, - Desc_mode_readonly, - Desc_mode_writeonly, - Desc_mode_readwrite, - Desc_mode_unused -}; - -struct DescSpec { - DescPos m_pos; // header or record - int m_id; // SQL_DESC_ identifier - OdbcData::Type m_type; // data type - DescMode m_mode[1+4]; // access mode IPD APD IRD ARD - // called before setting value - typedef void CallbackSet(Ctx& ctx, HandleBase* self, const OdbcData& data); - CallbackSet* m_set; - // called to get default value - typedef void CallbackDefault(Ctx& ctx, HandleBase* self, OdbcData& data); - CallbackDefault* m_default; -}; - -enum DescAlloc { - Desc_alloc_undef = 0, - Desc_alloc_auto, - Desc_alloc_user -}; - -enum DescUsage { - Desc_usage_undef = 0, - Desc_usage_IPD = 1, // these must be 1-4 - Desc_usage_IRD = 2, - Desc_usage_APD = 3, - Desc_usage_ARD = 4 -}; - -/** - * @class DescField - * @brief Field identified by an SQL_DESC_* constant - */ -class DescField { -public: - DescField(const DescSpec& spec, const OdbcData& data); - DescField(const DescField& field); - ~DescField(); -private: - friend class DescRec; - void setData(const OdbcData& data); - const OdbcData& getData(); - const DescSpec& m_spec; - OdbcData m_data; -}; - -inline -DescField::DescField(const DescSpec& spec, const OdbcData& data) : - m_spec(spec), - m_data(data) -{ -} - -inline -DescField::DescField(const DescField& field) : - m_spec(field.m_spec), - m_data(field.m_data) -{ -} - -inline -DescField::~DescField() -{ -} - -inline void -DescField::setData(const OdbcData& data) -{ - ctx_assert(m_spec.m_type == data.type()); - m_data.setValue(data); -} - -inline const OdbcData& -DescField::getData() -{ - ctx_assert(m_data.type() != OdbcData::Undef); - return m_data; -} - -/** - * @class DescRec - * @brief Descriptor record, a list of fields - */ -class DescRec { - friend class DescArea; -public: - DescRec(); - ~DescRec(); - void setField(int id, const OdbcData& data); - void getField(int id, OdbcData& data); - void setField(Ctx& ctx, int id, const OdbcData& data); - void getField(Ctx& ctx, int id, OdbcData& data); -private: - DescArea* m_area; - int m_num; // for logging only -1 = header 0 = bookmark - typedef std::map Fields; - Fields m_fields; -}; - -inline -DescRec::DescRec() : - m_area(0) -{ -} - -inline -DescRec::~DescRec() -{ -} - -/** - * @class DescArea - * @brief All records, including header (record 0) - * - * Descriptor area includes a header (record 0) - * and zero or more records at position >= 1. - * Each of these describes one parameter or one column. - * - * - DescArea : Collection of records - * - DescRec : Collection of fields - * - DescField : Contains data of type OdbcData - */ -class DescArea { -public: - DescArea(HandleBase* handle, const DescSpec* specList); - ~DescArea(); - void setAlloc(DescAlloc alloc); - DescAlloc getAlloc() const; - void setUsage(DescUsage usage); - DescUsage getUsage() const; - static const char* nameUsage(DescUsage u); - // find specifier - const DescSpec& findSpec(int id); - // get or set number of records (record 0 not counted) - unsigned getCount() const; - void setCount(Ctx& ctx, unsigned count); - // paush new record (record 0 exists always) - DescRec& pushRecord(); - // get ref to header or to any record - DescRec& getHeader(); - DescRec& getRecord(unsigned num); - // modified since last bind - void setBound(bool bound); - bool isBound() const; -private: - HandleBase* m_handle; - const DescSpec* const m_specList; - DescRec m_header; - typedef std::vector Recs; - Recs m_recs; - DescAlloc m_alloc; - DescUsage m_usage; - bool m_bound; -}; - -inline void -DescArea::setAlloc(DescAlloc alloc) -{ - m_alloc = alloc; -} - -inline DescAlloc -DescArea::getAlloc() const -{ - return m_alloc; -} - -inline void -DescArea::setUsage(DescUsage usage) -{ - m_usage = usage; -} - -inline DescUsage -DescArea::getUsage() const -{ - return m_usage; -} - -inline const char* -DescArea::nameUsage(DescUsage u) -{ - switch (u) { - case Desc_usage_undef: - break; - case Desc_usage_IPD: - return "IPD"; - case Desc_usage_IRD: - return "IRD"; - case Desc_usage_APD: - return "APD"; - case Desc_usage_ARD: - return "ARD"; - } - return "?"; -} - -inline void -DescArea::setBound(bool bound) -{ - m_bound = bound; -} - -inline bool -DescArea::isBound() const -{ - return m_bound; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/DiagArea.cpp b/ndb/src/old_files/client/odbc/common/DiagArea.cpp deleted file mode 100644 index 06e8da89495..00000000000 --- a/ndb/src/old_files/client/odbc/common/DiagArea.cpp +++ /dev/null @@ -1,284 +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 */ - -#include -#include "OdbcData.hpp" -#include "DiagArea.hpp" - -// DiagSpec - -static const DiagSpec -diag_spec_list[] = { - { Diag_pos_header, - SQL_DIAG_CURSOR_ROW_COUNT, - OdbcData::Integer, - Odbc_handle_stmt - }, - { Diag_pos_header, - SQL_DIAG_DYNAMIC_FUNCTION, - OdbcData::Sqlchar, - Odbc_handle_stmt - }, - { Diag_pos_header, - SQL_DIAG_DYNAMIC_FUNCTION_CODE, - OdbcData::Integer, - Odbc_handle_stmt - }, - { Diag_pos_header, - SQL_DIAG_NUMBER, - OdbcData::Integer, - Odbc_handle_all - }, - { Diag_pos_header, - SQL_DIAG_RETURNCODE, - OdbcData::Smallint, - Odbc_handle_all - }, - { Diag_pos_header, - SQL_DIAG_ROW_COUNT, - OdbcData::Integer, - Odbc_handle_stmt - }, - { Diag_pos_status, - SQL_DIAG_CLASS_ORIGIN, - OdbcData::Sqlchar, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_COLUMN_NUMBER, - OdbcData::Integer, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_CONNECTION_NAME, - OdbcData::Sqlchar, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_MESSAGE_TEXT, - OdbcData::Sqlchar, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_NATIVE, - OdbcData::Integer, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_ROW_NUMBER, - OdbcData::Integer, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_SERVER_NAME, - OdbcData::Sqlchar, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_SQLSTATE, - OdbcData::Sqlchar, - Odbc_handle_all - }, - { Diag_pos_status, - SQL_DIAG_SUBCLASS_ORIGIN, - OdbcData::Sqlchar, - Odbc_handle_all - }, - { Diag_pos_end, - 0, - OdbcData::Undef, - 0 - } -}; - -const DiagSpec& -DiagSpec::find(int id) -{ - const DiagSpec* p; - for (p = diag_spec_list; p->m_pos != Diag_pos_end; p++) { - if (p->m_id == id) - break; - } - return *p; -} - -// DiagField - -// DiagRec - -void -DiagRec::setField(int id, const OdbcData& data) -{ - Fields::iterator iter; - iter = m_fields.find(id); - if (iter != m_fields.end()) { - DiagField& field = (*iter).second; - field.setData(data); - return; - } - const DiagSpec& spec = DiagSpec::find(id); - if (spec.m_pos != Diag_pos_end) { - DiagField field(spec, data); - m_fields.insert(Fields::value_type(id, field)); - return; - } - ctx_assert(false); -} - -void -DiagRec::getField(Ctx& ctx, int id, OdbcData& data) -{ - Fields::iterator iter; - iter = m_fields.find(id); - if (iter != m_fields.end()) { - DiagField& field = (*iter).second; - data.setValue(field.getData()); - return; - } - const DiagSpec& spec = DiagSpec::find(id); - if (spec.m_pos != Diag_pos_end) { - // success and undefined value says the MS doc - data.setValue(); - return; - } - ctx_assert(false); -} - -// DiagArea - -DiagArea::DiagArea() : - m_recs(1), // add header - m_code(SQL_SUCCESS), - m_recNumber(0) -{ - setHeader(SQL_DIAG_NUMBER, (SQLINTEGER)0); -} - -DiagArea::~DiagArea() { -} - -unsigned -DiagArea::numStatus() -{ - ctx_assert(m_recs.size() > 0); - return m_recs.size() - 1; -} - -void -DiagArea::pushStatus() -{ - ctx_assert(m_recs.size() > 0); - DiagRec rec; - m_recs.push_back(rec); - SQLINTEGER diagNumber = m_recs.size() - 1; - setHeader(SQL_DIAG_NUMBER, diagNumber); -} - -void -DiagArea::setHeader(int id, const OdbcData& data) -{ - ctx_assert(m_recs.size() > 0); - getHeader().setField(id, data); -} - -// set status - -void -DiagArea::setStatus(int id, const OdbcData& data) -{ - getStatus().setField(id, data); -} - -void -DiagArea::setStatus(const Sqlstate& state) -{ - getStatus().setField(SQL_DIAG_SQLSTATE, state); - setCode(state.getCode(m_code)); -} - -void -DiagArea::setStatus(const Error& error) -{ - BaseString message(""); - // bracketed prefixes - message.append(NDB_ODBC_COMPONENT_VENDOR); - message.append(NDB_ODBC_COMPONENT_DRIVER); - if (! error.driverError()) - message.append(NDB_ODBC_COMPONENT_DATABASE); - // native error code - char nativeString[20]; - sprintf(nativeString, "%02d%02d%04d", - (unsigned)error.m_status % 100, - (unsigned)error.m_classification % 100, - (unsigned)error.m_code % 10000); - SQLINTEGER native = atoi(nativeString); - message.appfmt("NDB-%s", nativeString); - // message text - message.append(" "); - message.append(error.m_message); - if (error.m_sqlFunction != 0) - message.appfmt(" (in %s)", error.m_sqlFunction); - // set diag fields - setStatus(error.m_sqlstate); - setStatus(SQL_DIAG_NATIVE, native); - setStatus(SQL_DIAG_MESSAGE_TEXT, message.c_str()); -} - -// push status - -void -DiagArea::pushStatus(const Error& error) -{ - pushStatus(); - setStatus(error); -} - -// record access - -DiagRec& -DiagArea::getHeader() -{ - ctx_assert(m_recs.size() > 0); - return m_recs[0]; -} - -DiagRec& -DiagArea::getStatus() -{ - ctx_assert(m_recs.size() > 1); - return m_recs.back(); -} - -DiagRec& -DiagArea::getRecord(unsigned num) -{ - ctx_assert(num < m_recs.size()); - return m_recs[num]; -} - -void -DiagArea::getRecord(Ctx& ctx, unsigned num, int id, OdbcData& data) -{ - DiagRec& rec = getRecord(num); - rec.getField(ctx, id, data); -} - -void -DiagArea::setCode(SQLRETURN code) -{ - m_code = code; - getHeader().setField(SQL_DIAG_RETURNCODE, (SQLSMALLINT)code); -} diff --git a/ndb/src/old_files/client/odbc/common/DiagArea.hpp b/ndb/src/old_files/client/odbc/common/DiagArea.hpp deleted file mode 100644 index 79c03de6623..00000000000 --- a/ndb/src/old_files/client/odbc/common/DiagArea.hpp +++ /dev/null @@ -1,196 +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 ODBC_COMMON_DiagArea_hpp -#define ODBC_COMMON_DiagArea_hpp - -#include -#include -#include -#include "OdbcData.hpp" - -enum DiagPos { - Diag_pos_undef = 0, - Diag_pos_header, - Diag_pos_status, - Diag_pos_end -}; - -/** - * @class DiagSpec - * @brief Field specification - */ -struct DiagSpec { - DiagPos m_pos; // header or status - int m_id; // SQL_DIAG_ identifier - OdbcData::Type m_type; // data type - unsigned m_handles; // defined for these handle types - // find the spec - static const DiagSpec& find(int id); -}; - -/** - * @class DiagField - * @brief Field identified by an SQL_DIAG_* constant - */ -class DiagField { -public: - DiagField(const DiagSpec& spec, const OdbcData& data); - DiagField(const DiagField& field); - ~DiagField(); - void setData(const OdbcData& data); - const OdbcData& getData(); -private: - const DiagSpec& m_spec; - OdbcData m_data; -}; - -inline -DiagField::DiagField(const DiagSpec& spec, const OdbcData& data) : - m_spec(spec), - m_data(data) -{ -} - -inline -DiagField::DiagField(const DiagField& field) : - m_spec(field.m_spec), - m_data(field.m_data) -{ -} - -inline -DiagField::~DiagField() -{ -} - -inline void -DiagField::setData(const OdbcData& data) -{ - ctx_assert(m_spec.m_type == data.type()); - m_data.setValue(data); -} - -inline const OdbcData& -DiagField::getData() -{ - ctx_assert(m_data.type() != OdbcData::Undef); - return m_data; -} - -/** - * @class DiagRec - * @brief One diagnostic record, a list of fields - */ -class DiagRec { -public: - DiagRec(); - ~DiagRec(); - void setField(int id, const OdbcData& data); - void getField(Ctx& ctx, int id, OdbcData& data); -private: - typedef std::map Fields; - Fields m_fields; -}; - -inline -DiagRec::DiagRec() -{ -} - -inline -DiagRec::~DiagRec() -{ -} - -/** - * @class DiagArea - * @brief All records, including header (record 0) - * - * Diagnostic area includes a header (record 0) and zero or more - * status records at positions >= 1. - */ -class DiagArea { -public: - DiagArea(); - ~DiagArea(); - /** - * Get number of status records. - */ - unsigned numStatus(); - /** - * Push new status record. - */ - void pushStatus(); - /** - * Set field in header. - */ - void setHeader(int id, const OdbcData& data); - /** - * Set field in latest status record. The arguments can - * also be plain int, char*, Sqlstate. The NDB and other - * native errors set Sqlstate _IM000 automatically. - */ - void setStatus(int id, const OdbcData& data); - void setStatus(const Sqlstate& state); - void setStatus(const Error& error); - /** - * Convenience methods to push new status record and set - * some common fields in it. Sqlstate is set always. - */ - void pushStatus(const Error& error); - /** - * Get refs to various records. - */ - DiagRec& getHeader(); - DiagRec& getStatus(); - DiagRec& getRecord(unsigned num); - /** - * Get diag values. - */ - void getRecord(Ctx& ctx, unsigned num, int id, OdbcData& data); - /** - * Get or set return code. - */ - SQLRETURN getCode() const; - void setCode(SQLRETURN ret); - /** - * Get "next" record number (0 when no more). - * Used only by the deprecated SQLError function. - */ - unsigned nextRecNumber(); -private: - typedef std::vector Recs; - Recs m_recs; - SQLRETURN m_code; - unsigned m_recNumber; // for SQLError -}; - -inline SQLRETURN -DiagArea::getCode() const -{ - return m_code; -} - -inline unsigned -DiagArea::nextRecNumber() -{ - if (m_recNumber >= numStatus()) - return 0; - return ++m_recNumber; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/Makefile b/ndb/src/old_files/client/odbc/common/Makefile deleted file mode 100644 index 7ee29738d86..00000000000 --- a/ndb/src/old_files/client/odbc/common/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include .defs.mk - -TYPE = * - -NONPIC_ARCHIVE = N - -PIC_ARCHIVE = Y - -ARCHIVE_TARGET = odbccommon - -SOURCES = \ - common.cpp \ - Ctx.cpp \ - Sqlstate.cpp \ - OdbcData.cpp \ - DiagArea.cpp \ - AttrArea.cpp \ - DescArea.cpp \ - ConnArea.cpp \ - StmtInfo.cpp \ - StmtArea.cpp \ - CodeTree.cpp \ - ResultArea.cpp \ - DataType.cpp \ - DataField.cpp \ - DataRow.cpp - -include ../Extra.mk -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/client/odbc/common/OdbcData.cpp b/ndb/src/old_files/client/odbc/common/OdbcData.cpp deleted file mode 100644 index 32400e07c7a..00000000000 --- a/ndb/src/old_files/client/odbc/common/OdbcData.cpp +++ /dev/null @@ -1,560 +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 */ - -#include "OdbcData.hpp" - -OdbcData::OdbcData() : - m_type(Undef) -{ -} - -OdbcData::OdbcData(Type type) : - m_type(type) -{ - switch (m_type) { - case Smallint: - m_smallint = 0; - break; - case Usmallint: - m_usmallint = 0; - break; - case Integer: - m_integer = 0; - break; - case Uinteger: - m_uinteger = 0; - break; - case Pointer: - m_pointer = 0; - break; - case SmallintPtr: - m_smallintPtr = 0; - break; - case UsmallintPtr: - m_usmallintPtr = 0; - break; - case IntegerPtr: - m_integerPtr = 0; - break; - case UintegerPtr: - m_uintegerPtr = 0; - break; - case PointerPtr: - m_pointerPtr = 0; - break; - case Sqlchar: - m_sqlchar = 0; - break; - case Sqlstate: - m_sqlstate = 0; - break; - default: - ctx_assert(false); - break; - }; -} - -OdbcData::OdbcData(const OdbcData& odbcData) : - m_type(odbcData.m_type) -{ - switch (m_type) { - case Smallint: - m_smallint = odbcData.m_smallint; - break; - case Usmallint: - m_usmallint = odbcData.m_usmallint; - break; - case Integer: - m_integer = odbcData.m_integer; - break; - case Uinteger: - m_uinteger = odbcData.m_uinteger; - break; - case Pointer: - m_pointer = odbcData.m_pointer; - break; - case SmallintPtr: - m_smallintPtr = odbcData.m_smallintPtr; - break; - case UsmallintPtr: - m_usmallintPtr = odbcData.m_usmallintPtr; - break; - case IntegerPtr: - m_integerPtr = odbcData.m_integerPtr; - break; - case UintegerPtr: - m_uintegerPtr = odbcData.m_uintegerPtr; - break; - case PointerPtr: - m_pointerPtr = odbcData.m_pointerPtr; - break; - case Sqlchar: { - unsigned n = strlen(odbcData.m_sqlchar); - m_sqlchar = new char[n + 1]; - memcpy(m_sqlchar, odbcData.m_sqlchar, n + 1); - break; - } - case Sqlstate: - m_sqlstate = odbcData.m_sqlstate; - break; - default: - ctx_assert(false); - break; - }; -} - -OdbcData::~OdbcData() -{ - switch (m_type) { - case Sqlchar: - delete[] m_sqlchar; - break; - default: - break; - } -} - -void -OdbcData::setValue() -{ - m_type = Undef; -} - -void -OdbcData::setValue(Type type) -{ - if (m_type == Sqlchar) { - delete[] m_sqlchar; - m_sqlchar = 0; - } - switch (m_type) { - case Smallint: - m_smallint = 0; - break; - case Usmallint: - m_usmallint = 0; - break; - case Integer: - m_integer = 0; - break; - case Uinteger: - m_uinteger = 0; - break; - case Pointer: - m_pointer = 0; - break; - case SmallintPtr: - m_smallintPtr = 0; - break; - case UsmallintPtr: - m_usmallintPtr = 0; - break; - case IntegerPtr: - m_integerPtr = 0; - break; - case UintegerPtr: - m_uintegerPtr = 0; - break; - case PointerPtr: - m_pointerPtr = 0; - break; - case Sqlchar: - m_sqlchar = 0; - break; - case Sqlstate: - m_sqlstate = 0; - break; - default: - ctx_assert(false); - break; - }; -} - -void -OdbcData::setValue(const OdbcData odbcData) -{ - if (m_type == Sqlchar) { - delete[] m_sqlchar; - m_sqlchar = 0; - } - m_type = odbcData.m_type; - switch (m_type) { - case Smallint: - m_smallint = odbcData.m_smallint; - break; - case Usmallint: - m_usmallint = odbcData.m_usmallint; - break; - case Integer: - m_integer = odbcData.m_integer; - break; - case Uinteger: - m_uinteger = odbcData.m_uinteger; - break; - case Pointer: - m_pointer = odbcData.m_pointer; - break; - case SmallintPtr: - m_smallintPtr = odbcData.m_smallintPtr; - break; - case UsmallintPtr: - m_usmallintPtr = odbcData.m_usmallintPtr; - break; - case IntegerPtr: - m_integerPtr = odbcData.m_integerPtr; - break; - case UintegerPtr: - m_uintegerPtr = odbcData.m_uintegerPtr; - break; - case PointerPtr: - m_pointerPtr = odbcData.m_pointerPtr; - break; - case Sqlchar: { - unsigned n = strlen(odbcData.m_sqlchar); - m_sqlchar = new char[n + 1]; - memcpy(m_sqlchar, odbcData.m_sqlchar, n + 1); - break; - } - case Sqlstate: - m_sqlstate = odbcData.m_sqlstate; - break; - default: - ctx_assert(false); - break; - }; -} - -// copy in from user buffer - -void -OdbcData::copyin(Ctx& ctx, Type type, SQLPOINTER buf, SQLINTEGER length) -{ - if (m_type == Sqlchar) { - delete[] m_sqlchar; - m_sqlchar = 0; - } - m_type = type; - switch (m_type) { - case Smallint: { - SQLSMALLINT val = 0; - switch (length) { - case 0: - case SQL_IS_SMALLINT: - val = (SQLSMALLINT)(SQLINTEGER)buf; - break; - case SQL_IS_USMALLINT: - val = (SQLUSMALLINT)(SQLUINTEGER)buf; - break; - case SQL_IS_INTEGER: - val = (SQLINTEGER)buf; - break; - case SQL_IS_UINTEGER: - val = (SQLUINTEGER)buf; - break; - default: - ctx.pushStatus(Error::Gen, "smallint input - invalid length %d", (int)length); - return; - } - m_smallint = val; - break; - } - case Usmallint: { - SQLUSMALLINT val = 0; - switch (length) { - case SQL_IS_SMALLINT: - val = (SQLSMALLINT)(SQLINTEGER)buf; - break; - case 0: - case SQL_IS_USMALLINT: - val = (SQLUSMALLINT)(SQLUINTEGER)buf; - break; - case SQL_IS_INTEGER: - val = (SQLINTEGER)buf; - break; - case SQL_IS_UINTEGER: - val = (SQLUINTEGER)buf; - break; - default: - ctx.pushStatus(Error::Gen, "unsigned smallint input - invalid length %d", (int)length); - return; - } - m_usmallint = val; - break; - } - case Integer: { - SQLINTEGER val = 0; - switch (length) { - case SQL_IS_SMALLINT: - val = (SQLSMALLINT)(SQLINTEGER)buf; - break; - case SQL_IS_USMALLINT: - val = (SQLUSMALLINT)(SQLUINTEGER)buf; - break; - case 0: - case SQL_IS_INTEGER: - val = (SQLINTEGER)buf; - break; - case SQL_IS_UINTEGER: - val = (SQLUINTEGER)buf; - break; - default: - ctx.pushStatus(Error::Gen, "integer input - invalid length %d", (int)length); - return; - } - m_integer = val; - break; - } - case Uinteger: { - SQLUINTEGER val = 0; - switch (length) { - case SQL_IS_SMALLINT: - val = (SQLSMALLINT)(SQLINTEGER)buf; - break; - case SQL_IS_USMALLINT: - val = (SQLUSMALLINT)(SQLUINTEGER)buf; - break; - case SQL_IS_INTEGER: - val = (SQLINTEGER)buf; - break; - case 0: - case SQL_IS_UINTEGER: - val = (SQLUINTEGER)buf; - break; - default: - ctx.pushStatus(Error::Gen, "unsigned integer input - invalid length %d", (int)length); - return; - } - m_uinteger = val; - break; - } - case Pointer: { - SQLPOINTER val = 0; - switch (length) { - case 0: - case SQL_IS_POINTER: - val = (SQLPOINTER)buf; - break; - default: - ctx.pushStatus(Error::Gen, "pointer input - invalid length %d", (int)length); - return; - } - m_pointer = val; - break; - } - case SmallintPtr: { - SQLSMALLINT* val = 0; - switch (length) { - case 0: - case SQL_IS_POINTER: - val = (SQLSMALLINT*)buf; - break; - default: - ctx.pushStatus(Error::Gen, "smallint pointer input - invalid length %d", (int)length); - return; - } - m_smallintPtr = val; - break; - } - case UsmallintPtr: { - SQLUSMALLINT* val = 0; - switch (length) { - case 0: - case SQL_IS_POINTER: - val = (SQLUSMALLINT*)buf; - break; - default: - ctx.pushStatus(Error::Gen, "unsigned smallint pointer input - invalid length %d", (int)length); - return; - } - m_usmallintPtr = val; - break; - } - case IntegerPtr: { - SQLINTEGER* val = 0; - switch (length) { - case 0: - case SQL_IS_POINTER: - val = (SQLINTEGER*)buf; - break; - default: - ctx.pushStatus(Error::Gen, "integer pointer input - invalid length %d", (int)length); - return; - } - m_integerPtr = val; - break; - } - case UintegerPtr: { - SQLUINTEGER* val = 0; - switch (length) { - case 0: - case SQL_IS_POINTER: - val = (SQLUINTEGER*)buf; - break; - default: - ctx.pushStatus(Error::Gen, "unsigned integer pointer input - invalid length %d", (int)length); - return; - } - m_uintegerPtr = val; - break; - } - case Sqlchar: { - const char* val = (char*)buf; - if (val == 0) { - ctx.pushStatus(Sqlstate::_HY009, Error::Gen, "null string input"); - return; - } - if (length < 0 && length != SQL_NTS) { - ctx.pushStatus(Error::Gen, "string input - invalid length %d", (int)length); - return; - } - if (length == SQL_NTS) { - m_sqlchar = strcpy(new char[strlen(val) + 1], val); - } else { - m_sqlchar = (char*)memcpy(new char[length + 1], val, length); - m_sqlchar[length] = 0; - } - break; - } - default: - ctx_assert(false); - break; - } -} - -// copy out to user buffer - -void -OdbcData::copyout(Ctx& ctx, SQLPOINTER buf, SQLINTEGER length, SQLINTEGER* total, SQLSMALLINT* total2) -{ - if (buf == 0) { - ctx.setCode(SQL_ERROR); - return; - } - switch (m_type) { - case Smallint: { - SQLSMALLINT* ptr = static_cast(buf); - *ptr = m_smallint; - break; - } - case Usmallint: { - SQLUSMALLINT* ptr = static_cast(buf); - *ptr = m_usmallint; - break; - } - case Integer: { - SQLINTEGER* ptr = static_cast(buf); - *ptr = m_integer; - break; - } - case Uinteger: { - SQLUINTEGER* ptr = static_cast(buf); - *ptr = m_uinteger; - break; - } - case Pointer: { - SQLPOINTER* ptr = static_cast(buf); - *ptr = m_pointer; - break; - } - case Sqlchar: { - char* ptr = static_cast(buf); - if (length < 0 && length != SQL_NTS) { - ctx.setCode(SQL_ERROR); - return; - } - if (length == SQL_NTS) { - strcpy(ptr, m_sqlchar); - } else { - strncpy(ptr, m_sqlchar, length); - } - if (total != 0) - *total = strlen(m_sqlchar); - if (total2 != 0) - *total2 = strlen(m_sqlchar); - break; - } - case Sqlstate: { - char* ptr = static_cast(buf); - const char* state = m_sqlstate->state(); - if (length < 0 && length != SQL_NTS) { - ctx.setCode(SQL_ERROR); - return; - } - if (length == SQL_NTS) { - strcpy(ptr, state); - } else { - strncpy(ptr, state, length); - } - if (total != 0) - *total = strlen(state); - if (total2 != 0) - *total2 = strlen(state); - break; - } - default: - ctx_assert(false); - break; - } -} - -void -OdbcData::print(char* buf, unsigned size) const -{ - switch (m_type) { - case Undef: - snprintf(buf, size, "undef"); - break; - case Smallint: - snprintf(buf, size, "%d", (int)m_smallint); - break; - case Usmallint: - snprintf(buf, size, "%u", (unsigned)m_usmallint); - break; - case Integer: - snprintf(buf, size, "%ld", (long)m_integer); - break; - case Uinteger: - snprintf(buf, size, "%lu", (unsigned long)m_uinteger); - break; - case Pointer: - snprintf(buf, size, "0x%lx", (unsigned long)m_pointer); - break; - case SmallintPtr: - snprintf(buf, size, "0x%lx", (unsigned long)m_smallintPtr); - break; - case UsmallintPtr: - snprintf(buf, size, "0x%lx", (unsigned long)m_usmallintPtr); - break; - case IntegerPtr: - snprintf(buf, size, "0x%lx", (unsigned long)m_integerPtr); - break; - case UintegerPtr: - snprintf(buf, size, "0x%lx", (unsigned long)m_uintegerPtr); - break; - case PointerPtr: - snprintf(buf, size, "0x%lx", (unsigned long)m_pointerPtr); - break; - case Sqlchar: - snprintf(buf, size, "%s", m_sqlchar); - break; - case Sqlstate: - snprintf(buf, size, "%s", m_sqlstate->state()); - break; - default: - snprintf(buf, size, "data(%d)", (int)m_type); - break; - }; -} diff --git a/ndb/src/old_files/client/odbc/common/OdbcData.hpp b/ndb/src/old_files/client/odbc/common/OdbcData.hpp deleted file mode 100644 index c1884507cfe..00000000000 --- a/ndb/src/old_files/client/odbc/common/OdbcData.hpp +++ /dev/null @@ -1,283 +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 ODBC_COMMON_OdbcData_hpp -#define ODBC_COMMON_OdbcData_hpp - -#include -#include - -/** - * @class OdbcData - * @brief Odbc data types and storage - * - * Stores diagnostics, attributes, and descriptors. Also used - * for converting to and from driver function arguments. - */ -class OdbcData { -public: - enum Type { - Undef = 0, - Smallint, - Usmallint, - Integer, - Uinteger, - Pointer, - SmallintPtr, - UsmallintPtr, - IntegerPtr, - UintegerPtr, - PointerPtr, - Sqlchar, - Sqlstate - }; - OdbcData(); - OdbcData(Type type); - OdbcData(const OdbcData& odbcData); - OdbcData(SQLSMALLINT smallint); - OdbcData(SQLUSMALLINT usmallint); - OdbcData(SQLINTEGER integer); - OdbcData(SQLUINTEGER uinteger); - OdbcData(SQLPOINTER pointer); - OdbcData(SQLSMALLINT* smallintPtr); - OdbcData(SQLUSMALLINT* usmallintPtr); - OdbcData(SQLINTEGER* integerPtr); - OdbcData(SQLUINTEGER* uintegerPtr); - OdbcData(SQLPOINTER* pointerPtr); - OdbcData(const char* sqlchar); - OdbcData(const ::Sqlstate& sqlstate); - ~OdbcData(); - Type type() const; - void setValue(); - void setValue(Type type); - void setValue(const OdbcData odbcData); - // get value - SQLSMALLINT smallint() const; - SQLUSMALLINT usmallint() const; - SQLINTEGER integer() const; - SQLUINTEGER uinteger() const; - SQLPOINTER pointer() const; - SQLSMALLINT* smallintPtr() const; - SQLUSMALLINT* usmallintPtr() const; - SQLINTEGER* integerPtr() const; - SQLUINTEGER* uintegerPtr() const; - SQLPOINTER* pointerPtr() const; - const char* sqlchar() const; - const ::Sqlstate& sqlstate() const; - // copy in from user buffer - void copyin(Ctx& ctx, Type type, SQLPOINTER buf, SQLINTEGER length); - // copy out to user buffer - void copyout(Ctx& ctx, SQLPOINTER buf, SQLINTEGER length, SQLINTEGER* total, SQLSMALLINT* total2 = 0); - // logging - void print(char* buf, unsigned size) const; -private: - OdbcData& operator=(const OdbcData& odbcData); // disallowed - Type m_type; - union { - SQLSMALLINT m_smallint; - SQLUSMALLINT m_usmallint; - SQLINTEGER m_integer; - SQLUINTEGER m_uinteger; - SQLPOINTER m_pointer; - SQLSMALLINT* m_smallintPtr; - SQLUSMALLINT* m_usmallintPtr; - SQLINTEGER* m_integerPtr; - SQLUINTEGER* m_uintegerPtr; - SQLPOINTER* m_pointerPtr; - char* m_sqlchar; - const ::Sqlstate* m_sqlstate; - }; -}; - -inline OdbcData::Type -OdbcData::type() const -{ - return m_type; -} - -inline -OdbcData::OdbcData(SQLSMALLINT smallint) : - m_type(Smallint), - m_smallint(smallint) -{ -} - -inline -OdbcData::OdbcData(SQLUSMALLINT usmallint) : - m_type(Usmallint), - m_usmallint(usmallint) -{ -} - -inline -OdbcData::OdbcData(SQLINTEGER integer) : - m_type(Integer), - m_integer(integer) -{ -} - -inline -OdbcData::OdbcData(SQLUINTEGER uinteger) : - m_type(Uinteger), - m_uinteger(uinteger) -{ -} - -inline -OdbcData::OdbcData(SQLPOINTER pointer) : - m_type(Pointer), - m_pointer(pointer) -{ -} - -inline -OdbcData::OdbcData(SQLSMALLINT* smallintPtr) : - m_type(SmallintPtr), - m_smallintPtr(smallintPtr) -{ -} - -inline -OdbcData::OdbcData(SQLUSMALLINT* usmallintPtr) : - m_type(UsmallintPtr), - m_usmallintPtr(usmallintPtr) -{ -} - -inline -OdbcData::OdbcData(SQLINTEGER* integerPtr) : - m_type(IntegerPtr), - m_integerPtr(integerPtr) -{ -} - -inline -OdbcData::OdbcData(SQLUINTEGER* uintegerPtr) : - m_type(UintegerPtr), - m_uintegerPtr(uintegerPtr) -{ -} - -inline -OdbcData::OdbcData(SQLPOINTER* pointerPtr) : - m_type(PointerPtr), - m_pointerPtr(pointerPtr) -{ -} - -inline -OdbcData::OdbcData(const char* sqlchar) : - m_type(Sqlchar) -{ - unsigned n = strlen(sqlchar); - m_sqlchar = new char[n + 1]; - strcpy(m_sqlchar, sqlchar); -} - -inline -OdbcData::OdbcData(const ::Sqlstate& sqlstate) : - m_type(Sqlstate), - m_sqlstate(&sqlstate) -{ -} - -// get value - -inline SQLSMALLINT -OdbcData::smallint() const -{ - ctx_assert(m_type == Smallint); - return m_smallint; -} - -inline SQLUSMALLINT -OdbcData::usmallint() const -{ - ctx_assert(m_type == Usmallint); - return m_usmallint; -} - -inline SQLINTEGER -OdbcData::integer() const -{ - ctx_assert(m_type == Integer); - return m_integer; -} - -inline SQLUINTEGER -OdbcData::uinteger() const -{ - ctx_assert(m_type == Uinteger); - return m_uinteger; -} - -inline SQLPOINTER -OdbcData::pointer() const -{ - ctx_assert(m_type == Pointer); - return m_pointer; -} - -inline SQLSMALLINT* -OdbcData::smallintPtr() const -{ - ctx_assert(m_type == SmallintPtr); - return m_smallintPtr; -} - -inline SQLUSMALLINT* -OdbcData::usmallintPtr() const -{ - ctx_assert(m_type == UsmallintPtr); - return m_usmallintPtr; -} - -inline SQLINTEGER* -OdbcData::integerPtr() const -{ - ctx_assert(m_type == IntegerPtr); - return m_integerPtr; -} - -inline SQLUINTEGER* -OdbcData::uintegerPtr() const -{ - ctx_assert(m_type == UintegerPtr); - return m_uintegerPtr; -} - -inline SQLPOINTER* -OdbcData::pointerPtr() const -{ - ctx_assert(m_type == PointerPtr); - return m_pointerPtr; -} - -inline const char* -OdbcData::sqlchar() const -{ - ctx_assert(m_type == Sqlchar); - return m_sqlchar; -} - -inline const ::Sqlstate& -OdbcData::sqlstate() const -{ - ctx_assert(m_type == Sqlstate); - return *m_sqlstate; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/ResultArea.cpp b/ndb/src/old_files/client/odbc/common/ResultArea.cpp deleted file mode 100644 index 79d7fb0ccc4..00000000000 --- a/ndb/src/old_files/client/odbc/common/ResultArea.cpp +++ /dev/null @@ -1,29 +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 */ - -#include "ResultArea.hpp" - -// ResultArea - -ResultArea::~ResultArea() -{ -} - -// ResultSet - -ResultSet::~ResultSet() -{ -} diff --git a/ndb/src/old_files/client/odbc/common/ResultArea.hpp b/ndb/src/old_files/client/odbc/common/ResultArea.hpp deleted file mode 100644 index d4890c44d99..00000000000 --- a/ndb/src/old_files/client/odbc/common/ResultArea.hpp +++ /dev/null @@ -1,162 +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 ODBC_COMMON_ResultArea_hpp -#define ODBC_COMMON_ResultArea_hpp - -#include -#include - -class SqlRow; - -/** - * @class ResultArea - * @brief Execution result - * - * ResultArea contains general results from executing SQL - * statements. Data rows from queries are fetched via derived - * class ResultSet. - */ -class ResultArea { -public: - ResultArea(); - virtual ~ResultArea(); - /** - * Get number of rows: - * - * - for queries: number of rows fetched so far - * - for DML statements: number of rows affected - * - for DDL and other statements: 0 - */ - CountType getCount() const; -protected: - void setCount(CountType count); - void addCount(unsigned count = 1); -private: - CountType m_count; -}; - -inline -ResultArea::ResultArea() : - m_count(0) -{ -} - -inline CountType -ResultArea::getCount() const -{ - return m_count; -} - -inline void -ResultArea::setCount(CountType count) -{ - m_count = count; -} - -inline void -ResultArea::addCount(unsigned count) -{ - m_count += count; -} - -/** - * @class ResultSet - * @brief Data rows from queries - * - * ResultSet is an interface implemented by SQL queries and - * virtual queries (such as SQLTables). It has an associated - * data row accessor SqlRow. - */ -class ResultSet : public ResultArea { -public: - ResultSet(const SqlRow& dataRow); - virtual ~ResultSet(); - enum State { - State_init = 1, // before first fetch - State_ok = 2, // last fetch succeeded - State_end = 3 // end of fetch or error - }; - void initState(); - State getState() const; - /** - * Get data accessor. Can be retrieved once and used after - * each successful ResultSet::fetch(). - */ - const SqlRow& dataRow() const; - /** - * Try to fetch one more row from this result set. - * - returns true if a row was fetched - * - returns false on end of fetch - * - returns false on error and sets error status - * It is a fatal error to call fetch after end of fetch. - */ - bool fetch(Ctx& ctx, Exec_base::Ctl& ctl); -protected: - /** - * Implementation of ResultSet::fetch() must be provided by - * each concrete subclass. - */ - virtual bool fetchImpl(Ctx& ctx, Exec_base::Ctl& ctl) = 0; - const SqlRow& m_dataRow; - State m_state; -}; - -inline -ResultSet::ResultSet(const SqlRow& dataRow) : - m_dataRow(dataRow), - m_state(State_end) // explicit initState() is required -{ -} - -inline const SqlRow& -ResultSet::dataRow() const -{ - return m_dataRow; -} - -inline void -ResultSet::initState() -{ - m_state = State_init; - setCount(0); -} - -inline ResultSet::State -ResultSet::getState() const -{ - return m_state; -} - -inline bool -ResultSet::fetch(Ctx& ctx, Exec_base::Ctl& ctl) -{ - if (! (m_state == State_init || m_state == State_ok)) { - // should not happen but return error instead of assert - ctx.pushStatus(Error::Gen, "invalid fetch state %d", (int)m_state); - m_state = State_end; - return false; - } - if (fetchImpl(ctx, ctl)) { - m_state = State_ok; - addCount(); - return true; - } - m_state = State_end; - return false; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/Sqlstate.cpp b/ndb/src/old_files/client/odbc/common/Sqlstate.cpp deleted file mode 100644 index 2d625a7c159..00000000000 --- a/ndb/src/old_files/client/odbc/common/Sqlstate.cpp +++ /dev/null @@ -1,93 +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 */ - -#include - -// Initialize Sqlstate records statically. -// They are not used by other static initializers. - -#define make_Sqlstate(state, code) \ - const Sqlstate Sqlstate::_##state(#state, code) - -make_Sqlstate(00000, SQL_SUCCESS); -make_Sqlstate(01004, SQL_SUCCESS_WITH_INFO); -make_Sqlstate(01S02, SQL_SUCCESS_WITH_INFO); -make_Sqlstate(07009, SQL_ERROR); -make_Sqlstate(08003, SQL_ERROR); -make_Sqlstate(21S01, SQL_ERROR); -make_Sqlstate(22001, SQL_ERROR); -make_Sqlstate(22002, SQL_ERROR); -make_Sqlstate(22003, SQL_ERROR); -make_Sqlstate(22005, SQL_ERROR); -make_Sqlstate(22008, SQL_ERROR); -make_Sqlstate(22012, SQL_ERROR); -make_Sqlstate(24000, SQL_ERROR); -make_Sqlstate(25000, SQL_ERROR); -make_Sqlstate(42000, SQL_ERROR); -make_Sqlstate(42S02, SQL_ERROR); -make_Sqlstate(42S22, SQL_ERROR); -make_Sqlstate(HY004, SQL_ERROR); -make_Sqlstate(HY009, SQL_ERROR); -make_Sqlstate(HY010, SQL_ERROR); -make_Sqlstate(HY011, SQL_ERROR); -make_Sqlstate(HY012, SQL_ERROR); -make_Sqlstate(HY014, SQL_ERROR); -make_Sqlstate(HY019, SQL_ERROR); -make_Sqlstate(HY024, SQL_ERROR); -make_Sqlstate(HY090, SQL_ERROR); -make_Sqlstate(HY091, SQL_ERROR); -make_Sqlstate(HY092, SQL_ERROR); -make_Sqlstate(HY095, SQL_ERROR); -make_Sqlstate(HY096, SQL_ERROR); -make_Sqlstate(HYC00, SQL_ERROR); -make_Sqlstate(HYT00, SQL_ERROR); -make_Sqlstate(IM000, SQL_ERROR); // consider all to be errors for now -make_Sqlstate(IM001, SQL_ERROR); -make_Sqlstate(IM999, SQL_ERROR); - -SQLRETURN -Sqlstate::getCode(SQLRETURN code) const -{ - int codes[2]; - int ranks[2]; - codes[0] = code; - codes[1] = m_code; - for (int i = 0; i < 2; i++) { - switch (codes[i]) { - case SQL_SUCCESS: - ranks[i] = 0; - break; - case SQL_SUCCESS_WITH_INFO: - ranks[i] = 1; - break; - case SQL_NO_DATA: - ranks[i] = 2; - break; - case SQL_NEED_DATA: - ranks[i] = 3; - break; - case SQL_ERROR: - ranks[i] = 9; - break; - default: - ctx_assert(false); - ranks[i] = 9; - } - } - if (ranks[0] < ranks[1]) - code = m_code; - return code; -} diff --git a/ndb/src/old_files/client/odbc/common/Sqlstate.hpp b/ndb/src/old_files/client/odbc/common/Sqlstate.hpp deleted file mode 100644 index 3b4665dc6ca..00000000000 --- a/ndb/src/old_files/client/odbc/common/Sqlstate.hpp +++ /dev/null @@ -1,85 +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 ODBC_COMMON_SqlState_hpp -#define ODBC_COMMON_SqlState_hpp - -#include - -/** - * SQL states. - */ -class Sqlstate { -public: - static const Sqlstate _00000; // no state - static const Sqlstate _01004; // data converted with truncation - static const Sqlstate _01S02; // option value changed - static const Sqlstate _07009; // invalid descriptor index - static const Sqlstate _08003; // connection not open - static const Sqlstate _21S01; // insert value list does not match column list - static const Sqlstate _22001; // string data, right truncation - static const Sqlstate _22002; // indicator variable required but not supplied - static const Sqlstate _22003; // data overflow - static const Sqlstate _22005; // data is not numeric-literal - static const Sqlstate _22008; // data value is not a valid timestamp - static const Sqlstate _22012; // division by zero - static const Sqlstate _24000; // invalid cursor state - static const Sqlstate _25000; // invalid transaction state - static const Sqlstate _42000; // syntax error or access violation - static const Sqlstate _42S02; // base table or view not found - static const Sqlstate _42S22; // column not found - static const Sqlstate _HY004; // invalid SQL data type - static const Sqlstate _HY009; // invalid use of null pointer - static const Sqlstate _HY010; // function sequence error - static const Sqlstate _HY011; // attribute cannot be set now - static const Sqlstate _HY012; // invalid transaction operation code - static const Sqlstate _HY014; // limit on number of handles exceeded - static const Sqlstate _HY019; // non-character and non-binary data sent in pieces - static const Sqlstate _HY024; // invalid attribute value - static const Sqlstate _HY090; // invalid string or buffer length - static const Sqlstate _HY091; // invalid descriptor field identifier - static const Sqlstate _HY092; // invalid attribute/option identifier - static const Sqlstate _HY095; // function type out of range - static const Sqlstate _HY096; // information type out of range - static const Sqlstate _HYC00; // optional feature not implemented - static const Sqlstate _HYT00; // timeout expired - static const Sqlstate _IM000; // implementation defined - static const Sqlstate _IM001; // driver does not support this function - static const Sqlstate _IM999; // fill in the right state please - // get the 5-char text string - const char* state() const; - // get code or "upgrade" existing code - SQLRETURN getCode(SQLRETURN code = SQL_SUCCESS) const; -private: - Sqlstate(const char* state, const SQLRETURN code); - const char* const m_state; - const SQLRETURN m_code; -}; - -inline const char* -Sqlstate::state() const -{ - return m_state; -} - -inline -Sqlstate::Sqlstate(const char* state, const SQLRETURN code) : - m_state(state), - m_code(code) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/StmtArea.cpp b/ndb/src/old_files/client/odbc/common/StmtArea.cpp deleted file mode 100644 index 5ce2d47d31a..00000000000 --- a/ndb/src/old_files/client/odbc/common/StmtArea.cpp +++ /dev/null @@ -1,112 +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 */ - -#include "DiagArea.hpp" -#include "StmtArea.hpp" -#include - -StmtArea::StmtArea(ConnArea& connArea) : - m_connArea(connArea), - m_state(Free), - m_useSchemaCon(false), - m_useConnection(false), - m_planTree(0), - m_execTree(0), - m_unbound(0), - m_rowCount(0), - m_tuplesFetched(0) -{ - for (unsigned i = 0; i <= 4; i++) - m_descArea[i] = 0; -} - -StmtArea::~StmtArea() -{ -} - -void -StmtArea::free(Ctx &ctx) -{ - CodeGen codegen(*this); - codegen.close(ctx); - codegen.free(ctx); - m_sqlText.assign(""); - m_nativeText.assign(""); - useSchemaCon(ctx, false); - useConnection(ctx, false); - m_stmtInfo.free(ctx); - m_planTree = 0; - m_execTree = 0; - m_rowCount = 0; - m_tuplesFetched = 0; - m_unbound = 0; - m_state = Free; -} - -void -StmtArea::setRowCount(Ctx& ctx, CountType rowCount) -{ - m_rowCount = rowCount; - // location - DescArea& ird = descArea(Desc_usage_IRD); - OdbcData data; - ird.getHeader().getField(ctx, SQL_DESC_ROWS_PROCESSED_PTR, data); - if (data.type() != OdbcData::Undef) { - SQLUINTEGER* countPtr = data.uintegerPtr(); - if (countPtr != 0) { - *countPtr = static_cast(m_rowCount); - } - } - // diagnostic - SQLINTEGER count = static_cast(m_rowCount); - ctx.diagArea().setHeader(SQL_DIAG_ROW_COUNT, count); -} - -void -StmtArea::setFunction(Ctx& ctx, const char* function, SQLINTEGER functionCode) -{ - m_stmtInfo.m_function = function; - m_stmtInfo.m_functionCode = functionCode; -} - -void -StmtArea::setFunction(Ctx& ctx) -{ - OdbcData function(m_stmtInfo.m_function); - ctx.diagArea().setHeader(SQL_DIAG_DYNAMIC_FUNCTION, function); - OdbcData functionCode(m_stmtInfo.m_functionCode); - ctx.diagArea().setHeader(SQL_DIAG_DYNAMIC_FUNCTION_CODE, functionCode); -} - -bool -StmtArea::useSchemaCon(Ctx& ctx, bool use) -{ - if (m_useSchemaCon != use) - if (! m_connArea.useSchemaCon(ctx, use)) - return false; - m_useSchemaCon = use; - return true; -} - -bool -StmtArea::useConnection(Ctx& ctx, bool use) -{ - if (m_useConnection != use) - if (! m_connArea.useConnection(ctx, use)) - return false; - m_useConnection = use; - return true; -} diff --git a/ndb/src/old_files/client/odbc/common/StmtArea.hpp b/ndb/src/old_files/client/odbc/common/StmtArea.hpp deleted file mode 100644 index a88c6d36e6d..00000000000 --- a/ndb/src/old_files/client/odbc/common/StmtArea.hpp +++ /dev/null @@ -1,157 +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 ODBC_COMMON_StmtArea_hpp -#define ODBC_COMMON_StmtArea_hpp - -#include -#include "ConnArea.hpp" -#include "StmtInfo.hpp" -#include "DescArea.hpp" - -class PlanTree; -class ExecTree; - -/** - * @class StmtArea - * @brief Public part of statement handle - */ -class StmtArea { -public: - // state between ODBC function calls - enum State { - Free = 1, // not in use - Prepared = 2, // statement prepared, maybe unbound - NeedData = 3, // executed, SQLParamData expected - Open = 4 // cursor open - }; - // connection area shared by all statements - ConnArea& connArea(); - State getState() const; - // SQL text - const BaseString& sqlText(); - BaseString& nativeText(); - // allocate or unallocate connections if necessary - bool useSchemaCon(Ctx& ctx, bool use); - bool useConnection(Ctx& ctx, bool use); - // statement info - StmtInfo& stmtInfo(); - DescArea& descArea(DescUsage u); - unsigned unbound() const; - // set row count here and in diagnostics - void setRowCount(Ctx& ctx, CountType rowCount); - CountType getRowCount() const; - // raw tuple count (tuples fetched from NDB) - void resetTuplesFetched(); - void incTuplesFetched(); - CountType getTuplesFetched() const; - // set dynamic function in StmtInfo only (at prepare) - void setFunction(Ctx& ctx, const char* function, SQLINTEGER functionCode); - // set dynamic function in diagnostics (at execute) - void setFunction(Ctx& ctx); -protected: - friend class CodeGen; - friend class Executor; - friend class Plan_root; - StmtArea(ConnArea& connArea); - ~StmtArea(); - void free(Ctx& ctx); - ConnArea& m_connArea; - State m_state; - BaseString m_sqlText; - BaseString m_nativeText; - bool m_useSchemaCon; - bool m_useConnection; - StmtInfo m_stmtInfo; - // plan tree output from parser and rewritten by analyze - PlanTree* m_planTree; - // exec tree output from analyze - ExecTree* m_execTree; - // pointers within HandleDesc allocated via HandleStmt - DescArea* m_descArea[1+4]; - // parameters with unbound SQL type - unsigned m_unbound; - CountType m_rowCount; - CountType m_tuplesFetched; -}; - -inline ConnArea& -StmtArea::connArea() -{ - return m_connArea; -} - -inline StmtArea::State -StmtArea::getState() const -{ - return m_state; -} - -inline const BaseString& -StmtArea::sqlText() { - return m_sqlText; -} - -inline BaseString& -StmtArea::nativeText() { - return m_nativeText; -} - -inline StmtInfo& -StmtArea::stmtInfo() -{ - return m_stmtInfo; -} - -inline DescArea& -StmtArea::descArea(DescUsage u) -{ - ctx_assert(1 <= u && u <= 4); - ctx_assert(m_descArea[u] != 0); - return *m_descArea[u]; -} - -inline unsigned -StmtArea::unbound() const -{ - return m_unbound; -} - -inline CountType -StmtArea::getRowCount() const -{ - return m_rowCount; -} - -inline void -StmtArea::resetTuplesFetched() -{ - m_tuplesFetched = 0; -} - -inline void -StmtArea::incTuplesFetched() -{ - m_tuplesFetched++; -} - -inline CountType -StmtArea::getTuplesFetched() const -{ - return m_tuplesFetched; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/StmtInfo.cpp b/ndb/src/old_files/client/odbc/common/StmtInfo.cpp deleted file mode 100644 index 3467fb5023e..00000000000 --- a/ndb/src/old_files/client/odbc/common/StmtInfo.cpp +++ /dev/null @@ -1,78 +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 */ - -#include "StmtInfo.hpp" - -const char* -StmtInfo::getDesc() const -{ - switch (m_name) { - case Stmt_name_select: - return "select"; - case Stmt_name_insert: - return "insert"; - case Stmt_name_update: - return "update"; - case Stmt_name_delete: - return "delete"; - case Stmt_name_create_table: - return "create table"; - case Stmt_name_create_index: - return "create index"; - case Stmt_name_drop_table: - return "drop table"; - case Stmt_name_drop_index: - return "drop index"; - default: - ctx_assert(false); - break; - } - return ""; -} - -StmtType -StmtInfo::getType() const -{ - StmtType type = Stmt_type_undef; - switch (m_name) { - case Stmt_name_select: // query - type = Stmt_type_query; - break; - case Stmt_name_insert: // DML - case Stmt_name_update: - case Stmt_name_delete: - type = Stmt_type_DML; - break; - case Stmt_name_create_table: // DDL - case Stmt_name_create_index: - case Stmt_name_drop_table: - case Stmt_name_drop_index: - type = Stmt_type_DDL; - break; - default: - ctx_assert(false); - break; - } - return type; -} - -void -StmtInfo::free(Ctx& ctx) -{ - m_name = Stmt_name_undef; - m_function = ""; - m_functionCode = SQL_DIAG_UNKNOWN_STATEMENT; -} diff --git a/ndb/src/old_files/client/odbc/common/StmtInfo.hpp b/ndb/src/old_files/client/odbc/common/StmtInfo.hpp deleted file mode 100644 index 9cd489be6da..00000000000 --- a/ndb/src/old_files/client/odbc/common/StmtInfo.hpp +++ /dev/null @@ -1,86 +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 ODBC_COMMON_StmtInfo_hpp -#define ODBC_COMMON_StmtInfo_hpp - -#include - -// general type (determined by SQL command) -enum StmtType { - Stmt_type_undef = 0, - Stmt_type_query, // select - Stmt_type_DML, // insert, update, delete - Stmt_type_DDL, // create, drop, alter table - Stmt_type_info // virtual query -}; - -// specific SQL command (first 1-2 words) -enum StmtName { - Stmt_name_undef = 0, - Stmt_name_select, - Stmt_name_insert, - Stmt_name_update, - Stmt_name_delete, - Stmt_name_create_table, - Stmt_name_create_index, - Stmt_name_drop_table, - Stmt_name_drop_index -}; - -/** - * @class StmtInfo - * @brief Statement Info - * - * Statement info. This is a separate class which could - * be used in cases not tied to statement execution. - */ -class StmtInfo { -public: - StmtInfo(); - void setName(StmtName name); - StmtName getName() const; - const char* getDesc() const; - StmtType getType() const; - void free(Ctx& ctx); -private: - friend class StmtArea; - StmtName m_name; - const char* m_function; // not allocated - SQLINTEGER m_functionCode; -}; - -inline -StmtInfo::StmtInfo() : - m_name(Stmt_name_undef), - m_function(""), - m_functionCode(SQL_DIAG_UNKNOWN_STATEMENT) -{ -} - -inline void -StmtInfo::setName(StmtName name) -{ - m_name = name; -} - -inline StmtName -StmtInfo::getName() const -{ - return m_name; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/common/common.cpp b/ndb/src/old_files/client/odbc/common/common.cpp deleted file mode 100644 index 73d14c82efe..00000000000 --- a/ndb/src/old_files/client/odbc/common/common.cpp +++ /dev/null @@ -1,17 +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 */ - -#include "common.hpp" diff --git a/ndb/src/old_files/client/odbc/common/common.hpp b/ndb/src/old_files/client/odbc/common/common.hpp deleted file mode 100644 index d2f243b6437..00000000000 --- a/ndb/src/old_files/client/odbc/common/common.hpp +++ /dev/null @@ -1,124 +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 ODBC_COMMON_common_hpp -#define ODBC_COMMON_common_hpp - -#define stpcpy stpcpy -#include -#undef swap - -// misc defs - -#ifdef NDB_GCC // only for odbc -#define PRINTFLIKE(i,j) __attribute__ ((format (printf, i, j))) -#else -#define PRINTFLIKE(i,j) -#endif - -// odbc defs - -#define ODBCVER 0x0351 - -#ifdef NDB_WIN32 -#include -#endif - -extern "C" { -#include -} -// some types which may be missing -#ifndef SQL_BLOB -#define SQL_BLOB 30 -#endif -#ifndef SQL_BLOB_LOCATOR -#define SQL_BLOB_LOCATOR 31 -#endif -#ifndef SQL_CLOB -#define SQL_CLOB 40 -#endif -#ifndef SQL_CLOB_LOCATOR -#define SQL_CLOB_LOCATOR 41 -#endif - -// until real blobs use Varchar of this size -#define FAKE_BLOB_SIZE 2000 - -#define SQL_HANDLE_ROOT 0 // assume real handles != 0 - -enum OdbcHandle { - Odbc_handle_root = 0, // not an odbc handle - Odbc_handle_env = 1, - Odbc_handle_dbc = 2, - Odbc_handle_stmt = 4, - Odbc_handle_desc = 8, - Odbc_handle_all = (1|2|4|8) -}; - -// ndb defs - -#undef BOOL -#include -// this info not yet on api side -#include -#include - -#ifndef MAX_TAB_NAME_SIZE -#define MAX_TAB_NAME_SIZE 128 -#endif - -#ifndef MAX_ATTR_NAME_SIZE -#define MAX_ATTR_NAME_SIZE 32 -#endif - -#ifndef MAX_ATTR_DEFAULT_VALUE_SIZE -#define MAX_ATTR_DEFAULT_VALUE_SIZE 128 -#endif - -typedef Uint32 NdbAttrId; -typedef Uint64 CountType; - -// ndb odbc defs - -#define NDB_ODBC_COMPONENT_VENDOR "[MySQL]" -#define NDB_ODBC_COMPONENT_DRIVER "[ODBC driver]" -#define NDB_ODBC_COMPONENT_DATABASE "[NDB Cluster]" - -#define NDB_ODBC_VERSION_MAJOR 0 -#define NDB_ODBC_VERSION_MINOR 22 -#define NDB_ODBC_VERSION_STRING "0.22" - -// reserved error codes for non-NDB errors -#define NDB_ODBC_ERROR_MIN 5000 -#define NDB_ODBC_ERROR_MAX 5100 - -// maximum log level compiled in -#ifdef VM_TRACE -#define NDB_ODBC_MAX_LOG_LEVEL 5 -#else -#define NDB_ODBC_MAX_LOG_LEVEL 3 -#endif - -// driver specific statement attribute for number of NDB tuples fetched -#define SQL_ATTR_NDB_TUPLES_FETCHED 66601 - -#include -#include -#include - -#undef assert - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp b/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp deleted file mode 100644 index 433347c9a70..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp +++ /dev/null @@ -1,42 +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 */ - -#include -#include "DictCatalog.hpp" -#include "DictSchema.hpp" - -DictCatalog::~DictCatalog() -{ - for (Schemas::iterator i = m_schemas.begin(); i != m_schemas.end(); i++) { - delete *i; - *i = 0; - } -} - -DictSchema* -DictCatalog::findSchema(Ctx& ctx, const BaseString& name) -{ - for (Schemas::iterator i = m_schemas.begin(); i != m_schemas.end(); i++) { - DictSchema* schema = *i; - ctx_assert(schema != 0); - if (strcmp(schema->getName().c_str(), name.c_str()) == 0) - return schema; - } - ctx_assert(strcmp(name.c_str(), "NDB") == 0); - DictSchema* schema = new DictSchema(m_connArea, "NDB"); - m_schemas.push_back(schema); - return schema; -} diff --git a/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp b/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp deleted file mode 100644 index 5452990a51b..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp +++ /dev/null @@ -1,64 +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 ODBC_DICTIONARY_DictCatalog_hpp -#define ODBC_DICTIONARY_DictCatalog_hpp - -#include -#include -#include "DictSchema.hpp" - -class Ctx; -class ConnArea; -class DictSchema; - -/** - * @class DictCatalog - * @brief Collection of schemas - */ -class DictCatalog { -public: - DictCatalog(const ConnArea& connArea); - ~DictCatalog(); - const ConnArea& connArea() const; - DictSchema* findSchema(Ctx& ctx, const BaseString& name); - void addSchema(DictSchema* schema); -protected: - const ConnArea& m_connArea; - typedef std::list Schemas; - Schemas m_schemas; -}; - -inline -DictCatalog::DictCatalog(const ConnArea& connArea) : - m_connArea(connArea) -{ -} - -inline const ConnArea& -DictCatalog::connArea() const -{ - return m_connArea; -} - -inline void -DictCatalog::addSchema(DictSchema* schema) -{ - m_schemas.push_back(schema); - schema->setParent(this); -} - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp b/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp deleted file mode 100644 index fa0128f1ddb..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp +++ /dev/null @@ -1,23 +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 */ - -#include "DictColumn.hpp" - -DictColumn::~DictColumn() -{ - delete[] m_defaultValue; - m_defaultValue = 0; -} diff --git a/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp b/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp deleted file mode 100644 index 945fb86367b..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp +++ /dev/null @@ -1,143 +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 ODBC_DICTIONARY_DictColumn_hpp -#define ODBC_DICTIONARY_DictColumn_hpp - -#include -#include - -class Ctx; -class SqlType; -class ConnArea; -class DictTable; - -/** - * @class DictColumn - * @brief Table column - */ -class DictColumn { -public: - DictColumn(const ConnArea& connArea, const BaseString& name, const SqlType& sqlType); - ~DictColumn(); - const BaseString& getName() const; - const SqlType& sqlType() const; - void setPosition(unsigned position); - unsigned getPosition() const; - void setParent(DictTable* parent); - DictTable* getParent() const; - NdbAttrId getAttrId() const; - bool isKey() const; - bool isTupleId() const; - bool isAutoIncrement() const; - const char* getDefaultValue() const; -protected: - friend class DictSys; - friend class DictTable; - const ConnArea& m_connArea; - const BaseString m_name; - SqlType m_sqlType; - unsigned m_position; - DictTable* m_parent; - bool m_key; // part of key - bool m_tupleId; // the tuple id - bool m_autoIncrement; - const char* m_defaultValue; -}; - -inline -DictColumn::DictColumn(const ConnArea& connArea, const BaseString& name, const SqlType& sqlType) : - m_connArea(connArea), - m_name(name), - m_sqlType(sqlType), - m_position(0), - m_parent(0), - m_key(false), - m_tupleId(false), - m_autoIncrement(false), - m_defaultValue(0) -{ -} - -inline const SqlType& -DictColumn::sqlType() const -{ - return m_sqlType; -} - -inline void -DictColumn::setPosition(unsigned position) -{ - ctx_assert(position != 0); - m_position = position; -} - -inline unsigned -DictColumn::getPosition() const -{ - return m_position; -} - -inline void -DictColumn::setParent(DictTable* parent) -{ - m_parent = parent; -} - -inline DictTable* -DictColumn::getParent() const -{ - return m_parent; -} - -inline const BaseString& -DictColumn::getName() const -{ - return m_name; -} - -inline NdbAttrId -DictColumn::getAttrId() const -{ - ctx_assert(m_position != 0); - return static_cast(m_position - 1); -} - -inline bool -DictColumn::isKey() const -{ - return m_key; -} - -inline bool -DictColumn::isTupleId() const -{ - return m_tupleId; -} - -inline bool -DictColumn::isAutoIncrement() const -{ - return m_autoIncrement; -} - -inline const char* -DictColumn::getDefaultValue() const -{ - return m_defaultValue; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp b/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp deleted file mode 100644 index 95d93318902..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp +++ /dev/null @@ -1,29 +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 */ - -#include "DictTable.hpp" -#include "DictIndex.hpp" - -DictIndex::~DictIndex() -{ -} - -void -DictIndex::setColumn(unsigned i, DictColumn* column) -{ - ctx_assert(1 <= i && i <= m_size); - m_columns[i] = column; -} diff --git a/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp b/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp deleted file mode 100644 index 7ba46daaae3..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp +++ /dev/null @@ -1,108 +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 ODBC_DICTIONARY_DictIndex_hpp -#define ODBC_DICTIONARY_DictIndex_hpp - -#include -#include -#include "DictColumn.hpp" - -class Ctx; -class ConnArea; -class DictTable; -class DictColumn; -class DictIndex; - -/** - * @class DictIndex - * @brief Database table - */ -class DictIndex { - friend class DictSchema; -public: - DictIndex(const ConnArea& connArea, const BaseString& name, NdbDictionary::Object::Type type, unsigned size); - ~DictIndex(); - NdbDictionary::Object::Type getType() const; - unsigned getSize() const; - void setTable(DictTable* table); - DictTable* getTable() const; - void setColumn(unsigned i, DictColumn* column); - DictColumn* getColumn(unsigned i) const; - const BaseString& getName() const; - DictColumn* findColumn(const BaseString& name) const; -protected: - const ConnArea& m_connArea; - const BaseString m_name; - const NdbDictionary::Object::Type m_type; - const unsigned m_size; - DictSchema* m_parent; - DictTable* m_table; - typedef std::vector Columns; // pointers to table columns - Columns m_columns; -}; - -inline -DictIndex::DictIndex(const ConnArea& connArea, const BaseString& name, NdbDictionary::Object::Type type, unsigned size) : - m_connArea(connArea), - m_name(name), - m_type(type), - m_size(size), - m_parent(0), - m_columns(1 + size) -{ -} - -inline NdbDictionary::Object::Type -DictIndex::getType() const -{ - return m_type; -} - -inline unsigned -DictIndex::getSize() const -{ - ctx_assert(m_columns.size() == 1 + m_size); - return m_size; -} - -inline void -DictIndex::setTable(DictTable* table) -{ - m_table = table; -} - -inline DictTable* -DictIndex::getTable() const -{ - return m_table; -} - -inline DictColumn* -DictIndex::getColumn(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_size); - ctx_assert(m_columns[i] != 0); - return m_columns[i]; -} - -inline const BaseString& -DictIndex::getName() const -{ - return m_name; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp b/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp deleted file mode 100644 index 91939cb2f26..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp +++ /dev/null @@ -1,155 +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 */ - -#include -#include -#include "DictCatalog.hpp" -#include "DictSchema.hpp" -#include "DictTable.hpp" -#include "DictTable.hpp" -#include "DictColumn.hpp" -#include "DictIndex.hpp" -#include "DictSys.hpp" - -DictSchema::~DictSchema() -{ - for (Tables::iterator i = m_tables.begin(); i != m_tables.end(); i++) { - delete *i; - *i = 0; - } -} - -DictTable* -DictSchema::findTable(const BaseString& name) -{ - for (Tables::iterator i = m_tables.begin(); i != m_tables.end(); i++) { - DictTable* table = *i; - ctx_assert(table != 0); - if (strcmp(table->getName().c_str(), name.c_str()) == 0) - return table; - } - return 0; -} - -void -DictSchema::deleteTable(Ctx& ctx, const BaseString& name) -{ - Tables::iterator i = m_tables.begin(); - while (i != m_tables.end()) { - DictTable* table = *i; - ctx_assert(table != 0); - if (strcmp(table->getName().c_str(), name.c_str()) == 0) { - ctx_log2(("purge table %s from dictionary", name.c_str())); - delete table; - Tables::iterator j = i; - i++; - m_tables.erase(j); - break; - } - i++; - } -} - -void -DictSchema::deleteTableByIndex(Ctx& ctx, const BaseString& indexName) -{ - DictTable* foundTable = 0; - for (Tables::iterator i = m_tables.begin(); i != m_tables.end(); i++) { - DictTable* table = *i; - ctx_assert(table != 0); - for (unsigned k = 1; k <= table->indexCount(); k++) { - const DictIndex* index = table->getIndex(k); - if (strcmp(index->getName().c_str(), indexName.c_str()) == 0) { - foundTable = table; - break; - } - } - if (foundTable != 0) - break; - } - if (foundTable != 0) - deleteTable(ctx, foundTable->getName()); -} - -DictTable* -DictSchema::loadTable(Ctx& ctx, const BaseString& name) -{ - ctx_log4(("%s: load from NDB", name.c_str())); - Ndb* ndb = m_connArea.ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return 0; - } - const NdbDictionary::Table* ndbTable = ndbDictionary->getTable(name.c_str()); - if (ndbTable == 0) { - const NdbError& ndbError = ndbDictionary->getNdbError(); - if (ndbError.code == 709) { - // try built-in system table - DictTable* table = DictSys::loadTable(ctx, this, name); - if (table != 0) { - return table; - } - ctx_log3(("%s: not found in NDB", name.c_str())); - return 0; - } - ctx.pushStatus(ndbDictionary->getNdbError(), "getTable"); - return 0; - } - int nattr = ndbTable->getNoOfColumns(); - DictTable* table = new DictTable(m_connArea, name, nattr); - for (unsigned position = 1; position <= (unsigned)nattr; position++) { - DictColumn* column = table->loadColumn(ctx, position); - if (column == 0) - return 0; - ctx_log4(("add column %u %s", column->getPosition(), column->getName().c_str())); - } - // load indexes - NdbDictionary::Dictionary::List list; - if (ndbDictionary->listIndexes(list, name.c_str()) == -1) { - ctx.pushStatus(ndbDictionary->getNdbError(), "listIndexes"); - return 0; - } - for (unsigned i = 0; i < list.count; i++) { - const NdbDictionary::Dictionary::List::Element& elt = list.elements[i]; - if (elt.state != NdbDictionary::Object::StateOnline) { - ctx_log1(("%s: skip broken index %s", name.c_str(), elt.name)); - continue; - } - if (elt.type != NdbDictionary::Object::UniqueHashIndex && elt.type != NdbDictionary::Object::OrderedIndex) { - ctx_log1(("%s: skip unknown index type %s", name.c_str(), elt.name)); - continue; - } - const NdbDictionary::Index* ndbIndex = ndbDictionary->getIndex(elt.name, name.c_str()); - if (ndbIndex == 0) { - ctx.pushStatus(ndbDictionary->getNdbError(), "table %s getIndex %s", name.c_str(), elt.name); - return 0; - } - DictIndex* index = new DictIndex(m_connArea, elt.name, elt.type, ndbIndex->getNoOfIndexColumns()); - for (unsigned j = 0; j < index->getSize(); j++) { - const char* cname = ndbIndex->getIndexColumn(j); - ctx_assert(cname != 0); - DictColumn* icolumn = table->findColumn(cname); - ctx_assert(icolumn != 0); - index->setColumn(1 + j, icolumn); - } - table->addIndex(index); - ctx_log3(("%s: index %s: load from NDB done", name.c_str(), elt.name)); - } - addTable(table); - ctx_log3(("%s: load from NDB done", name.c_str())); - return table; -} diff --git a/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp b/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp deleted file mode 100644 index 099352edbb9..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp +++ /dev/null @@ -1,89 +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 ODBC_DICTIONARY_DictSchema_hpp -#define ODBC_DICTIONARY_DictSchema_hpp - -#include -#include -#include "DictTable.hpp" - -class Ctx; -class ConnArea; -class DictCatalog; -class DictTable; - -/** - * @class DictSchema - * @brief Collection of tables - */ -class DictSchema { -public: - DictSchema(const ConnArea& connArea, const BaseString& name); - ~DictSchema(); - const BaseString& getName() const; - void setParent(DictCatalog* parent); - DictCatalog* getParent() const; - void addTable(DictTable* table); - DictTable* findTable(const BaseString& name); - DictTable* loadTable(Ctx& ctx, const BaseString& name); - void deleteTable(Ctx& ctx, const BaseString& name); - void deleteTableByIndex(Ctx& ctx, const BaseString& indexName); -protected: - friend class DictCatalog; - friend class DictSys; - const ConnArea& m_connArea; - BaseString m_name; - DictCatalog* m_parent; - typedef std::list Tables; - Tables m_tables; -}; - -inline -DictSchema::DictSchema(const ConnArea& connArea, const BaseString& name) : - m_connArea(connArea), - m_name(name), - m_parent(0) -{ - ctx_assert(strcmp(name.c_str(), "NDB") == 0); -} - -inline const BaseString& -DictSchema::getName() const -{ - return m_name; -} - -inline void -DictSchema::setParent(DictCatalog* parent) -{ - m_parent = parent; -} - -inline DictCatalog* -DictSchema::getParent() const -{ - return m_parent; -} - -inline void -DictSchema::addTable(DictTable* table) -{ - m_tables.push_back(table); - table->setParent(this); -} - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp b/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp deleted file mode 100644 index 1ceef66ee57..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp +++ /dev/null @@ -1,433 +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 */ - -#include -#include -#include "DictSchema.hpp" -#include "DictTable.hpp" -#include "DictColumn.hpp" -#include "DictSys.hpp" - -#define arraySize(x) sizeof(x)/sizeof(x[0]) - -#define MAX_SCHEMA_NAME_LENGTH 32 -#define MAX_REMARKS_LENGTH 256 - -// typeinfo - -static DictSys::Column -column_ODBC_TYPEINFO[] = { - DictSys::Column( - 1, - "TYPE_NAME", - false, - SqlType(SqlType::Varchar, 20, false) - ), - DictSys::Column( - 2, - "DATA_TYPE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 3, - "COLUMN_SIZE", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 4, - "LITERAL_PREFIX", - false, - SqlType(SqlType::Varchar, 1, true) - ), - DictSys::Column( - 5, - "LITERAL_SUFFIX", - false, - SqlType(SqlType::Varchar, 1, true) - ), - DictSys::Column( - 6, - "CREATE_PARAMS", - false, - SqlType(SqlType::Varchar, 20, true) - ), - DictSys::Column( - 7, - "NULLABLE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 8, - "CASE_SENSITIVE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 9, - "SEARCHABLE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 10, - "UNSIGNED_ATTRIBUTE", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 11, - "FIXED_PREC_SCALE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 12, - "AUTO_UNIQUE_VALUE", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 13, - "LOCAL_TYPE_NAME", - false, - SqlType(SqlType::Varchar, 20, true) - ), - DictSys::Column( - 14, - "MINIMUM_SCALE", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 15, - "MAXIMUM_SCALE", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 16, - "SQL_DATA_TYPE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 17, - "SQL_DATETIME_SUB", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 18, - "NUM_PREC_RADIX", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 19, - "INTERVAL_PRECISION", - false, - SqlType(SqlType::Integer, true) - ) -}; - -static DictSys::Table -table_ODBC_TYPEINFO( - DictSys::OdbcTypeinfo, - "ODBC$TYPEINFO", - column_ODBC_TYPEINFO, - arraySize(column_ODBC_TYPEINFO) -); - -// tables - -static DictSys::Column -column_ODBC_TABLES[] = { - // perl docs/systables.pl tables -c - DictSys::Column( - 1, - "TABLE_CAT", - false, - SqlType(SqlType::Varchar, MAX_SCHEMA_NAME_LENGTH, true) - ), - DictSys::Column( - 2, - "TABLE_SCHEM", - false, - SqlType(SqlType::Varchar, MAX_SCHEMA_NAME_LENGTH, true) - ), - DictSys::Column( - 3, - "TABLE_NAME", - false, - SqlType(SqlType::Varchar, MAX_TAB_NAME_SIZE, false) - ), - DictSys::Column( - 4, - "TABLE_TYPE", - false, - SqlType(SqlType::Varchar, 20, false) - ), - DictSys::Column( - 5, - "REMARKS", - false, - SqlType(SqlType::Varchar, MAX_REMARKS_LENGTH, true) - ) -}; - -static DictSys::Table -table_ODBC_TABLES( - DictSys::OdbcTables, - "ODBC$TABLES", - column_ODBC_TABLES, - arraySize(column_ODBC_TABLES) -); - -// columns - -static DictSys::Column -column_ODBC_COLUMNS[] = { - // perl docs/systables.pl columns -c - DictSys::Column( - 1, - "TABLE_CAT", - false, - SqlType(SqlType::Varchar, MAX_SCHEMA_NAME_LENGTH, true) - ), - DictSys::Column( - 2, - "TABLE_SCHEM", - false, - SqlType(SqlType::Varchar, MAX_SCHEMA_NAME_LENGTH, true) - ), - DictSys::Column( - 3, - "TABLE_NAME", - false, - SqlType(SqlType::Varchar, MAX_TAB_NAME_SIZE, false) - ), - DictSys::Column( - 4, - "COLUMN_NAME", - false, - SqlType(SqlType::Varchar, MAX_ATTR_NAME_SIZE, false) - ), - DictSys::Column( - 5, - "DATA_TYPE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 6, - "TYPE_NAME", - false, - SqlType(SqlType::Varchar, 20, false) - ), - DictSys::Column( - 7, - "COLUMN_SIZE", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 8, - "BUFFER_LENGTH", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 9, - "DECIMAL_DIGITS", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 10, - "NUM_PREC_RADIX", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 11, - "NULLABLE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 12, - "REMARKS", - false, - SqlType(SqlType::Varchar, MAX_REMARKS_LENGTH, true) - ), - DictSys::Column( - 13, - "COLUMN_DEF", - false, - SqlType(SqlType::Varchar, MAX_ATTR_DEFAULT_VALUE_SIZE, true) - ), - DictSys::Column( - 14, - "SQL_DATA_TYPE", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 15, - "SQL_DATETIME_SUB", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 16, - "CHAR_OCTET_LENGTH", - false, - SqlType(SqlType::Integer, true) - ), - DictSys::Column( - 17, - "ORDINAL_POSITION", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 18, - "IS_NULLABLE", - false, - SqlType(SqlType::Varchar, 3, true) - ) -}; - -static DictSys::Table -table_ODBC_COLUMNS( - DictSys::OdbcColumns, - "ODBC$COLUMNS", - column_ODBC_COLUMNS, - arraySize(column_ODBC_COLUMNS) -); - -// primarykeys - -static DictSys::Column -column_ODBC_PRIMARYKEYS[] = { - DictSys::Column( - 1, - "TABLE_CAT", - false, - SqlType(SqlType::Varchar, MAX_SCHEMA_NAME_LENGTH, true) - ), - DictSys::Column( - 2, - "TABLE_SCHEM", - false, - SqlType(SqlType::Varchar, MAX_SCHEMA_NAME_LENGTH, true) - ), - DictSys::Column( - 3, - "TABLE_NAME", - false, - SqlType(SqlType::Varchar, MAX_TAB_NAME_SIZE, false) - ), - DictSys::Column( - 4, - "COLUMN_NAME", - false, - SqlType(SqlType::Varchar, MAX_ATTR_NAME_SIZE, false) - ), - DictSys::Column( - 5, - "KEY_SEQ", - false, - SqlType(SqlType::Integer, false) - ), - DictSys::Column( - 6, - "PK_NAME", - false, - SqlType(SqlType::Varchar, MAX_ATTR_NAME_SIZE, true) - ) -}; - -static DictSys::Table -table_ODBC_PRIMARYKEYS( - DictSys::OdbcPrimarykeys, - "ODBC$PRIMARYKEYS", - column_ODBC_PRIMARYKEYS, - arraySize(column_ODBC_PRIMARYKEYS) -); - -static DictSys::Column -column_DUAL[] = { - DictSys::Column( - 1, - "DUMMY", - false, - SqlType(SqlType::Varchar, 1, false) - ) -}; - -static DictSys::Table -table_DUAL( - DictSys::Dual, - "DUAL", - column_DUAL, - arraySize(column_DUAL) -); - -// all tables - -static const DictSys::Table* -tableList[] = { - &table_ODBC_TYPEINFO, - &table_ODBC_TABLES, - &table_ODBC_COLUMNS, - &table_ODBC_PRIMARYKEYS, - &table_DUAL -}; - -static const unsigned tableCount = arraySize(tableList); - -DictTable* -DictSys::loadTable(Ctx& ctx, DictSchema* schema, const BaseString& name) -{ - const Table* tp = 0; - for (unsigned i = 0; i < tableCount; i++) { - if (strcmp(tableList[i]->m_name, name.c_str()) == 0) { - tp = tableList[i]; - break; - } - } - if (tp == 0) - return 0; - DictTable* table = new DictTable(schema->m_connArea, tp->m_name, tp->m_columnCount); - table->sysId(tp->m_id); - schema->addTable(table); - for (unsigned position = 1; position <= tp->m_columnCount; position++) { - const Column* cp = &tp->m_columnList[position - 1]; - ctx_assert(cp->m_position == position); - const SqlType& sqlType = cp->m_sqlType; - DictColumn* column = new DictColumn(table->m_connArea, cp->m_name, sqlType); - table->setColumn(position, column); - column->m_key = cp->m_key; - if (column->m_key) - table->m_keys.push_back(column); - } - ctx_log3(("%s: system table defined", name.c_str())); - return table; -} diff --git a/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp b/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp deleted file mode 100644 index e6fa661fd59..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp +++ /dev/null @@ -1,77 +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 ODBC_DICTIONARY_DictSys_hpp -#define ODBC_DICTIONARY_DictSys_hpp - -#include -#include - -class Ctx; -class DictSchema; -class DictTable; -class SqlType; - -/** - * @class DictSys - * @brief Built-in tables (replaced later by real systables) - */ -class DictSys { -public: - enum Id { - Undef = 0, - OdbcTypeinfo = 1, - OdbcTables = 2, - OdbcColumns = 3, - OdbcPrimarykeys = 4, - Dual = 5 - }; - struct Column { - Column(unsigned position, const char* name, bool key, const SqlType& sqlType); - const unsigned m_position; - const char* const m_name; - const bool m_key; - const SqlType m_sqlType; - }; - struct Table { - Table(Id id, const char* name, const Column* columnList, unsigned columnCount); - const Id m_id; - const char* m_name; - const Column* const m_columnList; - const unsigned m_columnCount; - }; - static DictTable* loadTable(Ctx& ctx, DictSchema* schema, const BaseString& name); -}; - -inline -DictSys::Column::Column(unsigned position, const char* name, bool key, const SqlType& sqlType) : - m_position(position), - m_name(name), - m_key(key), - m_sqlType(sqlType) -{ -} - -inline -DictSys::Table::Table(DictSys::Id id, const char* name, const Column* columnList, unsigned columnCount) : - m_id(id), - m_name(name), - m_columnList(columnList), - m_columnCount(columnCount) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp b/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp deleted file mode 100644 index 4db7d3b3aec..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp +++ /dev/null @@ -1,91 +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 */ - -#include -#include -#include -#include -#include "DictSchema.hpp" -#include "DictTable.hpp" -#include "DictColumn.hpp" -#include "DictColumn.hpp" - -DictTable::~DictTable() -{ - for (Columns::iterator i = m_columns.begin(); i != m_columns.end(); i++) { - delete *i; - *i = 0; - } - for (Indexes::iterator i = m_indexes.begin(); i != m_indexes.end(); i++) { - delete *i; - *i = 0; - } -} - -DictColumn* -DictTable::findColumn(const BaseString& name) const -{ - for (unsigned i = 1; i <= getSize(); i++) { - DictColumn* column = m_columns[i]; - ctx_assert(column != 0); - if (strcmp(column->getName().c_str(), name.c_str()) == 0) - return column; - } - return 0; -} - -DictColumn* -DictTable::loadColumn(Ctx& ctx, unsigned position) -{ - Ndb* ndb = m_connArea.ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return 0; - } - const NdbDictionary::Table* ndbTable = ndbDictionary->getTable(m_name.c_str()); - ctx_assert(ndbTable != 0); - ctx_assert(position != 0); - NdbAttrId attrId = position - 1; - const NdbDictionary::Column* ndbColumn = ndbTable->getColumn(attrId); - ctx_assert(ndbColumn != 0); - SqlType sqlType(ctx, ndbColumn); - if (! ctx.ok()) - return 0; - DictColumn* column = new DictColumn(m_connArea, ndbColumn->getName(), sqlType); - setColumn(position, column); - column->m_key = column->m_tupleId = false; - if (ndbColumn->getPrimaryKey()) - column->m_key = true; - if (ndbColumn->getTupleKey()) - column->m_key = column->m_tupleId = true; - if (column->m_key) - m_keys.push_back(column); - // props - const char* value; - column->m_autoIncrement = false; - if (ndbColumn->getAutoIncrement()) - column->m_autoIncrement = true; - column->m_defaultValue = 0; - if ((value = ndbColumn->getDefaultValue()) != 0 && strlen(value) != 0) - column->m_defaultValue = strcpy(new char[strlen(value) + 1], value); - ctx_log4(("column %u %s keyFlag=%d idFlag=%d", position, ndbColumn->getName(), column->m_key, column->m_tupleId)); - if (column->m_tupleId) - m_tupleId = position; - if (column->m_autoIncrement) - m_autoIncrement = position; - return column; -} diff --git a/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp b/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp deleted file mode 100644 index 5cecfff9562..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp +++ /dev/null @@ -1,192 +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 ODBC_DICTIONARY_DictTable_hpp -#define ODBC_DICTIONARY_DictTable_hpp - -#include -#include -#include -#include "DictColumn.hpp" -#include "DictIndex.hpp" -#include "DictSys.hpp" - -class Ctx; -class ConnArea; -class DictSchema; -class DictColumn; -class DictIndex; - -/** - * @class DictTable - * @brief Database table - */ -class DictTable { - friend class DictSchema; -public: - DictTable(const ConnArea& connArea, const BaseString& name, unsigned size); - ~DictTable(); - unsigned getSize() const; - void setParent(DictSchema* parent); - DictSchema* getParent() const; - void setColumn(unsigned i, DictColumn* column); - DictColumn* getColumn(unsigned i) const; - const BaseString& getName() const; - DictColumn* findColumn(const BaseString& name) const; - DictColumn* loadColumn(Ctx& ctx, unsigned position); - unsigned keyCount() const; - DictColumn* getKey(unsigned i) const; - unsigned tupleId() const; - unsigned autoIncrement() const; - void sysId(DictSys::Id id); - DictSys::Id sysId() const; - // indexes - void addIndex(DictIndex* index); - unsigned indexCount() const; - const DictIndex* getIndex(unsigned i) const; // indexed from 1 -protected: - friend class DictSys; - const ConnArea& m_connArea; - const BaseString m_name; - unsigned m_size; - DictSchema* m_parent; - typedef std::vector Columns; - Columns m_columns; - Columns m_keys; - unsigned m_tupleId; // tuple id column - unsigned m_autoIncrement; // autoincrement key - DictSys::Id m_sysId; // built-in system table id (if non-zero) - typedef std::vector Indexes; - Indexes m_indexes; -}; - -inline -DictTable::DictTable(const ConnArea& connArea, const BaseString& name, unsigned size) : - m_connArea(connArea), - m_name(name), - m_size(size), - m_parent(0), - m_columns(1 + size), - m_keys(1), // indexed from 1 - m_tupleId(0), - m_autoIncrement(0), - m_sysId(DictSys::Undef), - m_indexes(1) -{ -} - -inline unsigned -DictTable::getSize() const -{ - ctx_assert(m_columns.size() == 1 + m_size); - return m_size; -} - -inline void -DictTable::setParent(DictSchema* parent) -{ - m_parent = parent; -} - -inline DictSchema* -DictTable::getParent() const -{ - return m_parent; -} - -inline void -DictTable::setColumn(unsigned i, DictColumn* column) -{ - ctx_assert(1 <= i && i <= m_size); - m_columns[i] = column; - column->setPosition(i); - column->setParent(this); -} - -inline DictColumn* -DictTable::getColumn(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_size); - ctx_assert(m_columns[i] != 0); - return m_columns[i]; -} - -inline const BaseString& -DictTable::getName() const -{ - return m_name; -} - -inline unsigned -DictTable::keyCount() const -{ - ctx_assert(m_keys.size() >= 1); - return m_keys.size() - 1; -} - -inline DictColumn* -DictTable::getKey(unsigned i) const -{ - ctx_assert(1 <= i && i <= m_keys.size() && m_keys[i] != 0); - return m_keys[i]; -} - -inline unsigned -DictTable::tupleId() const -{ - return m_tupleId; -} - -inline unsigned -DictTable::autoIncrement() const -{ - return m_autoIncrement; -} - -inline void -DictTable::sysId(DictSys::Id id) -{ - m_sysId = id; -} - -inline DictSys::Id -DictTable::sysId() const -{ - return m_sysId; -} - -inline void -DictTable::addIndex(DictIndex* index) -{ - m_indexes.push_back(index); - index->setTable(this); -} - -inline unsigned -DictTable::indexCount() const -{ - ctx_assert(m_indexes.size() >= 1); - return m_indexes.size() - 1; -} - -inline const DictIndex* -DictTable::getIndex(unsigned i) const -{ - ctx_assert(1 <= i && i < m_indexes.size() && m_indexes[i] != 0); - return m_indexes[i]; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/dictionary/Makefile b/ndb/src/old_files/client/odbc/dictionary/Makefile deleted file mode 100644 index cdfd3b6ea0c..00000000000 --- a/ndb/src/old_files/client/odbc/dictionary/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include .defs.mk - -TYPE = * - -NONPIC_ARCHIVE = N - -PIC_ARCHIVE = Y - -ARCHIVE_TARGET = odbcdictionary - -SOURCES = \ - DictCatalog.cpp \ - DictSchema.cpp \ - DictTable.cpp \ - DictColumn.cpp \ - DictIndex.cpp \ - DictSys.cpp - -include ../Extra.mk -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/client/odbc/docs/class.fig b/ndb/src/old_files/client/odbc/docs/class.fig deleted file mode 100644 index 38c24c1fba4..00000000000 --- a/ndb/src/old_files/client/odbc/docs/class.fig +++ /dev/null @@ -1,332 +0,0 @@ -#FIG 3.2 -Landscape -Flush left -Inches -A4 -100.00 -Single --2 -1200 2 -6 600 6600 1500 9600 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 600 6600 1500 6600 1500 7200 600 7200 600 6600 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 600 7800 1500 7800 1500 8400 600 8400 600 7800 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 600 9000 1500 9000 1500 9600 600 9600 600 9000 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 900 9000 900 8400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 900 7800 900 7200 -4 0 0 50 0 12 12 0.0000 4 180 420 750 6825 Diag\001 -4 0 0 50 0 12 12 0.0000 4 180 420 750 8025 Diag\001 -4 0 0 50 0 12 12 0.0000 4 135 630 750 8325 Record\001 -4 0 0 50 0 12 12 0.0000 4 180 420 750 9225 Diag\001 -4 0 0 50 0 12 12 0.0000 4 135 525 750 9525 Field\001 -4 0 0 50 0 12 12 0.0000 4 120 420 750 7125 Area\001 --6 -6 2700 6600 3600 9600 -6 2700 6600 3600 9600 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 2700 6600 3600 6600 3600 7200 2700 7200 2700 6600 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 2700 9000 3600 9000 3600 9600 2700 9600 2700 9000 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3000 9000 3000 7200 -4 0 0 50 0 12 12 0.0000 4 120 420 2850 6825 Attr\001 -4 0 0 50 0 12 12 0.0000 4 120 420 2850 9225 Attr\001 -4 0 0 50 0 12 12 0.0000 4 135 525 2850 9525 Field\001 -4 0 0 50 0 12 12 0.0000 4 120 420 2850 7125 Area\001 --6 --6 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 3300 3900 4200 3900 4200 4500 3300 4500 3300 3900 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 3300 2700 4200 2700 4200 3300 3300 3300 3300 2700 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 3300 1500 4200 1500 4200 2100 3300 2100 3300 1500 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 3300 300 4200 300 4200 900 3300 900 3300 300 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 1800 2700 2700 2700 2700 3300 1800 3300 1800 2700 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 1 2 - 1 1 1.00 60.00 120.00 - 3300 1800 3000 1800 -2 1 0 1 0 7 50 0 -1 0.000 0 0 7 0 1 2 - 1 1 1.00 60.00 120.00 - 3300 3000 3000 3000 -2 1 0 1 0 7 50 0 -1 0.000 0 0 7 0 1 2 - 1 1 1.00 60.00 120.00 - 3300 4200 3000 4200 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 1 2 - 1 1 1.00 60.00 120.00 - 1 1 1.00 60.00 120.00 - 4200 4200 4800 4200 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3600 3900 3600 3300 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3600 2700 3600 2100 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 3600 1500 3600 900 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 4800 5100 5700 5100 5700 5700 4800 5700 4800 5100 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 4800 2700 5700 2700 5700 3300 4800 3300 4800 2700 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 4800 3900 5700 3900 5700 4500 4800 4500 4800 3900 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 1 2 - 1 1 1.00 60.00 120.00 - 1 1 1.00 60.00 120.00 - 5100 6600 5100 5700 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 6 - 1 1 1.00 60.00 120.00 - 5100 5100 5100 4800 4500 4800 4500 3600 3900 3600 3900 3300 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 3 - 1 1 1.00 60.00 120.00 - 3600 4500 3600 5400 4800 5400 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 4800 6600 5700 6600 5700 7200 4800 7200 4800 6600 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 4800 7800 5700 7800 5700 8400 4800 8400 4800 7800 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 4800 9000 5700 9000 5700 9600 4800 9600 4800 9000 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 5100 9000 5100 8400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 5100 7800 5100 7200 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 1 2 - 1 1 1.00 60.00 120.00 - 1 1 1.00 60.00 120.00 - 4200 3000 4800 3000 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 6900 2700 7800 2700 7800 3300 6900 3300 6900 2700 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 6900 1500 7800 1500 7800 2100 6900 2100 6900 1500 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 3 - 0 0 1.00 60.00 120.00 - 7200 3300 7200 4050 5700 4050 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 3 - 0 0 1.00 60.00 120.00 - 11700 3300 11700 4350 5700 4350 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5100 3900 5100 3300 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 8400 300 9300 300 9300 900 8400 900 8400 300 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 5100 2700 5100 900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 - 3000 6600 3000 1800 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 6900 5100 7800 5100 7800 6000 6900 6000 6900 5100 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 8400 5100 9300 5100 9300 6000 8400 6000 8400 5100 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 9900 5100 10800 5100 10800 6000 9900 6000 9900 5100 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 11400 5100 12300 5100 12300 6000 11400 6000 11400 5100 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 7800 5550 8400 5550 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9300 5550 9900 5550 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 7500 5100 7500 3300 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 10500 5100 10500 3300 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 12000 5100 12000 3300 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 9900 2700 10800 2700 10800 3300 9900 3300 9900 2700 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 11400 2700 12300 2700 12300 3300 11400 3300 11400 2700 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 11400 1500 12300 1500 12300 2100 11400 2100 11400 1500 -2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 - 9900 1500 10800 1500 10800 2100 9900 2100 9900 1500 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 6900 6600 7800 6600 7800 7200 6900 7200 6900 6600 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 6900 7800 7800 7800 7800 8400 6900 8400 6900 7800 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 8400 6600 9300 6600 9300 7200 8400 7200 8400 6600 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 8400 7800 9300 7800 9300 8400 8400 8400 8400 7800 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 4 - 0 0 1.00 60.00 120.00 - 5700 3000 6300 3000 6300 6900 6900 6900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 4 - 0 0 1.00 60.00 120.00 - 5700 4200 6000 4200 6000 8100 6900 8100 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 8400 6900 7800 6900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 8400 8100 7800 8100 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9900 6900 9300 6900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9900 8100 9300 8100 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 11400 6900 10800 6900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 11400 8100 10800 8100 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 11400 6600 12300 6600 12300 7200 11400 7200 11400 6600 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 11400 7800 12300 7800 12300 8400 11400 8400 11400 7800 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 9900 6600 10800 6600 10800 7200 9900 7200 9900 6600 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 9900 7800 10800 7800 10800 8400 9900 8400 9900 7800 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 8400 2700 9300 2700 9300 3300 8400 3300 8400 2700 -2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 8400 1500 9300 1500 9300 2100 8400 2100 8400 1500 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9000 5100 9000 3300 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 7800 3000 8400 3000 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9300 3000 9900 3000 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 7800 1800 8400 1800 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 9300 1800 9900 1800 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 11400 3000 10800 3000 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 11400 1800 10800 1800 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 11400 5550 10800 5550 -2 4 0 2 0 7 50 0 -1 6.000 0 0 7 0 0 5 - 5700 900 5700 300 4800 300 4800 900 5700 900 -2 2 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 12900 6600 13800 6600 13800 7200 12900 7200 12900 6600 -2 2 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 12900 5100 13800 5100 13800 5700 12900 5700 12900 5100 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 13200 7800 13200 7200 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 13200 6600 13200 5700 -2 2 1 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 - 12900 7800 13800 7800 13800 8400 12900 8400 12900 7800 -2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 3 - 0 0 1.00 60.00 120.00 - 13200 5100 13200 1800 12300 1800 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 1 4 - 0 0 1.00 60.00 120.00 - 0 0 1.00 60.00 120.00 - 5700 7050 6600 7050 6600 7875 6900 7875 -4 0 0 50 0 12 12 0.0000 4 135 630 3375 525 Handle\001 -4 0 0 50 0 12 12 0.0000 4 135 630 3375 1725 Handle\001 -4 0 0 50 0 12 12 0.0000 4 135 630 3375 2925 Handle\001 -4 0 0 50 0 12 12 0.0000 4 135 630 3375 4125 Handle\001 -4 0 0 50 0 12 12 0.0000 4 120 420 3450 825 Root\001 -4 0 0 50 0 12 12 0.0000 4 120 315 3450 2025 Env\001 -4 0 0 50 0 12 12 0.0000 4 135 315 3450 3225 Dbc\001 -4 0 0 50 0 12 12 0.0000 4 120 420 3450 4425 Stmt\001 -4 0 0 50 0 12 12 0.0000 4 135 630 1875 2925 Handle\001 -4 0 0 50 0 12 12 0.0000 4 120 420 1950 3225 Base\001 -4 0 0 50 0 12 12 0.0000 4 135 630 4875 5325 Handle\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4950 5625 Desc\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4875 3225 Area\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4875 2925 Conn\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4875 4425 Area\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4875 4125 Stmt\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4950 6825 Desc\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4950 8025 Desc\001 -4 0 0 50 0 12 12 0.0000 4 135 630 4950 8325 Record\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4950 9225 Desc\001 -4 0 0 50 0 12 12 0.0000 4 120 420 4950 7125 Area\001 -4 0 0 50 0 12 12 0.0000 4 135 525 4950 9525 Field\001 -4 0 0 50 0 12 12 0.0000 4 135 735 3675 5925 ird ard\001 -4 0 0 50 0 12 12 0.0000 4 180 735 3675 5625 ipd apd\001 -4 0 0 50 0 12 12 0.0000 4 135 420 6975 2925 Plan\001 -4 0 0 50 0 12 12 0.0000 4 120 420 6975 3225 root\001 -4 0 0 50 0 12 12 0.0000 4 135 420 6975 1725 Plan\001 -4 0 0 50 0 12 12 0.0000 4 120 420 6975 2025 Tree\001 -4 0 0 50 0 12 12 0.0000 4 120 420 8475 525 Base\001 -4 0 0 50 0 12 12 0.0000 4 120 420 8475 825 Tree\001 -4 0 0 50 0 12 12 0.0000 4 120 315 5025 675 NDB\001 -4 0 0 50 0 14 14 0.0000 4 195 1755 300 525 Class Diagram\001 -4 0 0 50 0 12 12 0.0000 4 135 420 6975 5325 Plan\001 -4 0 0 50 0 12 12 0.0000 4 135 630 6975 5625 delete\001 -4 0 0 50 0 12 12 0.0000 4 135 840 6975 5925 searched\001 -4 0 0 50 0 12 12 0.0000 4 135 420 8475 5325 Plan\001 -4 0 0 50 0 12 12 0.0000 4 135 630 8475 5625 delete\001 -4 0 0 50 0 12 12 0.0000 4 135 420 8475 5925 full\001 -4 0 0 50 0 12 12 0.0000 4 135 420 9975 5325 Code\001 -4 0 0 50 0 12 12 0.0000 4 135 630 9975 5625 delete\001 -4 0 0 50 0 12 12 0.0000 4 135 420 9975 5925 full\001 -4 0 0 50 0 12 12 0.0000 4 120 315 11475 5325 Run\001 -4 0 0 50 0 12 12 0.0000 4 135 630 11475 5625 delete\001 -4 0 0 50 0 12 12 0.0000 4 135 420 11475 5925 full\001 -4 0 0 50 0 12 12 0.0000 4 120 420 9975 3225 root\001 -4 0 0 50 0 12 12 0.0000 4 120 315 11475 2925 Run\001 -4 0 0 50 0 12 12 0.0000 4 120 420 11475 3225 root\001 -4 0 0 50 0 12 12 0.0000 4 120 315 11475 1725 Run\001 -4 0 0 50 0 12 12 0.0000 4 120 420 11475 2025 Tree\001 -4 0 0 50 0 12 12 0.0000 4 135 420 9975 1725 Code\001 -4 0 0 50 0 12 12 0.0000 4 120 420 9975 2025 Tree\001 -4 0 0 50 0 12 12 0.0000 4 135 420 9975 2925 Code\001 -4 0 0 50 0 12 12 0.0000 4 120 420 6975 6825 Conn\001 -4 0 0 50 0 12 12 0.0000 4 180 735 6975 7125 Catalog\001 -4 0 0 50 0 12 12 0.0000 4 120 420 6975 8025 Stmt\001 -4 0 0 50 0 12 12 0.0000 4 180 735 6975 8325 Catalog\001 -4 0 0 50 0 12 12 0.0000 4 120 420 8475 6825 Conn\001 -4 0 0 50 0 12 12 0.0000 4 120 420 8475 8025 Stmt\001 -4 0 0 50 0 12 12 0.0000 4 135 630 8475 7125 Schema\001 -4 0 0 50 0 12 12 0.0000 4 135 630 8475 8325 Schema\001 -4 0 0 50 0 12 12 0.0000 4 120 420 11475 6825 Conn\001 -4 0 0 50 0 12 12 0.0000 4 120 420 11475 8025 Stmt\001 -4 0 0 50 0 12 12 0.0000 4 135 630 11475 7125 Column\001 -4 0 0 50 0 12 12 0.0000 4 135 525 11475 8325 Field\001 -4 0 0 50 0 12 12 0.0000 4 120 420 9975 6825 Conn\001 -4 0 0 50 0 12 12 0.0000 4 120 420 9975 8025 Stmt\001 -4 0 0 50 0 12 12 0.0000 4 135 525 9975 7125 Table\001 -4 0 0 50 0 12 12 0.0000 4 120 315 9975 8325 Row\001 -4 0 0 50 0 12 12 0.0000 4 135 420 8475 1725 Plan\001 -4 0 0 50 0 12 12 0.0000 4 120 420 8475 2025 Tree\001 -4 0 0 50 0 12 12 0.0000 4 135 420 8475 2925 Plan\001 -4 0 0 50 0 12 12 0.0000 4 120 420 8475 3225 root\001 -4 0 0 50 0 14 11 0.0000 4 180 840 675 825 (prelim)\001 -4 0 0 50 0 12 12 0.0000 4 180 525 6375 1350 input\001 -4 0 0 50 0 12 12 0.0000 4 180 840 7725 1350 optimize\001 -4 0 0 50 0 12 12 0.0000 4 165 630 9375 1350 output\001 -4 0 0 50 0 12 12 0.0000 4 120 735 10650 1350 execute\001 -4 0 0 50 0 12 12 0.0000 4 135 525 12075 1350 fetch\001 -4 0 0 50 0 12 12 0.0000 4 135 630 13050 5325 Result\001 -4 0 0 50 0 12 12 0.0000 4 120 315 13050 5625 Set\001 -4 0 0 50 0 12 12 0.0000 4 135 630 13050 6825 Result\001 -4 0 0 50 0 12 12 0.0000 4 120 315 13125 7125 Row\001 -4 0 0 50 0 12 12 0.0000 4 135 630 13050 8025 Result\001 -4 0 0 50 0 12 12 0.0000 4 135 525 13050 8325 Field\001 diff --git a/ndb/src/old_files/client/odbc/docs/descfield.pl b/ndb/src/old_files/client/odbc/docs/descfield.pl deleted file mode 100644 index 80fef22f303..00000000000 --- a/ndb/src/old_files/client/odbc/docs/descfield.pl +++ /dev/null @@ -1,1482 +0,0 @@ -# usage perl Desc.data -# prints template for DescSpec.cpp -use strict; -my $order = 0; - -# XXX do it later - -# -# odbcsqlsetdescfield.htm -# -my $descSpec = { -# -# -# -# SQLSetDescField -# -# -# -# -# -# -#
-#
-# -# -# -# -#
-# ODBC Programmer's Reference -#
-#
-#
-#
-# -#

SQLSetDescField

-# -#

Conformance

-# -#

Version Introduced: ODBC 3.0
-# Standards Compliance: ISO 92

-# -#

Summary

-# -#

SQLSetDescField sets the value of a single field of a descriptor record.

-# -#

Syntax

-# -#
SQLRETURN SQLSetDescField(
-#	     SQLHDESC     DescriptorHandle,
-#	     SQLSMALLINT     RecNumber,
-#	     SQLSMALLINT     FieldIdentifier,
-#	     SQLPOINTER     ValuePtr,
-#	     SQLINTEGER     BufferLength);
-# -#

Arguments -# -#

-#
DescriptorHandle
-# -#
[Input]
-# Descriptor handle.
-# -#
RecNumber
-# -#
[Input]
-# Indicates the descriptor record containing the field that the application seeks to set. Descriptor records are numbered from 0, with record number 0 being the bookmark record. The RecNumber argument is ignored for header fields.
-# -#
FieldIdentifier
-# -#
[Input]
-# Indicates the field of the descriptor whose value is to be set. For more information, see "FieldIdentifier Argument" in the "Comments" section.
-# -#
ValuePtr
-# -#
[Input]
-# Pointer to a buffer containing the descriptor information, or a 4-byte value. The data type depends on the value of FieldIdentifier. If ValuePtr is a 4-byte value, either all four of the bytes are used or just two of the four are used, depending on the value of the FieldIdentifier argument.
-# -#
BufferLength
-# -#
[Input]
-# If FieldIdentifier is an ODBC-defined field and ValuePtr points to a character string or a binary buffer, this argument should be the length of *ValuePtr. If FieldIdentifier is an ODBC-defined field and ValuePtr is an integer, BufferLength is ignored. -# -#

If FieldIdentifier is a driver-defined field, the application indicates the nature of the field to the Driver Manager by setting the BufferLength argument. BufferLength can have the following values: -# -# -#

    -#
  • If ValuePtr is a pointer to a character string, then BufferLength is the length of the string or SQL_NTS.
  • -# -#
  • If ValuePtr is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(length) macro in BufferLength. This places a negative value in BufferLength.
  • -# -#
  • If ValuePtr is a pointer to a value other than a character string or a binary string, then BufferLength should have the value SQL_IS_POINTER.
  • -# -#
  • If ValuePtr contains a fixed-length value, then BufferLength is either SQL_IS_INTEGER, SQL_IS_UINTEGER, SQL_IS_SMALLINT, or SQL_IS_USMALLINT, as appropriate.
  • -#
-#
-#
-# -#

Returns

-# -#

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

-# -#

Diagnostics

-# -#

When SQLSetDescField returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_DESC and a Handle of DescriptorHandle. The following table lists the SQLSTATE values commonly returned by SQLSetDescField and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQLSTATEErrorDescription
01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
01S02Option value changedThe driver did not support the value specified in *ValuePtr (if ValuePtr was a pointer) or the value in ValuePtr (if ValuePtr was a 4-byte value), or *ValuePtr was invalid because of implementation working conditions, so the driver substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.)
07009Invalid descriptor indexThe FieldIdentifier argument was a record field, the RecNumber argument was 0, and the DescriptorHandle argument referred to an IPD handle. -#

The RecNumber argument was less than 0, and the DescriptorHandle argument referred to an ARD or an APD.

-# -#

The RecNumber argument was greater than the maximum number of columns or parameters that the data source can support, and the DescriptorHandle argument referred to an APD or ARD.

-# -#

(DM) The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr argument was less than 0.

-# -#

The RecNumber argument was equal to 0, and the DescriptorHandle argument referred to an implicitly allocated APD. (This error does not occur with an explicitly allocated application descriptor, because it is not known whether an explicitly allocated application descriptor is an APD or ARD until execute time.)

-#
08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
22001String data, right
-# truncated
The FieldIdentifier argument was SQL_DESC_NAME, and the BufferLength argument was a value larger than SQL_MAX_IDENTIFIER_LEN.
HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001Memory allocation
-# error
The driver was unable to allocate memory required to support execution or completion of the function.
HY010Function sequence error(DM) The DescriptorHandle was associated with a StatementHandle for which an asynchronously executing function (not this one) was called and was still executing when this function was called. -#

(DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle with which the DescriptorHandle was associated and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

-#
HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY016Cannot modify an implementation row descriptorThe DescriptorHandle argument was associated with an IRD, and the FieldIdentifier argument was not SQL_DESC_ARRAY_STATUS_PTR or SQL_DESC_ROWS_PROCESSED_PTR.
HY021Inconsistent descriptor informationThe SQL_DESC_TYPE and SQL_DESC_DATETIME_INTERVAL_CODE fields do not form a valid ODBC SQL type or a valid driver-specific SQL type (for IPDs) or a valid ODBC C type (for APDs or ARDs). -#

Descriptor information checked during a consistency check was not consistent. (See "Consistency Check" in SQLSetDescRec.)

-#
HY090Invalid string or buffer length(DM) *ValuePtr is a character string, and BufferLength was less than zero but was not equal to SQL_NTS. -#

(DM) The driver was an ODBC 2.x driver, the descriptor was an ARD, the ColumnNumber argument was set to 0, and the value specified for the argument BufferLength was not equal to 4.

-#
HY091Invalid descriptor field identifierThe value specified for the FieldIdentifier argument was not an ODBC-defined field and was not an implementation-defined value. -#

The FieldIdentifier argument was invalid for the DescriptorHandle argument.

-# -#

The FieldIdentifier argument was a read-only, ODBC-defined field.

-#
HY092Invalid attribute/option identifierThe value in *ValuePtr was not valid for the FieldIdentifier argument. -#

The FieldIdentifier argument was SQL_DESC_UNNAMED, and ValuePtr was SQL_NAMED.

-#
HY105Invalid parameter type(DM) The value specified for the SQL_DESC_PARAMETER_TYPE field was invalid. (For more information, see the "InputOutputType Argument" section in SQLBindParameter.)
HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001Driver does not support this function(DM) The driver associated with the DescriptorHandle does not support the function.
-# -#

Comments

-# -#

An application can call SQLSetDescField to set any descriptor field one at a time. One call to SQLSetDescField sets a single field in a single descriptor. This function can be called to set any field in any descriptor type, provided the field can be set. (See the table later in this section.)

-# -#

Note   If a call to SQLSetDescField fails, the contents of the descriptor record identified by the RecNumber argument are undefined.

-# -#

Other functions can be called to set multiple descriptor fields with a single call of the function. The SQLSetDescRec function sets a variety of fields that affect the data type and buffer bound to a column or parameter (the SQL_DESC_TYPE, SQL_DESC_DATETIME_INTERVAL_CODE, SQL_DESC_OCTET_LENGTH, SQL_DESC_PRECISION, SQL_DESC_SCALE, SQL_DESC_DATA_PTR, SQL_DESC_OCTET_LENGTH_PTR, and SQL_DESC_INDICATOR_PTR fields). SQLBindCol or SQLBindParameter can be used to make a complete specification for the binding of a column or parameter. These functions set a specific group of descriptor fields with one function call.

-# -#

SQLSetDescField can be called to change the binding buffers by adding an offset to the binding pointers (SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, or SQL_DESC_OCTET_LENGTH_PTR). This changes the binding buffers without calling SQLBindCol or SQLBindParameter, which allows an application to change SQL_DESC_DATA_PTR without changing other fields, such as SQL_DESC_DATA_TYPE.

-# -#

If an application calls SQLSetDescField to set any field other than SQL_DESC_COUNT or the deferred fields SQL_DESC_DATA_PTR, SQL_DESC_OCTET_LENGTH_PTR, or SQL_DESC_INDICATOR_PTR, the record becomes unbound.

-# -#

Descriptor header fields are set by calling SQLSetDescField with the appropriate FieldIdentifier. Many header fields are also statement attributes, so they can also be set by a call to SQLSetStmtAttr. This allows applications to set a descriptor field without first obtaining a descriptor handle. When SQLSetDescField is called to set a header field, the RecNumber argument is ignored.

-# -#

A RecNumber of 0 is used to set bookmark fields.

-# -#

Note   The statement attribute SQL_ATTR_USE_BOOKMARKS should always be set before calling SQLSetDescField to set bookmark fields. While this is not mandatory, it is strongly recommended.

-# -#

Sequence of Setting Descriptor Fields

-# -#

When setting descriptor fields by calling SQLSetDescField, the application must follow a specific sequence: -# -#

    -#
  1. The application must first set the SQL_DESC_TYPE, SQL_DESC_CONCISE_TYPE, or SQL_DESC_DATETIME_INTERVAL_CODE field.
  2. -# -#
  3. After one of these fields has been set, the application can set an attribute of a data type, and the driver sets data type attribute fields to the appropriate default values for the data type. Automatic defaulting of type attribute fields ensures that the descriptor is always ready to use once the application has specified a data type. If the application explicitly sets a data type attribute, it is overriding the default attribute.
  4. -# -#
  5. After one of the fields listed in step 1 has been set, and data type attributes have been set, the application can set SQL_DESC_DATA_PTR. This prompts a consistency check of descriptor fields. If the application changes the data type or attributes after setting the SQL_DESC_DATA_PTR field, the driver sets SQL_DESC_DATA_PTR to a null pointer, unbinding the record. This forces the application to complete the proper steps in sequence, before the descriptor record is usable.
  6. -#
-# -#

Initialization of Descriptor Fields

-# -#

When a descriptor is allocated, the fields in the descriptor can be initialized to a default value, be initialized without a default value, or be undefined for the type of descriptor. The following tables indicate the initialization of each field for each type of descriptor, with "D" indicating that the field is initialized with a default, and "ND" indicating that the field is initialized without a default. If a number is shown, the default value of the field is that number. The tables also indicate whether a field is read/write (R/W) or read-only (R).

-# -#

The fields of an IRD have a default value only after the statement has been prepared or executed and the IRD has been populated, not when the statement handle or descriptor has been allocated. Until the IRD has been populated, any attempt to gain access to a field of an IRD will return an error.

-# -#

Some descriptor fields are defined for one or more, but not all, of the descriptor types (ARDs and IRDs, and APDs and IPDs). When a field is undefined for a type of descriptor, it is not needed by any of the functions that use that descriptor.

-# -#

The fields that can be accessed by SQLGetDescField cannot necessarily be set by SQLSetDescField. Fields that can be set by SQLSetDescField are listed in the following tables.

-# -#

The initialization of header fields is outlined in the table that follows.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Header field nameTypeR/WDefault
SQL_DESC_ALLOC_TYPESQLSMALLINTARD: R
-# APD: R
-# IRD: R
-# IPD: R
ARD: SQL_DESC_ALLOC_AUTO for implicit or SQL_DESC_ALLOC_USER for explicit -#

APD: SQL_DESC_ALLOC_AUTO for implicit or SQL_DESC_ALLOC_USER for explicit

-# -#

IRD: SQL_DESC_ALLOC_AUTO

-# -#

IPD: SQL_DESC_ALLOC_AUTO

-#
SQL_DESC_ARRAY_SIZESQLUINTEGERARD: R/W
-# APD: R/W
-# IRD: Unused
-# IPD: Unused
ARD:[1]
-# APD:[1]
-# IRD: Unused
-# IPD: Unused
SQL_DESC_ARRAY_STATUS_PTRSQLUSMALLINT*ARD: R/W
-# APD: R/W
-# IRD: R/W
-# IPD: R/W
ARD: Null ptr
-# APD: Null ptr
-# IRD: Null ptr
-# IPD: Null ptr
SQL_DESC_BIND_OFFSET_PTRSQLINTEGER*ARD: R/W
-# APD: R/W
-# IRD: Unused
-# IPD: Unused
ARD: Null ptr
-# APD: Null ptr
-# IRD: Unused
-# IPD: Unused
SQL_DESC_BIND_TYPESQLINTEGERARD: R/W
-# APD: R/W
-# IRD: Unused
-# IPD: Unused
ARD: SQL_BIND_BY_COLUMN -#

APD: SQL_BIND_BY_COLUMN

-# -#

IRD: Unused

-# -#

IPD: Unused

-#
SQL_DESC_COUNTSQLSMALLINTARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: 0
-# APD: 0
-# IRD: D
-# IPD: 0
SQL_DESC_ROWS_PROCESSED_PTRSQLUINTEGER*ARD: Unused
-# APD: Unused
-# IRD: R/W
-# IPD: R/W
ARD: Unused
-# APD: Unused
-# IRD: Null ptr
-# IPD: Null ptr
-# -#

[1]   These fields are defined only when the IPD is automatically populated by the driver. If not, they are undefined. If an application attempts to set these fields, SQLSTATE HY091 (Invalid descriptor field identifier) will be returned.

-#

The initialization of record fields is as shown in the following table.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Record field nameTypeR/WDefault
SQL_DESC_AUTO_UNIQUE_VALUESQLINTEGERARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_BASE_COLUMN_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_BASE_TABLE_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_CASE_SENSITIVESQLINTEGERARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: D[1]
SQL_DESC_CATALOG_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_CONCISE_TYPESQLSMALLINTARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: SQL_C_
-# DEFAULT
-# APD: SQL_C_
-# DEFAULT
-# IRD: D
-# IPD: ND
SQL_DESC_DATA_PTRSQLPOINTERARD: R/W
-# APD: R/W
-# IRD: Unused
-# IPD: Unused
ARD: Null ptr
-# APD: Null ptr
-# IRD: Unused
-# IPD: Unused[2]
SQL_DESC_DATETIME_INTERVAL_CODESQLSMALLINTARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_DATETIME_INTERVAL_PRECISIONSQLINTEGERARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_DISPLAY_SIZESQLINTEGERARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_FIXED_PREC_SCALESQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: D[1]
SQL_DESC_INDICATOR_PTRSQLINTEGER *ARD: R/W
-# APD: R/W
-# IRD: Unused
-# IPD: Unused
ARD: Null ptr
-# APD: Null ptr
-# IRD: Unused
-# IPD: Unused
SQL_DESC_LABELSQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_LENGTHSQLUINTEGERARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_LITERAL_PREFIXSQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_LITERAL_SUFFIXSQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_LOCAL_TYPE_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: D[1]
SQL_DESC_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_NULLABLESQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_NUM_PREC_RADIXSQLINTEGERARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_OCTET_LENGTHSQLINTEGERARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_OCTET_LENGTH_PTRSQLINTEGER *ARD: R/W
-# APD: R/W
-# IRD: Unused
-# IPD: Unused
ARD: Null ptr
-# APD: Null ptr
-# IRD: Unused
-# IPD: Unused
SQL_DESC_PARAMETER_TYPESQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: Unused
-# IPD: R/W
ARD: Unused
-# APD: Unused
-# IRD: Unused
-# IPD: D=SQL_PARAM_INPUT
SQL_DESC_PRECISIONSQLSMALLINTARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_ROWVERSQLSMALLINTARD: Unused -#

APD: Unused

-# -#

IRD: R

-# -#

IPD: R

-#
ARD: Unused -#

APD: Unused

-# -#

IRD: ND

-# -#

IPD: ND

-#
SQL_DESC_SCALESQLSMALLINTARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_SCHEMA_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_SEARCHABLESQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_TABLE_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
SQL_DESC_TYPESQLSMALLINTARD: R/W
-# APD: R/W
-# IRD: R
-# IPD: R/W
ARD: SQL_C_DEFAULT
-# APD: SQL_C_DEFAULT
-# IRD: D
-# IPD: ND
SQL_DESC_TYPE_NAMESQLCHAR *ARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: D[1]
SQL_DESC_UNNAMEDSQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R/W
ARD: ND
-# APD: ND
-# IRD: D
-# IPD: ND
SQL_DESC_UNSIGNEDSQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: R
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: D[1]
SQL_DESC_UPDATABLESQLSMALLINTARD: Unused
-# APD: Unused
-# IRD: R
-# IPD: Unused
ARD: Unused
-# APD: Unused
-# IRD: D
-# IPD: Unused
-# -#

[1]   These fields are defined only when the IPD is automatically populated by the driver. If not, they are undefined. If an application attempts to set these fields, SQLSTATE HY091 (Invalid descriptor field identifier) will be returned.

-#

[2]   The SQL_DESC_DATA_PTR field in the IPD can be set to force a consistency check. In a subsequent call to SQLGetDescField or SQLGetDescRec, the driver is not required to return the value that SQL_DESC_DATA_PTR was set to.

-#

FieldIdentifier Argument

-# -#

The FieldIdentifier argument indicates the descriptor field to be set. A descriptor contains the descriptor header, consisting of the header fields described in the next section, "Header Fields," and zero or more descriptor records, consisting of the record fields described in the section following the "Header Fields" section.

-# -#

Header Fields

-# -#

Each descriptor has a header consisting of the following fields: -# -#

-#
SQL_DESC_ALLOC_TYPE [All]
-# -#
This read-only SQLSMALLINT header field specifies whether the descriptor was allocated automatically by the driver or explicitly by the application. The application can obtain, but not modify, this field. The field is set to SQL_DESC_ALLOC_AUTO by the driver if the descriptor was automatically allocated by the driver. It is set to SQL_DESC_ALLOC_USER by the driver if the descriptor was explicitly allocated by the application.
-# -#
SQL_DESC_ARRAY_SIZE [Application descriptors]
-# -#
In ARDs, this SQLUINTEGER header field specifies the number of rows in the rowset. This is the number of rows to be returned by a call to SQLFetch or SQLFetchScroll or to be operated on by a call to SQLBulkOperations or SQLSetPos. -# -#

In APDs, this SQLUINTEGER header field specifies the number of values for each parameter. -# -# -#

The default value of this field is 1. If SQL_DESC_ARRAY_SIZE is greater than 1, SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR of the APD or ARD point to arrays. The cardinality of each array is equal to the value of this field. -# -# -#

This field in the ARD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_ROW_ARRAY_SIZE attribute. This field in the APD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_PARAMSET_SIZE attribute. -#

-# -#
SQL_DESC_ARRAY_STATUS_PTR [All]
-# -#
For each descriptor type, this SQLUSMALLINT * header field points to an array of SQLUSMALLINT values. These arrays are named as follows: row status array (IRD), parameter status array (IPD), row operation array (ARD), and parameter operation array (APD). -# -#

In the IRD, this header field points to a row status array containing status values after a call to SQLBulkOperations, SQLFetch, SQLFetchScroll, or SQLSetPos. The array has as many elements as there are rows in the rowset. The application must allocate an array of SQLUSMALLINTs and set this field to point to the array. The field is set to a null pointer by default. The driver will populate the array—unless the SQL_DESC_ARRAY_STATUS_PTR field is set to a null pointer, in which case no status values are generated and the array is not populated. -# -# -#

Caution   Driver behavior is undefined if the application sets the elements of the row status array pointed to by the SQL_DESC_ARRAY_STATUS_PTR field of the IRD. -# -# -#

The array is initially populated by a call to SQLBulkOperations, SQLFetch, SQLFetchScroll, or SQLSetPos. If the call did not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the array pointed to by this field are undefined. The elements in the array can contain the following values: -# -# -#

    -#
  • SQL_ROW_SUCCESS: The row was successfully fetched and has not changed since it was last fetched.
  • -# -#
  • SQL_ROW_SUCCESS_WITH_INFO: The row was successfully fetched and has not changed since it was last fetched. However, a warning was returned about the row.
  • -# -#
  • SQL_ROW_ERROR: An error occurred while fetching the row.
  • -# -#
  • SQL_ROW_UPDATED: The row was successfully fetched and has been updated since it was last fetched. If the row is fetched again, its status is SQL_ROW_SUCCESS.
  • -# -#
  • SQL_ROW_DELETED: The row has been deleted since it was last fetched.
  • -# -#
  • SQL_ROW_ADDED: The row was inserted by SQLBulkOperations. If the row is fetched again, its status is SQL_ROW_SUCCESS.
  • -# -#
  • SQL_ROW_NOROW: The rowset overlapped the end of the result set, and no row was returned that corresponded to this element of the row status array.
  • -#
-# -# -#

This field in the IRD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_ROW_STATUS_PTR attribute. -# -# -#

The SQL_DESC_ARRAY_STATUS_PTR field of the IRD is valid only after SQL_SUCCESS or SQL_SUCCESS_WITH_INFO has been returned. If the return code is not one of these, the location pointed to by SQL_DESC_ROWS_PROCESSED_PTR is undefined. -# -# -#

In the IPD, this header field points to a parameter status array containing status information for each set of parameter values after a call to SQLExecute or SQLExecDirect. If the call to SQLExecute or SQLExecDirect did not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the array pointed to by this field are undefined. The application must allocate an array of SQLUSMALLINTs and set this field to point to the array. The driver will populate the array—unless the SQL_DESC_ARRAY_STATUS_PTR field is set to a null pointer, in which case no status values are generated and the array is not populated. The elements in the array can contain the following values: -# -# -#

    -#
  • SQL_PARAM_SUCCESS: The SQL statement was successfully executed for this set of parameters.
  • -# -#
  • SQL_PARAM_SUCCESS_WITH_INFO: The SQL statement was successfully executed for this set of parameters; however, warning information is available in the diagnostics data structure.
  • -# -#
  • SQL_PARAM_ERROR: An error occurred in processing this set of parameters. Additional error information is available in the diagnostics data structure.
  • -# -#
  • SQL_PARAM_UNUSED: This parameter set was unused, possibly due to the fact that some previous parameter set caused an error that aborted further processing, or because SQL_PARAM_IGNORE was set for that set of parameters in the array specified by the SQL_DESC_ARRAY_STATUS_PTR field of the APD.
  • -# -#
  • SQL_PARAM_DIAG_UNAVAILABLE: Diagnostic information is not available. An example of this is when the driver treats arrays of parameters as a monolithic unit and so does not generate this level of error information.
  • -#
-# -# -#

This field in the IPD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_PARAM_STATUS_PTR attribute. -# -# -#

In the ARD, this header field points to a row operation array of values that can be set by the application to indicate whether this row is to be ignored for SQLSetPos operations. The elements in the array can contain the following values: -# -# -#

    -#
  • SQL_ROW_PROCEED: The row is included in the bulk operation using SQLSetPos. (This setting does not guarantee that the operation will occur on the row. If the row has the status SQL_ROW_ERROR in the IRD row status array, the driver might not be able to perform the operation in the row.)
  • -# -#
  • SQL_ROW_IGNORE: The row is excluded from the bulk operation using SQLSetPos.
  • -#
-# -# -#

If no elements of the array are set, all rows are included in the bulk operation. If the value in the SQL_DESC_ARRAY_STATUS_PTR field of the ARD is a null pointer, all rows are included in the bulk operation; the interpretation is the same as if the pointer pointed to a valid array and all elements of the array were SQL_ROW_PROCEED. If an element in the array is set to SQL_ROW_IGNORE, the value in the row status array for the ignored row is not changed. -# -# -#

This field in the ARD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_ROW_OPERATION_PTR attribute. -# -# -#

In the APD, this header field points to a parameter operation array of values that can be set by the application to indicate whether this set of parameters is to be ignored when SQLExecute or SQLExecDirect is called. The elements in the array can contain the following values: -# -# -#

    -#
  • SQL_PARAM_PROCEED: The set of parameters is included in the SQLExecute or SQLExecDirect call.
  • -# -#
  • SQL_PARAM_IGNORE: The set of parameters is excluded from the SQLExecute or SQLExecDirect call.
  • -#
-# -# -#

If no elements of the array are set, all sets of parameters in the array are used in the SQLExecute or SQLExecDirect calls. If the value in the SQL_DESC_ARRAY_STATUS_PTR field of the APD is a null pointer, all sets of parameters are used; the interpretation is the same as if the pointer pointed to a valid array and all elements of the array were SQL_PARAM_PROCEED. -# -# -#

This field in the APD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_PARAM_OPERATION_PTR attribute. -#

-# -#
SQL_DESC_BIND_OFFSET_PTR [Application descriptors]
-# -#
This SQLINTEGER * header field points to the binding offset. It is set to a null pointer by default. If this field is not a null pointer, the driver dereferences the pointer and adds the dereferenced value to each of the deferred fields that has a non-null value in the descriptor record (SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR) at fetch time and uses the new pointer values when binding. -# -#

The binding offset is always added directly to the values in the SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR fields. If the offset is changed to a different value, the new value is still added directly to the value in each descriptor field. The new offset is not added to the field value plus any earlier offset. -# -# -#

This field is a deferred field: It is not used at the time it is set but is used at a later time by the driver when it needs to determine addresses for data buffers. -# -# -#

This field in the ARD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_ROW_BIND_OFFSET_PTR attribute. This field in the ARD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_PARAM_BIND_OFFSET_PTR attribute. -# -# -#

For more information, see the description of row-wise binding in SQLFetchScroll and SQLBindParameter. -#

-# -#
SQL_DESC_BIND_TYPE [Application descriptors]
-# -#
This SQLUINTEGER header field sets the binding orientation to be used for binding either columns or parameters. -# -#

In ARDs, this field specifies the binding orientation when SQLFetchScroll or SQLFetch is called on the associated statement handle. -# -# -#

To select column-wise binding for columns, this field is set to SQL_BIND_BY_COLUMN (the default). -# -# -#

This field in the ARD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_ROW_BIND_TYPE Attribute. -# -# -#

In APDs, this field specifies the binding orientation to be used for dynamic parameters. -# -# -#

To select column-wise binding for parameters, this field is set to SQL_BIND_BY_COLUMN (the default). -# -# -#

This field in the APD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_PARAM_BIND_TYPE Attribute. -#

-# -#
SQL_DESC_COUNT [All]
-# -#
This SQLSMALLINT header field specifies the 1-based index of the highest-numbered record that contains data. When the driver sets the data structure for the descriptor, it must also set the SQL_DESC_COUNT field to show how many records are significant. When an application allocates an instance of this data structure, it does not have to specify how many records to reserve room for. As the application specifies the contents of the records, the driver takes any required action to ensure that the descriptor handle refers to a data structure of the adequate size. -# -#

SQL_DESC_COUNT is not a count of all data columns that are bound (if the field is in an ARD) or of all parameters that are bound (if the field is in an APD), but the number of the highest-numbered record. If the highest-numbered column or parameter is unbound, then SQL_DESC_COUNT is changed to the number of the next highest-numbered column or parameter. If a column or a parameter with a number that is less than the number of the highest-numbered column is unbound (by calling SQLBindCol with the TargetValuePtr argument set to a null pointer, or SQLBindParameter with the ParameterValuePtr argument set to a null pointer), SQL_DESC_COUNT is not changed. If additional columns or parameters are bound with numbers greater than the highest-numbered record that contains data, the driver automatically increases the value in the SQL_DESC_COUNT field. If all columns are unbound by calling SQLFreeStmt with the SQL_UNBIND option, the SQL_DESC_COUNT fields in the ARD and IRD are set to 0. If SQLFreeStmt is called with the SQL_RESET_PARAMS option, the SQL_DESC_COUNT fields in the APD and IPD are set to 0. -# -# -#

The value in SQL_DESC_COUNT can be set explicitly by an application by calling SQLSetDescField. If the value in SQL_DESC_COUNT is explicitly decreased, all records with numbers greater than the new value in SQL_DESC_COUNT are effectively removed. If the value in SQL_DESC_COUNT is explicitly set to 0 and the field is in an ARD, all data buffers except a bound bookmark column are released. -# -# -#

The record count in this field of an ARD does not include a bound bookmark column. The only way to unbind a bookmark column is to set the SQL_DESC_DATA_PTR field to a null pointer. -#

-# -#
SQL_DESC_ROWS_PROCESSED_PTR [Implementation descriptors]
-# -#
In an IRD, this SQLUINTEGER * header field points to a buffer containing the number of rows fetched after a call to SQLFetch or SQLFetchScroll, or the number of rows affected in a bulk operation performed by a call to SQLBulkOperations or SQLSetPos, including error rows. -# -#

In an IPD, this SQLUINTEGER * header field points to a buffer containing the number of sets of parameters that have been processed, including error sets. No number will be returned if this is a null pointer. -# -# -#

SQL_DESC_ROWS_PROCESSED_PTR is valid only after SQL_SUCCESS or SQL_SUCCESS_WITH_INFO has been returned after a call to SQLFetch or SQLFetchScroll (for an IRD field) or SQLExecute, SQLExecDirect, or SQLParamData (for an IPD field). If the call that fills in the buffer pointed to by this field does not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined, unless it returns SQL_NO_DATA, in which case the value in the buffer is set to 0. -# -# -#

This field in the ARD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_ROWS_FETCHED_PTR attribute. This field in the APD can also be set by calling SQLSetStmtAttr with the SQL_ATTR_PARAMS_PROCESSED_PTR attribute. -# -# -#

The buffer pointed to by this field is allocated by the application. It is a deferred output buffer that is set by the driver. It is set to a null pointer by default. -#

-#
-# -#

Record Fields

-# -#

Each descriptor contains one or more records consisting of fields that define either column data or dynamic parameters, depending on the type of descriptor. Each record is a complete definition of a single column or parameter. -# -#

-#
SQL_DESC_AUTO_UNIQUE_VALUE [IRDs]
-# -#
This read-only SQLINTEGER record field contains SQL_TRUE if the column is an auto-incrementing column, or SQL_FALSE if the column is not an auto-incrementing column. This field is read-only, but the underlying auto-incrementing column is not necessarily read-only.
-# -#
SQL_DESC_BASE_COLUMN_NAME [IRDs]
-# -#
This read-only SQLCHAR * record field contains the base column name for the result set column. If a base column name does not exist (as in the case of columns that are expressions), this variable contains an empty string.
-# -#
SQL_DESC_BASE_TABLE_NAME [IRDs]
-# -#
This read-only SQLCHAR * record field contains the base table name for the result set column. If a base table name cannot be defined or is not applicable, this variable contains an empty string.
-# -#
SQL_DESC_CASE_SENSITIVE [Implementation descriptors]
-# -#
This read-only SQLINTEGER record field contains SQL_TRUE if the column or parameter is treated as case-sensitive for collations and comparisons, or SQL_FALSE if the column is not treated as case-sensitive for collations and comparisons or if it is a noncharacter column.
-# -#
SQL_DESC_CATALOG_NAME [IRDs]
-# -#
This read-only SQLCHAR * record field contains the catalog for the base table that contains the column. The return value is driver-dependent if the column is an expression or if the column is part of a view. If the data source does not support catalogs or the catalog cannot be determined, this variable contains an empty string.
-# -#
SQL_DESC_CONCISE_TYPE [All]
-# -#
This SQLSMALLINT header field specifies the concise data type for all data types, including the datetime and interval data types. -# -#

The values in the SQL_DESC_CONCISE_TYPE, SQL_DESC_TYPE, and SQL_DESC_DATETIME_INTERVAL_CODE fields are interdependent. Each time one of the fields is set, the other must also be set. SQL_DESC_CONCISE_TYPE can be set by a call to SQLBindCol or SQLBindParameter, or SQLSetDescField. SQL_DESC_TYPE can be set by a call to SQLSetDescField or SQLSetDescRec. -# -# -#

If SQL_DESC_CONCISE_TYPE is set to a concise data type other than an interval or datetime data type, the SQL_DESC_TYPE field is set to the same value and the SQL_DESC_DATETIME_INTERVAL_CODE field is set to 0. -# -# -#

If SQL_DESC_CONCISE_TYPE is set to the concise datetime or interval data type, the SQL_DESC_TYPE field is set to the corresponding verbose type (SQL_DATETIME or SQL_INTERVAL) and the SQL_DESC_DATETIME_INTERVAL_CODE field is set to the appropriate subcode. -#

-# -#
SQL_DESC_DATA_PTR [Application descriptors and IPDs]
-# -#
This SQLPOINTER record field points to a variable that will contain the parameter value (for APDs) or the column value (for ARDs). This field is a deferred field. It is not used at the time it is set but is used at a later time by the driver to retrieve data. -# -#

The column specified by the SQL_DESC_DATA_PTR field of the ARD is unbound if the TargetValuePtr argument in a call to SQLBindCol is a null pointer or if the SQL_DESC_DATA_PTR field in the ARD is set by a call to SQLSetDescField or SQLSetDescRec to a null pointer. Other fields are not affected if the SQL_DESC_DATA_PTR field is set to a null pointer. -# -# -#

If the call to SQLFetch or SQLFetchScroll that fills in the buffer pointed to by this field did not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined. -# -# -#

Whenever the SQL_DESC_DATA_PTR field of an APD, ARD, or IPD is set, the driver checks that the value in the SQL_DESC_TYPE field contains one of the valid ODBC C data types or a driver-specific data type, and that all other fields affecting the data types are consistent. Prompting a consistency check is the only use of the SQL_DESC_DATA_PTR field of an IPD. Specifically, if an application sets the SQL_DESC_DATA_PTR field of an IPD and later calls SQLGetDescField on this field, it is not necessarily returned the value that it had set. For more information, see "Consistency Checks" in SQLSetDescRec. -#

-# -#
SQL_DESC_DATETIME_INTERVAL_CODE [All]
-# -#
This SQLSMALLINT record field contains the subcode for the specific datetime or interval data type when the SQL_DESC_TYPE field is SQL_DATETIME or SQL_INTERVAL. This is true for both SQL and C data types. The code consists of the data type name with "CODE" substituted for either "TYPE" or "C_TYPE" (for datetime types), or "CODE" substituted for "INTERVAL" or "C_INTERVAL" (for interval types). -# -#

If SQL_DESC_TYPE and SQL_DESC_CONCISE_TYPE in an application descriptor are set to SQL_C_DEFAULT and the descriptor is not associated with a statement handle, the contents of SQL_DESC_DATETIME_INTERVAL_CODE are undefined. -# -# -#

This field can be set for the datetime data types listed in the following table. -# -# -#

-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Datetime typesDATETIME_INTERVAL_CODE
SQL_TYPE_DATE/SQL_C_TYPE_DATESQL_CODE_DATE
SQL_TYPE_TIME/SQL_C_TYPE_TIMESQL_CODE_TIME
SQL_TYPE_TIMESTAMP/
-# SQL_C_TYPE_TIMESTAMP
SQL_CODE_TIMESTAMP
-# -# -# -#

This field can be set for the interval data types listed in the following table. -# -# -#

-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Interval typeDATETIME_INTERVAL_CODE
SQL_INTERVAL_DAY/
-# SQL_C_INTERVAL_DAY
SQL_CODE_DAY
SQL_INTERVAL_DAY_TO_HOUR/
-# SQL_C_INTERVAL_DAY_TO_HOUR
SQL_CODE_DAY_TO_HOUR
SQL_INTERVAL_DAY_TO_MINUTE/
-# SQL_C_INTERVAL_DAY_TO_MINUTE
SQL_CODE_DAY_TO_MINUTE
SQL_INTERVAL_DAY_TO_SECOND/
-# SQL_C_INTERVAL_DAY_TO_SECOND
SQL_CODE_DAY_TO_SECOND
SQL_INTERVAL_HOUR/
-# SQL_C_INTERVAL_HOUR
SQL_CODE_HOUR
SQL_INTERVAL_HOUR_TO_MINUTE/
-# SQL_C_INTERVAL_HOUR_TO_MINUTE
SQL_CODE_HOUR_TO_MINUTE
SQL_INTERVAL_HOUR_TO_SECOND/
-# SQL_C_INTERVAL_HOUR_TO_SECOND
SQL_CODE_HOUR_TO_SECOND
SQL_INTERVAL_MINUTE/
-# SQL_C_INTERVAL_MINUTE
SQL_CODE_MINUTE
SQL_INTERVAL_MINUTE_TO_SECOND/
-# SQL_C_INTERVAL_MINUTE_TO_SECOND
SQL_CODE_MINUTE_TO_SECOND
SQL_INTERVAL_MONTH/
-# SQL_C_INTERVAL_MONTH
SQL_CODE_MONTH
SQL_INTERVAL_SECOND/
-# SQL_C_INTERVAL_SECOND
SQL_CODE_SECOND
SQL_INTERVAL_YEAR/
-# SQL_C_INTERVAL_YEAR
SQL_CODE_YEAR
SQL_INTERVAL_YEAR_TO_MONTH/
-# SQL_C_INTERVAL_YEAR_TO_MONTH
SQL_CODE_YEAR_TO_MONTH
-# -# -# -#

For more information about the data intervals and this field, see "Data Type Identifiers and Descriptors" in Appendix D: Data Types. -#

-# -#
SQL_DESC_DATETIME_INTERVAL_PRECISION [All]
-# -#
This SQLINTEGER record field contains the interval leading precision if the SQL_DESC_TYPE field is SQL_INTERVAL. When the SQL_DESC_DATETIME_INTERVAL_CODE field is set to an interval data type, this field is set to the default interval leading precision.
-# -#
SQL_DESC_DISPLAY_SIZE [IRDs]
-# -#
This read-only SQLINTEGER record field contains the maximum number of characters required to display the data from the column.
-# -#
SQL_DESC_FIXED_PREC_SCALE [Implementation descriptors]
-# -#
This read-only SQLSMALLINT record field is set to SQL_TRUE if the column is an exact numeric column and has a fixed precision and nonzero scale, or to SQL_FALSE if the column is not an exact numeric column with a fixed precision and scale.
-# -#
SQL_DESC_INDICATOR_PTR [Application descriptors]
-# -#
In ARDs, this SQLINTEGER * record field points to the indicator variable. This variable contains SQL_NULL_DATA if the column value is a NULL. For APDs, the indicator variable is set to SQL_NULL_DATA to specify NULL dynamic arguments. Otherwise, the variable is zero (unless the values in SQL_DESC_INDICATOR_PTR and SQL_DESC_OCTET_LENGTH_PTR are the same pointer). -# -#

If the SQL_DESC_INDICATOR_PTR field in an ARD is a null pointer, the driver is prevented from returning information about whether the column is NULL or not. If the column is NULL and SQL_DESC_INDICATOR_PTR is a null pointer, SQLSTATE 22002 (Indicator variable required but not supplied) is returned when the driver attempts to populate the buffer after a call to SQLFetch or SQLFetchScroll. If the call to SQLFetch or SQLFetchScroll did not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined. -# -# -#

The SQL_DESC_INDICATOR_PTR field determines whether the field pointed to by SQL_DESC_OCTET_LENGTH_PTR is set. If the data value for a column is NULL, the driver sets the indicator variable to SQL_NULL_DATA. The field pointed to by SQL_DESC_OCTET_LENGTH_PTR is then not set. If a NULL value is not encountered during the fetch, the buffer pointed to by SQL_DESC_INDICATOR_PTR is set to zero and the buffer pointed to by SQL_DESC_OCTET_LENGTH_PTR is set to the length of the data. -# -# -#

If the SQL_DESC_INDICATOR_PTR field in an APD is a null pointer, the application cannot use this descriptor record to specify NULL arguments. -# -# -#

This field is a deferred field: It is not used at the time it is set but is used at a later time by the driver to indicate nullability (for ARDs) or to determine nullability (for APDs). -#

-# -#
SQL_DESC_LABEL [IRDs]
-# -#
This read-only SQLCHAR * record field contains the column label or title. If the column does not have a label, this variable contains the column name. If the column is unnamed and unlabeled, this variable contains an empty string.
-# -#
SQL_DESC_LENGTH [All]
-# -#
This SQLUINTEGER record field is either the maximum or actual length of a character string in characters or a binary data type in bytes. It is the maximum length for a fixed-length data type, or the actual length for a variable-length data type. Its value always excludes the null-termination character that ends the character string. For values whose type is SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, or one of the SQL interval data types, this field has the length in characters of the character string representation of the datetime or interval value. -# -#

The value in this field may be different from the value for "length" as defined in ODBC 2.x. For more information, see Appendix D: Data Types. -#

-# -#
SQL_DESC_LITERAL_PREFIX [IRDs]
-# -#
This read-only SQLCHAR * record field contains the character or characters that the driver recognizes as a prefix for a literal of this data type. This variable contains an empty string for a data type for which a literal prefix is not applicable.
-# -#
SQL_DESC_LITERAL_SUFFIX [IRDs]
-# -#
This read-only SQLCHAR * record field contains the character or characters that the driver recognizes as a suffix for a literal of this data type. This variable contains an empty string for a data type for which a literal suffix is not applicable.
-# -#
SQL_DESC_LOCAL_TYPE_NAME [Implementation descriptors]
-# -#
This read-only SQLCHAR * record field contains any localized (native language) name for the data type that may be different from the regular name of the data type. If there is no localized name, an empty string is returned. This field is for display purposes only.
-# -#
SQL_DESC_NAME [Implementation descriptors]
-# -#
This SQLCHAR * record field in a row descriptor contains the column alias, if it applies. If the column alias does not apply, the column name is returned. In either case, the driver sets the SQL_DESC_UNNAMED field to SQL_NAMED when it sets the SQL_DESC_NAME field. If there is no column name or a column alias, the driver returns an empty string in the SQL_DESC_NAME field and sets the SQL_DESC_UNNAMED field to SQL_UNNAMED. -# -#

An application can set the SQL_DESC_NAME field of an IPD to a parameter name or alias to specify stored procedure parameters by name. (For more information, see "Binding Parameters by Name (Named Parameters)" in Chapter 9: Executing Statements.) The SQL_DESC_NAME field of an IRD is a read-only field; SQLSTATE HY091 (Invalid descriptor field identifier) will be returned if an application attempts to set it. -# -# -#

In IPDs, this field is undefined if the driver does not support named parameters. If the driver supports named parameters and is capable of describing parameters, the parameter name is returned in this field. -#

-# -#
SQL_DESC_NULLABLE [Implementation descriptors]
-# -#
In IRDs, this read-only SQLSMALLINT record field is SQL_NULLABLE if the column can have NULL values, SQL_NO_NULLS if the column does not have NULL values, or SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values. This field pertains to the result set column, not the base column. -# -#

In IPDs, this field is always set to SQL_NULLABLE because dynamic parameters are always nullable and cannot be set by an application. -#

-# -#
SQL_DESC_NUM_PREC_RADIX [All]
-# -#
This SQLINTEGER field contains a value of 2 if the data type in the SQL_DESC_TYPE field is an approximate numeric data type, because the SQL_DESC_PRECISION field contains the number of bits. This field contains a value of 10 if the data type in the SQL_DESC_TYPE field is an exact numeric data type, because the SQL_DESC_PRECISION field contains the number of decimal digits. This field is set to 0 for all non-numeric data types.
-# -#
SQL_DESC_OCTET_LENGTH [All]
-# -#
This SQLINTEGER record field contains the length, in bytes, of a character string or binary data type. For fixed-length character or binary types, this is the actual length in bytes. For variable-length character or binary types, this is the maximum length in bytes. This value always excludes space for the null-termination character for implementation descriptors and always includes space for the null-termination character for application descriptors. For application data, this field contains the size of the buffer. For APDs, this field is defined only for output or input/output parameters.
-# -#
SQL_DESC_OCTET_LENGTH_PTR [Application descriptors]
-# -#
This SQLINTEGER * record field points to a variable that will contain the total length in bytes of a dynamic argument (for parameter descriptors) or of a bound column value (for row descriptors). -# -#

For an APD, this value is ignored for all arguments except character string and binary; if this field points to SQL_NTS, the dynamic argument must be null-terminated. To indicate that a bound parameter will be a data-at-execution parameter, an application sets this field in the appropriate record of the APD to a variable that, at execute time, will contain the value SQL_DATA_AT_EXEC or the result of the SQL_LEN_DATA_AT_EXEC macro. If there is more than one such field, SQL_DESC_DATA_PTR can be set to a value uniquely identifying the parameter to help the application determine which parameter is being requested. -# -# -#

If the OCTET_LENGTH_PTR field of an ARD is a null pointer, the driver does not return length information for the column. If the SQL_DESC_OCTET_LENGTH_PTR field of an APD is a null pointer, the driver assumes that character strings and binary values are null-terminated. (Binary values should not be null-terminated but should be given a length to avoid truncation.) -# -# -#

If the call to SQLFetch or SQLFetchScroll that fills in the buffer pointed to by this field did not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined. This field is a deferred field. It is not used at the time it is set but is used at a later time by the driver to determine or indicate the octet length of the data. -#

-# -#
SQL_DESC_PARAMETER_TYPE [IPDs]
-# -#
This SQLSMALLINT record field is set to SQL_PARAM_INPUT for an input parameter, SQL_PARAM_INPUT_OUTPUT for an input/output parameter, or SQL_PARAM_OUTPUT for an output parameter. It is set to SQL_PARAM_INPUT by default. -# -#

For an IPD, the field is set to SQL_PARAM_INPUT by default if the IPD is not automatically populated by the driver (the SQL_ATTR_ENABLE_AUTO_IPD statement attribute is SQL_FALSE). An application should set this field in the IPD for parameters that are not input parameters. -#

-# -#
SQL_DESC_PRECISION [All]
-# -#
This SQLSMALLINT record field contains the number of digits for an exact numeric type, the number of bits in the mantissa (binary precision) for an approximate numeric type, or the numbers of digits in the fractional seconds component for the SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, or SQL_INTERVAL_SECOND data type. This field is undefined for all other data types. -# -#

The value in this field may be different from the value for "precision" as defined in ODBC 2.x. For more information, see Appendix D: Data Types. -#

-# -#
SQL_DESC_ROWVER [Implementation descriptors]
-# -#
This SQLSMALLINT record field indicates whether a column is automatically modified by the DBMS when a row is updated (for example, a column of the type "timestamp" in SQL Server). The value of this record field is set to SQL_TRUE if the column is a row versioning column, and to SQL_FALSE otherwise. This column attribute is similar to calling SQLSpecialColumns with IdentifierType of SQL_ROWVER to determine whether a column is automatically updated.
-# -#
SQL_DESC_SCALE [All]
-# -#
This SQLSMALLINT record field contains the defined scale for decimal and numeric data types. The field is undefined for all other data types. -# -#

The value in this field may be different from the value for "scale" as defined in ODBC 2.x. For more information, see Appendix D: Data Types. -#

-# -#
SQL_DESC_SCHEMA_NAME [IRDs]
-# -#
This read-only SQLCHAR * record field contains the schema name of the base table that contains the column. The return value is driver-dependent if the column is an expression or if the column is part of a view. If the data source does not support schemas or the schema name cannot be determined, this variable contains an empty string.
-# -#
SQL_DESC_SEARCHABLE [IRDs]
-# -#
This read-only SQLSMALLINT record field is set to one of the following values: -# -#
    -#
  • SQL_PRED_NONE if the column cannot be used in a WHERE clause. (This is the same as the SQL_UNSEARCHABLE value in ODBC 2.x.)
  • -# -#
  • SQL_PRED_CHAR if the column can be used in a WHERE clause but only with the LIKE predicate. (This is the same as the SQL_LIKE_ONLY value in ODBC 2.x.)
  • -# -#
  • SQL_PRED_BASIC if the column can be used in a WHERE clause with all the comparison operators except LIKE. (This is the same as the SQL_EXCEPT_LIKE value in ODBC 2.x.)
  • -# -#
  • SQL_PRED_SEARCHABLE if the column can be used in a WHERE clause with any comparison operator.
  • -#
-#
-# -#
SQL_DESC_TABLE_NAME [IRDs]
-# -#
This read-only SQLCHAR * record field contains the name of the base table that contains this column. The return value is driver-dependent if the column is an expression or if the column is part of a view.
-# -#
SQL_DESC_TYPE [All]
-# -#
This SQLSMALLINT record field specifies the concise SQL or C data type for all data types except datetime and interval data types. For the datetime and interval data types, this field specifies the verbose data type, which is SQL_DATETIME or SQL_INTERVAL. -# -#

Whenever this field contains SQL_DATETIME or SQL_INTERVAL, the SQL_DESC_DATETIME_INTERVAL_CODE field must contain the appropriate subcode for the concise type. For datetime data types, SQL_DESC_TYPE contains SQL_DATETIME, and the SQL_DESC_DATETIME_INTERVAL_CODE field contains a subcode for the specific datetime data type. For interval data types, SQL_DESC_TYPE contains SQL_INTERVAL and the SQL_DESC_DATETIME_INTERVAL_CODE field contains a subcode for the specific interval data type. -# -# -#

The values in the SQL_DESC_TYPE and SQL_DESC_CONCISE_TYPE fields are interdependent. Each time one of the fields is set, the other must also be set. SQL_DESC_TYPE can be set by a call to SQLSetDescField or SQLSetDescRec. SQL_DESC_CONCISE_TYPE can be set by a call to SQLBindCol or SQLBindParameter, or SQLSetDescField. -# -# -#

If SQL_DESC_TYPE is set to a concise data type other than an interval or datetime data type, the SQL_DESC_CONCISE_TYPE field is set to the same value and the SQL_DESC_DATETIME_INTERVAL_CODE field is set to 0. -# -# -#

If SQL_DESC_TYPE is set to the verbose datetime or interval data type (SQL_DATETIME or SQL_INTERVAL) and the SQL_DESC_DATETIME_INTERVAL_CODE field is set to the appropriate subcode, the SQL_DESC_CONCISE TYPE field is set to the corresponding concise type. Trying to set SQL_DESC_TYPE to one of the concise datetime or interval types will return SQLSTATE HY021 (Inconsistent descriptor information). -# -# -#

When the SQL_DESC_TYPE field is set by a call to SQLBindCol, SQLBindParameter, or SQLSetDescField, the following fields are set to the following default values, as shown in the table below. The values of the remaining fields of the same record are undefined. -# -# -#

-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Value of SQL_DESC_TYPEOther fields implicitly set
SQL_CHAR, SQL_VARCHAR, SQL_C_CHAR, SQL_C_VARCHARSQL_DESC_LENGTH is set to 1. SQL_DESC_PRECISION is set to 0.
SQL_DATETIMEWhen SQL_DESC_DATETIME_INTERVAL_CODE is set to SQL_CODE_DATE or SQL_CODE_TIME, SQL_DESC_PRECISION is set to 0. When it is set to SQL_DESC_TIMESTAMP, SQL_DESC_PRECISION is set to 6.
SQL_DECIMAL, SQL_NUMERIC,
-# SQL_C_NUMERIC
SQL_DESC_SCALE is set to 0. SQL_DESC_PRECISION is set to the implementation-defined precision for the respective data type.
SQL_FLOAT, SQL_C_FLOATSQL_DESC_PRECISION is set to the implementation-defined default precision for SQL_FLOAT.
SQL_INTERVALWhen SQL_DESC_DATETIME_INTERVAL_CODE is set to an interval data type, SQL_DESC_DATETIME_INTERVAL_PRECISION is set to 2 (the default interval leading precision). When the interval has a seconds component, SQL_DESC_PRECISION is set to 6 (the default interval seconds precision).
-# -# -# -#

When an application calls SQLSetDescField to set fields of a descriptor rather than calling SQLSetDescRec, the application must first declare the data type. When it does, the other fields indicated in the previous table are implicitly set. If any of the values implicitly set are unacceptable, the application can then call SQLSetDescField or SQLSetDescRec to set the unacceptable value explicitly. -#

-# -#
SQL_DESC_TYPE_NAME [Implementation descriptors]
-# -#
This read-only SQLCHAR * record field contains the data source–dependent type name (for example, "CHAR", "VARCHAR", and so on). If the data type name is unknown, this variable contains an empty string.
-# -#
SQL_DESC_UNNAMED [Implementation descriptors]
-# -#
This SQLSMALLINT record field in a row descriptor is set by the driver to either SQL_NAMED or SQL_UNNAMED when it sets the SQL_DESC_NAME field. If the SQL_DESC_NAME field contains a column alias or if the column alias does not apply, the driver sets the SQL_DESC_UNNAMED field to SQL_NAMED. If an application sets the SQL_DESC_NAME field of an IPD to a parameter name or alias, the driver sets the SQL_DESC_UNNAMED field of the IPD to SQL_NAMED. If there is no column name or a column alias, the driver sets the SQL_DESC_UNNAMED field to SQL_UNNAMED. -# -#

An application can set the SQL_DESC_UNNAMED field of an IPD to SQL_UNNAMED. A driver returns SQLSTATE HY091 (Invalid descriptor field identifier) if an application attempts to set the SQL_DESC_UNNAMED field of an IPD to SQL_NAMED. The SQL_DESC_UNNAMED field of an IRD is read-only; SQLSTATE HY091 (Invalid descriptor field identifier) will be returned if an application attempts to set it. -#

-# -#
SQL_DESC_UNSIGNED [Implementation descriptors]
-# -#
This read-only SQLSMALLINT record field is set to SQL_TRUE if the column type is unsigned or non-numeric, or SQL_FALSE if the column type is signed.
-# -#
SQL_DESC_UPDATABLE [IRDs]
-# -#
This read-only SQLSMALLINT record field is set to one of the following values: -# -#
    -#
  • SQL_ATTR_READ_ONLY if the result set column is read-only.
  • -# -#
  • SQL_ATTR_WRITE if the result set column is read-write.
  • -# -#
  • SQL_ATTR_READWRITE_UNKNOWN if it is not known whether the result set column is updatable or not.
  • -#
-# -# -#

SQL_DESC_UPDATABLE describes the updatability of the column in the result set, not the column in the base table. The updatability of the column in the base table on which this result set column is based may be different than the value in this field. Whether a column is updatable can be based on the data type, user privileges, and the definition of the result set itself. If it is unclear whether a column is updatable, SQL_ATTR_READWRITE_UNKNOWN should be returned. -#

-#
-# -#

Consistency Checks

-# -#

A consistency check is performed by the driver automatically whenever an application passes in a value for the SQL_DESC_DATA_PTR field of the ARD, APD, or IPD. If any of the fields is inconsistent with other fields, SQLSetDescField will return SQLSTATE HY021 (Inconsistent descriptor information). For more information, see "Consistency Check" in SQLSetDescRec.

-# -#

Related Functions

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
For information aboutSee
Binding a columnSQLBindCol
Binding a parameterSQLBindParameter
Getting a descriptor fieldSQLGetDescField
Getting multiple descriptor fieldsSQLGetDescRec
Setting multiple descriptor fieldsSQLSetDescRec
-#

-# -#
-# -# -# -}; diff --git a/ndb/src/old_files/client/odbc/docs/diag.txt b/ndb/src/old_files/client/odbc/docs/diag.txt deleted file mode 100644 index a9a0e0f42d0..00000000000 --- a/ndb/src/old_files/client/odbc/docs/diag.txt +++ /dev/null @@ -1,48 +0,0 @@ -# Header Fields - -SQL_DIAG_CURSOR_ROW_COUNT -SQLINTEGER - -SQL_DIAG_DYNAMIC_FUNCTION -SQLCHAR * - -SQL_DIAG_DYNAMIC_FUNCTION_CODE -SQLINTEGER - -SQL_DIAG_NUMBER -SQLINTEGER - -SQL_DIAG_RETURNCODE -SQLRETURN - -SQL_DIAG_ROW_COUNT -SQLINTEGER - -# Record Fields - -SQL_DIAG_CLASS_ORIGIN -SQLCHAR * - -SQL_DIAG_COLUMN_NUMBER -SQLINTEGER - -SQL_DIAG_CONNECTION_NAME -SQLCHAR * - -SQL_DIAG_MESSAGE_TEXT -SQLCHAR * - -SQL_DIAG_NATIVE -SQLINTEGER - -SQL_DIAG_ROW_NUMBER -SQLINTEGER - -SQL_DIAG_SERVER_NAME -SQLCHAR * - -SQL_DIAG_SQLSTATE -SQLCHAR * - -SQL_DIAG_SUBCLASS_ORIGIN -SQLCHAR * diff --git a/ndb/src/old_files/client/odbc/docs/getinfo.pl b/ndb/src/old_files/client/odbc/docs/getinfo.pl deleted file mode 100644 index 34e26b47bab..00000000000 --- a/ndb/src/old_files/client/odbc/docs/getinfo.pl +++ /dev/null @@ -1,3676 +0,0 @@ -# -use strict; - -# -# odbcsqlgetinfo.htm -# -my $info = { -# -# -# -# SQLGetInfo -# -# -# -# -# -# -#
-#
-# -# -# -# -#
-# ODBC Programmer's Reference -#
-#
-#
-#
-# -#

SQLGetInfo

-# -#

Conformance

-# -#

Version Introduced: ODBC 1.0
-# Standards Compliance: ISO 92

-# -#

Summary

-# -#

SQLGetInfo returns general information about the driver and data source associated with a connection.

-# -#

Syntax

-# -#
SQLRETURN SQLGetInfo(
-#	     SQLHDBC     ConnectionHandle,
-#	     SQLUSMALLINT     InfoType,
-#	     SQLPOINTER     InfoValuePtr,
-#	     SQLSMALLINT     BufferLength,
-#	     SQLSMALLINT *     StringLengthPtr);
-# -#

Arguments -# -#

-#
ConnectionHandle
-# -#
[Input]
-# Connection handle.
-# -#
InfoType
-# -#
[Input]
-# Type of information.
-# -#
InfoValuePtr
-# -#
[Output]
-# Pointer to a buffer in which to return the information. Depending on the InfoType requested, the information returned will be one of the following: a null-terminated character string, an SQLUSMALLINT value, an SQLUINTEGER bitmask, an SQLUINTEGER flag, or a SQLUINTEGER binary value. -# -#

If the InfoType argument is SQL_DRIVER_HDESC or SQL_DRIVER_HSTMT, the InfoValuePtr argument is both input and output. (See the SQL_DRIVER_HDESC or SQL_DRIVER_HSTMT descriptors later in this function description for more information.) -#

-# -#
BufferLength
-# -#
[Input]
-# Length of the *InfoValuePtr buffer. If the value in *InfoValuePtr is not a character string or if InfoValuePtr is a null pointer, the BufferLength argument is ignored. The driver assumes that the size of *InfoValuePtr is SQLUSMALLINT or SQLUINTEGER, based on the InfoType. If *InfoValuePtr is a Unicode string (when calling SQLGetInfoW), the BufferLength argument must be an even number; if not, SQLSTATE HY090 (Invalid string or buffer length) is returned.
-# -#
StringLengthPtr
-# -#
[Output]
-# Pointer to a buffer in which to return the total number of bytes (excluding the null-termination character for character data) available to return in *InfoValuePtr. -# -#

For character data, if the number of bytes available to return is greater than or equal to BufferLength, the information in *InfoValuePtr is truncated to BufferLength bytes minus the length of a null-termination character and is null-terminated by the driver. -# -# -#

For all other types of data, the value of BufferLength is ignored and the driver assumes the size of *InfoValuePtr is SQLUSMALLINT or SQLUINTEGER, depending on the InfoType. -#

-#
-# -#

Returns

-# -#

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

-# -#

Diagnostics

-# -#

When SQLGetInfo returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_DBC and a Handle of ConnectionHandle. The following table lists the SQLSTATE values commonly returned by SQLGetInfo and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQLSTATEErrorDescription
01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
01004String data, right truncatedThe buffer *InfoValuePtr was not large enough to return all of the requested information, so the information was truncated. The length of the requested information in its untruncated form is returned in *StringLengthPtr. (Function returns SQL_SUCCESS_WITH_INFO.)
08003Connection does not exist(DM) The type of information requested in InfoType requires an open connection. Of the information types reserved by ODBC, only SQL_ODBC_VER can be returned without an open connection.
08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001Memory allocation
-# error
The driver was unable to allocate memory required to support execution or completion of the function.
HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY024Invalid attribute value(DM) The InfoType argument was SQL_DRIVER_HSTMT, and the value pointed to by InfoValuePtr was not a valid statement handle. -#

(DM) The InfoType argument was SQL_DRIVER_HDESC, and the value pointed to by InfoValuePtr was not a valid descriptor handle.

-#
HY090Invalid string or buffer length(DM) The value specified for argument BufferLength was less than 0. -#

(DM) The value specified for BufferLength was an odd number, and *InfoValuePtr was of a Unicode data type.

-#
HY096Information type out of rangeThe value specified for the argument InfoType was not valid for the version of ODBC supported by the driver.
HYC00Optional field not implementedThe value specified for the argument InfoType was a driver-specific value that is not supported by the driver.
HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001Driver does not support this function(DM) The driver corresponding to the ConnectionHandle does not support the function.
-# -#

Comments

-# -#

The currently defined information types are shown in "Information Types," later in this section; it is expected that more will be defined to take advantage of different data sources. A range of information types is reserved by ODBC; driver developers must reserve values for their own driver-specific use from X/Open. SQLGetInfo performs no Unicode conversion or thunking (see Appendix A of the ODBC Programmer's Reference) for driver-defined InfoTypes. For more information, see "Driver-Specific Data Types, Descriptor Types, Information Types, Diagnostic Types, and Attributes" in Chapter 17: Programming Considerations. The format of the information returned in *InfoValuePtr depends on the InfoType requested. SQLGetInfo will return information in one of five different formats: -# -#

    -#
  • A null-terminated character string
  • -# -#
  • An SQLUSMALLINT value
  • -# -#
  • An SQLUINTEGER bitmask
  • -# -#
  • An SQLUINTEGER value
  • -# -#
  • A SQLUINTEGER binary value
  • -#
-# -#

The format of each of the following information types is noted in the type's description. The application must cast the value returned in *InfoValuePtr accordingly. For an example of how an application could retrieve data from a SQLUINTEGER bitmask, see "Code Example."

-# -#

A driver must return a value for each of the information types defined in the tables below. If an information type does not apply to the driver or data source, the driver returns one of the values listed in the following table.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Format of *InfoValuePtrReturned value
Character string ("Y" or "N")"N"
Character string (not "Y" or "N")Empty string
SQLUSMALLINT0
SQLUINTEGER bitmask or SQLUINTEGER binary value0L
-# -#

For example, if a data source does not support procedures, SQLGetInfo returns the values listed in the following table for the values of InfoType that are related to procedures.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
InfoTypeReturned value
SQL_PROCEDURES"N"
SQL_ACCESSIBLE_PROCEDURES"N"
SQL_MAX_PROCEDURE_NAME_LEN0
SQL_PROCEDURE_TERMEmpty string
-# -#

SQLGetInfo returns SQLSTATE HY096 (Invalid argument value) for values of InfoType that are in the range of information types reserved for use by ODBC but are not defined by the version of ODBC supported by the driver. To determine what version of ODBC a driver conforms to, an application calls SQLGetInfo with the SQL_DRIVER_ODBC_VER information type. SQLGetInfo returns SQLSTATE HYC00 (Optional feature not implemented) for values of InfoType that are in the range of information types reserved for driver-specific use but are not supported by the driver.

-# -#

All calls to SQLGetInfo require an open connection, except when the InfoType is SQL_ODBC_VER, which returns the version of the Driver Manager.

-# -#

Information Types

-# -#

This section lists the information types supported by SQLGetInfo. Information types are grouped categorically and listed alphabetically. Information types that were added or renamed for ODBC 3.x are also listed.

-# -#

Driver Information

-# -#

The following values of the InfoType argument return information about the ODBC driver, such as the number of active statements, the data source name, and the interface standards compliance level:

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_ACTIVE_ENVIRONMENTSSQL_GETDATA_EXTENSIONS
SQL_ASYNC_MODESQL_INFO_SCHEMA_VIEWS
SQL_BATCH_ROW_COUNTSQL_KEYSET_CURSOR_ATTRIBUTES1
SQL_BATCH_SUPPORTSQL_KEYSET_CURSOR_ATTRIBUTES2
SQL_DATA_SOURCE_NAMESQL_MAX_ASYNC_CONCURRENT_STATEMENTS
SQL_DRIVER_HDBCSQL_MAX_CONCURRENT_ACTIVITIES
SQL_DRIVER_HDESCSQL_MAX_DRIVER_CONNECTIONS
SQL_DRIVER_HENVSQL_ODBC_INTERFACE_CONFORMANCE
SQL_DRIVER_HLIBSQL_ODBC_STANDARD_CLI_CONFORMANCE
SQL_DRIVER_HSTMTSQL_ODBC_VER
SQL_DRIVER_NAMESQL_PARAM_ARRAY_ROW_COUNTS
SQL_DRIVER_ODBC_VERSQL_PARAM_ARRAY_SELECTS
SQL_DRIVER_VERSQL_ROW_UPDATES
SQL_DYNAMIC_CURSOR_ATTRIBUTES1SQL_SEARCH_PATTERN_ESCAPE
SQL_DYNAMIC_CURSOR_ATTRIBUTES2SQL_SERVER_NAME
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1SQL_STATIC_CURSOR_ATTRIBUTES1
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2SQL_STATIC_CURSOR_ATTRIBUTES2
SQL_FILE_USAGE 
-# -#

DBMS Product Information

-# -#

The following values of the InfoType argument return information about the DBMS product, such as the DBMS name and version:

-# -#

SQL_DATABASE_NAME
-# SQL_DBMS_NAME
-# SQL_DBMS_VER

-# -#

Data Source Information

-# -#

The following values of the InfoType argument return information about the data source, such as cursor characteristics and transaction capabilities:

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_ACCESSIBLE_PROCEDURESSQL_MULT_RESULT_SETS
SQL_ACCESSIBLE_TABLESSQL_MULTIPLE_ACTIVE_TXN
SQL_BOOKMARK_PERSISTENCESQL_NEED_LONG_DATA_LEN
SQL_CATALOG_TERMSQL_NULL_COLLATION
SQL_COLLATION_SEQSQL_PROCEDURE_TERM
SQL_CONCAT_NULL_BEHAVIORSQL_SCHEMA_TERM
SQL_CURSOR_COMMIT_BEHAVIORSQL_SCROLL_OPTIONS
SQL_CURSOR_ROLLBACK_BEHAVIORSQL_TABLE_TERM
SQL_CURSOR_SENSITIVITYSQL_TXN_CAPABLE
SQL_DATA_SOURCE_READ_ONLYSQL_TXN_ISOLATION_OPTION
SQL_DEFAULT_TXN_ISOLATIONSQL_USER_NAME
SQL_DESCRIBE_PARAMETER 
-# -#

Supported SQL

-# -#

The following values of the InfoType argument return information about the SQL statements supported by the data source. The SQL syntax of each feature described by these information types is the SQL-92 syntax. These information types do not exhaustively describe the entire SQL-92 grammar. Instead, they describe those parts of the grammar for which data sources commonly offer different levels of support. Specifically, most of the DDL statements in SQL-92 are covered.

-# -#

Applications should determine the general level of supported grammar from the SQL_SQL_CONFORMANCE information type and use the other information types to determine variations from the stated standards compliance level.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_AGGREGATE_FUNCTIONSSQL_DROP_TABLE
SQL_ALTER_DOMAINSQL_DROP_TRANSLATION
SQL_ALTER_SCHEMASQL_DROP_VIEW
SQL_ALTER_TABLESQL_EXPRESSIONS_IN_ORDERBY
SQL_ANSI_SQL_DATETIME_LITERALSSQL_GROUP_BY
SQL_CATALOG_LOCATION SQL_IDENTIFIER_CASE
SQL_CATALOG_NAMESQL_IDENTIFIER_QUOTE_CHAR
SQL_CATALOG_NAME_SEPARATORSQL_INDEX_KEYWORDS
SQL_CATALOG_USAGESQL_INSERT_STATEMENT
SQL_COLUMN_ALIASSQL_INTEGRITY
SQL_CORRELATION_NAMESQL_KEYWORDS
SQL_CREATE_ASSERTIONSQL_LIKE_ESCAPE_CLAUSE
SQL_CREATE_CHARACTER_SETSQL_NON_NULLABLE_COLUMNS
SQL_CREATE_COLLATIONSQL_SQL_CONFORMANCE
SQL_CREATE_DOMAINSQL_OJ_CAPABILITIES
SQL_CREATE_SCHEMASQL_ORDER_BY_COLUMNS_IN_SELECT
SQL_CREATE_TABLESQL_OUTER_JOINS
SQL_CREATE_TRANSLATIONSQL_PROCEDURES
SQL_DDL_INDEXSQL_QUOTED_IDENTIFIER_CASE
SQL_DROP_ASSERTIONSQL_SCHEMA_USAGE
SQL_DROP_CHARACTER_SETSQL_SPECIAL_CHARACTERS
SQL_DROP_COLLATIONSQL_SUBQUERIES
SQL_DROP_DOMAINSQL_UNION
SQL_DROP_SCHEMA 
-# -#

SQL Limits

-# -#

The following values of the InfoType argument return information about the limits applied to identifiers and clauses in SQL statements, such as the maximum lengths of identifiers and the maximum number of columns in a select list. Limitations can be imposed by either the driver or the data source.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_MAX_BINARY_LITERAL_LENSQL_MAX_IDENTIFIER_LEN
SQL_MAX_CATALOG_NAME_LENSQL_MAX_INDEX_SIZE
SQL_MAX_CHAR_LITERAL_LENSQL_MAX_PROCEDURE_NAME_LEN
SQL_MAX_COLUMN_NAME_LENSQL_MAX_ROW_SIZE
SQL_MAX_COLUMNS_IN_GROUP_BYSQL_MAX_ROW_SIZE_INCLUDES_LONG
SQL_MAX_COLUMNS_IN_INDEXSQL_MAX_SCHEMA_NAME_LEN
SQL_MAX_COLUMNS_IN_ORDER_BYSQL_MAX_STATEMENT_LEN
SQL_MAX_COLUMNS_IN_SELECTSQL_MAX_TABLE_NAME_LEN
SQL_MAX_COLUMNS_IN_TABLESQL_MAX_TABLES_IN_SELECT
SQL_MAX_CURSOR_NAME_LENSQL_MAX_USER_NAME_LEN
-# -#

Scalar Function Information

-# -#

The following values of the InfoType argument return information about the scalar functions supported by the data source and the driver. For more information about scalar functions, see Appendix E: Scalar Functions.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_CONVERT_FUNCTIONSSQL_TIMEDATE_ADD_INTERVALS
SQL_NUMERIC_FUNCTIONSSQL_TIMEDATE_DIFF_INTERVALS
SQL_STRING_FUNCTIONSSQL_TIMEDATE_FUNCTIONS
SQL_SYSTEM_FUNCTIONS 
-# -#

Conversion Information

-# -#

The following values of the InfoType argument return a list of the SQL data types to which the data source can convert the specified SQL data type with the CONVERT scalar function:

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_CONVERT_BIGINTSQL_CONVERT_LONGVARBINARY
SQL_CONVERT_BINARYSQL_CONVERT_LONGVARCHAR
SQL_CONVERT_BITSQL_CONVERT_NUMERIC
SQL_CONVERT_CHARSQL_CONVERT_REAL
SQL_CONVERT_DATESQL_CONVERT_SMALLINT
SQL_CONVERT_DECIMALSQL_CONVERT_TIME
SQL_CONVERT_DOUBLESQL_CONVERT_TIMESTAMP
SQL_CONVERT_FLOATSQL_CONVERT_TINYINT
SQL_CONVERT_INTEGERSQL_CONVERT_VARBINARY
SQL_CONVERT_INTERVAL_YEAR_MONTHSQL_CONVERT_VARCHAR
SQL_CONVERT_INTERVAL_DAY_TIME 
-# -#

Information Types Added for ODBC 3.x

-# -#

The following values of the InfoType argument have been added for ODBC 3.x:

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_ACTIVE_ENVIRONMENTSSQL_DROP_ASSERTION
SQL_AGGREGATE_FUNCTIONSSQL_DROP_CHARACTER_SET
SQL_ALTER_DOMAINSQL_DROP_COLLATION
SQL_ALTER_SCHEMASQL_DROP_DOMAIN
SQL_ANSI_SQL_DATETIME_LITERALSSQL_DROP_SCHEMA
SQL_ASYNC_MODESQL_DROP_TABLE
SQL_BATCH_ROW_COUNTSQL_DROP_TRANSLATION
SQL_BATCH_SUPPORTSQL_DROP_VIEW
SQL_CATALOG_NAMESQL_DYNAMIC_CURSOR_ATTRIBUTES1
SQL_COLLATION_SEQSQL_DYNAMIC_CURSOR_ATTRIBUTES2
SQL_CONVERT_INTERVAL_YEAR_MONTHSQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1
SQL_CONVERT_INTERVAL_DAY_TIMESQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
SQL_CREATE_ASSERTIONSQL_INFO_SCHEMA_VIEWS
SQL_CREATE_CHARACTER_SETSQL_INSERT_STATEMENT
SQL_CREATE_COLLATIONSQL_KEYSET_CURSOR_ATTRIBUTES1
SQL_CREATE_DOMAINSQL_KEYSET_CURSOR_ATTRIBUTES2
SQL_CREATE_SCHEMASQL_MAX_ASYNC_CONCURRENT_STATEMENTS
SQL_CREATE_TABLESQL_MAX_IDENTIFIER_LEN
SQL_CREATE_TRANSLATIONSQL_PARAM_ARRAY_ROW_COUNTS
SQL_CURSOR_SENSITIVITYSQL_PARAM_ARRAY_SELECTS
SQL_DDL_INDEXSQL_STATIC_CURSOR_ATTRIBUTES1
SQL_DESCRIBE_PARAMETERSQL_STATIC_CURSOR_ATTRIBUTES2
SQL_DM_VERSQL_XOPEN_CLI_YEAR
SQL_DRIVER_HDESC 
-# -#

Information Types Renamed for ODBC 3.x

-# -#

The following values of the InfoType argument have been renamed for ODBC 3.x.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
ODBC 2.0 InfoTypeODBC 3.x InfoType
SQL_ACTIVE_CONNECTIONSSQL_MAX_DRIVER_CONNECTIONS
SQL_ACTIVE_STATEMENTSSQL_MAX_CONCURRENT_ACTIVITIES
SQL_MAX_OWNER_NAME_LENSQL_MAX_SCHEMA_NAME_LEN
SQL_MAX_QUALIFIER_NAME_LENSQL_MAX_CATALOG_NAME_LEN
SQL_ODBC_SQL_OPT_IEFSQL_INTEGRITY
SQL_OWNER_TERMSQL_SCHEMA_TERM
SQL_OWNER_USAGESQL_SCHEMA_USAGE
SQL_QUALIFIER_LOCATIONSQL_CATALOG_LOCATION
SQL_QUALIFIER_NAME_SEPARATORSQL_CATALOG_NAME_SEPARATOR
SQL_QUALIFIER_TERMSQL_CATALOG_TERM
SQL_QUALIFIER_USAGESQL_CATALOG_USAGE
-# -#

Information Types Deprecated in ODBC 3.x

-# -#

The following values of the InfoType argument have been deprecated in ODBC 3.x. ODBC 3.x drivers must continue to support these information types for backward compatibility with ODBC 2.x applications. (For more information on these types, see "SQLGetInfo Support" in Appendix G: Driver Guidelines for Backward Compatibility.)

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQL_FETCH_DIRECTIONSQL_POS_OPERATIONS
SQL_LOCK_TYPESSQL_POSITIONED_STATEMENTS
SQL_ODBC_API_CONFORMANCESQL_SCROLL_CONCURRENCY
SQL_ODBC_SQL_CONFORMANCESQL_STATIC_SENSITIVITY
-# -#

Information Type Descriptions

-# -#

The following table alphabetically lists each information type, the version of ODBC in which it was introduced, and its description.

-#
-# -# -# -# -# -# -# -# -# -# - SQL_ACCESSIBLE_PROCEDURES => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_ACCESSIBLE_TABLES => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_ACTIVE_ENVIRONMENTS => { - type => q(Short), - }, -# -# -# -# -# - SQL_AGGREGATE_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_ALTER_DOMAIN => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_ALTER_TABLE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_ASYNC_MODE => { - type => q(Long), - }, -# -# -# -# -# - SQL_BATCH_ROW_COUNT => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_BATCH_SUPPORT => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_BOOKMARK_PERSISTENCE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CATALOG_LOCATION => { - type => q(Short), - }, -# -# -# -# -# - SQL_CATALOG_NAME => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_CATALOG_NAME_SEPARATOR => { - type => q(Char), - }, -# -# -# -# -# - SQL_CATALOG_TERM => { - type => q(Char), - }, -# -# -# -# -# - SQL_CATALOG_USAGE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_COLLATION_SEQ => { - type => q(Char), - }, -# -# -# -# -# - SQL_COLUMN_ALIAS => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_CONCAT_NULL_BEHAVIOR => { - type => q(Short), - }, -# -# -# -# -# -# -# -# -# -# - SQL_CONVERT_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CORRELATION_NAME => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_ASSERTION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_CHARACTER_SET => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_COLLATION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_DOMAIN => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_SCHEMA => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_TABLE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_TRANSLATION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CREATE_VIEW => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_CURSOR_COMMIT_BEHAVIOR => { - type => q(Short), - }, -# -# -# -# -# - SQL_CURSOR_ROLLBACK_BEHAVIOR => { - type => q(Short), - }, -# -# -# -# -# - SQL_CURSOR_SENSITIVITY => { - type => q(Long), - }, -# -# -# -# -# - SQL_DATA_SOURCE_NAME => { - type => q(Char), - }, -# -# -# -# -# - SQL_DATA_SOURCE_READ_ONLY => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_DATABASE_NAME => { - type => q(Char), - }, -# -# -# -# -# - SQL_DATETIME_LITERALS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DBMS_NAME => { - type => q(Char), - }, -# -# -# -# -# - SQL_DBMS_VER => { - type => q(Char), - }, -# -# -# -# -# - SQL_DDL_INDEX => { - type => q(Long), - }, -# -# -# -# -# - SQL_DEFAULT_TXN_ISOLATION => { - type => q(Long), - }, -# -# -# -# -# - SQL_DESCRIBE_PARAMETER => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_DM_VER => { - type => q(Char), - }, -# -# -# -# -# - SQL_DRIVER_HDBC => { - type => q(Long), - }, -# -# -# -# -# - SQL_DRIVER_HDESC => { - type => q(Long), - }, -# -# -# -# -# - SQL_DRIVER_HLIB => { - type => q(Long), - }, -# -# -# -# -# - SQL_DRIVER_HSTMT => { - type => q(Long), - }, -# -# -# -# -# - SQL_DRIVER_NAME => { - type => q(Char), - }, -# -# -# -# -# - SQL_DRIVER_ODBC_VER => { - type => q(Char), - }, -# -# -# -# -# - SQL_DRIVER_VER => { - type => q(Char), - }, -# -# -# -# -# - SQL_DROP_ASSERTION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_CHARACTER_SET => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_COLLATION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_DOMAIN => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_SCHEMA => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_TABLE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_TRANSLATION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DROP_VIEW => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DYNAMIC_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_DYNAMIC_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_EXPRESSIONS_IN_ORDERBY => { - type => q(Char), - }, -# -# -# -# -# - SQL_FILE_USAGE => { - type => q(Short), - }, -# -# -# -# -# - SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_GETDATA_EXTENSIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_GROUP_BY => { - type => q(Short), - }, -# -# -# -# -# - SQL_IDENTIFIER_CASE => { - type => q(Short), - }, -# -# -# -# -# - SQL_IDENTIFIER_QUOTE_CHAR => { - type => q(Char), - }, -# -# -# -# -# - SQL_INDEX_KEYWORDS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_INFO_SCHEMA_VIEWS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_INSERT_STATEMENT => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_INTEGRITY => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_KEYSET_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_KEYSET_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_KEYWORDS => { - type => q(Char), - }, -# -# -# -# -# - SQL_LIKE_ESCAPE_CLAUSE => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_MAX_ASYNC_CONCURRENT_STATEMENTS => { - type => q(Long), - }, -# -# -# -# -# - SQL_MAX_BINARY_LITERAL_LEN => { - type => q(Long), - }, -# -# -# -# -# - SQL_MAX_CATALOG_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_CHAR_LITERAL_LEN => { - type => q(Long), - }, -# -# -# -# -# - SQL_MAX_COLUMN_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_COLUMNS_IN_GROUP_BY => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_COLUMNS_IN_INDEX => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_COLUMNS_IN_ORDER_BY => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_COLUMNS_IN_SELECT => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_COLUMNS_IN_TABLE => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_CONCURRENT_ACTIVITIES => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_CURSOR_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_DRIVER_CONNECTIONS => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_IDENTIFIER_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_INDEX_SIZE => { - type => q(Long), - }, -# -# -# -# -# - SQL_MAX_PROCEDURE_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_ROW_SIZE => { - type => q(Long), - }, -# -# -# -# -# - SQL_MAX_ROW_SIZE_INCLUDES_LONG => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_MAX_SCHEMA_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_STATEMENT_LEN => { - type => q(Long), - }, -# -# -# -# -# - SQL_MAX_TABLE_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_TABLES_IN_SELECT => { - type => q(Short), - }, -# -# -# -# -# - SQL_MAX_USER_NAME_LEN => { - type => q(Short), - }, -# -# -# -# -# - SQL_MULT_RESULT_SETS => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_MULTIPLE_ACTIVE_TXN => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_NEED_LONG_DATA_LEN => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_NON_NULLABLE_COLUMNS => { - type => q(Short), - }, -# -# -# -# -# - SQL_NULL_COLLATION => { - type => q(Short), - }, -# -# -# -# -# - SQL_NUMERIC_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_ODBC_INTERFACE_CONFORMANCE => { - type => q(Long), - }, -# -# -# -# -# - SQL_ODBC_VER => { - type => q(Char), - }, -# -# -# -# -# - SQL_OJ_CAPABILITIES => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_ORDER_BY_COLUMNS_IN_SELECT => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_PARAM_ARRAY_ROW_COUNTS => { - type => q(Long), - }, -# -# -# -# -# - SQL_PARAM_ARRAY_SELECTS => { - type => q(Long), - }, -# -# -# -# -# - SQL_PROCEDURE_TERM => { - type => q(Char), - }, -# -# -# -# -# - SQL_PROCEDURES => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_POS_OPERATIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_QUOTED_IDENTIFIER_CASE => { - type => q(Short), - }, -# -# -# -# -# - SQL_ROW_UPDATES => { - type => q(YesNo), - }, -# -# -# -# -# - SQL_SCHEMA_TERM => { - type => q(Char), - }, -# -# -# -# -# - SQL_SCHEMA_USAGE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SCROLL_OPTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SEARCH_PATTERN_ESCAPE => { - type => q(Char), - }, -# -# -# -# -# - SQL_SERVER_NAME => { - type => q(Char), - }, -# -# -# -# -# - SQL_SPECIAL_CHARACTERS => { - type => q(Char), - }, -# -# -# -# -# - SQL_SQL_CONFORMANCE => { - type => q(Long), - }, -# -# -# -# -# - SQL_SQL92_DATETIME_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_FOREIGN_KEY_DELETE_RULE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_FOREIGN_KEY_UPDATE_RULE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_GRANT => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_NUMERIC_VALUE_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_PREDICATES => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_RELATIONAL_JOIN_OPERATORS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_REVOKE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_ROW_VALUE_CONSTRUCTOR => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_STRING_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SQL92_VALUE_EXPRESSIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_STANDARD_CLI_CONFORMANCE => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_STATIC_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_STATIC_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_STRING_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SUBQUERIES => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_SYSTEM_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_TABLE_TERM => { - type => q(Char), - }, -# -# -# -# -# - SQL_TIMEDATE_ADD_INTERVALS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_TIMEDATE_DIFF_INTERVALS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_TIMEDATE_FUNCTIONS => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_TXN_CAPABLE => { - type => q(Short), - }, -# -# -# -# -# - SQL_TXN_ISOLATION_OPTION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_UNION => { - type => q(Bitmask), - }, -# -# -# -# -# - SQL_USER_NAME => { - type => q(Char), - }, -# -# -# -# -# - SQL_XOPEN_CLI_YEAR => { - type => q(Char), - }, -#
InfoTypeReturns
SQL_ACCESSIBLE_PROCEDURES
-# (ODBC 1.0)
A character string: "Y" if the user can execute all procedures returned by SQLProcedures; "N" if there may be procedures returned that the user cannot execute.
SQL_ACCESSIBLE_TABLES
-# (ODBC 1.0)
A character string: "Y" if the user is guaranteed SELECT privileges to all tables returned by SQLTables; "N" if there may be tables returned that the user cannot access.
SQL_ACTIVE_ENVIRONMENTS
-# (ODBC 3.0)
An SQLUSMALLINT value specifying the maximum number of active environments that the driver can support. If there is no specified limit or the limit is unknown, this value is set to zero.
SQL_AGGREGATE_FUNCTIONS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating support for aggregation functions: -#

SQL_AF_ALL
-# SQL_AF_AVG
-# SQL_AF_COUNT
-# SQL_AF_DISTINCT
-# SQL_AF_MAX
-# SQL_AF_MIN
-# SQL_AF_SUM

-# -#

An SQL-92 Entry level–conformant driver will always return all of these options as supported.

-#
SQL_ALTER_DOMAIN
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the ALTER DOMAIN statement, as defined in SQL-92, supported by the data source. An SQL-92 Full level–compliant driver will always return all of the bitmasks. A return value of "0" means that the ALTER DOMAIN statement is not supported. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_AD_ADD_DOMAIN_CONSTRAINT = Adding a domain constraint is supported (Full level)

-# -#

SQL_AD_ADD_DOMAIN_DEFAULT = <alter domain> <set domain default clause> is supported (Full level)

-# -#

SQL_AD_CONSTRAINT_NAME_DEFINITION = <constraint name definition clause> is supported for naming domain constraint (Intermediate level)

-# -#

SQL_AD_DROP_DOMAIN_CONSTRAINT = <drop domain constraint clause> is supported (Full level)

-# -#

SQL_AD_DROP_DOMAIN_DEFAULT = <alter domain> <drop domain default clause> is supported (Full level)

-# -#

The following bits specify the supported <constraint attributes> if <add domain constraint> is supported (the SQL_AD_ADD_DOMAIN_CONSTRAINT bit is set):

-# -#

SQL_AD_ADD_CONSTRAINT_DEFERRABLE (Full level)
-# SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE (Full level)
-# SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED (Full level)
-# SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE (Full level)

-#
SQL_ALTER_TABLE
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the clauses in the ALTER TABLE statement supported by the data source. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_AT_ADD_COLUMN_COLLATION = <add column> clause is supported, with facility to specify column collation (Full level) (ODBC 3.0)

-# -#

SQL_AT_ADD_COLUMN_DEFAULT = <add column> clause is supported, with facility to specify column defaults (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_ADD_COLUMN_SINGLE = <add column> is supported (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_ADD_CONSTRAINT = <add column> clause is supported, with facility to specify column constraints (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_ADD_TABLE_CONSTRAINT = <add table constraint> clause is supported (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_CONSTRAINT_NAME_DEFINITION = <constraint name definition> is supported for naming column and table constraints (Intermediate level) (ODBC 3.0)

-# -#

SQL_AT_DROP_COLUMN_CASCADE = <drop column> CASCADE is supported (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_DROP_COLUMN_DEFAULT = <alter column> <drop column default clause> is supported (Intermediate level) (ODBC 3.0)

-# -#

SQL_AT_DROP_COLUMN_RESTRICT = <drop column> RESTRICT is supported (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE (ODBC 3.0)

-# -#

SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT = <drop column> RESTRICT is supported (FIPS Transitional level) (ODBC 3.0)

-# -#

SQL_AT_SET_COLUMN_DEFAULT = <alter column> <set column default clause> is supported (Intermediate level) (ODBC 3.0)

-# -#

The following bits specify the support <constraint attributes> if specifying column or table constraints is supported (the SQL_AT_ADD_CONSTRAINT bit is set):

-# -#

SQL_AT_CONSTRAINT_INITIALLY_DEFERRED (Full level) (ODBC 3.0)
-# SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE (Full level) (ODBC 3.0)
-# SQL_AT_CONSTRAINT_DEFERRABLE (Full level) (ODBC 3.0)
-# SQL_AT_CONSTRAINT_NON_DEFERRABLE (Full level) (ODBC 3.0)

-#
SQL_ASYNC_MODE
-# (ODBC 3.0)
An SQLUINTEGER value indicating the level of asynchronous support in the driver: -#

SQL_AM_CONNECTION = Connection level asynchronous execution is supported. Either all statement handles associated with a given connection handle are in asynchronous mode or all are in synchronous mode. A statement handle on a connection cannot be in asynchronous mode while another statement handle on the same connection is in synchronous mode, and vice versa.

-# -#

SQL_AM_STATEMENT = Statement level asynchronous execution is supported. Some statement handles associated with a connection handle can be in asynchronous mode, while other statement handles on the same connection are in synchronous mode.

-# -#

SQL_AM_NONE = Asynchronous mode is not supported.

-#
SQL_BATCH_ROW_COUNT
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the behavior of the driver with respect to the availability of row counts. The following bitmasks are used in conjunction with the information type: -#

SQL_BRC_ROLLED_UP = Row counts for consecutive INSERT, DELETE, or UPDATE statements are rolled up into one. If this bit is not set, then row counts are available for each individual statement.

-# -#

SQL_BRC_PROCEDURES = Row counts, if any, are available when a batch is executed in a stored procedure. If row counts are available, they can be rolled up or individually available, depending on the SQL_BRC_ROLLED_UP bit.

-# -#

SQL_BRC_EXPLICIT = Row counts, if any, are available when a batch is executed directly by calling SQLExecute or SQLExecDirect. If row counts are available, they can be rolled up or individually available, depending on the SQL_BRC_ROLLED_UP bit.

-#
SQL_BATCH_SUPPORT
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the driver's support for batches. The following bitmasks are used to determine which level is supported: -#

SQL_BS_SELECT_EXPLICIT = The driver supports explicit batches that can have result-set generating statements.

-# -#

SQL_BS_ROW_COUNT_EXPLICIT = The driver supports explicit batches that can have row-count generating statements.

-# -#

SQL_BS_SELECT_PROC = The driver supports explicit procedures that can have result-set generating statements.

-# -#

SQL_BS_ROW_COUNT_PROC = The driver supports explicit procedures that can have row-count generating statements.

-#
SQL_BOOKMARK_PERSISTENCE
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the operations through which bookmarks persist. -#

The following bitmasks are used in conjunction with the flag to determine through which options bookmarks persist:

-# -#

SQL_BP_CLOSE = Bookmarks are valid after an application calls SQLFreeStmt with the SQL_CLOSE option, or SQLCloseCursor to close the cursor associated with a statement.

-# -#

SQL_BP_DELETE = The bookmark for a row is valid after that row has been deleted.

-# -#

SQL_BP_DROP = Bookmarks are valid after an application calls SQLFreeHandle with a HandleType of SQL_HANDLE_STMT to drop a statement.

-# -#

SQL_BP_TRANSACTION = Bookmarks are valid after an application commits or rolls back a transaction.

-# -#

SQL_BP_UPDATE = The bookmark for a row is valid after any column in that row has been updated, including key columns.

-# -#

SQL_BP_OTHER_HSTMT = A bookmark associated with one statement can be used with another statement. Unless SQL_BP_CLOSE or SQL_BP_DROP is specified, the cursor on the first statement must be open.

-#
SQL_CATALOG_LOCATION
-# (ODBC 2.0)
An SQLUSMALLINT value indicating the position of the catalog in a qualified table name: -#

SQL_CL_START
-# SQL_CL_END

-# -#

For example, an Xbase driver returns SQL_CL_START because the directory (catalog) name is at the start of the table name, as in \EMPDATA\EMP.DBF. An ORACLE Server driver returns SQL_CL_END because the catalog is at the end of the table name, as in ADMIN.EMP@EMPDATA.

-# -#

An SQL-92 Full level–conformant driver will always return SQL_CL_START. A value of 0 is returned if catalogs are not supported by the data source. To find out whether catalogs are supported, an application calls SQLGetInfo with the SQL_CATALOG_NAME information type.

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_QUALIFIER_LOCATION.

-#
SQL_CATALOG_NAME
-# (ODBC 3.0)
A character string: "Y" if the server supports catalog names, or "N" if it does not. -#

An SQL-92 Full level–conformant driver will always return "Y".

-#
SQL_CATALOG_NAME_SEPARATOR
-# (ODBC 1.0)
A character string: the character or characters that the data source defines as the separator between a catalog name and the qualified name element that follows or precedes it. -#

An empty string is returned if catalogs are not supported by the data source. To find out whether catalogs are supported, an application calls SQLGetInfo with the SQL_CATALOG_NAME information type. An SQL-92 Full level–conformant driver will always return ".".

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_QUALIFIER_NAME_SEPARATOR.

-#
SQL_CATALOG_TERM
-# (ODBC 1.0)
A character string with the data source vendor's name for a catalog; for example, "database" or "directory". This string can be in upper, lower, or mixed case. -#

An empty string is returned if catalogs are not supported by the data source. To find out whether catalogs are supported, an application calls SQLGetInfo with the SQL_CATALOG_NAME information type. An SQL-92 Full level–conformant driver will always return "catalog".

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_QUALIFIER_TERM.

-#
SQL_CATALOG_USAGE
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the statements in which catalogs can be used. -#

The following bitmasks are used to determine where catalogs can be used:

-# -#

SQL_CU_DML_STATEMENTS = Catalogs are supported in all Data Manipulation Language statements: SELECT, INSERT, UPDATE, DELETE, and if supported, SELECT FOR UPDATE and positioned update and delete statements.

-# -#

SQL_CU_PROCEDURE_INVOCATION = Catalogs are supported in the ODBC procedure invocation statement.

-# -#

SQL_CU_TABLE_DEFINITION = Catalogs are supported in all table definition statements: CREATE TABLE, CREATE VIEW, ALTER TABLE, DROP TABLE, and DROP VIEW.

-# -#

SQL_CU_INDEX_DEFINITION = Catalogs are supported in all index definition statements: CREATE INDEX and DROP INDEX.

-# -#

SQL_CU_PRIVILEGE_DEFINITION = Catalogs are supported in all privilege definition statements: GRANT and REVOKE.

-# -#

A value of 0 is returned if catalogs are not supported by the data source. To find out whether catalogs are supported, an application calls SQLGetInfo with the SQL_CATALOG_NAME information type. An SQL-92 Full level–conformant driver will always return a bitmask with all of these bits set.

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_QUALIFIER_USAGE.

-#
SQL_COLLATION_SEQ
-# (ODBC 3.0)
The name of the collation sequence. This is a character string that indicates the name of the default collation for the default character set for this server (for example, 'ISO 8859-1' or EBCDIC). If this is unknown, an empty string will be returned. An SQL-92 Full level–conformant driver will always return a non-empty string.
SQL_COLUMN_ALIAS
-# (ODBC 2.0)
A character string: "Y" if the data source supports column aliases; otherwise, "N". -#

A column alias is an alternate name that can be specified for a column in the select list by using an AS clause. An SQL-92 Entry level–conformant driver will always return "Y".

-#
SQL_CONCAT_NULL_BEHAVIOR
-# (ODBC 1.0)
An SQLUSMALLINT value indicating how the data source handles the concatenation of NULL valued character data type columns with non-NULL valued character data type columns: -#

SQL_CB_NULL = Result is NULL valued.

-# -#

SQL_CB_NON_NULL = Result is concatenation of non-NULL valued column or columns.

-# -#

An SQL-92 Entry level–conformant driver will always return SQL_CB_NULL.

-#
SQL_CONVERT_BIGINT
- SQL_CONVERT_BIGINT => { - type => q(Bitmask), - }, -# SQL_CONVERT_BINARY
- SQL_CONVERT_BINARY => { - type => q(Bitmask), - }, -# SQL_CONVERT_BIT
- SQL_CONVERT_BIT => { - type => q(Bitmask), - }, -# SQL_CONVERT_CHAR
- SQL_CONVERT_CHAR => { - type => q(Bitmask), - }, -# SQL_CONVERT_GUID
- SQL_CONVERT_GUID => { - type => q(Bitmask), - omit => 1, - }, -# SQL_CONVERT_DATE
- SQL_CONVERT_DATE => { - type => q(Bitmask), - }, -# SQL_CONVERT_DECIMAL
- SQL_CONVERT_DECIMAL => { - type => q(Bitmask), - }, -# SQL_CONVERT_DOUBLE
- SQL_CONVERT_DOUBLE => { - type => q(Bitmask), - }, -# SQL_CONVERT_FLOAT
- SQL_CONVERT_FLOAT => { - type => q(Bitmask), - }, -# SQL_CONVERT_INTEGER
- SQL_CONVERT_INTEGER => { - type => q(Bitmask), - }, -# SQL_CONVERT_INTERVAL_YEAR_MONTH
- SQL_CONVERT_INTERVAL_YEAR_MONTH => { - type => q(Bitmask), - }, -# SQL_CONVERT_INTERVAL_DAY_TIME
- SQL_CONVERT_INTERVAL_DAY_TIME => { - type => q(Bitmask), - }, -# SQL_CONVERT_LONGVARBINARY
- SQL_CONVERT_LONGVARBINARY => { - type => q(Bitmask), - }, -# SQL_CONVERT_LONGVARCHAR
- SQL_CONVERT_LONGVARCHAR => { - type => q(Bitmask), - }, -# SQL_CONVERT_NUMERIC
- SQL_CONVERT_NUMERIC => { - type => q(Bitmask), - }, -# SQL_CONVERT_REAL
- SQL_CONVERT_REAL => { - type => q(Bitmask), - }, -# SQL_CONVERT_SMALLINT
- SQL_CONVERT_SMALLINT => { - type => q(Bitmask), - }, -# SQL_CONVERT_TIME
- SQL_CONVERT_TIME => { - type => q(Bitmask), - }, -# SQL_CONVERT_TIMESTAMP
- SQL_CONVERT_TIMESTAMP => { - type => q(Bitmask), - }, -# SQL_CONVERT_TINYINT
- SQL_CONVERT_TINYINT => { - type => q(Bitmask), - }, -# SQL_CONVERT_VARBINARY
- SQL_CONVERT_VARBINARY => { - type => q(Bitmask), - }, -# SQL_CONVERT_VARCHAR
- SQL_CONVERT_VARCHAR => { - type => q(Bitmask), - }, -# (ODBC 1.0)
An SQLUINTEGER bitmask. The bitmask indicates the conversions supported by the data source with the CONVERT scalar function for data of the type named in the InfoType. If the bitmask equals zero, the data source does not support any conversions from data of the named type, including conversion to the same data type. -#

For example, to find out if a data source supports the conversion of SQL_INTEGER data to the SQL_BIGINT data type, an application calls SQLGetInfo with the InfoType of SQL_CONVERT_INTEGER. The application performs an AND operation with the returned bitmask and SQL_CVT_BIGINT. If the resulting value is nonzero, the conversion is supported.

-# -#

The following bitmasks are used to determine which conversions are supported:

-# -#

SQL_CVT_BIGINT (ODBC 1.0)
-# SQL_CVT_BINARY (ODBC 1.0)
-# SQL_CVT_BIT (ODBC 1.0)
-# SQL_CVT_GUID (ODBC 3.5)
-# SQL_CVT_CHAR (ODBC 1.0)
-# SQL_CVT_DATE (ODBC 1.0)
-# SQL_CVT_DECIMAL (ODBC 1.0)
-# SQL_CVT_DOUBLE (ODBC 1.0)
-# SQL_CVT_FLOAT (ODBC 1.0)
-# SQL_CVT_INTEGER (ODBC 1.0)
-# SQL_CVT_INTERVAL_YEAR_MONTH (ODBC 3.0)
-# SQL_CVT_INTERVAL_DAY_TIME (ODBC 3.0)
-# SQL_CVT_LONGVARBINARY (ODBC 1.0)
-# SQL_CVT_LONGVARCHAR (ODBC 1.0)
-# SQL_CVT_NUMERIC (ODBC 1.0)
-# SQL_CVT_REAL ODBC 1.0)
-# SQL_CVT_SMALLINT (ODBC 1.0)
-# SQL_CVT_TIME (ODBC 1.0)
-# SQL_CVT_TIMESTAMP (ODBC 1.0)
-# SQL_CVT_TINYINT (ODBC 1.0)
-# SQL_CVT_VARBINARY (ODBC 1.0)
-# SQL_CVT_VARCHAR (ODBC 1.0)

-#
SQL_CONVERT_FUNCTIONS
-# (ODBC 1.0)
An SQLUINTEGER bitmask enumerating the scalar conversion functions supported by the driver and associated data source. -#

The following bitmask is used to determine which conversion functions are supported:

-# -#

SQL_FN_CVT_CAST
-# SQL_FN_CVT_CONVERT

-#
SQL_CORRELATION_NAME
-# (ODBC 1.0)
An SQLUSMALLINT value indicating whether table correlation names are supported: -#

SQL_CN_NONE = Correlation names are not supported.

-# -#

SQL_CN_DIFFERENT = Correlation names are supported but must differ from the names of the tables they represent.

-# -#

SQL_CN_ANY = Correlation names are supported and can be any valid user-defined name.

-# -#

An SQL-92 Entry level–conformant driver will always return SQL_CN_ANY.

-#
SQL_CREATE_ASSERTION
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE ASSERTION statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_CA_CREATE_ASSERTION

-# -#

The following bits specify the supported constraint attribute if the ability to specify constraint attributes explicitly is supported (see the SQL_ALTER_TABLE and SQL_CREATE_TABLE information types):

-# -#

SQL_CA_CONSTRAINT_INITIALLY_DEFERRED
-# SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE
-# SQL_CA_CONSTRAINT_DEFERRABLE
-# SQL_CA_CONSTRAINT_NON_DEFERRABLE

-# -#

An SQL-92 Full level–conformant driver will always return all of these options as supported. A return value of "0" means that the CREATE ASSERTION statement is not supported.

-#
SQL_CREATE_CHARACTER_SET
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE CHARACTER SET statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_CCS_CREATE_CHARACTER_SET
-# SQL_CCS_COLLATE_CLAUSE
-# SQL_CCS_LIMITED_COLLATION

-# -#

An SQL-92 Full level–conformant driver will always return all of these options as supported. A return value of "0" means that the CREATE CHARACTER SET statement is not supported.

-#
SQL_CREATE_COLLATION
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE COLLATION statement, as defined in SQL-92, supported by the data source. -#

The following bitmask is used to determine which clauses are supported:

-# -#

SQL_CCOL_CREATE_COLLATION

-# -#

An SQL-92 Full level–conformant driver will always return this option as supported. A return value of "0" means that the CREATE COLLATION statement is not supported.

-#
SQL_CREATE_DOMAIN
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE DOMAIN statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_CDO_CREATE_DOMAIN = The CREATE DOMAIN statement is supported (Intermediate level).

-# -#

SQL_CDO_CONSTRAINT_NAME_DEFINITION = <constraint name definition> is supported for naming domain constraints (Intermediate level).

-# -#

The following bits specify the ability to create column constraints:
-# SQL_CDO_DEFAULT = Specifying domain constraints is supported (Intermediate level)
-# SQL_CDO_CONSTRAINT = Specifying domain defaults is supported (Intermediate level)
-# SQL_CDO_COLLATION = Specifying domain collation is supported (Full level)

-# -#

The following bits specify the supported constraint attributes if specifying domain constraints is supported (SQL_CDO_DEFAULT is set):

-# -#

SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED (Full level)
-# SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE (Full level)
-# SQL_CDO_CONSTRAINT_DEFERRABLE (Full level)
-# SQL_CDO_CONSTRAINT_NON_DEFERRABLE (Full level)

-# -#

A return value of "0" means that the CREATE DOMAIN statement is not supported.

-#
SQL_CREATE_SCHEMA
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE SCHEMA statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_CS_CREATE_SCHEMA
-# SQL_CS_AUTHORIZATION
-# SQL_CS_DEFAULT_CHARACTER_SET

-# -#

An SQL-92 Intermediate level–conformant driver will always return the SQL_CS_CREATE_SCHEMA and SQL_CS_AUTHORIZATION options as supported. These must also be supported at the SQL-92 Entry level, but not necessarily as SQL statements. An SQL-92 Full level–conformant driver will always return all of these options as supported.

-#
SQL_CREATE_TABLE
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE TABLE statement, as defined in SQL-92, supported by the data source. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_CT_CREATE_TABLE = The CREATE TABLE statement is supported. (Entry level)

-# -#

SQL_CT_TABLE_CONSTRAINT = Specifying table constraints is supported (FIPS Transitional level)

-# -#

SQL_CT_CONSTRAINT_NAME_DEFINITION = The <constraint name definition> clause is supported for naming column and table constraints (Intermediate level)

-# -#

The following bits specify the ability to create temporary tables:

-# -#

SQL_CT_COMMIT_PRESERVE = Deleted rows are preserved on commit. (Full level)
-# SQL_CT_COMMIT_DELETE = Deleted rows are deleted on commit. (Full level)
-# SQL_CT_GLOBAL_TEMPORARY = Global temporary tables can be created. (Full level)
-# SQL_CT_LOCAL_TEMPORARY = Local temporary tables can be created. (Full level)

-# -#

The following bits specify the ability to create column constraints:

-# -#

SQL_CT_COLUMN_CONSTRAINT = Specifying column constraints is supported (FIPS Transitional level)
-# SQL_CT_COLUMN_DEFAULT = Specifying column defaults is supported (FIPS Transitional level)
-# SQL_CT_COLUMN_COLLATION = Specifying column collation is supported (Full level)

-# -#

The following bits specify the supported constraint attributes if specifying column or table constraints is supported:

-# -#

SQL_CT_CONSTRAINT_INITIALLY_DEFERRED (Full level)
-# SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE (Full level)
-# SQL_CT_CONSTRAINT_DEFERRABLE (Full level)
-# SQL_CT_CONSTRAINT_NON_DEFERRABLE (Full level)

-#
SQL_CREATE_TRANSLATION
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE TRANSLATION statement, as defined in SQL-92, supported by the data source. -#

The following bitmask is used to determine which clauses are supported:

-# -#

SQL_CTR_CREATE_TRANSLATION

-# -#

An SQL-92 Full level–conformant driver will always return these options as supported. A return value of "0" means that the CREATE TRANSLATION statement is not supported.

-#
SQL_CREATE_VIEW
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the CREATE VIEW statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_CV_CREATE_VIEW
-# SQL_CV_CHECK_OPTION
-# SQL_CV_CASCADED
-# SQL_CV_LOCAL

-# -#

A return value of "0" means that the CREATE VIEW statement is not supported.

-# -#

An SQL-92 Entry level–conformant driver will always return the SQL_CV_CREATE_VIEW and SQL_CV_CHECK_OPTION options as supported.

-# -#

An SQL-92 Full level–conformant driver will always return all of these options as supported.

-#
SQL_CURSOR_COMMIT_BEHAVIOR
-# (ODBC 1.0)
An SQLUSMALLINT value indicating how a COMMIT operation affects cursors and prepared statements in the data source: -#

SQL_CB_DELETE = Close cursors and delete prepared statements. To use the cursor again, the application must reprepare and reexecute the statement.

-# -#

SQL_CB_CLOSE = Close cursors. For prepared statements, the application can call SQLExecute on the statement without calling SQLPrepare again.

-# -#

SQL_CB_PRESERVE = Preserve cursors in the same position as before the COMMIT operation. The application can continue to fetch data, or it can close the cursor and reexecute the statement without repreparing it.

-#
SQL_CURSOR_ROLLBACK_BEHAVIOR
-# (ODBC 1.0)
An SQLUSMALLINT value indicating how a ROLLBACK operation affects cursors and prepared statements in the data source: -#

SQL_CB_DELETE = Close cursors and delete prepared statements. To use the cursor again, the application must reprepare and reexecute the statement.

-# -#

SQL_CB_CLOSE = Close cursors. For prepared statements, the application can call SQLExecute on the statement without calling SQLPrepare again.

-# -#

SQL_CB_PRESERVE = Preserve cursors in the same position as before the ROLLBACK operation. The application can continue to fetch data, or it can close the cursor and reexecute the statement without repreparing it.

-#
SQL_CURSOR_ROLLBACK_SQL_CURSOR_SENSITIVITY
-# (ODBC 3.0)
An SQLUINTEGER value indicating the support for cursor sensitivity: -#

SQL_INSENSITIVE = All cursors on the statement handle show the result set without reflecting any changes made to it by any other cursor within the same transaction.

-# -#

SQL_UNSPECIFIED = It is unspecified whether cursors on the statement handle make visible the changes made to a result set by another cursor within the same transaction. Cursors on the statement handle may make visible none, some, or all such changes.

-# -#

SQL_SENSITIVE = Cursors are sensitive to changes made by other cursors within the same transaction.

-# -#

An SQL-92 Entry level–conformant driver will always return the SQL_UNSPECIFIED option as supported.

-# -#

An SQL-92 Full level–conformant driver will always return the SQL_INSENSITIVE option as supported.

-#
SQL_DATA_SOURCE_NAME
-# (ODBC 1.0)
A character string with the data source name used during connection. If the application called SQLConnect, this is the value of the szDSN argument. If the application called SQLDriverConnect or SQLBrowseConnect, this is the value of the DSN keyword in the connection string passed to the driver. If the connection string did not contain the DSN keyword (such as when it contains the DRIVER keyword), this is an empty string.
SQL_DATA_SOURCE_READ_ONLY
-# (ODBC 1.0)
A character string. "Y" if the data source is set to READ ONLY mode, "N" if it is otherwise. -#

This characteristic pertains only to the data source itself; it is not a characteristic of the driver that enables access to the data source. A driver that is read/write can be used with a data source that is read-only. If a driver is read-only, all of its data sources must be read-only and must return SQL_DATA_SOURCE_READ_ONLY.

-#
SQL_DATABASE_NAME
-# (ODBC 1.0)
A character string with the name of the current database in use, if the data source defines a named object called "database". -#

Note   In ODBC 3.x, the value returned for this InfoType can also be returned by calling SQLGetConnectAttr with an Attribute argument of SQL_ATTR_CURRENT_CATALOG.

-#
SQL_DATETIME_LITERALS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the SQL-92 datetime literals supported by the data source. Note that these are the datetime literals listed in the SQL-92 specification and are separate from the datetime literal escape clauses defined by ODBC. For more information about the ODBC datetime literal escape clauses, see "Date, Time, Timestamp, and Datetime Interval Literals" in Chapter 8: SQL Statements. -#

A FIPS Transitional level–conformant driver will always return the "1" value in the bitmask for the bits listed below. A value of "0" means that SQL-92 datetime literals are not supported.

-# -#

The following bitmasks are used to determine which literals are supported:

-# -#

SQL_DL_SQL92_DATE
-# SQL_DL_SQL92_TIME
-# SQL_DL_SQL92_TIMESTAMP
-# SQL_DL_SQL92_INTERVAL_YEAR
-# SQL_DL_SQL92_INTERVAL_MONTH
-# SQL_DL_SQL92_INTERVAL_DAY
-# SQL_DL_SQL92_INTERVAL_HOUR
-# SQL_DL_SQL92_INTERVAL_MINUTE
-# SQL_DL_SQL92_INTERVAL_SECOND
-# SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH
-# SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR

-# -#

SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE
-# SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND
-# SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE
-# SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND
-# SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND

-#
SQL_DBMS_NAME
-# (ODBC 1.0)
A character string with the name of the DBMS product accessed by the driver.
SQL_DBMS_VER
-# (ODBC 1.0)
A character string indicating the version of the DBMS product accessed by the driver. The version is of the form ##.##.####, where the first two digits are the major version, the next two digits are the minor version, and the last four digits are the release version. The driver must render the DBMS product version in this form but can also append the DBMS product-specific version as well. For example, "04.01.0000 Rdb 4.1".
SQL_DDL_INDEX
-# (ODBC 3.0)
An SQLUINTEGER value that indicates support for creation and dropping of indexes: -#

SQL_DI_CREATE_INDEX
-# SQL_DI_DROP_INDEX

-#
SQL_DEFAULT_TXN_ISOLATION
-# (ODBC 1.0)
An SQLUINTEGER value that indicates the default transaction isolation level supported by the driver or data source, or zero if the data source does not support transactions. The following terms are used to define transaction isolation levels: -#

Dirty Read Transaction 1 changes a row. Transaction 2 reads the changed row before transaction 1 commits the change. If transaction 1 rolls back the change, transaction 2 will have read a row that is considered to have never existed.

-# -#

Nonrepeatable Read Transaction 1 reads a row. Transaction 2 updates or deletes that row and commits this change. If transaction 1 attempts to reread the row, it will receive different row values or discover that the row has been deleted.

-# -#

Phantom Transaction 1 reads a set of rows that satisfy some search criteria. Transaction 2 generates one or more rows (through either inserts or updates) that match the search criteria. If transaction 1 reexecutes the statement that reads the rows, it receives a different set of rows.

-# -#

If the data source supports transactions, the driver returns one of the following bitmasks:

-# -#

SQL_TXN_READ_UNCOMMITTED = Dirty reads, nonrepeatable reads, and phantoms are possible.

-# -#

SQL_TXN_READ_COMMITTED = Dirty reads are not possible. Nonrepeatable reads and phantoms are possible.

-# -#

SQL_TXN_REPEATABLE_READ = Dirty reads and nonrepeatable reads are not possible. Phantoms are possible.

-# -#

SQL_TXN_SERIALIZABLE = Transactions are serializable. Serializable transactions do not allow dirty reads, nonrepeatable reads, or phantoms.

-#
SQL_DESCRIBE_PARAMETER
-# (ODBC 3.0)
A character string: "Y" if parameters can be described; "N", if not. -#

An SQL-92 Full level–conformant driver will usually return "Y" because it will support the DESCRIBE INPUT statement. Because this does not directly specify the underlying SQL support, however, describing parameters might not be supported, even in a SQL-92 Full level–conformant driver.

-#
SQL_DM_VER
-# (ODBC 3.0)
A character string with the version of the Driver Manager. The version is of the form ##.##.####.####, where: -#

The first set of two digits is the major ODBC version, as given by the constant SQL_SPEC_MAJOR.

-# -#

The second set of two digits is the minor ODBC version, as given by the constant SQL_SPEC_MINOR.

-# -#

The third set of four digits is the Driver Manager major build number.

-# -#

The last set of four digits is the Driver Manager minor build number.

-#
SQL_DRIVER_HDBC
-# SQL_DRIVER_HENV
-# (ODBC 1.0)
An SQLUINTEGER value, the driver's environment handle or connection handle, determined by the argument InfoType. -#

These information types are implemented by the Driver Manager alone.

-#
SQL_DRIVER_HDESC
-# (ODBC 3.0)
An SQLUINTEGER value, the driver's descriptor handle determined by the Driver Manager's descriptor handle, which must be passed on input in *InfoValuePtr from the application. In this case, InfoValuePtr is both an input and output argument. The input descriptor handle passed in *InfoValuePtr must have been either explicitly or implicitly allocated on the ConnectionHandle. -#

The application should make a copy of the Driver Manager's descriptor handle before calling SQLGetInfo with this information type, to ensure that the handle is not overwritten on output.

-# -#

This information type is implemented by the Driver Manager alone.

-#
SQL_DRIVER_HLIB
-# (ODBC 2.0)
An SQLUINTEGER value, the hinst from the load library returned to the Driver Manager when it loaded the driver DLL (on a Microsoft® Windows® platform) or equivalent on a non-Windows platform. The handle is valid only for the connection handle specified in the call to SQLGetInfo. -#

This information type is implemented by the Driver Manager alone.

-#
SQL_DRIVER_HSTMT
-# (ODBC 1.0)
An SQLUINTEGER value, the driver's statement handle determined by the Driver Manager statement handle, which must be passed on input in *InfoValuePtr from the application. In this case, InfoValuePtr is both an input and an output argument. The input statement handle passed in *InfoValuePtr must have been allocated on the argument ConnectionHandle. -#

The application should make a copy of the Driver Manager's statement handle before calling SQLGetInfo with this information type, to ensure that the handle is not overwritten on output.

-# -#

This information type is implemented by the Driver Manager alone.

-#
SQL_DRIVER_NAME
-# (ODBC 1.0)
A character string with the file name of the driver used to access the data source.
SQL_DRIVER_ODBC_VER
-# (ODBC 2.0)
A character string with the version of ODBC that the driver supports. The version is of the form ##.##, where the first two digits are the major version and the next two digits are the minor version. SQL_SPEC_MAJOR and SQL_SPEC_MINOR define the major and minor version numbers. For the version of ODBC described in this manual, these are 3 and 0, and the driver should return "03.00".
SQL_DRIVER_VER
-# (ODBC 1.0)
A character string with the version of the driver and optionally, a description of the driver. At a minimum, the version is of the form ##.##.####, where the first two digits are the major version, the next two digits are the minor version, and the last four digits are the release version.
SQL_DROP_ASSERTION
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP ASSERTION statement, as defined in SQL-92, supported by the data source. -#

The following bitmask is used to determine which clauses are supported:

-# -#

SQL_DA_DROP_ASSERTION

-# -#

An SQL-92 Full level–conformant driver will always return this option as supported.

-#
SQL_DROP_CHARACTER_SET
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP CHARACTER SET statement, as defined in SQL-92, supported by the data source. -#

The following bitmask is used to determine which clauses are supported:

-# -#

SQL_DCS_DROP_CHARACTER_SET

-# -#

An SQL-92 Full level–conformant driver will always return this option as supported.

-#
SQL_DROP_COLLATION
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP COLLATION statement, as defined in SQL-92, supported by the data source. -#

The following bitmask is used to determine which clauses are supported:

-# -#

SQL_DC_DROP_COLLATION

-# -#

An SQL-92 Full level–conformant driver will always return this option as supported.

-#
SQL_DROP_DOMAIN
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP DOMAIN statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_DD_DROP_DOMAIN
-# SQL_DD_CASCADE
-# SQL_DD_RESTRICT

-# -#

An SQL-92 Intermediate level–conformant driver will always return all of these options as supported.

-#
SQL_DROP_SCHEMA
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP SCHEMA statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_DS_DROP_SCHEMA
-# SQL_DS_CASCADE
-# SQL_DS_RESTRICT

-# -#

An SQL-92 Intermediate level–conformant driver will always return all of these options as supported.

-#
SQL_DROP_TABLE
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP TABLE statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_DT_DROP_TABLE
-# SQL_DT_CASCADE
-# SQL_DT_RESTRICT

-# -#

An FIPS Transitional level–conformant driver will always return all of these options as supported.

-#
SQL_DROP_TRANSLATION
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP TRANSLATION statement, as defined in SQL-92, supported by the data source. -#

The following bitmask is used to determine which clauses are supported:

-# -#

SQL_DTR_DROP_TRANSLATION

-# -#

An SQL-92 Full level–conformant driver will always return this option as supported.

-#
SQL_DROP_VIEW
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses in the DROP VIEW statement, as defined in SQL-92, supported by the data source. -#

The following bitmasks are used to determine which clauses are supported:

-# -#

SQL_DV_DROP_VIEW
-# SQL_DV_CASCADE
-# SQL_DV_RESTRICT

-# -#

An FIPS Transitional level–conformant driver will always return all of these options as supported.

-#
SQL_DYNAMIC_CURSOR_ATTRIBUTES1
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a dynamic cursor that are supported by the driver. This bitmask contains the first subset of attributes; for the second subset, see SQL_DYNAMIC_CURSOR_ATTRIBUTES2. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA1_NEXT = A FetchOrientation argument of SQL_FETCH_NEXT is supported in a call to SQLFetchScroll when the cursor is a dynamic cursor.

-# -#

SQL_CA1_ABSOLUTE = FetchOrientation arguments of SQL_FETCH_FIRST, SQL_FETCH_LAST, and SQL_FETCH_ABSOLUTE are supported in a call to SQLFetchScroll when the cursor is a dynamic cursor. (The rowset that will be fetched is independent of the current cursor position.)

-# -#

SQL_CA1_RELATIVE = FetchOrientation arguments of SQL_FETCH_PRIOR and SQL_FETCH_RELATIVE are supported in a call to SQLFetchScroll when the cursor is a dynamic cursor. (The rowset that will be fetched is dependent on the current cursor position. Note that this is separated from SQL_FETCH_NEXT because in a forward-only cursor, only SQL_FETCH_NEXT is supported.)

-# -#

SQL_CA1_BOOKMARK = A FetchOrientation argument of SQL_FETCH_BOOKMARK is supported in a call to SQLFetchScroll when the cursor is a dynamic cursor.

-# -#

SQL_CA1_LOCK_EXCLUSIVE = A LockType argument of SQL_LOCK_EXCLUSIVE is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_LOCK_NO_CHANGE = A LockType argument of SQL_LOCK_NO_CHANGE is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_LOCK_UNLOCK = A LockType argument of SQL_LOCK_UNLOCK is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_POS_POSITION = An Operation argument of SQL_POSITION is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_POS_UPDATE = An Operation argument of SQL_UPDATE is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_POS_DELETE = An Operation argument of SQL_DELETE is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_POS_REFRESH = An Operation argument of SQL_REFRESH is supported in a call to SQLSetPos when the cursor is a dynamic cursor.

-# -#

SQL_CA1_POSITIONED_UPDATE = An UPDATE WHERE CURRENT OF SQL statement is supported when the cursor is a dynamic cursor. (An SQL-92 Entry level–conformant driver will always return this option as supported.)

-# -#

SQL_CA1_POSITIONED_DELETE = A DELETE WHERE CURRENT OF SQL statement is supported when the cursor is a dynamic cursor. (An SQL-92 Entry level–conformant driver will always return this option as supported.)

-# -#

SQL_CA1_SELECT_FOR_UPDATE = A SELECT FOR UPDATE SQL statement is supported when the cursor is a dynamic cursor. (An SQL-92 Entry level–conformant driver will always return this option as supported.)

-# -#

SQL_CA1_BULK_ADD = An Operation argument of SQL_ADD is supported in a call to SQLBulkOperations when the cursor is a dynamic cursor.

-# -#

SQL_CA1_BULK_UPDATE_BY_BOOKMARK = An Operation argument of SQL_UPDATE_BY_BOOKMARK is supported in a call to SQLBulkOperations when the cursor is a dynamic cursor.

-# -#

SQL_CA1_BULK_DELETE_BY_BOOKMARK = An Operation argument of SQL_DELETE_BY_BOOKMARK is supported in a call to SQLBulkOperations when the cursor is a dynamic cursor.

-# -#

SQL_CA1_BULK_FETCH_BY_BOOKMARK = An Operation argument of SQL_FETCH_BY_BOOKMARK is supported in a call to SQLBulkOperations when the cursor is a dynamic cursor.

-# -#

An SQL-92 Intermediate level–conformant driver will usually return the SQL_CA1_NEXT, SQL_CA1_ABSOLUTE, and SQL_CA1_RELATIVE options as supported, because it supports scrollable cursors through the embedded SQL FETCH statement. Because this does not directly determine the underlying SQL support, however, scrollable cursors may not be supported, even for an SQL-92 Intermediate level–conformant driver.

-#
SQL_DYNAMIC_CURSOR_ATTRIBUTES2
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a dynamic cursor that are supported by the driver. This bitmask contains the second subset of attributes; for the first subset, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA2_READ_ONLY_CONCURRENCY = A read-only dynamic cursor, in which no updates are allowed, is supported. (The SQL_ATTR_CONCURRENCY statement attribute can be SQL_CONCUR_READ_ONLY for a dynamic cursor).

-# -#

SQL_CA2_LOCK_CONCURRENCY = A dynamic cursor that uses the lowest level of locking sufficient to ensure that the row can be updated is supported. (The SQL_ATTR_CONCURRENCY statement attribute can be SQL_CONCUR_LOCK for a dynamic cursor.) These locks must be consistent with the transaction isolation level set by the SQL_ATTR_TXN_ISOLATION connection attribute.

-# -#

SQL_CA2_OPT_ROWVER_CONCURRENCY = A dynamic cursor that uses the optimistic concurrency control comparing row versions is supported. (The SQL_ATTR_CONCURRENCY statement attribute can be SQL_CONCUR_ROWVER for a dynamic cursor.)

-# -#

SQL_CA2_OPT_VALUES_CONCURRENCY = A dynamic cursor that uses the optimistic concurrency control comparing values is supported. (The SQL_ATTR_CONCURRENCY statement attribute can be SQL_CONCUR_VALUES for a dynamic cursor.)

-# -#

SQL_CA2_SENSITIVITY_ADDITIONS = Added rows are visible to a dynamic cursor; the cursor can scroll to those rows. (Where these rows are added to the cursor is driver-dependent.)

-# -#

SQL_CA2_SENSITIVITY_DELETIONS = Deleted rows are no longer available to a dynamic cursor, and do not leave a "hole" in the result set; after the dynamic cursor scrolls from a deleted row, it cannot return to that row.

-# -#

SQL_CA2_SENSITIVITY_UPDATES = Updates to rows are visible to a dynamic cursor; if the dynamic cursor scrolls from and returns to an updated row, the data returned by the cursor is the updated data, not the original data.

-# -#

SQL_CA2_MAX_ROWS_SELECT = The SQL_ATTR_MAX_ROWS statement attribute affects SELECT statements when the cursor is a dynamic cursor.

-# -#

SQL_CA2_MAX_ROWS_INSERT = The SQL_ATTR_MAX_ROWS statement attribute affects INSERT statements when the cursor is a dynamic cursor.

-# -#

SQL_CA2_MAX_ROWS_DELETE = The SQL_ATTR_MAX_ROWS statement attribute affects DELETE statements when the cursor is a dynamic cursor.

-# -#

SQL_CA2_MAX_ROWS_UPDATE = The SQL_ATTR_MAX_ROWS statement attribute affects UPDATE statements when the cursor is a dynamic cursor.

-# -#

SQL_CA2_MAX_ROWS_CATALOG = The SQL_ATTR_MAX_ROWS statement attribute affects CATALOG result sets when the cursor is a dynamic cursor.

-# -#

SQL_CA2_MAX_ROWS_AFFECTS_ALL = The SQL_ATTR_MAX_ROWS statement attribute affects SELECT, INSERT, DELETE, and UPDATE statements, and CATALOG result sets, when the cursor is a dynamic cursor.

-# -#

SQL_CA2_CRC_EXACT = The exact row count is available in the SQL_DIAG_CURSOR_ROW_COUNT diagnostic field when the cursor is a dynamic cursor.

-# -#

SQL_CA2_CRC_APPROXIMATE = An approximate row count is available in the SQL_DIAG_CURSOR_ROW_COUNT diagnostic field when the cursor is a dynamic cursor.

-# -#

SQL_CA2_SIMULATE_NON_UNIQUE = The driver does not guarantee that simulated positioned update or delete statements will affect only one row when the cursor is a dynamic cursor; it is the application's responsibility to guarantee this. (If a statement affects more than one row, SQLExecute or SQLExecDirect returns SQLSTATE 01001 [Cursor operation conflict].) To set this behavior, the application calls SQLSetStmtAttr with the SQL_ATTR_SIMULATE_CURSOR attribute set to SQL_SC_NON_UNIQUE.

-# -#

SQL_CA2_SIMULATE_TRY_UNIQUE = The driver attempts to guarantee that simulated positioned update or delete statements will affect only one row when the cursor is a dynamic cursor. The driver always executes such statements, even if they might affect more than one row, such as when there is no unique key. (If a statement affects more than one row, SQLExecute or SQLExecDirect returns SQLSTATE 01001 [Cursor operation conflict].) To set this behavior, the application calls SQLSetStmtAttr with the SQL_ATTR_SIMULATE_CURSOR attribute set to SQL_SC_TRY_UNIQUE.

-# -#

SQL_CA2_SIMULATE_UNIQUE = The driver guarantees that simulated positioned update or delete statements will affect only one row when the cursor is a dynamic cursor. If the driver cannot guarantee this for a given statement, SQLExecDirect or SQLPrepare return SQLSTATE 01001 (Cursor operation conflict). To set this behavior, the application calls SQLSetStmtAttr with the SQL_ATTR_SIMULATE_CURSOR attribute set to SQL_SC_UNIQUE.

-#
SQL_EXPRESSIONS_IN_ORDERBY
-# (ODBC 1.0)
A character string: "Y" if the data source supports expressions in the ORDER BY list; "N" if it does not.
SQL_FILE_USAGE
-# (ODBC 2.0)
An SQLUSMALLINT value indicating how a single-tier driver directly treats files in a data source: -#

SQL_FILE_NOT_SUPPORTED = The driver is not a single-tier driver. For example, an ORACLE driver is a two-tier driver.

-# -#

SQL_FILE_TABLE = A single-tier driver treats files in a data source as tables. For example, an Xbase driver treats each Xbase file as a table.

-# -#

SQL_FILE_CATALOG = A single-tier driver treats files in a data source as a catalog. For example, a Microsoft® Access driver treats each Microsoft Access file as a complete database.

-# -#

An application might use this to determine how users will select data. For example, Xbase users often think of data as stored in files, while ORACLE and MicrosoftAccess users generally think of data as stored in tables.

-# -#

When a user selects an Xbase data source, the application could display the Windows File Open common dialog box; when the user selects a Microsoft Access or ORACLE data source, the application could display a custom Select Table dialog box.

-#
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a forward-only cursor that are supported by the driver. This bitmask contains the first subset of attributes; for the second subset, see SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA1_NEXT
-# SQL_CA1_LOCK_EXCLUSIVE
-# SQL_CA1_LOCK_NO_CHANGE
-# SQL_CA1_LOCK_UNLOCK
-# SQL_CA1_POS_POSITION
-# SQL_CA1_POS_UPDATE
-# SQL_CA1_POS_DELETE
-# SQL_CA1_POS_REFRESH
-# SQL_CA1_POSITIONED_UPDATE
-# SQL_CA1_POSITIONED_DELETE
-# SQL_CA1_SELECT_FOR_UPDATE
-# SQL_CA1_BULK_ADD
-# SQL_CA1_BULK_UPDATE_BY_BOOKMARK
-# SQL_CA1_BULK_DELETE_BY_BOOKMARK
-# SQL_CA1_BULK_FETCH_BY_BOOKMARK

-# -#

For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "forward-only cursor" for "dynamic cursor" in the descriptions).

-#
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a forward-only cursor that are supported by the driver. This bitmask contains the second subset of attributes; for the first subset, see SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA2_READ_ONLY_CONCURRENCY
-# SQL_CA2_LOCK_CONCURRENCY
-# SQL_CA2_OPT_ROWVER_CONCURRENCY
-# SQL_CA2_OPT_VALUES_CONCURRENCY
-# SQL_CA2_SENSITIVITY_ADDITIONS
-# SQL_CA2_SENSITIVITY_DELETIONS
-# SQL_CA2_SENSITIVITY_UPDATES
-# SQL_CA2_MAX_ROWS_SELECT
-# SQL_CA2_MAX_ROWS_INSERT
-# SQL_CA2_MAX_ROWS_DELETE
-# SQL_CA2_MAX_ROWS_UPDATE
-# SQL_CA2_MAX_ROWS_CATALOG
-# SQL_CA2_MAX_ROWS_AFFECTS_ALL
-# SQL_CA2_CRC_EXACT
-# SQL_CA2_CRC_APPROXIMATE
-# SQL_CA2_SIMULATE_NON_UNIQUE
-# SQL_CA2_SIMULATE_TRY_UNIQUE
-# SQL_CA2_SIMULATE_UNIQUE

-# -#

For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES2 (and substitute "forward-only cursor" for "dynamic cursor" in the descriptions).

-#
SQL_GETDATA_EXTENSIONS
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating extensions to SQLGetData. -#

The following bitmasks are used in conjunction with the flag to determine what common extensions the driver supports for SQLGetData:

-# -#

SQL_GD_ANY_COLUMN = SQLGetData can be called for any unbound column, including those before the last bound column. Note that the columns must be called in order of ascending column number unless SQL_GD_ANY_ORDER is also returned.

-# -#

SQL_GD_ANY_ORDER = SQLGetData can be called for unbound columns in any order. Note that SQLGetData can be called only for columns after the last bound column unless SQL_GD_ANY_COLUMN is also returned.

-# -#

SQL_GD_BLOCK = SQLGetData can be called for an unbound column in any row in a block (where the rowset size is greater than 1) of data after positioning to that row with SQLSetPos.

-# -#

SQL_GD_BOUND = SQLGetData can be called for bound columns as well as unbound columns. A driver cannot return this value unless it also returns SQL_GD_ANY_COLUMN.

-# -#

SQLGetData is required to return data only from unbound columns that occur after the last bound column, are called in order of increasing column number, and are not in a row in a block of rows.

-# -#

If a driver supports bookmarks (either fixed-length or variable-length), it must support calling SQLGetData on column 0. This support is required regardless of what the driver returns for a call to SQLGetInfo with the SQL_GETDATA_EXTENSIONS InfoType.

-#
SQL_GROUP_BY
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the relationship between the columns in the GROUP BY clause and the nonaggregated columns in the select list: -#

SQL_GB_COLLATE = A COLLATE clause can be specified at the end of each grouping column. (ODBC 3.0)

-# -#

SQL_GB_NOT_SUPPORTED = GROUP BY clauses are not supported. (ODBC 2.0)

-# -#

SQL_GB_GROUP_BY_EQUALS_SELECT = The GROUP BY clause must contain all nonaggregated columns in the select list. It cannot contain any other columns. For example, SELECT DEPT, MAX(SALARY) FROM EMPLOYEE GROUP BY DEPT. (ODBC 2.0)

-# -#

SQL_GB_GROUP_BY_CONTAINS_SELECT = The GROUP BY clause must contain all nonaggregated columns in the select list. It can contain columns that are not in the select list. For example, SELECT DEPT, MAX(SALARY) FROM EMPLOYEE GROUP BY DEPT, AGE. (ODBC 2.0)

-# -#

SQL_GB_NO_RELATION = The columns in the GROUP BY clause and the select list are not related. The meaning of nongrouped, nonaggregated columns in the select list is data source–dependent. For example, SELECT DEPT, SALARY FROM EMPLOYEE GROUP BY DEPT, AGE. (ODBC 2.0)

-# -#

An SQL-92 Entry level–conformant driver will always return the SQL_GB_GROUP_BY_EQUALS_SELECT option as supported. An SQL-92 Full level–conformant driver will always return the SQL_GB_COLLATE option as supported. If none of the options is supported, the GROUP BY clause is not supported by the data source.

-#
SQL_IDENTIFIER_CASE
-# (ODBC 1.0)
An SQLUSMALLINT value as follows: -#

SQL_IC_UPPER = Identifiers in SQL are not case-sensitive and are stored in uppercase in system catalog.

-# -#

SQL_IC_LOWER = Identifiers in SQL are not case-sensitive and are stored in lowercase in system catalog.

-# -#

SQL_IC_SENSITIVE = Identifiers in SQL are case-sensitive and are stored in mixed case in system catalog.

-# -#

SQL_IC_MIXED = Identifiers in SQL are not case-sensitive and are stored in mixed case in system catalog.

-# -#

Because identifiers in SQL-92 are never case-sensitive, a driver that conforms strictly to SQL-92 (any level) will never return the SQL_IC_SENSITIVE option as supported.

-#
SQL_IDENTIFIER_QUOTE_CHAR
-# (ODBC 1.0)
The character string used as the starting and ending delimiter of a quoted (delimited) identifier in SQL statements. (Identifiers passed as arguments to ODBC functions do not need to be quoted.) If the data source does not support quoted identifiers, a blank is returned. -#

This character string can also be used for quoting catalog function arguments when the connection attribute SQL_ATTR_METADATA_ID is set to SQL_TRUE.

-# -#

Because the identifier quote character in SQL-92 is the double quotation mark ("), a driver that conforms strictly to SQL-92 will always return the double quotation mark character.

-#
SQL_INDEX_KEYWORDS
-# (ODBC 3.0)
An SQLUINTEGER bitmask that enumerates keywords in the CREATE INDEX statement that are supported by the driver: -#

SQL_IK_NONE = None of the keywords is supported.

-# -#

SQL_IK_ASC = ASC keyword is supported.

-# -#

SQL_IK_DESC = DESC keyword is supported.

-# -#

SQL_IK_ALL = All keywords are supported.

-# -#

To see if the CREATE INDEX statement is supported, an application calls SQLGetInfo with the SQL_DLL_INDEX information type.

-#
SQL_INFO_SCHEMA_VIEWS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the views in the INFORMATION_SCHEMA that are supported by the driver. The views in, and the contents of, INFORMATION_SCHEMA are as defined in SQL-92. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which views are supported:

-# -#

SQL_ISV_ASSERTIONS = Identifies the catalog's assertions that are owned by a given user. (Full level)

-# -#

SQL_ISV_CHARACTER_SETS = Identifies the catalog's character sets that are accessible to a given user. (Intermediate level)

-# -#

SQL_ISV_CHECK_CONSTRAINTS = Identifies the CHECK constraints that are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_COLLATIONS = Identifies the character collations for the catalog that are accessible to a given user. (Full level)

-# -#

SQL_ISV_COLUMN_DOMAIN_USAGE = Identifies columns for the catalog that are dependent on domains defined in the catalog and are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_COLUMN_PRIVILEGES = Identifies the privileges on columns of persistent tables that are available to or granted by a given user. (FIPS Transitional level)

-# -#

SQL_ISV_COLUMNS = Identifies the columns of persistent tables that are accessible to a given user. (FIPS Transitional level)

-# -#

SQL_ISV_CONSTRAINT_COLUMN_USAGE = Similar to CONSTRAINT_TABLE_USAGE view, columns are identified for the various constraints that are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_CONSTRAINT_TABLE_USAGE = Identifies the tables that are used by constraints (referential, unique, and assertions), and are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_DOMAIN_CONSTRAINTS = Identifies the domain constraints (of the domains in the catalog) that are accessible to a given user. (Intermediate level)

-# -#

SQL_ISV_DOMAINS = Identifies the domains defined in a catalog that are accessible to the user. (Intermediate level)

-# -#

SQL_ISV_KEY_COLUMN_USAGE = Identifies columns defined in the catalog that are constrained as keys by a given user. (Intermediate level)

-# -#

SQL_ISV_REFERENTIAL_CONSTRAINTS = Identifies the referential constraints that are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_SCHEMATA = Identifies the schemas that are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_SQL_LANGUAGES = Identifies the SQL conformance levels, options, and dialects supported by the SQL implementation. (Intermediate level)

-# -#

SQL_ISV_TABLE_CONSTRAINTS = Identifies the table constraints that are owned by a given user. (Intermediate level)

-# -#

SQL_ISV_TABLE_PRIVILEGES = Identifies the privileges on persistent tables that are available to or granted by a given user. (FIPS Transitional level)

-# -#

SQL_ISV_TABLES = Identifies the persistent tables defined in a catalog that are accessible to a given user. (FIPS Transitional level)

-# -#

SQL_ISV_TRANSLATIONS = Identifies character translations for the catalog that are accessible to a given user. (Full level)

-# -#

SQL_ISV_USAGE_PRIVILEGES = Identifies the USAGE privileges on catalog objects that are available to or owned by a given user. (FIPS Transitional level)

-# -#

SQL_ISV_VIEW_COLUMN_USAGE = Identifies the columns on which the catalog's views that are owned by a given user are dependent. (Intermediate level)

-# -#

SQL_ISV_VIEW_TABLE_USAGE = Identifies the tables on which the catalog's views that are owned by a given user are dependent. (Intermediate level)

-# -#

SQL_ISV_VIEWS = Identifies the viewed tables defined in this catalog that are accessible to a given user. (FIPS Transitional level)

-#
SQL_INSERT_STATEMENT
-# (ODBC 3.0)
An SQLUINTEGER bitmask that indicates support for INSERT statements: -#

SQL_IS_INSERT_LITERALS

-# -#

SQL_IS_INSERT_SEARCHED

-# -#

SQL_IS_SELECT_INTO

-# -#

An SQL-92 Entry level–conformant driver will always return all of these options as supported.

-#
SQL_INTEGRITY
-# (ODBC 1.0)
A character string: "Y" if the data source supports the Integrity Enhancement Facility; "N" if it does not. -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_ODBC_SQL_OPT_IEF.

-#
SQL_KEYSET_CURSOR_ATTRIBUTES1
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a keyset cursor that are supported by the driver. This bitmask contains the first subset of attributes; for the second subset, see SQL_KEYSET_CURSOR_ATTRIBUTES2. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA1_NEXT
-# SQL_CA1_ABSOLUTE
-# SQL_CA1_RELATIVE
-# SQL_CA1_BOOKMARK
-# SQL_CA1_LOCK_EXCLUSIVE
-# SQL_CA1_LOCK_NO_CHANGE
-# SQL_CA1_LOCK_UNLOCK
-# SQL_CA1_POS_POSITION
-# SQL_CA1_POS_UPDATE
-# SQL_CA1_POS_DELETE
-# SQL_CA1_POS_REFRESH
-# SQL_CA1_POSITIONED_UPDATE
-# SQL_CA1_POSITIONED_DELETE
-# SQL_CA1_SELECT_FOR_UPDATE
-# SQL_CA1_BULK_ADD
-# SQL_CA1_BULK_UPDATE_BY_BOOKMARK
-# SQL_CA1_BULK_DELETE_BY_BOOKMARK
-# SQL_CA1_BULK_FETCH_BY_BOOKMARK

-# -#

For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "keyset-driven cursor" for "dynamic cursor" in the descriptions).

-# -#

An SQL-92 Intermediate level–conformant driver will usually return the SQL_CA1_NEXT, SQL_CA1_ABSOLUTE, and SQL_CA1_RELATIVE options as supported, because the driver supports scrollable cursors through the embedded SQL FETCH statement. Because this does not directly determine the underlying SQL support, however, scrollable cursors may not be supported, even for an SQL-92 Intermediate level–conformant driver.

-#
SQL_KEYSET_CURSOR_ATTRIBUTES2
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a keyset cursor that are supported by the driver. This bitmask contains the second subset of attributes; for the first subset, see SQL_KEYSET_CURSOR_ATTRIBUTES1. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA2_READ_ONLY_CONCURRENCY
-# SQL_CA2_LOCK_CONCURRENCY
-# SQL_CA2_OPT_ROWVER_CONCURRENCY
-# SQL_CA2_OPT_VALUES_CONCURRENCY
-# SQL_CA2_SENSITIVITY_ADDITIONS
-# SQL_CA2_SENSITIVITY_DELETIONS
-# SQL_CA2_SENSITIVITY_UPDATES
-# SQL_CA2_MAX_ROWS_SELECT
-# SQL_CA2_MAX_ROWS_INSERT
-# SQL_CA2_MAX_ROWS_DELETE
-# SQL_CA2_MAX_ROWS_UPDATE
-# SQL_CA2_MAX_ROWS_CATALOG
-# SQL_CA2_MAX_ROWS_AFFECTS_ALL
-# SQL_CA2_CRC_EXACT
-# SQL_CA2_CRC_APPROXIMATE
-# SQL_CA2_SIMULATE_NON_UNIQUE
-# SQL_CA2_SIMULATE_TRY_UNIQUE
-# SQL_CA2_SIMULATE_UNIQUE

-# -#

For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "keyset-driven cursor" for "dynamic cursor" in the descriptions).

-#
SQL_KEYWORDS
-# (ODBC 2.0)
A character string containing a comma-separated list of all data source–specific keywords. This list does not contain keywords specific to ODBC or keywords used by both the data source and ODBC. This list represents all the reserved keywords; interoperable applications should not use these words in object names. -#

For a list of ODBC keywords, see "List of Reserved Keywords" in Appendix C, "SQL Grammar." The #define value SQL_ODBC_KEYWORDS contains a comma-separated list of ODBC keywords.

-#
SQL_LIKE_ESCAPE_CLAUSE
-# (ODBC 2.0)
A character string: "Y" if the data source supports an escape character for the percent character (%) and underscore character (_) in a LIKE predicate and the driver supports the ODBC syntax for defining a LIKE predicate escape character; "N" otherwise.
SQL_MAX_ASYNC_CONCURRENT_STATEMENTS
-# (ODBC 3.0)
An SQLUINTEGER value specifying the maximum number of active concurrent statements in asynchronous mode that the driver can support on a given connection. If there is no specific limit or the limit is unknown, this value is zero.
SQL_MAX_BINARY_LITERAL_LEN
-# (ODBC 2.0)
An SQLUINTEGER value specifying the maximum length (number of hexadecimal characters, excluding the literal prefix and suffix returned by SQLGetTypeInfo) of a binary literal in an SQL statement. For example, the binary literal 0xFFAA has a length of 4. If there is no maximum length or the length is unknown, this value is set to zero.
SQL_MAX_CATALOG_NAME_LEN
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum length of a catalog name in the data source. If there is no maximum length or the length is unknown, this value is set to zero. -#

An FIPS Full level–conformant driver will return at least 128.

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_MAX_QUALIFIER_NAME_LEN.

-#
SQL_MAX_CHAR_LITERAL_LEN
-# (ODBC 2.0)
An SQLUINTEGER value specifying the maximum length (number of characters, excluding the literal prefix and suffix returned by SQLGetTypeInfo) of a character literal in an SQL statement. If there is no maximum length or the length is unknown, this value is set to zero.
SQL_MAX_COLUMN_NAME_LEN
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum length of a column name in the data source. If there is no maximum length or the length is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.

-#
SQL_MAX_COLUMNS_IN_GROUP_BY
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum number of columns allowed in a GROUP BY clause. If there is no specified limit or the limit is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 6. An FIPS Intermediate level–conformant driver will return at least 15.

-#
SQL_MAX_COLUMNS_IN_INDEX
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum number of columns allowed in an index. If there is no specified limit or the limit is unknown, this value is set to zero.
SQL_MAX_COLUMNS_IN_ORDER_BY
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum number of columns allowed in an ORDER BY clause. If there is no specified limit or the limit is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 6. An FIPS Intermediate level–conformant driver will return at least 15.

-#
SQL_MAX_COLUMNS_IN_SELECT
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum number of columns allowed in a select list. If there is no specified limit or the limit is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 100. An FIPS Intermediate level–conformant driver will return at least 250.

-#
SQL_MAX_COLUMNS_IN_TABLE
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum number of columns allowed in a table. If there is no specified limit or the limit is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 100. An FIPS Intermediate level–conformant driver will return at least 250.

-#
SQL_MAX_CONCURRENT_ACTIVITIES
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum number of active statements that the driver can support for a connection. A statement is defined as active if it has results pending, with the term "results" meaning rows from a SELECT operation or rows affected by an INSERT, UPDATE, or DELETE operation (such as a row count), or if it is in a NEED_DATA state. This value can reflect a limitation imposed by either the driver or the data source. If there is no specified limit or the limit is unknown, this value is set to zero. -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_ACTIVE_STATEMENTS.

-#
SQL_MAX_CURSOR_NAME_LEN
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum length of a cursor name in the data source. If there is no maximum length or the length is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.

-#
SQL_MAX_DRIVER_CONNECTIONS
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum number of active connections that the driver can support for an environment. This value can reflect a limitation imposed by either the driver or the data source. If there is no specified limit or the limit is unknown, this value is set to zero. -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_ACTIVE_CONNECTIONS.

-#
SQL_MAX_IDENTIFIER_LEN
-# (ODBC 3.0)
An SQLUSMALLINT that indicates the maximum size in characters that the data source supports for user-defined names. -#

An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.

-#
SQL_MAX_INDEX_SIZE
-# (ODBC 2.0)
An SQLUINTEGER value specifying the maximum number of bytes allowed in the combined fields of an index. If there is no specified limit or the limit is unknown, this value is set to zero.
SQL_MAX_PROCEDURE_NAME_LEN
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum length of a procedure name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.
SQL_MAX_ROW_SIZE
-# (ODBC 2.0)
An SQLUINTEGER value specifying the maximum length of a single row in a table. If there is no specified limit or the limit is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 2,000. An FIPS Intermediate level–conformant driver will return at least 8,000.

-#
SQL_MAX_ROW_SIZE_INCLUDES_LONG
-# (ODBC 3.0)
A character string: "Y" if the maximum row size returned for the SQL_MAX_ROW_SIZE information type includes the length of all SQL_LONGVARCHAR and SQL_LONGVARBINARY columns in the row; "N" otherwise.
SQL_MAX_SCHEMA_NAME_LEN
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum length of a schema name in the data source. If there is no maximum length or the length is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_MAX_OWNER_NAME_LEN.

-#
SQL_MAX_STATEMENT_LEN
-# (ODBC 2.0)
An SQLUINTEGER value specifying the maximum length (number of characters, including white space) of an SQL statement. If there is no maximum length or the length is unknown, this value is set to zero.
SQL_MAX_TABLE_NAME_LEN
-# (ODBC 1.0)
An SQLUSMALLINT value specifying the maximum length of a table name in the data source. If there is no maximum length or the length is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.

-#
SQL_MAX_TABLES_IN_SELECT
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum number of tables allowed in the FROM clause of a SELECT statement. If there is no specified limit or the limit is unknown, this value is set to zero. -#

An FIPS Entry level–conformant driver will return at least 15. An FIPS Intermediate level–conformant driver will return at least 50.

-#
SQL_MAX_USER_NAME_LEN
-# (ODBC 2.0)
An SQLUSMALLINT value specifying the maximum length of a user name in the data source. If there is no maximum length or the length is unknown, this value is set to zero.
SQL_MULT_RESULT_SETS
-# (ODBC 1.0)
A character string: "Y" if the data source supports multiple result sets, "N" if it does not. -#

For more information on multiple result sets, see "Multiple Results" in Chapter 11: Retrieving Results (Advanced).

-#
SQL_MULTIPLE_ACTIVE_TXN
-# (ODBC 1.0)
A character string: "Y" if the driver supports more than one active transaction at the same time, "N" if only one transaction can be active at any time. -#

The information returned for this information type does not apply in the case of distributed transactions.

-#
SQL_NEED_LONG_DATA_LEN
-# (ODBC 2.0)
A character string: "Y" if the data source needs the length of a long data value (the data type is SQL_LONGVARCHAR, SQL_LONGVARBINARY, or a long data source–specific data type) before that value is sent to the data source, "N" if it does not. For more information, see SQLBindParameter and SQLSetPos.
SQL_NON_NULLABLE_COLUMNS
-# (ODBC 1.0)
An SQLUSMALLINT value specifying whether the data source supports NOT NULL in columns: -#

SQL_NNC_NULL = All columns must be nullable.

-# -#

SQL_NNC_NON_NULL = Columns cannot be nullable. (The data source supports the NOT NULL column constraint in CREATE TABLE statements.)

-# -#

An SQL-92 Entry level–conformant driver will return SQL_NNC_NON_NULL.

-#
SQL_NULL_COLLATION
-# (ODBC 2.0)
An SQLUSMALLINT value specifying where NULLs are sorted in a result set: -#

SQL_NC_END = NULLs are sorted at the end of the result set, regardless of the ASC or DESC keywords.

-# -#

SQL_NC_HIGH = NULLs are sorted at the high end of the result set, depending on the ASC or DESC keywords.

-# -#

SQL_NC_LOW = NULLs are sorted at the low end of the result set, depending on the ASC or DESC keywords.

-# -#

SQL_NC_START = NULLs are sorted at the start of the result set, regardless of the ASC or DESC keywords.

-#
SQL_NUMERIC_FUNCTIONS
-# (ODBC 1.0) -#

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

-#
An SQLUINTEGER bitmask enumerating the scalar numeric functions supported by the driver and associated data source. -#

The following bitmasks are used to determine which numeric functions are supported:

-# -#

SQL_FN_NUM_ABS (ODBC 1.0)
-# SQL_FN_NUM_ACOS (ODBC 1.0)
-# SQL_FN_NUM_ASIN (ODBC 1.0)
-# SQL_FN_NUM_ATAN (ODBC 1.0)
-# SQL_FN_NUM_ATAN2 (ODBC 1.0)
-# SQL_FN_NUM_CEILING (ODBC 1.0)
-# SQL_FN_NUM_COS (ODBC 1.0)
-# SQL_FN_NUM_COT (ODBC 1.0)
-# SQL_FN_NUM_DEGREES (ODBC 2.0)
-# SQL_FN_NUM_EXP (ODBC 1.0)
-# SQL_FN_NUM_FLOOR (ODBC 1.0)
-# SQL_FN_NUM_LOG (ODBC 1.0)
-# SQL_FN_NUM_LOG10 (ODBC 2.0)
-# SQL_FN_NUM_MOD (ODBC 1.0)
-# SQL_FN_NUM_PI (ODBC 1.0)
-# SQL_FN_NUM_POWER (ODBC 2.0)
-# SQL_FN_NUM_RADIANS (ODBC 2.0)
-# SQL_FN_NUM_RAND (ODBC 1.0)
-# SQL_FN_NUM_ROUND (ODBC 2.0)
-# SQL_FN_NUM_SIGN (ODBC 1.0)
-# SQL_FN_NUM_SIN (ODBC 1.0)
-# SQL_FN_NUM_SQRT (ODBC 1.0)
-# SQL_FN_NUM_TAN (ODBC 1.0)
-# SQL_FN_NUM_TRUNCATE (ODBC 2.0)

-#
SQL_ODBC_INTERFACE_CONFORMANCE
-# (ODBC 3.0)
An SQLUINTEGER value indicating the level of the ODBC 3.x interface that the driver conforms to. -#

SQL_OIC_CORE: The minimum level that all ODBC drivers are expected to conform to. This level includes basic interface elements such as connection functions, functions for preparing and executing an SQL statement, basic result set metadata functions, basic catalog functions, and so on.

-# -#

SQL_OIC_LEVEL1: A level including the core standards compliance level functionality, plus scrollable cursors, bookmarks, positioned updates and deletes, and so on.

-# -#

SQL_OIC_LEVEL2: A level including level 1 standards compliance level functionality, plus advanced features such as sensitive cursors; update, delete, and refresh by bookmarks; stored procedure support; catalog functions for primary and foreign keys; multicatalog support; and so on.

-# -#

For more information, see "Interface Conformance Levels" in Chapter 4: ODBC Fundamentals.

-#
SQL_ODBC_VER
-# (ODBC 1.0)
A character string with the version of ODBC to which the Driver Manager conforms. The version is of the form ##.##.0000, where the first two digits are the major version and the next two digits are the minor version. This is implemented solely in the Driver Manager.
SQL_OJ_CAPABILITIES
-# (ODBC 2.01)
An SQLUINTEGER bitmask enumerating the types of outer joins supported by the driver and data source. The following bitmasks are used to determine which types are supported: -#

SQL_OJ_LEFT = Left outer joins are supported.

-# -#

SQL_OJ_RIGHT = Right outer joins are supported.

-# -#

SQL_OJ_FULL = Full outer joins are supported.

-# -#

SQL_OJ_NESTED = Nested outer joins are supported.

-# -#

SQL_OJ_NOT_ORDERED = The column names in the ON clause of the outer join do not have to be in the same order as their respective table names in the OUTER JOIN clause.

-# -#

SQL_OJ_INNER = The inner table (the right table in a left outer join or the left table in a right outer join) can also be used in an inner join. This does not apply to full outer joins, which do not have an inner table.

-# -#

SQL_OJ_ALL_COMPARISON_OPS = The comparison operator in the ON clause can be any of the ODBC comparison operators. If this bit is not set, only the equals (=) comparison operator can be used in outer joins.

-# -#

If none of these options is returned as supported, no outer join clause is supported.

-# -#

For information on the support of relational join operators in a SELECT statement, as defined by SQL-92, see SQL_SQL92_RELATIONAL_JOIN_OPERATORS.

-#
SQL_ORDER_BY_COLUMNS_IN_SELECT
-# (ODBC 2.0)
A character string: "Y" if the columns in the ORDER BY clause must be in the select list; otherwise, "N".
SQL_PARAM_ARRAY_ROW_COUNTS
-# (ODBC 3.0)
An SQLUINTEGER enumerating the driver's properties regarding the availability of row counts in a parameterized execution. Has the following values: -#

SQL_PARC_BATCH = Individual row counts are available for each set of parameters. This is conceptually equivalent to the driver generating a batch of SQL statements, one for each parameter set in the array. Extended error information can be retrieved by using the SQL_PARAM_STATUS_PTR descriptor field.

-# -#

SQL_PARC_NO_BATCH = There is only one row count available, which is the cumulative row count resulting from the execution of the statement for the entire array of parameters. This is conceptually equivalent to treating the statement along with the entire parameter array as one atomic unit. Errors are handled the same as if one statement were executed.

-#
SQL_PARAM_ARRAY_SELECTS
-# (ODBC 3.0)
An SQLUINTEGER enumerating the driver's properties regarding the availability of result sets in a parameterized execution. Has the following values: -#

SQL_PAS_BATCH = There is one result set available per set of parameters. This is conceptually equivalent to the driver generating a batch of SQL statements, one for each parameter set in the array.

-# -#

SQL_PAS_NO_BATCH = There is only one result set available, which represents the cumulative result set resulting from the execution of the statement for the entire array of parameters. This is conceptually equivalent to treating the statement along with the entire parameter array as one atomic unit.

-# -#

SQL_PAS_NO_SELECT = A driver does not allow a result-set generating statement to be executed with an array of parameters.

-#
SQL_PROCEDURE_TERM
-# (ODBC 1.0)
A character string with the data source vendor's name for a procedure; for example, "database procedure", "stored procedure", "procedure", "package", or "stored query".
SQL_PROCEDURES
-# (ODBC 1.0)
A character string: "Y" if the data source supports procedures and the driver supports the ODBC procedure invocation syntax; "N" otherwise.
SQL_POS_OPERATIONS (ODBC 2.0)An SQLINTEGER bitmask enumerating the support operations in SQLSetPos. -#

The following bitmasks are used in conjunction with the flag to determine which options are supported.

-# -#

SQL_POS_POSITION (ODBC 2.0) SQL_POS_REFRESH (ODBC 2.0) SQL_POS_UPDATE (ODBC 2.0) SQL_POS_DELETE (ODBC 2.0) SQL_POS_ADD (ODBC 2.0)

-#
SQL_QUOTED_IDENTIFIER_CASE
-# (ODBC 2.0)
An SQLUSMALLINT value as follows: -#

SQL_IC_UPPER = Quoted identifiers in SQL are not case-sensitive and are stored in uppercase in the system catalog.

-# -#

SQL_IC_LOWER = Quoted identifiers in SQL are not case-sensitive and are stored in lowercase in the system catalog.

-# -#

SQL_IC_SENSITIVE = Quoted identifiers in SQL are case-sensitive and are stored in mixed case in the system catalog. (In an SQL-92–compliant database, quoted identifiers are always case-sensitive.)

-# -#

SQL_IC_MIXED = Quoted identifiers in SQL are not case-sensitive and are stored in mixed case in the system catalog.

-# -#

An SQL-92 Entry level–conformant driver will always return SQL_IC_SENSITIVE.

-#
SQL_ROW_UPDATES
-# (ODBC 1.0)
A character string: "Y" if a keyset-driven or mixed cursor maintains row versions or values for all fetched rows and therefore can detect any updates made to a row by any user since the row was last fetched. (This applies only to updates, not to deletions or insertions.) The driver can return the SQL_ROW_UPDATED flag to the row status array when SQLFetchScroll is called. Otherwise, "N".
SQL_SCHEMA_TERM
-# (ODBC 1.0)
A character string with the data source vendor's name for an schema; for example, "owner", "Authorization ID", or "Schema". -#

The character string can be returned in upper, lower, or mixed case.

-# -#

An SQL-92 Entry level–conformant driver will always return "schema".

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_OWNER_TERM.

-#
SQL_SCHEMA_USAGE
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the statements in which schemas can be used: -#

SQL_SU_DML_STATEMENTS = Schemas are supported in all Data Manipulation Language statements: SELECT, INSERT, UPDATE, DELETE, and if supported, SELECT FOR UPDATE and positioned update and delete statements.

-# -#

SQL_SU_PROCEDURE_INVOCATION = Schemas are supported in the ODBC procedure invocation statement.

-# -#

SQL_SU_TABLE_DEFINITION = Schemas are supported in all table definition statements: CREATE TABLE, CREATE VIEW, ALTER TABLE, DROP TABLE, and DROP VIEW.

-# -#

SQL_SU_INDEX_DEFINITION = Schemas are supported in all index definition statements: CREATE INDEX and DROP INDEX.

-# -#

SQL_SU_PRIVILEGE_DEFINITION = Schemas are supported in all privilege definition statements: GRANT and REVOKE.

-# -#

An SQL-92 Entry level–conformant driver will always return the SQL_SU_DML_STATEMENTS, SQL_SU_TABLE_DEFINITION, and SQL_SU_PRIVILEGE_DEFINITION options, as supported.

-# -#

This InfoType has been renamed for ODBC 3.0 from the ODBC 2.0 InfoType SQL_OWNER_USAGE.

-#
SQL_SCROLL_OPTIONS
-# (ODBC 1.0) -#

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

-#
An SQLUINTEGER bitmask enumerating the scroll options supported for scrollable cursors. -#

The following bitmasks are used to determine which options are supported:

-# -#

SQL_SO_FORWARD_ONLY = The cursor only scrolls forward. (ODBC 1.0)

-# -#

SQL_SO_STATIC = The data in the result set is static. (ODBC 2.0)

-# -#

SQL_SO_KEYSET_DRIVEN = The driver saves and uses the keys for every row in the result set. (ODBC 1.0)

-# -#

SQL_SO_DYNAMIC = The driver keeps the keys for every row in the rowset (the keyset size is the same as the rowset size). (ODBC 1.0)

-# -#

SQL_SO_MIXED = The driver keeps the keys for every row in the keyset, and the keyset size is greater than the rowset size. The cursor is keyset-driven inside the keyset and dynamic outside the keyset. (ODBC 1.0)

-# -#

For information about scrollable cursors, see "Scrollable Cursors" in Chapter 11: Retrieving Results (Advanced)

-#
SQL_SEARCH_PATTERN_ESCAPE
-# (ODBC 1.0)
A character string specifying what the driver supports as an escape character that permits the use of the pattern match metacharacters underscore (_) and percent sign (%) as valid characters in search patterns. This escape character applies only for those catalog function arguments that support search strings. If this string is empty, the driver does not support a search-pattern escape character. -#

Because this information type does not indicate general support of the escape character in the LIKE predicate, SQL-92 does not include requirements for this character string.

-# -#

This InfoType is limited to catalog functions. For a description of the use of the escape character in search pattern strings, see "Pattern Value Arguments" in Chapter 7: Catalog Functions.

-#
SQL_SERVER_NAME
-# (ODBC 1.0)
A character string with the actual data source–specific server name; useful when a data source name is used during SQLConnect, SQLDriverConnect, and SQLBrowseConnect.
SQL_SPECIAL_CHARACTERS
-# (ODBC 2.0)
A character string containing all special characters (that is, all characters except a through z, A through Z, 0 through 9, and underscore) that can be used in an identifier name, such as a table name, column column name, or index name, on the data source. For example, "#$^". If an identifier contains one or more of these characters, the identifier must be a delimited identifier.
SQL_SQL_CONFORMANCE
-# (ODBC 3.0)
An SQLUINTEGER value indicating the level of SQL-92 supported by the driver: -#

SQL_SC_SQL92_ENTRY = Entry level SQL-92 compliant.

-# -#

SQL_SC_FIPS127_2_TRANSITIONAL = FIPS 127-2 transitional level compliant.

-# -#

SQL_SC_SQL92_FULL = Full level SQL-92 compliant.

-# -#

SQL_SC_ SQL92_INTERMEDIATE = Intermediate level SQL-92 compliant.

-#
SQL_SQL92_DATETIME_FUNCTIONS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the datetime scalar functions that are supported by the driver and the associated data source, as defined in SQL-92. -#

The following bitmasks are used to determine which datetime functions are supported:

-# -#

SQL_SDF_CURRENT_DATE
-# SQL_SDF_CURRENT_TIME
-# SQL_SDF_CURRENT_TIMESTAMP

-#
SQL_SQL92_FOREIGN_KEY_DELETE_RULE
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the rules supported for a foreign key in a DELETE statement, as defined in SQL-92. -#

The following bitmasks are used to determine which clauses are supported by the data source:

-# -#

SQL_SFKD_CASCADE
-# SQL_SFKD_NO_ACTION
-# SQL_SFKD_SET_DEFAULT
-# SQL_SFKD_SET_NULL

-# -#

An FIPS Transitional level–conformant driver will always return all of these options as supported.

-#
SQL_SQL92_FOREIGN_KEY_UPDATE_RULE
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the rules supported for a foreign key in an UPDATE statement, as defined in SQL-92. -#

The following bitmasks are used to determine which clauses are supported by the data source:

-# -#

SQL_SFKU_CASCADE
-# SQL_SFKU_NO_ACTION
-# SQL_SFKU_SET_DEFAULT
-# SQL_SFKU_SET_NULL

-# -#

An SQL-92 Full level–conformant driver will always return all of these options as supported.

-#
SQL_SQL92_GRANT
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses supported in the GRANT statement, as defined in SQL-92. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which clauses are supported by the data source:

-# -#

SQL_SG_DELETE_TABLE (Entry level)
-# SQL_SG_INSERT_COLUMN (Intermediate level)
-# SQL_SG_INSERT_TABLE (Entry level)
-# SQL_SG_REFERENCES_TABLE (Entry level)
-# SQL_SG_REFERENCES_COLUMN (Entry level)
-# SQL_SG_SELECT_TABLE (Entry level)
-# SQL_SG_UPDATE_COLUMN (Entry level)
-# SQL_SG_UPDATE_TABLE (Entry level)
-# SQL_SG_USAGE_ON_DOMAIN (FIPS Transitional level)
-# SQL_SG_USAGE_ON_CHARACTER_SET (FIPS Transitional level)
-# SQL_SG_USAGE_ON_COLLATION (FIPS Transitional level)
-# SQL_SG_USAGE_ON_TRANSLATION (FIPS Transitional level)
-# SQL_SG_WITH_GRANT_OPTION (Entry level)

-#
SQL_SQL92_NUMERIC_VALUE_FUNCTIONS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the numeric value scalar functions that are supported by the driver and the associated data source, as defined in SQL-92. -#

The following bitmasks are used to determine which numeric functions are supported:

-# -#

SQL_SNVF_BIT_LENGTH
-# SQL_SNVF_CHAR_LENGTH
-# SQL_SNVF_CHARACTER_LENGTH
-# SQL_SNVF_EXTRACT
-# SQL_SNVF_OCTET_LENGTH
-# SQL_SNVF_POSITION

-#
SQL_SQL92_PREDICATES
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the predicates supported in a SELECT statement, as defined in SQL-92. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which options are supported by the data source:

-# -#

SQL_SP_BETWEEN (Entry level)
-# SQL_SP_COMPARISON (Entry level)
-# SQL_SP_EXISTS (Entry level)
-# SQL_SP_IN (Entry level)
-# SQL_SP_ISNOTNULL (Entry level)
-# SQL_SP_ISNULL (Entry level)
-# SQL_SP_LIKE (Entry level)
-# SQL_SP_MATCH_FULL (Full level)
-# SQL_SP_MATCH_PARTIAL(Full level)
-# SQL_SP_MATCH_UNIQUE_FULL (Full level)
-# SQL_SP_MATCH_UNIQUE_PARTIAL (Full level)
-# SQL_SP_OVERLAPS (FIPS Transitional level)
-# SQL_SP_QUANTIFIED_COMPARISON (Entry level)
-# SQL_SP_UNIQUE (Entry level)

-#
SQL_SQL92_RELATIONAL_JOIN_OPERATORS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the relational join operators supported in a SELECT statement, as defined in SQL-92. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which options are supported by the data source:

-# -#

SQL_SRJO_CORRESPONDING_CLAUSE (Intermediate level)
-# SQL_SRJO_CROSS_JOIN (Full level)
-# SQL_SRJO_EXCEPT_JOIN (Intermediate level)
-# SQL_SRJO_FULL_OUTER_JOIN (Intermediate level)
-# SQL_SRJO_INNER_JOIN (FIPS Transitional level)
-# SQL_SRJO_INTERSECT_JOIN (Intermediate level)
-# SQL_SRJO_LEFT_OUTER_JOIN (FIPS Transitional level)
-# SQL_SRJO_NATURAL_JOIN (FIPS Transitional level)
-# SQL_SRJO_RIGHT_OUTER_JOIN (FIPS Transitional level)
-# SQL_SRJO_UNION_JOIN (Full level)

-# -#

SQL_SRJO_INNER_JOIN indicates support for the INNER JOIN syntax, not for the inner join capability. Support for the INNER JOIN syntax is FIPS TRANSITIONAL, while support for the inner join capability is ENTRY.

-#
SQL_SQL92_REVOKE
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the clauses supported in the REVOKE statement, as defined in SQL-92, supported by the data source. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which clauses are supported by the data source:

-# -#

SQL_SR_CASCADE (FIPS Transitional level)
-# SQL_SR_DELETE_TABLE (Entry level)
-# SQL_SR_GRANT_OPTION_FOR (Intermediate level)
-# SQL_SR_INSERT_COLUMN (Intermediate level)
-# SQL_SR_INSERT_TABLE (Entry level)
-# SQL_SR_REFERENCES_COLUMN (Entry level)
-# SQL_SR_REFERENCES_TABLE (Entry level)
-# SQL_SR_RESTRICT (FIPS Transitional level)
-# SQL_SR_SELECT_TABLE (Entry level)
-# SQL_SR_UPDATE_COLUMN (Entry level)
-# SQL_SR_UPDATE_TABLE (Entry level)
-# SQL_SR_USAGE_ON_DOMAIN (FIPS Transitional level)
-# SQL_SR_USAGE_ON_CHARACTER_SET (FIPS Transitional level)
-# SQL_SR_USAGE_ON_COLLATION (FIPS Transitional level)
-# SQL_SR_USAGE_ON_TRANSLATION (FIPS Transitional level)

-#
SQL_SQL92_ROW_VALUE_CONSTRUCTOR
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the row value constructor expressions supported in a SELECT statement, as defined in SQL-92. The following bitmasks are used to determine which options are supported by the data source: -#

SQL_SRVC_VALUE_EXPRESSION
-# SQL_SRVC_NULL
-# SQL_SRVC_DEFAULT
-# SQL_SRVC_ROW_SUBQUERY

-#
SQL_SQL92_STRING_FUNCTIONS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the string scalar functions that are supported by the driver and the associated data source, as defined in SQL-92. -#

The following bitmasks are used to determine which string functions are supported:

-# -#

SQL_SSF_CONVERT
-# SQL_SSF_LOWER
-# SQL_SSF_UPPER
-# SQL_SSF_SUBSTRING
-# SQL_SSF_TRANSLATE
-# SQL_SSF_TRIM_BOTH
-# SQL_SSF_TRIM_LEADING
-# SQL_SSF_TRIM_TRAILING

-#
SQL_SQL92_VALUE_EXPRESSIONS
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the value expressions supported, as defined in SQL-92. -#

The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.

-# -#

The following bitmasks are used to determine which options are supported by the data source:

-# -#

SQL_SVE_CASE (Intermediate level)
-# SQL_SVE_CAST (FIPS Transitional level)
-# SQL_SVE_COALESCE (Intermediate level)
-# SQL_SVE_NULLIF (Intermediate level)

-#
SQL_STANDARD_CLI_CONFORMANCE
-# (ODBC 3.0)
An SQLUINTEGER bitmask enumerating the CLI standard or standards to which the driver conforms. The following bitmasks are used to determine which levels the driver conforms to: -#

SQL_SCC_XOPEN_CLI_VERSION1: The driver conforms to the X/Open CLI version 1.

-# -#

SQL_SCC_ISO92_CLI: The driver conforms to the ISO 92 CLI.

-#
SQL_STATIC_CURSOR_ATTRIBUTES1
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a static cursor that are supported by the driver. This bitmask contains the first subset of attributes; for the second subset, see SQL_STATIC_CURSOR_ATTRIBUTES2. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA1_NEXT
-# SQL_CA1_ABSOLUTE
-# SQL_CA1_RELATIVE
-# SQL_CA1_BOOKMARK
-# SQL_CA1_LOCK_NO_CHANGE
-# SQL_CA1_LOCK_EXCLUSIVE
-# SQL_CA1_LOCK_UNLOCK
-# SQL_CA1_POS_POSITION
-# SQL_CA1_POS_UPDATE
-# SQL_CA1_POS_DELETE
-# SQL_CA1_POS_REFRESH
-# SQL_CA1_POSITIONED_UPDATE
-# SQL_CA1_POSITIONED_DELETE
-# SQL_CA1_SELECT_FOR_UPDATE
-# SQL_CA1_BULK_ADD
-# SQL_CA1_BULK_UPDATE_BY_BOOKMARK
-# SQL_CA1_BULK_DELETE_BY_BOOKMARK
-# SQL_CA1_BULK_FETCH_BY_BOOKMARK

-# -#

For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "static cursor" for "dynamic cursor" in the descriptions).

-# -#

An SQL-92 Intermediate level–conformant driver will usually return the SQL_CA1_NEXT, SQL_CA1_ABSOLUTE, and SQL_CA1_RELATIVE options as supported, because the driver supports scrollable cursors through the embedded SQL FETCH statement. Because this does not directly determine the underlying SQL support, however, scrollable cursors may not be supported, even for an SQL-92 Intermediate level–conformant driver.

-#
SQL_STATIC_CURSOR_ATTRIBUTES2
-# (ODBC 3.0)
An SQLUINTEGER bitmask that describes the attributes of a static cursor that are supported by the driver. This bitmask contains the second subset of attributes; for the first subset, see SQL_STATIC_CURSOR_ATTRIBUTES1. -#

The following bitmasks are used to determine which attributes are supported:

-# -#

SQL_CA2_READ_ONLY_CONCURRENCY
-# SQL_CA2_LOCK_CONCURRENCY
-# SQL_CA2_OPT_ROWVER_CONCURRENCY
-# SQL_CA2_OPT_VALUES_CONCURRENCY
-# SQL_CA2_SENSITIVITY_ADDITIONS
-# SQL_CA2_SENSITIVITY_DELETIONS
-# SQL_CA2_SENSITIVITY_UPDATES
-# SQL_CA2_MAX_ROWS_SELECT
-# SQL_CA2_MAX_ROWS_INSERT
-# SQL_CA2_MAX_ROWS_DELETE
-# SQL_CA2_MAX_ROWS_UPDATE
-# SQL_CA2_MAX_ROWS_CATALOG
-# SQL_CA2_MAX_ROWS_AFFECTS_ALL
-# SQL_CA2_CRC_EXACT
-# SQL_CA2_CRC_APPROXIMATE
-# SQL_CA2_SIMULATE_NON_UNIQUE
-# SQL_CA2_SIMULATE_TRY_UNIQUE
-# SQL_CA2_SIMULATE_UNIQUE

-# -#

For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES2 (and substitute "static cursor" for "dynamic cursor" in the descriptions).

-#
SQL_STRING_FUNCTIONS
-# (ODBC 1.0) -#

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

-#
An SQLUINTEGER bitmask enumerating the scalar string functions supported by the driver and associated data source. -#

The following bitmasks are used to determine which string functions are supported:

-# -#

SQL_FN_STR_ASCII (ODBC 1.0)
-# SQL_FN_STR_BIT_LENGTH (ODBC 3.0)
-# SQL_FN_STR_CHAR (ODBC 1.0)
-# SQL_FN_STR_CHAR_
-# LENGTH (ODBC 3.0)
-# SQL_FN_STR_CHARACTER_
-# LENGTH (ODBC 3.0)
-# SQL_FN_STR_CONCAT (ODBC 1.0)
-# SQL_FN_STR_DIFFERENCE (ODBC 2.0)
-# SQL_FN_STR_INSERT (ODBC 1.0)
-# SQL_FN_STR_LCASE (ODBC 1.0)
-# SQL_FN_STR_LEFT (ODBC 1.0)
-# SQL_FN_STR_LENGTH (ODBC 1.0)
-# SQL_FN_STR_LOCATE (ODBC 1.0)
-# SQL_FN_STR_LTRIM (ODBC 1.0)
-# SQL_FN_STR_OCTET_
-# LENGTH (ODBC 3.0)
-# SQL_FN_STR_POSITION (ODBC 3.0)
-# SQL_FN_STR_REPEAT (ODBC 1.0)
-# SQL_FN_STR_REPLACE (ODBC 1.0)
-# SQL_FN_STR_RIGHT (ODBC 1.0)
-# SQL_FN_STR_RTRIM (ODBC 1.0)
-# SQL_FN_STR_SOUNDEX (ODBC 2.0)
-# SQL_FN_STR_SPACE (ODBC 2.0)
-# SQL_FN_STR_SUBSTRING (ODBC 1.0)
-# SQL_FN_STR_UCASE (ODBC 1.0)

-# -#

If an application can call the LOCATE scalar function with the string_exp1, string_exp2, and start arguments, the driver returns the SQL_FN_STR_LOCATE bitmask. If an application can call the LOCATE scalar function with only the string_exp1 and string_exp2 arguments, the driver returns the SQL_FN_STR_LOCATE_2 bitmask. Drivers that fully support the LOCATE scalar function return both bitmasks.

-# -#

(For more information, see String Functions in Appendix E, "Scalar Functions.")

-#
SQL_SUBQUERIES
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the predicates that support subqueries: -#

SQL_SQ_CORRELATED_SUBQUERIES
-# SQL_SQ_COMPARISON
-# SQL_SQ_EXISTS
-# SQL_SQ_IN
-# SQL_SQ_QUANTIFIED

-# -#

The SQL_SQ_CORRELATED_SUBQUERIES bitmask indicates that all predicates that support subqueries support correlated subqueries.

-# -#

An SQL-92 Entry level–conformant driver will always return a bitmask in which all of these bits are set.

-#
SQL_SYSTEM_FUNCTIONS
-# (ODBC 1.0)
An SQLUINTEGER bitmask enumerating the scalar system functions supported by the driver and associated data source. -#

The following bitmasks are used to determine which system functions are supported:

-# -#

SQL_FN_SYS_DBNAME
-# SQL_FN_SYS_IFNULL
-# SQL_FN_SYS_USERNAME

-#
SQL_TABLE_TERM
-# (ODBC 1.0)
A character string with the data source vendor's name for a table; for example, "table" or "file". -#

This character string can be in upper, lower, or mixed case.

-# -#

An SQL-92 Entry level–conformant driver will always return "table".

-#
SQL_TIMEDATE_ADD_INTERVALS
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the timestamp intervals supported by the driver and associated data source for the TIMESTAMPADD scalar function. -#

The following bitmasks are used to determine which intervals are supported:

-# -#

SQL_FN_TSI_FRAC_SECOND
-# SQL_FN_TSI_SECOND
-# SQL_FN_TSI_MINUTE
-# SQL_FN_TSI_HOUR
-# SQL_FN_TSI_DAY
-# SQL_FN_TSI_WEEK
-# SQL_FN_TSI_MONTH
-# SQL_FN_TSI_QUARTER
-# SQL_FN_TSI_YEAR

-# -#

An FIPS Transitional level–conformant driver will always return a bitmask in which all of these bits are set.

-#
SQL_TIMEDATE_DIFF_INTERVALS
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the timestamp intervals supported by the driver and associated data source for the TIMESTAMPDIFF scalar function. -#

The following bitmasks are used to determine which intervals are supported:

-# -#

SQL_FN_TSI_FRAC_SECOND
-# SQL_FN_TSI_SECOND
-# SQL_FN_TSI_MINUTE
-# SQL_FN_TSI_HOUR
-# SQL_FN_TSI_DAY
-# SQL_FN_TSI_WEEK
-# SQL_FN_TSI_MONTH
-# SQL_FN_TSI_QUARTER
-# SQL_FN_TSI_YEAR

-# -#

An FIPS Transitional level–conformant driver will always return a bitmask in which all of these bits are set.

-#
SQL_TIMEDATE_FUNCTIONS
-# (ODBC 1.0) -#

The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.

-#
An SQLUINTEGER bitmask enumerating the scalar date and time functions supported by the driver and associated data source. -#

The following bitmasks are used to determine which date and time functions are supported:

-# -#

SQL_FN_TD_CURRENT_DATE ODBC 3.0)
-# SQL_FN_TD_CURRENT_TIME (ODBC 3.0)
-# SQL_FN_TD_CURRENT_TIMESTAMP (ODBC 3.0)
-# SQL_FN_TD_CURDATE (ODBC 1.0)
-# SQL_FN_TD_CURTIME (ODBC 1.0)
-# SQL_FN_TD_DAYNAME (ODBC 2.0)
-# SQL_FN_TD_DAYOFMONTH (ODBC 1.0)
-# SQL_FN_TD_DAYOFWEEK (ODBC 1.0)
-# SQL_FN_TD_DAYOFYEAR (ODBC 1.0)
-# SQL_FN_TD_EXTRACT (ODBC 3.0)
-# SQL_FN_TD_HOUR (ODBC 1.0)
-# SQL_FN_TD_MINUTE (ODBC 1.0)
-# SQL_FN_TD_MONTH (ODBC 1.0)
-# SQL_FN_TD_MONTHNAME (ODBC 2.0)
-# SQL_FN_TD_NOW (ODBC 1.0)
-# SQL_FN_TD_QUARTER (ODBC 1.0)
-# SQL_FN_TD_SECOND (ODBC 1.0)
-# SQL_FN_TD_TIMESTAMPADD (ODBC 2.0)
-# SQL_FN_TD_TIMESTAMPDIFF (ODBC 2.0)
-# SQL_FN_TD_WEEK (ODBC 1.0)
-# SQL_FN_TD_YEAR (ODBC 1.0)

-#
SQL_TXN_CAPABLE
-# (ODBC 1.0) -#

The information type was introduced in ODBC 1.0; each return value is labeled with the version in which it was introduced.

-#
An SQLUSMALLINT value describing the transaction support in the driver or data source: -#

SQL_TC_NONE = Transactions not supported. (ODBC 1.0)

-# -#

SQL_TC_DML = Transactions can contain only Data Manipulation Language (DML) statements (SELECT, INSERT, UPDATE, DELETE). Data Definition Language (DDL) statements encountered in a transaction cause an error. (ODBC 1.0)

-# -#

SQL_TC_DDL_COMMIT = Transactions can contain only DML statements. DDL statements (CREATE TABLE, DROP INDEX, and so on) encountered in a transaction cause the transaction to be committed. (ODBC 2.0)

-# -#

SQL_TC_DDL_IGNORE = Transactions can contain only DML statements. DDL statements encountered in a transaction are ignored. (ODBC 2.0)

-# -#

SQL_TC_ALL = Transactions can contain DDL statements and DML statements in any order. (ODBC 1.0)

-# -#

(Because support of transactions is mandatory in SQL-92, an SQL-92 conformant driver [any level] will never return SQL_TC_NONE.)

-#
SQL_TXN_ISOLATION_OPTION
-# (ODBC 1.0)
An SQLUINTEGER bitmask enumerating the transaction isolation levels available from the driver or data source. -#

The following bitmasks are used in conjunction with the flag to determine which options are supported:

-# -#

SQL_TXN_READ_UNCOMMITTED
-# SQL_TXN_READ_COMMITTED
-# SQL_TXN_REPEATABLE_READ
-# SQL_TXN_SERIALIZABLE

-# -#

For descriptions of these isolation levels, see the description of SQL_DEFAULT_TXN_ISOLATION.

-# -#

To set the transaction isolation level, an application calls SQLSetConnectAttr to set the SQL_ATTR_TXN_ISOLATION attribute. For more information, see SQLSetConnectAttr.

-# -#

An SQL-92 Entry level–conformant driver will always return SQL_TXN_SERIALIZABLE as supported. A FIPS Transitional level–conformant driver will always return all of these options as supported.

-#
SQL_UNION
-# (ODBC 2.0)
An SQLUINTEGER bitmask enumerating the support for the UNION clause: -#

SQL_U_UNION = The data source supports the UNION clause.

-# -#

SQL_U_UNION_ALL = The data source supports the ALL keyword in the UNION clause. (SQLGetInfo returns both SQL_U_UNION and SQL_U_UNION_ALL in this case.)

-# -#

An SQL-92 Entry level–conformant driver will always return both of these options as supported.

-#
SQL_USER_NAME
-# (ODBC 1.0)
A character string with the name used in a particular database, which can be different from the login name.
SQL_XOPEN_CLI_YEAR
-# (ODBC 3.0)
A character string that indicates the year of publication of the X/Open specification with which the version of the ODBC Driver Manager fully complies.
-# -#

Code Example

-# -#

SQLGetInfo returns lists of supported options as an SQLUINTEGER bitmask in *InfoValuePtr. The bitmask for each option is used in conjunction with the flag to determine whether the option is supported.

-# -#

For example, an application could use the following code to determine whether the SUBSTRING scalar function is supported by the driver associated with the connection:

-# -#
SQLUINTEGER    fFuncs;
-#	
-#	SQLGetInfo(hdbc,
-#	   SQL_STRING_FUNCTIONS,
-#	   (SQLPOINTER)&fFuncs,
-#	   sizeof(fFuncs),
-#	   NULL);
-#	
-#	if (fFuncs & SQL_FN_STR_SUBSTRING)   /* SUBSTRING supported */
-#	      ;
-#	else                                 /* SUBSTRING not supported */
-#	      ;
-# -#

Related Functions

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
For information aboutSee
Returning the setting of a connection attributeSQLGetConnectAttr
Determining whether a driver supports a functionSQLGetFunctions
Returning the setting of a statement attributeSQLGetStmtAttr
Returning information about a data source's data typesSQLGetTypeInfo
-#

-# -#
-# -# -# -}; - -print <{$name}; - my $type = $p->{type}; - $type =~ /^(Char|YesNo|Short|Long|Bitmask)$/ - or die "$name: bad type $type"; - my $defstr = $type eq "YesNo" ? q("N") : $type eq "Char" ? q("") : q(0); - my $s = <{omit}) { - $s ="#if 0\n" . $s . "#endif\n"; - } - print $s; -}; - -print < "UNDEF", - type => q(Undef), - nullable => q(true), - position => 0, - }, -# -# -# -# SQLGetTypeInfo -# -# -# -# -# -# -#
-#
-# -# -# -# -#
-# ODBC Programmer's Reference -#
-#
-#
-#
-# -#

SQLGetTypeInfo

-# -#

Conformance

-# -#

Version Introduced: ODBC 1.0
-# Standards Compliance: ISO 92

-# -#

Summary

-# -#

SQLGetTypeInfo returns information about data types supported by the data source. The driver returns the information in the form of an SQL result set. The data types are intended for use in Data Definition Language (DDL) statements.

-# -#

Important   Applications must use the type names returned in the TYPE_NAME column of the SQLGetTypeInfo result set in ALTER TABLE and CREATE TABLE statements. SQLGetTypeInfo may return more than one row with the same value in the DATA_TYPE column.

-# -#

Syntax

-# -#
SQLRETURN SQLGetTypeInfo(
-#	     SQLHSTMT     StatementHandle,
-#	     SQLSMALLINT     DataType);
-# -#

Arguments -# -#

-#
StatementHandle
-# -#
[Input]
-# Statement handle for the result set.
-# -#
DataType
-# -#
[Input]
-# The SQL data type. This must be one of the values in the "SQL Data Types" section of Appendix D: Data Types, or a driver-specific SQL data type. SQL_ALL_TYPES specifies that information about all data types should be returned.
-#
-# -#

Returns

-# -#

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

-# -#

Diagnostics

-# -#

When SQLGetTypeInfo returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLGetTypeInfo and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQLSTATEErrorDescription
01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
01S02Option value changedA specified statement attribute was invalid because of implementation working conditions, so a similar value was temporarily substituted. (Call SQLGetStmtAttr to determine the temporarily substituted value.) The substitute value is valid for the StatementHandle until the cursor is closed. The statement attributes that can be changed are: SQL_ATTR_CONCURRENCY, SQL_ATTR_CURSOR_TYPE, SQL_ATTR_KEYSET_SIZE, SQL_ATTR_MAX_LENGTH, SQL_ATTR_MAX_ROWS, SQL_ATTR_QUERY_TIMEOUT, and SQL_ATTR_SIMULATE_CURSOR. (Function returns SQL_SUCCESS_WITH_INFO.)
08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
24000Invalid cursor stateA cursor was open on the StatementHandle, and SQLFetch or SQLFetchScroll had been called. This error is returned by the Driver Manager if SQLFetch or SQLFetchScroll has not returned SQL_NO_DATA, and is returned by the driver if SQLFetch or SQLFetchScroll has returned SQL_NO_DATA. -#

A result set was open on the StatementHandle, but SQLFetch or SQLFetchScroll had not been called.

-#
40001Serialization failureThe transaction was rolled back due to a resource deadlock with another transaction.
40003Statement completion unknownThe associated connection failed during the execution of this function and the state of the transaction cannot be determined.
HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001Memory allocation errorThe driver was unable to allocate memory required to support execution or completion of the function.
HY004Invalid SQL data typeThe value specified for the argument DataType was neither a valid ODBC SQL data type identifier nor a driver-specific data type identifier supported by the driver.
HY008Operation canceledAsynchronous processing was enabled for the StatementHandle, then the function was called and, before it completed execution, SQLCancel was called on the StatementHandle. Then the function was called again on the StatementHandle. -#

The function was called and, before it completed execution, SQLCancel was called on the StatementHandle from a different thread in a multithread application.

-#
HY010Function sequence error(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called. -#

(DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

-#
HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HYC00Optional feature not implementedThe combination of the current settings of the SQL_ATTR_CONCURRENCY and SQL_ATTR_CURSOR_TYPE statement attributes was not supported by the driver or data source. -#

The SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_VARIABLE, and the SQL_ATTR_CURSOR_TYPE statement attribute was set to a cursor type for which the driver does not support bookmarks.

-#
HYT00Timeout expiredThe query timeout period expired before the data source returned the result set. The timeout period is set through SQLSetStmtAttr, SQL_ATTR_QUERY_TIMEOUT.
HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001Driver does not support this function(DM) The driver corresponding to the StatementHandle does not support the function.
-# -#

Comments

-# -#

SQLGetTypeInfo returns the results as a standard result set, ordered by DATA_TYPE and then by how closely the data type maps to the corresponding ODBC SQL data type. Data types defined by the data source take precedence over user-defined data types. Consequently, the sort order is not necessarily consistent but can be generalized as DATA_TYPE first, followed by TYPE_NAME, both ascending. For example, suppose that a data source defined INTEGER and COUNTER data types, where COUNTER is auto-incrementing, and that a user-defined data type WHOLENUM has also been defined. These would be returned in the order INTEGER, WHOLENUM, and COUNTER, because WHOLENUM maps closely to the ODBC SQL data type SQL_INTEGER, while the auto-incrementing data type, even though supported by the data source, does not map closely to an ODBC SQL data type. For information about how this information might be used, see "DDL Statements" in Chapter 8: SQL Statements.

-# -#

If the DataType argument specifies a data type which is valid for the version of ODBC supported by the driver, but is not supported by the driver, then it will return an empty result set.

-# -#

Note   For more information about the general use, arguments, and returned data of ODBC catalog functions, see Chapter 7: Catalog Functions.

-# -#

The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility because applications bind by column number.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
ODBC 2.0 columnODBC 3.x column
PRECISIONCOLUMN_SIZE
MONEYFIXED_PREC_SCALE
AUTO_INCREMENTAUTO_UNIQUE_VALUE
-# -#

The following columns have been added to the results set returned by SQLGetTypeInfo for ODBC 3.x: -# -#

    -#
  • SQL_DATA_TYPE
  • -# -#
  • INTERVAL_PRECISION
  • -# -#
  • SQL_DATETIME_SUB
  • -# -#
  • NUM_PREC_RADIX
  • -#
-# -#

The following table lists the columns in the result set. Additional columns beyond column 19 (INTERVAL_PRECISION) can be defined by the driver. An application should gain access to driver-specific columns by counting down from the end of the result set rather than specifying an explicit ordinal position. For more information, see "Data Returned by Catalog Functions" in Chapter 7: Catalog Functions.

-# -#

Note   SQLGetTypeInfo might not return all data types. For example, a driver might not return user-defined data types. Applications can use any valid data type, regardless of whether it is returned by SQLGetTypeInfo.

-# -#

The data types returned by SQLGetTypeInfo are those supported by the data source. They are intended for use in Data Definition Language (DDL) statements. Drivers can return result-set data using data types other than the types returned by SQLGetTypeInfo. In creating the result set for a catalog function, the driver might use a data type that is not supported by the data source.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# - { name => "TYPE_NAME", - type => q(Varchar), - length => 20, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "DATA_TYPE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "COLUMN_SIZE", - type => q(Integer), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "LITERAL_PREFIX", - type => q(Varchar), - length => 1, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "LITERAL_SUFFIX", - type => q(Varchar), - length => 1, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "CREATE_PARAMS", - type => q(Varchar), - length => 20, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "NULLABLE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "CASE_SENSITIVE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "SEARCHABLE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "UNSIGNED_ATTRIBUTE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "FIXED_PREC_SCALE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "AUTO_UNIQUE_VALUE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "LOCAL_TYPE_NAME", - type => q(Varchar), - length => 20, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "MINIMUM_SCALE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "MAXIMUM_SCALE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "SQL_DATA_TYPE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "SQL_DATETIME_SUB", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "NUM_PREC_RADIX", - type => q(Integer), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# -# -# -# -# -# - { name => "INTERVAL_PRECISION", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -#

-# Column name
Column
-# number

-# Data type

-# Comments
TYPE_NAME
-# (ODBC 2.0)
1Varchar
-# not NULL
Data source–dependent data-type name; for example, "CHAR()", "VARCHAR()", "MONEY", "LONG VARBINARY", or "CHAR ( ) FOR BIT DATA". Applications must use this name in CREATE TABLE and ALTER TABLE statements.
DATA_TYPE
-# (ODBC 2.0)
2Smallint
-# not NULL
SQL data type. This can be an ODBC SQL data type or a driver-specific SQL data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). For a list of valid ODBC SQL data types, see "SQL Data Types" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver’s documentation.
COLUMN_SIZE
-# (ODBC 2.0)
3IntegerThe maximum column size that the server supports for this data type. For numeric data, this is the maximum precision. For string data, this is the length in characters. For datetime data types, this is the length in characters of the string representation (assuming the maximum allowed precision of the fractional seconds component). NULL is returned for data types where column size is not applicable. For interval data types, this is the number of characters in the character representation of the interval literal (as defined by the interval leading precision; see "Interval Data Type Length" in Appendix D: Data Types). -#

For more information on column size, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.

-#
LITERAL_PREFIX
-# (ODBC 2.0)
4VarcharCharacter or characters used to prefix a literal; for example, a single quotation mark (') for character data types or 0x for binary data types; NULL is returned for data types where a literal prefix is not applicable.
LITERAL_SUFFIX
-# (ODBC 2.0)
5VarcharCharacter or characters used to terminate a literal; for example, a single quotation mark (') for character data types; NULL is returned for data types where a literal suffix is not applicable.
CREATE_PARAMS
-# (ODBC 2.0)
6VarcharA list of keywords, separated by commas, corresponding to each parameter that the application may specify in parentheses when using the name that is returned in the TYPE_NAME field. The keywords in the list can be any of the following: length, precision, or scale. They appear in the order that the syntax requires them to be used. For example, CREATE_PARAMS for DECIMAL would be "precision,scale"; CREATE_PARAMS for VARCHAR would equal "length." NULL is returned if there are no parameters for the data type definition; for example, INTEGER. -#

The driver supplies the CREATE_PARAMS text in the language of the country where it is used.

-#
NULLABLE
-# (ODBC 2.0)
7Smallint
-# not NULL
Whether the data type accepts a NULL value: -#

SQL_NO_NULLS if the data type does not accept NULL values.

-# -#

SQL_NULLABLE if the data type accepts NULL values.

-# -#

SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values.

-#
CASE_SENSITIVE
-# (ODBC 2.0)
8Smallint
-# not NULL
Whether a character data type is case-sensitive in collations and comparisons: -#

SQL_TRUE if the data type is a character data type and is case-sensitive.

-# -#

SQL_FALSE if the data type is not a character data type or is not case-sensitive.

-#
SEARCHABLE
-# (ODBC 2.0)
9Smallint
-# not NULL
How the data type is used in a WHERE clause: -#

SQL_PRED_NONE if the column cannot be used in a WHERE clause. (This is the same as the SQL_UNSEARCHABLE value in ODBC 2.x.)

-# -#

SQL_PRED_CHAR if the column can be used in a WHERE clause, but only with the LIKE predicate. (This is the same as the SQL_LIKE_ONLY value in ODBC 2.x.)

-# -#

SQL_PRED_BASIC if the column can be used in a WHERE clause with all the comparison operators except LIKE (comparison, quantified comparison, BETWEEN, DISTINCT, IN, MATCH, and UNIQUE). (This is the same as the SQL_ALL_EXCEPT_LIKE value in ODBC 2.x.)

-# -#

SQL_SEARCHABLE if the column can be used in a WHERE clause with any comparison operator.

-#
UNSIGNED_ATTRIBUTE
-# (ODBC 2.0)
10SmallintWhether the data type is unsigned: -#

SQL_TRUE if the data type is unsigned.

-# -#

SQL_FALSE if the data type is signed.

-# -#

NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.

-#
FIXED_PREC_SCALE
-# (ODBC 2.0)
11Smallint
-# not NULL
Whether the data type has predefined fixed precision and scale (which are data source–specific), such as a money data type: -#

SQL_TRUE if it has predefined fixed precision and scale.

-# -#

SQL_FALSE if it does not have predefined fixed precision and scale.

-#
AUTO_UNIQUE_VALUE
-# (ODBC 2.0)
12SmallintWhether the data type is autoincrementing: -#

SQL_TRUE if the data type is autoincrementing.

-# -#

SQL_FALSE if the data type is not autoincrementing.

-# -#

NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.

-# -#

An application can insert values into a column having this attribute, but typically cannot update the values in the column.

-# -#

When an insert is made into an auto-increment column, a unique value is inserted into the column at insert time. The increment is not defined, but is data source–specific. An application should not assume that an auto-increment column starts at any particular point or increments by any particular value.

-#
LOCAL_TYPE_NAME
-# (ODBC 2.0)
13VarcharLocalized version of the data source–dependent name of the data type. NULL is returned if a localized name is not supported by the data source. This name is intended for display only, such as in dialog boxes.
MINIMUM_SCALE
-# (ODBC 2.0)
14SmallintThe minimum scale of the data type on the data source. If a data type has a fixed scale, the MINIMUM_SCALE and MAXIMUM_SCALE columns both contain this value. For example, an SQL_TYPE_TIMESTAMP column might have a fixed scale for fractional seconds. NULL is returned where scale is not applicable. For more information, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.
MAXIMUM_SCALE
-# (ODBC 2.0)
15SmallintThe maximum scale of the data type on the data source. NULL is returned where scale is not applicable. If the maximum scale is not defined separately on the data source, but is instead defined to be the same as the maximum precision, this column contains the same value as the COLUMN_SIZE column. For more information, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.
SQL_DATA_TYPE
-# (ODBC 3.0)
16Smallint NOT NULLThe value of the SQL data type as it appears in the SQL_DESC_TYPE field of the descriptor. This column is the same as the DATA_TYPE column, except for interval and datetime data types. -#

For interval and datetime data types, the SQL_DATA_TYPE field in the result set will return SQL_INTERVAL or SQL_DATETIME, and the SQL_DATETIME_SUB field will return the subcode for the specific interval or datetime data type. (See Appendix D: Data Types.)

-#
SQL_DATETIME_SUB
-# (ODBC 3.0)
17SmallintWhen the value of SQL_DATA_TYPE is SQL_DATETIME or SQL_INTERVAL, this column contains the datetime/interval subcode. For data types other than datetime and interval, this field is NULL. -#

For interval or datetime data types, the SQL_DATA_TYPE field in the result set will return SQL_INTERVAL or SQL_DATETIME, and the SQL_DATETIME_SUB field will return the subcode for the specific interval or datetime data type. (See Appendix D: Data Types.)

-#
NUM_PREC_RADIX
-# (ODBC 3.0)
18IntegerIf the data type is an approximate numeric type, this column contains the value 2 to indicate that COLUMN_SIZE specifies a number of bits. For exact numeric types, this column contains the value 10 to indicate that COLUMN_SIZE specifies a number of decimal digits. Otherwise, this column is NULL.
INTERVAL_PRECISION
-# (ODBC 3.0)
19SmallintIf the data type is an interval data type, then this column contains the value of the interval leading precision. (See "Interval Data Type Precision" in Appendix D: Data Types.) Otherwise, this column is NULL.
-# -#

Attribute information can apply to data types or to specific columns in a result set. SQLGetTypeInfo returns information about attributes associated with data types; SQLColAttribute returns information about attributes associated with columns in a result set.

-# -#

Related Functions

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
For information aboutSee
Binding a buffer to a column in a result setSQLBindCol
Canceling statement processingSQLCancel
Returning information about a column in a result setSQLColAttribute
Fetching a block of data or scrolling through a result setSQLFetchScroll
Fetching a single row or a block of data in a forward-only directionSQLFetch
Returning information about a driver or data sourceSQLGetInfo
-#

-# -#
-# -# -# -); - -my $i4 = " " x 4; -print "// template-begin\n"; -print "#define Varchar Char\n"; -print "#define Smallint Integer\n"; -print "const SqlTypeInfo::Column\nSqlTypeInfo::m_columnList[] = {\n"; -for my $p (@typeinfo) { - print "$i4\{\t$p->{position},\n"; - print "\t\"$p->{name}\",\n"; - my $type = $p->{type}; - if ($p->{position} == 0) { - print "\tSqlType()\n"; - } elsif (! $p->{length}) { - print "\tSqlType(SqlType::$type, $p->{nullable})\n"; - } else { - print "\tSqlType(SqlType::$type, $p->{length}, $p->{nullable})\n"; - } - my $c = $p == $typeinfo[-1] ? "" : ","; - print "$i4\}$c\n"; -} -print "};\n"; -print "#undef Varchar\n"; -print "#undef Smallint\n"; -print "const unsigned\nSqlTypeInfo::m_columnCount = $position;\n"; -print "// template-end\n"; - -# vim: set sw=4: diff --git a/ndb/src/old_files/client/odbc/docs/handleattr.pl b/ndb/src/old_files/client/odbc/docs/handleattr.pl deleted file mode 100644 index 892d34b105b..00000000000 --- a/ndb/src/old_files/client/odbc/docs/handleattr.pl +++ /dev/null @@ -1,2232 +0,0 @@ -# usage: perl Attr.data X (X = Env,Dbc,Stmt) -# prints template for AttrX.cpp -use strict; -my $type = shift; -my $order = 0; - -# -# odbcsqlsetenvattr.htm -# -my $attrEnv = { -# -# -# -# SQLSetEnvAttr -# -# -# -# -# -# -#
-#
-# -# -# -# -#
-# ODBC Programmer's Reference -#
-#
-#
-#
-# -#

SQLSetEnvAttr

-# -#

Conformance

-# -#

Version Introduced: ODBC 3.0
-# Standards Compliance: ISO 92

-# -#

Summary

-# -#

SQLSetEnvAttr sets attributes that govern aspects of environments.

-# -#

Syntax

-# -#
SQLRETURN SQLSetEnvAttr(
-#	     SQLHENV     EnvironmentHandle,
-#	     SQLINTEGER     Attribute,
-#	     SQLPOINTER     ValuePtr,
-#	     SQLINTEGER     StringLength);
-# -#

Arguments -# -#

-#
EnvironmentHandle
-# -#
[Input]
-# Environment handle.
-# -#
Attribute
-# -#
[Input]
-# Attribute to set, listed in "Comments."
-# -#
ValuePtr
-# -#
[Input]
-# Pointer to the value to be associated with Attribute. Depending on the value of Attribute, ValuePtr will be a 32-bit integer value or point to a null-terminated character string.
-# -#
StringLength
-# -#
[Input] If ValuePtr points to a character string or a binary buffer, this argument should be the length of *ValuePtr. If ValuePtr is an integer, StringLength is ignored.
-#
-# -#

Returns

-# -#

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

-# -#

Diagnostics

-# -#

When SQLSetEnvAttr returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_ENV and a Handle of EnvironmentHandle. The following table lists the SQLSTATE values commonly returned by SQLSetEnvAttr and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise. If a driver does not support an environment attribute, the error can be returned only during connect time.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQLSTATEErrorDescription
01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
01S02Option value changedThe driver did not support the value specified in ValuePtr and substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.)
HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001Memory allocation
-# error
The driver was unable to allocate memory required to support execution or completion of the function.
HY009Invalid use of null pointerThe Attribute argument identified an environment attribute that required a string value, and the ValuePtr argument was a null pointer.
HY010Function sequence error(DM) A connection handle has been allocated on EnvironmentHandle.
HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY024Invalid attribute valueGiven the specified Attribute value, an invalid value was specified in ValuePtr.
HY090Invalid string or buffer lengthThe StringLength argument was less than 0 but was not SQL_NTS.
HY092Invalid attribute/option identifier(DM) The value specified for the argument Attribute was not valid for the version of ODBC supported by the driver.
HYC00Optional feature not implementedThe value specified for the argument Attribute was a valid ODBC environment attribute for the version of ODBC supported by the driver, but was not supported by the driver. -#

(DM) The Attribute argument was SQL_ATTR_OUTPUT_NTS, and ValuePtr was SQL_FALSE.

-#
-# -#

Comments

-# -#

An application can call SQLSetEnvAttr only if no connection handle is allocated on the environment. All environment attributes successfully set by the application for the environment persist until SQLFreeHandle is called on the environment. More than one environment handle can be allocated simultaneously in ODBC 3.x.

-# -#

The format of information set through ValuePtr depends on the specified Attribute. SQLSetEnvAttr will accept attribute information in one of two different formats: a null-terminated character string or a 32-bit integer value. The format of each is noted in the attribute's description.

-# -#

There are no driver-specific environment attributes.

-# -#

Connection attributes cannot be set by a call to SQLSetEnvAttr. Attempting to do so will return SQLSTATE HY092 (Invalid attribute/option identifier).

-#
-# -# -# -# -# -# -# -# -# -# - SQL_ATTR_CONNECTION_POOLING => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_CP_OFF SQL_CP_ONE_PER_DRIVER SQL_CP_ONE_PER_HENV) ], - default => q(SQL_CP_OFF), - mode => 'rw', - order => ++$order, - }, -# -# -# -# - SQL_ATTR_CP_MATCH => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_CP_STRICT_MATCH SQL_CP_RELAXED_MATCH) ], - default => q(SQL_CP_STRICT_MATCH), - mode => 'rw', - order => ++$order, - }, -# -# -# -# - SQL_ATTR_ODBC_VERSION => { - type => q(SQLINTEGER), - ptr => 0, - value => [ qw(SQL_OV_ODBC3 SQL_OV_ODBC2) ], - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# - SQL_ATTR_OUTPUT_NTS => { - type => q(SQLINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_TRUE), - mode => 'rw', - order => ++$order, - } -#
AttributeValuePtr contents
SQL_ATTR_CONNECTION_POOLING
-# (ODBC 3.0)
A 32-bit SQLUINTEGER value that enables or disables connection pooling at the environment level. The following values are used: -#

SQL_CP_OFF = Connection pooling is turned off. This is the default.

-# -#

SQL_CP_ONE_PER_DRIVER = A single connection pool is supported for each driver. Every connection in a pool is associated with one driver.

-# -#

SQL_CP_ONE_PER_HENV = A single connection pool is supported for each environment. Every connection in a pool is associated with one environment.

-# -#

Connection pooling is enabled by calling SQLSetEnvAttr to set the SQL_ATTR_CONNECTION_POOLING attribute to SQL_CP_ONE_PER_DRIVER or SQL_CP_ONE_PER_HENV. This call must be made before the application allocates the shared environment for which connection pooling is to be enabled. The environment handle in the call to SQLSetEnvAttr is set to null, which makes SQL_ATTR_CONNECTION_POOLING a process-level attribute. After connection pooling is enabled, the application then allocates an implicit shared environment by calling SQLAllocHandle with the InputHandle argument set to SQL_HANDLE_ENV.

-# -#

After connection pooling has been enabled and a shared environment has been selected for an application, SQL_ATTR_CONNECTION_POOLING cannot be reset for that environment, because SQLSetEnvAttr is called with a null environment handle when setting this attribute. If this attribute is set while connection pooling is already enabled on a shared environment, the attribute affects only shared environments that are allocated subsequently.

-# -#

For more information, see "ODBC Connection Pooling" in Chapter 6: Connecting to a Data Source or Driver.

-#
SQL_ATTR_CP_MATCH
-# (ODBC 3.0)
A 32-bit SQLUINTEGER value that determines how a connection is chosen from a connection pool. When SQLConnect or SQLDriverConnect is called, the Driver Manager determines which connection is reused from the pool. The Driver Manager attempts to match the connection options in the call and the connection attributes set by the application to the keywords and connection attributes of the connections in the pool. The value of this attribute determines the level of precision of the matching criteria. -#

The following values are used to set the value of this attribute:

-# -#

SQL_CP_STRICT_MATCH = Only connections that exactly match the connection options in the call and the connection attributes set by the application are reused. This is the default.

-# -#

SQL_CP_RELAXED_MATCH = Connections with matching connection string keywords can be used. Keywords must match, but not all connection attributes must match.

-# -#

For more information on how the Driver Manager performs the match in connecting to a pooled connection, see SQLConnect. For more information on connection pooling, see "ODBC Connection Pooling" in Chapter 6: Connecting to a Data Source or Driver.

-#
SQL_ATTR_ODBC_VERSION
-# (ODBC 3.0)
A 32-bit integer that determines whether certain functionality exhibits ODBC 2.x behavior or ODBC 3.x behavior. The following values are used to set the value of this attribute: -#

SQL_OV_ODBC3 = The Driver Manager and driver exhibit the following ODBC 3.x behavior: -# -#

    -#
  • The driver returns and expects ODBC 3.x codes for date, time, and timestamp.
  • -# -#
  • The driver returns ODBC 3.x SQLSTATE codes when SQLError, SQLGetDiagField, or SQLGetDiagRec is called.
  • -# -#
  • The CatalogName argument in a call to SQLTables accepts a search pattern.
  • -#
-# -#

SQL_OV_ODBC2 = The Driver Manager and driver exhibit the following ODBC 2.x behavior. This is especially useful for an ODBC 2.x application working with an ODBC 3.x driver. -# -#

    -#
  • The driver returns and expects ODBC 2.x codes for date, time, and timestamp.
  • -# -#
  • The driver returns ODBC 2.x SQLSTATE codes when SQLError, SQLGetDiagField, or SQLGetDiagRec is called.
  • -# -#
  • The CatalogName argument in a call to SQLTables does not accept a search pattern.
  • -#
-# -#

An application must set this environment attribute before calling any function that has an SQLHENV argument, or the call will return SQLSTATE HY010 (Function sequence error). It is driver-specific whether or not additional behaviors exist for these environmental flags. -# -#

-#
SQL_ATTR_OUTPUT_NTS
-# (ODBC 3.0)
A 32-bit integer that determines how the driver returns string data. If SQL_TRUE, the driver returns string data null-terminated. If SQL_FALSE, the driver does not return string data null-terminated. -#

This attribute defaults to SQL_TRUE. A call to SQLSetEnvAttr to set it to SQL_TRUE returns SQL_SUCCESS. A call to SQLSetEnvAttr to set it to SQL_FALSE returns SQL_ERROR and SQLSTATE HYC00 (Optional feature not implemented).

-#
-# -#

Related Functions

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
For information aboutSee
Allocating a handleSQLAllocHandle
Returning the setting of an environment attributeSQLGetEnvAttr
-#

-# -#
-# -# -# -}; - -# -# odbcsqlsetconnectattr.htm -# -my $attrDbc = { -# -# -# -# SQLSetConnectAttr -# -# -# -# -# -# -#
-#
-# -# -# -# -#
-# ODBC Programmer's Reference -#
-#
-#
-#
-# -#

SQLSetConnectAttr

-# -#

Conformance

-# -#

Version Introduced: ODBC 3.0
-# Standards Compliance: ISO 92

-# -#

Summary

-# -#

SQLSetConnectAttr sets attributes that govern aspects of connections.

-# -#

Note   For more information about what the Driver Manager maps this function to when an ODBC 3.x application is working with an ODBC 2.x driver, see "Mapping Replacement Functions for Backward Compatibility of Applications" in Chapter 17: Programming Considerations.

-# -#

Syntax

-# -#
SQLRETURN SQLSetConnectAttr(
-#	     SQLHDBC     ConnectionHandle,
-#	     SQLINTEGER     Attribute,
-#	     SQLPOINTER     ValuePtr,
-#	     SQLINTEGER     StringLength);
-# -#

Arguments -# -#

-#
ConnectionHandle
-# -#
[Input]
-# Connection handle.
-# -#
Attribute
-# -#
[Input]
-# Attribute to set, listed in "Comments."
-# -#
ValuePtr
-# -#
[Input]
-# Pointer to the value to be associated with Attribute. Depending on the value of Attribute, ValuePtr will be a 32-bit unsigned integer value or will point to a null-terminated character string. Note that if the Attribute argument is a driver-specific value, the value in ValuePtr may be a signed integer.
-# -#
StringLength
-# -#
[Input]
-# If Attribute is an ODBC-defined attribute and ValuePtr points to a character string or a binary buffer, this argument should be the length of *ValuePtr. If Attribute is an ODBC-defined attribute and ValuePtr is an integer, StringLength is ignored. -# -#

If Attribute is a driver-defined attribute, the application indicates the nature of the attribute to the Driver Manager by setting the StringLength argument. StringLength can have the following values: -# -# -#

    -#
  • If ValuePtr is a pointer to a character string, then StringLength is the length of the string or SQL_NTS.
  • -# -#
  • If ValuePtr is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(length) macro in StringLength. This places a negative value in StringLength.
  • -# -#
  • If ValuePtr is a pointer to a value other than a character string or a binary string, then StringLength should have the value SQL_IS_POINTER.
  • -# -#
  • If ValuePtr contains a fixed-length value, then StringLength is either SQL_IS_INTEGER or SQL_IS_UINTEGER, as appropriate.
  • -#
-#
-#
-# -#

Returns

-# -#

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

-# -#

Diagnostics

-# -#

When SQLSetConnectAttr returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_DBC and a Handle of ConnectionHandle. The following table lists the SQLSTATE values commonly returned by SQLSetConnectAttr and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

-# -#

The driver can return SQL_SUCCESS_WITH_INFO to provide information about the result of setting an option.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQLSTATEErrorDescription
01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
01S02Option value changedThe driver did not support the value specified in ValuePtr and substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.)
08002Connection name in useThe Attribute argument was SQL_ATTR_ODBC_CURSORS, and the driver was already connected to the data source.
08003Connection does not exist(DM) An Attribute value was specified that required an open connection, but the ConnectionHandle was not in a connected state.
08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
24000Invalid cursor stateThe Attribute argument was SQL_ATTR_CURRENT_CATALOG, and a result set was pending.
3D000Invalid catalog nameThe Attribute argument was SQL_CURRENT_CATALOG, and the specified catalog name was invalid.
HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001Memory allocation errorThe driver was unable to allocate memory required to support execution or completion of the function.
HY009Invalid use of null pointerThe Attribute argument identified a connection attribute that required a string value, and the ValuePtr argument was a null pointer.
HY010Function sequence error(DM) An asynchronously executing function was called for a StatementHandle associated with the ConnectionHandle and was still executing when SQLSetConnectAttr was called. -#

(DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for a StatementHandle associated with the ConnectionHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

-# -#

(DM) SQLBrowseConnect was called for the ConnectionHandle and returned SQL_NEED_DATA. This function was called before SQLBrowseConnect returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.

-#
HY011Attribute cannot be set nowThe Attribute argument was SQL_ATTR_TXN_ISOLATION, and a transaction was open.
HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY024Invalid attribute valueGiven the specified Attribute value, an invalid value was specified in ValuePtr. (The Driver Manager returns this SQLSTATE only for connection and statement attributes that accept a discrete set of values, such as SQL_ATTR_ACCESS_MODE or SQL_ATTR_ASYNC_ENABLE. For all other connection and statement attributes, the driver must verify the value specified in ValuePtr.) -#

The Attribute argument was SQL_ATTR_TRACEFILE or SQL_ATTR_TRANSLATE_LIB, and ValuePtr was an empty string.

-#
HY090Invalid string or buffer length(DM) *ValuePtr is a character string, and the StringLength argument was less than 0 but was not SQL_NTS.
HY092Invalid attribute/option identifier(DM) The value specified for the argument Attribute was not valid for the version of ODBC supported by the driver. -#

(DM) The value specified for the argument Attribute was a read-only attribute.

-#
HYC00Optional feature not implementedThe value specified for the argument Attribute was a valid ODBC connection or statement attribute for the version of ODBC supported by the driver but was not supported by the driver.
HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001Driver does not support this function(DM) The driver associated with the ConnectionHandle does not support the function.
IM009Unable to load translation DLLThe driver was unable to load the translation DLL that was specified for the connection. This error can be returned only when Attribute is SQL_ATTR_TRANSLATE_LIB.
-# -#

When Attribute is a statement attribute, SQLSetConnectAttr can return any SQLSTATEs returned by SQLSetStmtAttr.

-# -#

Comments

-# -#

For general information about connection attributes, see "Connection Attributes" in Chapter 6: Connecting to a Data Source or Driver.

-# -#

The currently defined attributes and the version of ODBC in which they were introduced are shown in the table later in this section; it is expected that more attributes will be defined to take advantage of different data sources. A range of attributes is reserved by ODBC; driver developers must reserve values for their own driver-specific use from X/Open.

-# -#

Note   The ability to set statement attributes at the connection level by calling SQLSetConnectAttr has been deprecated in ODBC 3.x. ODBC 3.x applications should never set statement attributes at the connection level. ODBC 3.x statement attributes cannot be set at the connection level, with the exception of the SQL_ATTR_METADATA_ID and SQL_ATTR_ASYNC_ENABLE attributes, which are both connection attributes and statement attributes and can be set at either the connection level or the statement level.

-# -#

ODBC 3.x drivers need only support this functionality if they should work with ODBC 2.x applications that set ODBC 2.x statement options at the connection level. For more information, see "SQLSetConnectOption Mapping" in Appendix G: Driver Guidelines for Backward Compatibility.

-# -#

An application can call SQLSetConnectAttr at any time between the time the connection is allocated and freed. All connection and statement attributes successfully set by the application for the connection persist until SQLFreeHandle is called on the connection. For example, if an application calls SQLSetConnectAttr before connecting to a data source, the attribute persists even if SQLSetConnectAttr fails in the driver when the application connects to the data source; if an application sets a driver-specific attribute, the attribute persists even if the application connects to a different driver on the connection.

-# -#

Some connection attributes can be set only before a connection has been made; others can be set only after a connection has been made. The following table indicates those connection attributes that must be set either before or after a connection has been made. Either indicates that the attribute can be set either before or after connection.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
AttributeSet before or after connection?
SQL_ATTR_ACCESS_MODEEither[1]
SQL_ATTR_ASYNC_ENABLEEither[2]
SQL_ATTR_AUTOCOMMITEither
SQL_ATTR_CONNECTION_TIMEOUTEither
SQL_ATTR_CURRENT_CATALOGEither[1]
SQL_ATTR_LOGIN_TIMEOUTBefore
SQL_ATTR_METADATA_IDEither
SQL_ATTR_ODBC_CURSORSBefore
SQL_ATTR_PACKET_SIZEBefore
SQL_ATTR_QUIET_MODEEither
SQL_ATTR_TRACEEither
SQL_ATTR_TRACEFILEEither
SQL_ATTR_TRANSLATE_LIBAfter
SQL_ATTR_TRANSLATE_OPTIONAfter
SQL_ATTR_TXN_ISOLATIONEither[3]
-# -#

[1]   SQL_ATTR_ACCESS_MODE and SQL_ATTR_CURRENT_CATALOG can be set before or after connecting, depending on the driver. However, interoperable applications set them before connecting because some drivers do not support changing these after connecting.

-#

[2]   SQL_ATTR_ASYNC_ENABLE must be set before there is an active statement.

-#

[3]   SQL_ATTR_TXN_ISOLATION can be set only if there are no open transactions on the connection. Some connection attributes support substitution of a similar value if the data source does not support the value specified in *ValuePtr. In such cases, the driver returns SQL_SUCCESS_WITH_INFO and SQLSTATE 01S02 (Option value changed). For example, if Attribute is SQL_ATTR_PACKET_SIZE and *ValuePtr exceeds the maximum packet size, the driver substitutes the maximum size. To determine the substituted value, an application calls SQLGetConnectAttr.

-#

The format of information set in the *ValuePtr buffer depends on the specified Attribute. SQLSetConnectAttr will accept attribute information in one of two different formats: a null-terminated character string or a 32-bit integer value. The format of each is noted in the attribute's description. Character strings pointed to by the ValuePtr argument of SQLSetConnectAttr have a length of StringLength bytes.

-# -#

The StringLength argument is ignored if the length is defined by the attribute, as is the case for all attributes introduced in ODBC 2.x or earlier.

-#
-# -# -# -# -# -# -# -# -# -# - SQL_ATTR_ACCESS_MODE => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_MODE_READ_ONLY SQL_MODE_READ_WRITE) ], - default => q(SQL_MODE_READ_WRITE), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ASYNC_ENABLE_ON => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_ASYNC_ENABLE_OFF SQL_ASYNC_ENABLE_ON) ], - default => q(SQL_ASYNC_ENABLE_OFF), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_AUTO_IPD => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_AUTOCOMMIT => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_AUTOCOMMIT_OFF SQL_AUTOCOMMIT_ON) ], - default => q(SQL_AUTOCOMMIT_ON), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CONNECTION_DEAD => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_CD_FALSE SQL_CD_TRUE) ], - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CONNECTION_TIMEOUT => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => 0, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CURRENT_CATALOG => { - type => q(SQLCHAR), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_LOGIN_TIMEOUT => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => 0, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_METADATA_ID => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_FALSE), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ODBC_CURSORS => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_CUR_USE_IF_NEEDED SQL_CUR_USE_ODBC SQL_CUR_USE_DRIVER) ], - default => q(SQL_CUR_USE_DRIVER), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_PACKET_SIZE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_QUIET_MODE => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_TRACE => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_OPT_TRACE_OFF SQL_OPT_TRACE_ON) ], - default => q(SQL_OPT_TRACE_OFF), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_TRACEFILE => { - type => q(SQLCHAR), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_TRANSLATE_LIB => { - type => q(SQLCHAR), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_TRANSLATE_OPTION => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_TXN_ISOLATION => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -#
AttributeValuePtr contents
SQL_ATTR_ACCESS_MODE
-# (ODBC 1.0)
An SQLUINTEGER value. SQL_MODE_READ_ONLY is used by the driver or data source as an indicator that the connection is not required to support SQL statements that cause updates to occur. This mode can be used to optimize locking strategies, transaction management, or other areas as appropriate to the driver or data source. The driver is not required to prevent such statements from being submitted to the data source. The behavior of the driver and data source when asked to process SQL statements that are not read-only during a read-only connection is implementation-defined. SQL_MODE_READ_WRITE is the default.
SQL_ATTR_ASYNC_ENABLE
-# (ODBC 3.0)
An SQLUINTEGER value that specifies whether a function called with a statement on the specified connection is executed asynchronously: -#

SQL_ASYNC_ENABLE_OFF = Off (the default)
-# SQL_ASYNC_ENABLE_ON = On

-# -#

Setting SQL_ASYNC_ENABLE_ON enables asynchronous execution for all future statement handles allocated on this connection. It is driver-defined whether this enables asynchronous execution for existing statement handles associated with this connection. An error is returned if asynchronous execution is enabled while there is an active statement on the connection.

-# -#

This attribute can be set whether SQLGetInfo with the SQL_ASYNC_MODE information type returns SQL_AM_CONNECTION or SQL_AM_STATEMENT.

-# -#

After a function has been called asynchronously, only the original function, SQLAllocHandle, SQLCancel, SQLGetDiagField, or SQLGetDiagRec can be called on the statement or the connection associated with StatementHandle, until the original function returns a code other than SQL_STILL_EXECUTING. Any other function called on StatementHandle or the connection associated with StatementHandle returns SQL_ERROR with an SQLSTATE of HY010 (Function sequence error). Functions can be called on other statements. For more information, see "Asynchronous Execution" in Chapter 9: Executing Statements.

-# -#

In general, applications should execute functions asynchronously only on single-thread operating systems. On multithread operating systems, applications should execute functions on separate threads rather than executing them asynchronously on the same thread. Drivers that operate only on multithread operating systems do not need to support asynchronous execution.

-# -#

The following functions can be executed asynchronously:

-# -#

SQLBulkOperations
-# SQLColAttribute

-# SQLColumnPrivileges
-# SQLColumns
-# SQLCopyDesc
-# SQLDescribeCol
-# SQLDescribeParam
-# SQLExecDirect
-# SQLExecute
-# SQLFetch
-# SQLFetchScroll
-# SQLForeignKeys
-# SQLGetData
-# SQLGetDescField[1]
-#
SQLGetDescRec[1]
-# SQLGetDiagField

-# SQLGetDiagRec
-# SQLGetTypeInfo

-# SQLMoreResults
-# SQLNumParams
-# SQLNumResultCols
-# SQLParamData
-# SQLPrepare
-# SQLPrimaryKeys
-# SQLProcedureColumns
-# SQLProcedures
-# SQLPutData
-# SQLSetPos
-# SQLSpecialColumns
-# SQLStatistics
-# SQLTablePrivileges
-# SQLTables

-#
SQL_ATTR_AUTO_IPD
-# (ODBC 3.0)
A read-only SQLUINTEGER value that specifies whether automatic population of the IPD after a call to SQLPrepare is supported: -#

SQL_TRUE = Automatic population of the IPD after a call to SQLPrepare is supported by the driver.

-# -#

SQL_FALSE = Automatic population of the IPD after a call to SQLPrepare is not supported by the driver. Servers that do not support prepared statements will not be able to populate the IPD automatically.

-# -#

If SQL_TRUE is returned for the SQL_ATTR_AUTO_IPD connection attribute, the statement attribute SQL_ATTR_ENABLE_AUTO_IPD can be set to turn automatic population of the IPD on or off. If SQL_ATTR_AUTO_IPD is SQL_FALSE, SQL_ATTR_ENABLE_AUTO_IPD cannot be set to SQL_TRUE. The default value of SQL_ATTR_ENABLE_AUTO_IPD is equal to the value of SQL_ATTR_AUTO_IPD.

-# -#

This connection attribute can be returned by SQLGetConnectAttr but cannot be set by SQLSetConnectAttr.

-#
SQL_ATTR_AUTOCOMMIT
-# (ODBC 1.0)
An SQLUINTEGER value that specifies whether to use autocommit or manual-commit mode: -#

SQL_AUTOCOMMIT_OFF = The driver uses manual-commit mode, and the application must explicitly commit or roll back transactions with SQLEndTran.

-# -#

SQL_AUTOCOMMIT_ON = The driver uses autocommit mode. Each statement is committed immediately after it is executed. This is the default. Any open transactions on the connection are committed when SQL_ATTR_AUTOCOMMIT is set to SQL_AUTOCOMMIT_ON to change from manual-commit mode to autocommit mode.

-# -#

For more information, see "Commit Mode" in Chapter 14: Transactions.

-# -#

Important   Some data sources delete the access plans and close the cursors for all statements on a connection each time a statement is committed; autocommit mode can cause this to happen after each nonquery statement is executed or when the cursor is closed for a query. For more information, see the SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR information types in SQLGetInfo and "Effect of Transactions on Cursors and Prepared Statements" in Chapter 14: Transactions.

-# -#

When a batch is executed in autocommit mode, two things are possible. The entire batch can be treated as an autocommitable unit, or each statement in a batch is treated as an autocommitable unit. Certain data sources can support both these behaviors and may provide a way of choosing one or the other. It is driver-defined whether a batch is treated as an autocommitable unit or whether each individual statement within the batch is autocommitable.

-#
SQL_ATTR_CONNECTION_DEAD -#

(ODBC 3.5)

-#
An SQLUINTERGER value that indicates the state of the connection. If SQL_CD_TRUE, the connection has been lost. If SQL_CD_FALSE, the connection is still active.
SQL_ATTR_CONNECTION_TIMEOUT
-# (ODBC 3.0)
An SQLUINTEGER value corresponding to the number of seconds to wait for any request on the connection to complete before returning to the application. The driver should return SQLSTATE HYT00 (Timeout expired) anytime that it is possible to time out in a situation not associated with query execution or login. -#

If ValuePtr is equal to 0 (the default), there is no timeout.

-#
SQL_ATTR_CURRENT_CATALOG
-# (ODBC 2.0)
A character string containing the name of the catalog to be used by the data source. For example, in SQL Server, the catalog is a database, so the driver sends a USE database statement to the data source, where database is the database specified in *ValuePtr. For a single-tier driver, the catalog might be a directory, so the driver changes its current directory to the directory specified in *ValuePtr.
SQL_ATTR_LOGIN_TIMEOUT
-# (ODBC 1.0)
An SQLUINTEGER value corresponding to the number of seconds to wait for a login request to complete before returning to the application. The default is driver-dependent. If ValuePtr is 0, the timeout is disabled and a connection attempt will wait indefinitely. -#

If the specified timeout exceeds the maximum login timeout in the data source, the driver substitutes that value and returns SQLSTATE 01S02 (Option value changed).

-#
SQL_ATTR_METADATA_ID
-# (ODBC 3.0)
An SQLUINTEGER value that determines how the string arguments of catalog functions are treated. -#

If SQL_TRUE, the string argument of catalog functions are treated as identifiers. The case is not significant. For nondelimited strings, the driver removes any trailing spaces and the string is folded to uppercase. For delimited strings, the driver removes any leading or trailing spaces and takes literally whatever is between the delimiters. If one of these arguments is set to a null pointer, the function returns SQL_ERROR and SQLSTATE HY009 (Invalid use of null pointer).

-# -#

If SQL_FALSE, the string arguments of catalog functions are not treated as identifiers. The case is significant. They can either contain a string search pattern or not, depending on the argument.

-# -#

The default value is SQL_FALSE.

-# -#

The TableType argument of SQLTables, which takes a list of values, is not affected by this attribute.

-# -#

SQL_ATTR_METADATA_ID can also be set on the statement level. (It is the only connection attribute that is also a statement attribute.)

-# -#

For more information, see "Arguments in Catalog Functions" in Chapter 7: Catalog Functions.

-#
SQL_ATTR_ODBC_CURSORS
-# (ODBC 2.0)
An SQLUINTEGER value specifying how the Driver Manager uses the ODBC cursor library: -#

SQL_CUR_USE_IF_NEEDED = The Driver Manager uses the ODBC cursor library only if it is needed. If the driver supports the SQL_FETCH_PRIOR option in SQLFetchScroll, the Driver Manager uses the scrolling capabilities of the driver. Otherwise, it uses the ODBC cursor library.

-# -#

SQL_CUR_USE_ODBC = The Driver Manager uses the ODBC cursor library.

-# -#

SQL_CUR_USE_DRIVER = The Driver Manager uses the scrolling capabilities of the driver. This is the default setting.

-# -#

For more information about the ODBC cursor library, see Appendix F: ODBC Cursor Library.

-#
SQL_ATTR_PACKET_SIZE
-# (ODBC 2.0)
An SQLUINTEGER value specifying the network packet size in bytes. -#

Note   Many data sources either do not support this option or only can return but not set the network packet size.

-# -#

If the specified size exceeds the maximum packet size or is smaller than the minimum packet size, the driver substitutes that value and returns SQLSTATE 01S02 (Option value changed).

-# -#

If the application sets packet size after a connection has already been made, the driver will return SQLSTATE HY011 (Attribute cannot be set now).

-#
SQL_ATTR_QUIET_MODE
-# (ODBC 2.0)
A 32-bit window handle (hwnd). -#

If the window handle is a null pointer, the driver does not display any dialog boxes.

-# -#

If the window handle is not a null pointer, it should be the parent window handle of the application. This is the default. The driver uses this handle to display dialog boxes.

-# -#

Note   The SQL_ATTR_QUIET_MODE connection attribute does not apply to dialog boxes displayed by SQLDriverConnect.

-#
SQL_ATTR_TRACE
-# (ODBC 1.0)
An SQLUINTEGER value telling the Driver Manager whether to perform tracing: -#

SQL_OPT_TRACE_OFF = Tracing off (the default)

-# -#

SQL_OPT_TRACE_ON = Tracing on

-# -#

When tracing is on, the Driver Manager writes each ODBC function call to the trace file.

-# -#

Note   When tracing is on, the Driver Manager can return SQLSTATE IM013 (Trace file error) from any function.

-# -#

An application specifies a trace file with the SQL_ATTR_TRACEFILE option. If the file already exists, the Driver Manager appends to the file. Otherwise, it creates the file. If tracing is on and no trace file has been specified, the Driver Manager writes to the file SQL.LOG in the root directory.

-# -#

An application can set the variable ODBCSharedTraceFlag to enable tracing dynamically. Tracing is then enabled for all ODBC applications currently running. If an application turns tracing off, it is turned off only for that application.

-# -#

If the Trace keyword in the system information is set to 1 when an application calls SQLAllocHandle with a HandleType of SQL_HANDLE_ENV, tracing is enabled for all handles. It is enabled only for the application that called SQLAllocHandle.

-# -#

Calling SQLSetConnectAttr with an Attribute of SQL_ATTR_TRACE does not require that the ConnectionHandle argument be valid and will not return SQL_ERROR if ConnectionHandle is NULL. This attribute applies to all connections.

-#
SQL_ATTR_TRACEFILE
-# (ODBC 1.0)
A null-terminated character string containing the name of the trace file. -#

The default value of the SQL_ATTR_TRACEFILE attribute is specified with the TraceFile keyword in the system information. For more information, see "ODBC Subkey" in Chapter 19: Configuring Data Sources.

-# -#

Calling SQLSetConnectAttr with an Attribute of SQL_ATTR_ TRACEFILE does not require the ConnectionHandle argument to be valid and will not return SQL_ERROR if ConnectionHandle is invalid. This attribute applies to all connections.

-#
SQL_ATTR_TRANSLATE_LIB
-# (ODBC 1.0)
A null-terminated character string containing the name of a library containing the functions SQLDriverToDataSource and SQLDataSourceToDriver that the driver accesses to perform tasks such as character set translation. This option may be specified only if the driver has connected to the data source. The setting of this attribute will persist across connections. For more information about translating data, see "Translation DLLs" in Chapter 17: Programming Considerations, and Chapter 24: Translation DLL Function Reference.
SQL_ATTR_TRANSLATE_OPTION
-# (ODBC 1.0)
A 32-bit flag value that is passed to the translation DLL. This attribute can be specified only if the driver has connected to the data source. For information about translating data, see "Translation DLLs" in Chapter 17: Programming Considerations.
SQL_ATTR_TXN_ISOLATION
-# (ODBC 1.0)
A 32-bit bitmask that sets the transaction isolation level for the current connection. An application must call SQLEndTran to commit or roll back all open transactions on a connection, before calling SQLSetConnectAttr with this option. -#

The valid values for ValuePtr can be determined by calling SQLGetInfo with InfoType equal to SQL_TXN_ISOLATION_OPTIONS.

-# -#

For a description of transaction isolation levels, see the description of the SQL_DEFAULT_TXN_ISOLATION information type in SQLGetInfo and "Transaction Isolation Levels" in Chapter 14: Transactions.

-#
-# -#

[1]   These functions can be called asynchronously only if the descriptor is an implementation descriptor, not an application descriptor.

-#

Code Example

-# -#

See SQLConnect.

-# -#

Related Functions

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
For information aboutSee
Allocating a handleSQLAllocHandle
Returning the setting of a connection
-# attribute
SQLGetConnectAttr
-#

-# -#
-# -# -# -}; - -# -# odbcsqlsetstmtattr.htm -# -my $attrStmt = { -# -# -# -# SQLSetStmtAttr -# -# -# -# -# -# -#
-#
-# -# -# -# -#
-# ODBC Programmer's Reference -#
-#
-#
-#
-# -#

SQLSetStmtAttr

-# -#

Conformance

-# -#

Version Introduced: ODBC 3.0
-# Standards Compliance: ISO 92

-# -#

Summary

-# -#

SQLSetStmtAttr sets attributes related to a statement.

-# -#

Note   For more information about what the Driver Manager maps this function to when an ODBC 3.x application is working with an ODBC 2.x driver, see "Mapping Replacement Functions for Backward Compatibility of Applications" in Chapter 17: Programming Considerations.

-# -#

Syntax

-# -#
SQLRETURN SQLSetStmtAttr(
-#	     SQLHSTMT     StatementHandle,
-#	     SQLINTEGER     Attribute,
-#	     SQLPOINTER     ValuePtr,
-#	     SQLINTEGER     StringLength);
-# -#

Arguments -# -#

-#
StatementHandle
-# -#
[Input]
-# Statement handle.
-# -#
Attribute
-# -#
[Input]
-# Option to set, listed in "Comments."
-# -#
ValuePtr
-# -#
[Input]
-# Pointer to the value to be associated with Attribute. Depending on the value of Attribute, ValuePtr will be a 32-bit unsigned integer value or a pointer to a null-terminated character string, a binary buffer, or a driver-defined value. If the Attribute argument is a driver-specific value, ValuePtr may be a signed integer.
-# -#
StringLength
-# -#
[Input]
-# If Attribute is an ODBC-defined attribute and ValuePtr points to a character string or a binary buffer, this argument should be the length of *ValuePtr. If Attribute is an ODBC-defined attribute and ValuePtr is an integer, StringLength is ignored. -# -#

If Attribute is a driver-defined attribute, the application indicates the nature of the attribute to the Driver Manager by setting the StringLength argument. StringLength can have the following values: -#

-#
-# -#
    -#
  • If ValuePtr is a pointer to a character string, then StringLength is the length of the string or SQL_NTS.
  • -# -#
  • If ValuePtr is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(length) macro in StringLength. This places a negative value in StringLength.
  • -# -#
  • If ValuePtr is a pointer to a value other than a character string or a binary string, then StringLength should have the value SQL_IS_POINTER.
  • -# -#
  • If ValuePtr contains a fixed-length value, then StringLength is either SQL_IS_INTEGER or SQL_IS_UINTEGER, as appropriate.
  • -#
-# -#

Returns

-# -#

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

-# -#

Diagnostics

-# -#

When SQLSetStmtAttr returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLSetStmtAttr and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
SQLSTATEErrorDescription
01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
01S02Option value changedThe driver did not support the value specified in ValuePtr, or the value specified in ValuePtr was invalid because of implementation working conditions, so the driver substituted a similar value. (SQLGetStmtAttr can be called to determine the temporarily substituted value.) The substitute value is valid for the StatementHandle until the cursor is closed, at which point the statement attribute reverts to its previous value. The statement attributes that can be changed are: -#

SQL_ ATTR_CONCURRENCY
-# SQL_ ATTR_CURSOR_TYPE
-# SQL_ ATTR_KEYSET_SIZE
-# SQL_ ATTR_MAX_LENGTH
-# SQL_ ATTR_MAX_ROWS
-# SQL_ ATTR_QUERY_TIMEOUT
-# SQL_ATTR_ROW_ARRAY_SIZE
-# SQL_ ATTR_SIMULATE_CURSOR

-# -#

(Function returns SQL_SUCCESS_WITH_INFO.)

-#
08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
24000Invalid cursor stateThe Attribute was SQL_ATTR_CONCURRENCY, SQL_ATTR_CURSOR_TYPE, SQL_ATTR_SIMULATE_CURSOR, or SQL_ATTR_USE_BOOKMARKS, and the cursor was open.
HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001Memory allocation
-# error
The driver was unable to allocate memory required to support execution or completion of the function.
HY009Invalid use of null pointerThe Attribute argument identified a statement attribute that required a string attribute, and the ValuePtr argument was a null pointer.
HY010Function sequence error(DM) An asynchronously executing function was called for the StatementHandle and was still executing when this function was called. -#

(DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

-#
HY011Attribute cannot be set nowThe Attribute was SQL_ATTR_CONCURRENCY, SQL_ ATTR_CURSOR_TYPE, SQL_ ATTR_SIMULATE_CURSOR, or SQL_ ATTR_USE_BOOKMARKS, and the statement was prepared.
HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY017Invalid use of an automatically allocated descriptor handle(DM) The Attribute argument was SQL_ATTR_IMP_ROW_DESC or SQL_ATTR_IMP_PARAM_DESC. -#

(DM) The Attribute argument was SQL_ATTR_APP_ROW_DESC or SQL_ATTR_APP_PARAM_DESC, and the value in ValuePtr was an implicitly allocated descriptor handle other than the handle originally allocated for the ARD or APD.

-#
HY024Invalid attribute valueGiven the specified Attribute value, an invalid value was specified in ValuePtr. (The Driver Manager returns this SQLSTATE only for connection and statement attributes that accept a discrete set of values, such as SQL_ATTR_ACCESS_MODE or SQL_ ATTR_ASYNC_ENABLE. For all other connection and statement attributes, the driver must verify the value specified in ValuePtr.) -#

The Attribute argument was SQL_ATTR_APP_ROW_DESC or SQL_ATTR_APP_PARAM_DESC, and ValuePtr was an explicitly allocated descriptor handle that is not on the same connection as the StatementHandle argument.

-#
HY090Invalid string or buffer length(DM) *ValuePtr is a character string, and the StringLength argument was less than 0 but was not SQL_NTS.
HY092Invalid attribute/option identifier(DM) The value specified for the argument Attribute was not valid for the version of ODBC supported by the driver. -#

(DM) The value specified for the argument Attribute was a read-only attribute.

-#
HYC00Optional feature not implementedThe value specified for the argument Attribute was a valid ODBC statement attribute for the version of ODBC supported by the driver but was not supported by the driver. -#

The Attribute argument was SQL_ATTR_ASYNC_ENABLE, and a call to SQLGetInfo with an InfoType of SQL_ASYNC_MODE returns SQL_AM_CONNECTION.

-# -#

The Attribute argument was SQL_ATTR_ENABLE_AUTO_IPD, and the value of the connection attribute SQL_ATTR_AUTO_IPD was SQL_FALSE.

-#
HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001Driver does not support this function(DM) The driver associated with the StatementHandle does not support the function.
-# -#

Comments

-# -#

Statement attributes for a statement remain in effect until they are changed by another call to SQLSetStmtAttr or until the statement is dropped by calling SQLFreeHandle. Calling SQLFreeStmt with the SQL_CLOSE, SQL_UNBIND, or SQL_RESET_PARAMS option does not reset statement attributes.

-# -#

Some statement attributes support substitution of a similar value if the data source does not support the value specified in ValuePtr. In such cases, the driver returns SQL_SUCCESS_WITH_INFO and SQLSTATE 01S02 (Option value changed). For example, if Attribute is SQL_ATTR_CONCURRENCY and ValuePtr is SQL_CONCUR_ROWVER, and if the data source does not support this, the driver substitutes SQL_CONCUR_VALUES and returns SQL_SUCCESS_WITH_INFO. To determine the substituted value, an application calls SQLGetStmtAttr.

-# -#

The format of information set with ValuePtr depends on the specified Attribute. SQLSetStmtAttr accepts attribute information in one of two different formats: a character string or a 32-bit integer value. The format of each is noted in the attribute's description. This format applies to the information returned for each attribute in SQLGetStmtAttr. Character strings pointed to by the ValuePtr argument of SQLSetStmtAttr have a length of StringLength.

-# -#

Note   The ability to set statement attributes at the connection level by calling SQLSetConnectAttr has been deprecated in ODBC 3.x. ODBC 3.x applications should never set statement attributes at the connection level. ODBC 3.x statement attributes cannot be set at the connection level, with the exception of the SQL_ATTR_METADATA_ID and SQL_ATTR_ASYNC_ENABLE attributes, which are both connection attributes and statement attributes, and can be set at either the connection level or the statement level.

-# -#

ODBC 3.x drivers need only support this functionality if they should work with ODBC 2.x applications that set ODBC 2.x statement options at the connection level. For more information, see "Setting Statement Options on the Connection Level" under "SQLSetConnectOption Mapping" in Appendix G: Driver Guidelines for Backward Compatibility.

-# -#

Statement Attributes That Set Descriptor Fields

-# -#

Many statement attributes correspond to a header field of a descriptor. Setting these attributes actually results in the setting of the descriptor fields. Setting fields by a call to SQLSetStmtAttr rather than to SQLSetDescField has the advantage that a descriptor handle does not have to be obtained for the function call.

-# -#

Caution   Calling SQLSetStmtAttr for one statement can affect other statements. This occurs when the APD or ARD associated with the statement is explicitly allocated and is also associated with other statements. Because SQLSetStmtAttr modifies the APD or ARD, the modifications apply to all statements with which this descriptor is associated. If this is not the required behavior, the application should dissociate this descriptor from the other statements (by calling SQLSetStmtAttr to set the SQL_ATTR_APP_ROW_DESC or SQL_ATTR_APP_PARAM_DESC field to a different descriptor handle) before calling SQLSetStmtAttr again.

-# -#

When a descriptor field is set as a result of the corresponding statement attribute being set, the field is set only for the applicable descriptors that are currently associated with the statement identified by the StatementHandle argument, and the attribute setting does not affect any descriptors that may be associated with that statement in the future. When a descriptor field that is also a statement attribute is set by a call to SQLSetDescField, the corresponding statement attribute is set. If an explicitly allocated descriptor is dissociated from a statement, a statement attribute that corresponds to a header field will revert to the value of the field in the implicitly allocated descriptor.

-# -#

When a statement is allocated (see SQLAllocHandle), four descriptor handles are automatically allocated and associated with the statement. Explicitly allocated descriptor handles can be associated with the statement by calling SQLAllocHandle with an fHandleType of SQL_HANDLE_DESC to allocate a descriptor handle and then calling SQLSetStmtAttr to associate the descriptor handle with the statement.

-# -#

The statement attributes in the following table correspond to descriptor header fields.

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
Statement attributeHeader fieldDesc.
SQL_ATTR_PARAM_BIND_OFFSET_PTRSQL_DESC_BIND_OFFSET_PTRAPD
SQL_ATTR_PARAM_BIND_TYPESQL_DESC_BIND_TYPEAPD
SQL_ATTR_PARAM_OPERATION_PTRSQL_DESC_ARRAY_STATUS_PTRAPD
SQL_ATTR_PARAM_STATUS_PTRSQL_DESC_ARRAY_STATUS_PTRIPD
SQL_ATTR_PARAMS_PROCESSED_PTRSQL_DESC_ROWS_PROCESSED_PTRIPD
SQL_ATTR_PARAMSET_SIZESQL_DESC_ARRAY_SIZEAPD
SQL_ATTR_ROW_ARRAY_SIZESQL_DESC_ARRAY_SIZEARD
SQL_ATTR_ROW_BIND_OFFSET_PTRSQL_DESC_BIND_OFFSET_PTRARD
SQL_ATTR_ROW_BIND_TYPESQL_DESC_BIND_TYPEARD
SQL_ATTR_ROW_OPERATION_PTRSQL_DESC_ARRAY_STATUS_PTRARD
SQL_ATTR_ROW_STATUS_PTRSQL_DESC_ARRAY_STATUS_PTRIRD
SQL_ATTR_ROWS_FETCHED_PTRSQL_DESC_ROWS_PROCESSED_PTRIRD
-# -#

Statement Attributes

-# -#

The currently defined attributes and the version of ODBC in which they were introduced are shown in the following table; it is expected that more attributes will be defined by drivers to take advantage of different data sources. A range of attributes is reserved by ODBC; driver developers must reserve values for their own driver-specific use from X/Open. For more information, see "Driver-Specific Data Types, Descriptor Types, Information Types, Diagnostic Types, and Attributes" in Chapter 17: Programming Considerations.

-#
-# -# -# -# -# -# -# -# -# -# - SQL_ATTR_APP_PARAM_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_APP_ROW_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ASYNC_ENABLE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CONCURRENCY => { - type => q(SQLUINTEGER), - ptr => undef, - value => [ qw(SQL_CONCUR_READ_ONLY SQL_CONCUR_LOCK SQL_CONCUR_ROWVER SQL_CONCUR_ROWVER) ], - default => q(SQL_CONCUR_READ_ONLY), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CURSOR_SCROLLABLE => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_NONSCROLLABLE SQL_SCROLLABLE) ], - default => q(SQL_NONSCROLLABLE), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CURSOR_SENSITIVITY => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_UNSPECIFIED SQL_INSENSITIVE SQL_SENSITIVE) ], - default => q(SQL_UNSPECIFIED), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_CURSOR_TYPE => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_CURSOR_FORWARD_ONLY SQL_CURSOR_STATIC SQL_CURSOR_KEYSET_DRIVEN SQL_CURSOR_DYNAMIC) ], - default => q(SQL_CURSOR_FORWARD_ONLY), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ENABLE_AUTO_IPD => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_FALSE), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_FETCH_BOOKMARK_PTR => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_IMP_PARAM_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_IMP_ROW_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_KEYSET_SIZE => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_MAX_LENGTH => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => 0, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_MAX_ROWS => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_METADATA_ID => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_FALSE), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_NOSCAN => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_NOSCAN_OFF SQL_NOSCAN_ON) ], - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_PARAM_BIND_OFFSET_PTR => { - type => q(SQLUINTEGER), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# -# -# -# -# -# - SQL_ATTR_PARAM_BIND_TYPE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_PARAM_OPERATION_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_PARAM_STATUS_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_PARAMS_PROCESSED_PTR => { - type => q(SQLUINTEGER), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_PARAMSET_SIZE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_QUERY_TIMEOUT => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_RETRIEVE_DATA => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_RD_ON SQL_RD_OFF) ], - default => q(SQL_RD_ON), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROW_ARRAY_SIZE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROW_BIND_OFFSET_PTR => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROW_BIND_TYPE => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_BIND_BY_COLUMN etc) ], - default => q(SQL_BIND_BY_COLUMN), - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROW_NUMBER => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROW_OPERATION_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROW_STATUS_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_ROWS_FETCHED_PTR => { - type => q(SQLUINTEGER), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_SIMULATE_CURSOR => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_SC_NON_UNIQUE SQL_SC_TRY_UNIQUE SQL_SC_UNIQUE) ], - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# -# -# -# - SQL_ATTR_USE_BOOKMARKS => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_UB_OFF SQL_UB_VARIABLE SQL_UB_FIXED) ], - default => undef, - mode => 'rw', - order => ++$order, - }, -#
AttributeValuePtr contents
SQL_ATTR_APP_PARAM_DESC
-# (ODBC 3.0)
The handle to the APD for subsequent calls to SQLExecute and SQLExecDirect on the statement handle. The initial value of this attribute is the descriptor implicitly allocated when the statement was initially allocated. If the value of this attribute is set to SQL_NULL_DESC or the handle originally allocated for the descriptor, an explicitly allocated APD handle that was previously associated with the statement handle is dissociated from it and the statement handle reverts to the implicitly allocated APD handle. -#

This attribute cannot be set to a descriptor handle that was implicitly allocated for another statement or to another descriptor handle that was implicitly set on the same statement; implicitly allocated descriptor handles cannot be associated with more than one statement or descriptor handle.

-#
SQL_ATTR_APP_ROW_DESC
-# (ODBC 3.0)
The handle to the ARD for subsequent fetches on the statement handle. The initial value of this attribute is the descriptor implicitly allocated when the statement was initially allocated. If the value of this attribute is set to SQL_NULL_DESC or the handle originally allocated for the descriptor, an explicitly allocated ARD handle that was previously associated with the statement handle is dissociated from it and the statement handle reverts to the implicitly allocated ARD handle. -#

This attribute cannot be set to a descriptor handle that was implicitly allocated for another statement or to another descriptor handle that was implicitly set on the same statement; implicitly allocated descriptor handles cannot be associated with more than one statement or descriptor handle.

-#
SQL_ATTR_ASYNC_ENABLE
-# (ODBC 1.0)
An SQLUINTEGER value that specifies whether a function called with the specified statement is executed asynchronously: -#

SQL_ASYNC_ENABLE_OFF = Off (the default)
-# SQL_ASYNC_ENABLE_ON = On

-# -#

Once a function has been called asynchronously, only the original function, SQLCancel, SQLGetDiagField, or SQLGetDiagRec can be called on the statement, and only the original function, SQLAllocHandle (with a HandleType of SQL_HANDLE_STMT), SQLGetDiagField, SQLGetDiagRec, or SQLGetFunctions can be called on the connection associated with the statement, until the original function returns a code other than SQL_STILL_EXECUTING. Any other function called on the statement or the connection associated with the statement returns SQL_ERROR with an SQLSTATE of HY010 (Function sequence error). Functions can be called on other statements. For more information, see "Asynchronous Execution" in Chapter 9: Executing Statements.

-# -#

For drivers with statement level asynchronous execution support, the statement attribute SQL_ATTR_ASYNC_ENABLE may be set. Its initial value is the same as the value of the connection level attribute with the same name at the time the statement handle was allocated.

-# -#

For drivers with connection-level, asynchronous-execution support, the statement attribute SQL_ATTR_ASYNC_ENABLE is read-only. Its value is the same as the value of the connection level attribute with the same name at the time the statement handle was allocated. Calling SQLSetStmtAttr to set SQL_ATTR_ASYNC_ENABLE when the SQL_ASYNC_MODE InfoType returns SQL_AM_CONNECTION returns SQLSTATE HYC00 (Optional feature not implemented). (See SQLSetConnectAttr for more information.)

-# -#

As a standard practice, applications should execute functions asynchronously only on single-thread operating systems. On multithread operating systems, applications should execute functions on separate threads rather than executing them asynchronously on the same thread. No functionality is lost if drivers that operate only on multithread operating systems do not need to support asynchronous execution.

-# -#

The following functions can be executed asynchronously:

-# -#

SQLBulkOperations
-# SQLColAttribute

-# SQLColumnPrivileges
-# SQLColumns
-# SQLCopyDesc
-# SQLDescribeCol
-# SQLDescribeParam
-# SQLExecDirect
-# SQLExecute
-# SQLFetch
-# SQLFetchScroll
-# SQLForeignKeys
-# SQLGetData
-# SQLGetDescField[1]
-# SQLGetDescRec[1]
-# SQLGetDiagField

-# SQLGetDiagRec
-# SQLGetTypeInfo

-# SQLMoreResults
-# SQLNumParams
-# SQLNumResultCols
-# SQLParamData
-# SQLPrepare
-# SQLPrimaryKeys
-# SQLProcedureColumns
-# SQLProcedures
-# SQLPutData
-# SQLSetPos
-# SQLSpecialColumns
-# SQLStatistics
-# SQLTablePrivileges
-# SQLTables

-#
SQL_ATTR_CONCURRENCY
-# (ODBC 2.0)
An SQLUINTEGER value that specifies the cursor concurrency: -#

SQL_CONCUR_READ_ONLY = Cursor is read-only. No updates are allowed.

-# -#

SQL_CONCUR_LOCK = Cursor uses the lowest level of locking sufficient to ensure that the row can be updated.

-# -#

SQL_CONCUR_ROWVER = Cursor uses optimistic concurrency control, comparing row versions such as SQLBase ROWID or Sybase TIMESTAMP.

-# -#

SQL_CONCUR_VALUES = Cursor uses optimistic concurrency control, comparing values.

-# -#

The default value for SQL_ATTR_CONCURRENCY is SQL_CONCUR_READ_ONLY.

-# -#

This attribute cannot be specified for an open cursor. For more information, see "Concurrency Types" in Chapter 14: Transactions.

-# -#

If the SQL_ATTR_CURSOR_TYPE Attribute is changed to a type that does not support the current value of SQL_ATTR_CONCURRENCY, the value of SQL_ATTR_CONCURRENCY will be changed at execution time, and a warning issued when SQLExecDirect or SQLPrepare is called.

-# -#

If the driver supports the SELECT FOR UPDATE statement and such a statement is executed while the value of SQL_ATTR_CONCURRENCY is set to SQL_CONCUR_READ_ONLY, an error will be returned. If the value of SQL_ATTR_CONCURRENCY is changed to a value that the driver supports for some value of SQL_ATTR_CURSOR_TYPE but not for the current value of SQL_ATTR_CURSOR_TYPE, the value of SQL_ATTR_CURSOR_TYPE will be changed at execution time and SQLSTATE 01S02 (Option value changed) is issued when SQLExecDirect or SQLPrepare is called.

-# -#

If the specified concurrency is not supported by the data source, the driver substitutes a different concurrency and returns SQLSTATE 01S02 (Option value changed). For SQL_CONCUR_VALUES, the driver substitutes SQL_CONCUR_ROWVER, and vice versa. For SQL_CONCUR_LOCK, the driver substitutes, in order, SQL_CONCUR_ROWVER or SQL_CONCUR_VALUES. The validity of the substituted value is not checked until execution time.

-# -#

For more information about the relationship between SQL_ATTR_CONCURRENCY and the other cursor attributes, see "Cursor Characteristics and Cursor Type" in Chapter 11: Retrieving Results (Advanced).

-#
SQL_ATTR_CURSOR_SCROLLABLE
-# (ODBC 3.0)
An SQLUINTEGER value that specifies the level of support that the application requires. Setting this attribute affects subsequent calls to SQLExecDirect and SQLExecute. -#

SQL_NONSCROLLABLE = Scrollable cursors are not required on the statement handle. If the application calls SQLFetchScroll on this handle, the only valid value of FetchOrientation is SQL_FETCH_NEXT. This is the default.

-# -#

SQL_SCROLLABLE = Scrollable cursors are required on the statement handle. When calling SQLFetchScroll, the application may specify any valid value of FetchOrientation, achieving cursor positioning in modes other than the sequential mode.

-# -#

For more information about scrollable cursors, see "Scrollable Cursors" in Chapter 11: Retrieving Results (Advanced). For more information about the relationship between SQL_ATTR_CURSOR_SCROLLABLE and the other cursor attributes, see "Cursor Characteristics and Cursor Type" in Chapter 11: Retrieving Results (Advanced).

-#
SQL_ATTR_CURSOR_SENSITIVITY
-# (ODBC 3.0)
An SQLUINTEGER value that specifies whether cursors on the statement handle make visible the changes made to a result set by another cursor. Setting this attribute affects subsequent calls to SQLExecDirect and SQLExecute. An application can read back the value of this attribute to obtain its initial state or its state as most recently set by the application. -#

SQL_UNSPECIFIED = It is unspecified what the cursor type is and whether cursors on the statement handle make visible the changes made to a result set by another cursor. Cursors on the statement handle may make visible none, some, or all such changes. This is the default.

-# -#

SQL_INSENSITIVE = All cursors on the statement handle show the result set without reflecting any changes made to it by any other cursor. Insensitive cursors are read-only. This corresponds to a static cursor, which has a concurrency that is read-only.

-# -#

SQL_SENSITIVE = All cursors on the statement handle make visible all changes made to a result set by another cursor.

-# -#

For more information about the relationship between SQL_ATTR_CURSOR_SENSITIVITY and the other cursor attributes, see "Cursor Characteristics and Cursor Type" in Chapter 11: Retrieving Results (Advanced).

-#
SQL_ATTR_CURSOR_TYPE
-# (ODBC 2.0)
An SQLUINTEGER value that specifies the cursor type: -#

SQL_CURSOR_FORWARD_ONLY = The cursor only scrolls forward.

-# -#

SQL_CURSOR_STATIC = The data in the result set is static.

-# -#

SQL_CURSOR_KEYSET_DRIVEN = The driver saves and uses the keys for the number of rows specified in the SQL_ATTR_KEYSET_SIZE statement attribute.

-# -#

SQL_CURSOR_DYNAMIC = The driver saves and uses only the keys for the rows in the rowset.

-# -#

The default value is SQL_CURSOR_FORWARD_ONLY. This attribute cannot be specified after the SQL statement has been prepared.

-# -#

If the specified cursor type is not supported by the data source, the driver substitutes a different cursor type and returns SQLSTATE 01S02 (Option value changed). For a mixed or dynamic cursor, the driver substitutes, in order, a keyset-driven or static cursor. For a keyset-driven cursor, the driver substitutes a static cursor.

-# -#

For more information about scrollable cursor types, see "Scrollable Cursor Types" in Chapter 11: Retrieving Results (Advanced). For more information about the relationship between SQL_ATTR_CURSOR_TYPE and the other cursor attributes, see "Cursor Characteristics and Cursor Type" in Chapter 11: Retrieving Results (Advanced).

-#
SQL_ATTR_ENABLE_AUTO_IPD
-# (ODBC 3.0)
An SQLUINTEGER value that specifies whether automatic population of the IPD is performed: -#

SQL_TRUE = Turns on automatic population of the IPD after a call to SQLPrepare. SQL_FALSE = Turns off automatic population of the IPD after a call to SQLPrepare. (An application can still obtain IPD field information by calling SQLDescribeParam, if supported.) The default value of the statement attribute SQL_ATTR_ENABLE_AUTO_IPD is SQL_FALSE. For more information, see "Automatic Population of the IPD" in Chapter 13: Descriptors.

-#
SQL_ATTR_FETCH_BOOKMARK_PTR
-# (ODBC 3.0)
A pointer that points to a binary bookmark value. When SQLFetchScroll is called with fFetchOrientation equal to SQL_FETCH_BOOKMARK, the driver picks up the bookmark value from this field. This field defaults to a null pointer. For more information, see "Scrolling by Bookmark" in Chapter 11: Retrieving Results (Advanced). -#

The value pointed to by this field is not used for delete by bookmark, update by bookmark, or fetch by bookmark operations in SQLBulkOperations, which use bookmarks cached in rowset buffers.

-#
SQL_ATTR_IMP_PARAM_DESC
-# (ODBC 3.0)
The handle to the IPD. The value of this attribute is the descriptor allocated when the statement was initially allocated. The application cannot set this attribute. -#

This attribute can be retrieved by a call to SQLGetStmtAttr but not set by a call to SQLSetStmtAttr.

-#
SQL_ATTR_IMP_ROW_DESC
-# (ODBC 3.0)
The handle to the IRD. The value of this attribute is the descriptor allocated when the statement was initially allocated. The application cannot set this attribute. -#

This attribute can be retrieved by a call to SQLGetStmtAttr but not set by a call to SQLSetStmtAttr.

-#
SQL_ATTR_KEYSET_SIZE
-# (ODBC 2.0)
An SQLUINTEGER that specifies the number of rows in the keyset for a keyset-driven cursor. If the keyset size is 0 (the default), the cursor is fully keyset-driven. If the keyset size is greater than 0, the cursor is mixed (keyset-driven within the keyset and dynamic outside of the keyset). The default keyset size is 0. For more information about keyset-driven cursors, see "Keyset-Driven Cursors" in Chapter 11: Retrieving Results (Advanced). -#

If the specified size exceeds the maximum keyset size, the driver substitutes that size and returns SQLSTATE 01S02 (Option value changed).

-# -#

SQLFetch or SQLFetchScroll returns an error if the keyset size is greater than 0 and less than the rowset size.

-#
SQL_ATTR_MAX_LENGTH
-# (ODBC 1.0)
An SQLUINTEGER value that specifies the maximum amount of data that the driver returns from a character or binary column. If ValuePtr is less than the length of the available data, SQLFetch or SQLGetData truncates the data and returns SQL_SUCCESS. If ValuePtr is 0 (the default), the driver attempts to return all available data. -#

If the specified length is less than the minimum amount of data that the data source can return or greater than the maximum amount of data that the data source can return, the driver substitutes that value and returns SQLSTATE 01S02 (Option value changed).

-# -#

The value of this attribute can be set on an open cursor; however, the setting might not take effect immediately, in which case the driver will return SQLSTATE 01S02 (Option value changed) and reset the attribute to its original value.

-# -#

This attribute is intended to reduce network traffic and should be supported only when the data source (as opposed to the driver) in a multiple-tier driver can implement it. This mechanism should not be used by applications to truncate data; to truncate data received, an application should specify the maximum buffer length in the BufferLength argument in SQLBindCol or SQLGetData.

-#
SQL_ATTR_MAX_ROWS
-# (ODBC 1.0)
An SQLUINTEGER value corresponding to the maximum number of rows to return to the application for a SELECT statement. If *ValuePtr equals 0 (the default), the driver returns all rows. -#

This attribute is intended to reduce network traffic. Conceptually, it is applied when the result set is created and limits the result set to the first ValuePtr rows. If the number of rows in the result set is greater than ValuePtr, the result set is truncated.

-# -#

SQL_ATTR_MAX_ROWS applies to all result sets on the Statement, including those returned by catalog functions. SQL_ATTR_MAX_ROWS establishes a maximum for the value of the cursor row count.

-# -#

A driver should not emulate SQL_ATTR_MAX_ROWS behavior for SQLFetch or SQLFetchScroll (if result set size limitations cannot be implemented at the data source) if it cannot guarantee that SQL_ATTR_MAX_ROWS will be implemented properly.

-# -#

It is driver-defined whether SQL_ATTR_MAX_ROWS applies to statements other than SELECT statements (such as catalog functions).

-# -#

The value of this attribute can be set on an open cursor; however, the setting might not take effect immediately, in which case the driver will return SQLSTATE 01S02 (Option value changed) and reset the attribute to its original value.

-#
SQL_ATTR_METADATA_ID
-# (ODBC 3.0)
An SQLUINTEGER value that determines how the string arguments of catalog functions are treated. -#

If SQL_TRUE, the string argument of catalog functions are treated as identifiers. The case is not significant. For nondelimited strings, the driver removes any trailing spaces and the string is folded to uppercase. For delimited strings, the driver removes any leading or trailing spaces and takes whatever is between the delimiters literally. If one of these arguments is set to a null pointer, the function returns SQL_ERROR and SQLSTATE HY009 (Invalid use of null pointer).

-# -#

If SQL_FALSE, the string arguments of catalog functions are not treated as identifiers. The case is significant. They can either contain a string search pattern or not, depending on the argument.

-# -#

The default value is SQL_FALSE.

-# -#

The TableType argument of SQLTables, which takes a list of values, is not affected by this attribute.

-# -#

SQL_ATTR_METADATA_ID can also be set on the connection level. (It and SQL_ATTR_ASYNC_ENABLE are the only statement attributes that are also connection attributes.)

-# -#

For more information, see "Arguments in Catalog Functions" in Chapter 7: Catalog Functions.

-#
SQL_ATTR_NOSCAN
-# (ODBC 1.0)
An SQLUINTEGER value that indicates whether the driver should scan SQL strings for escape sequences: -#

SQL_NOSCAN_OFF = The driver scans SQL strings for escape sequences (the default).

-# -#

SQL_NOSCAN_ON = The driver does not scan SQL strings for escape sequences. Instead, the driver sends the statement directly to the data source.

-# -#

For more information, see "Escape Sequences in ODBC" in Chapter 8: SQL Statements.

-#
SQL_ATTR_PARAM_BIND_OFFSET_PTR
-# (ODBC 3.0)
An SQLUINTEGER * value that points to an offset added to pointers to change binding of dynamic parameters. If this field is non-null, the driver dereferences the pointer, adds the dereferenced value to each of the deferred fields in the descriptor record (SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR), and uses the new pointer values when binding. It is set to null by default. -#

The bind offset is always added directly to the SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR fields. If the offset is changed to a different value, the new value is still added directly to the value in the descriptor field. The new offset is not added to the field value plus any earlier offsets.

-#
SQL_ATTR_PARAM_BIND_OFFSET_PTR
-# (ODBC 3.0) (continued)
For more information, see "Parameter Binding Offsets" in Chapter 9: Executing Statements. -#

Setting this statement attribute sets the SQL_DESC_BIND_OFFSET_PTR field in the APD header.

-#
SQL_ATTR_PARAM_BIND_TYPE
-# (ODBC 3.0)
An SQLUINTEGER value that indicates the binding orientation to be used for dynamic parameters. -#

This field is set to SQL_PARAM_BIND_BY_COLUMN (the default) to select column-wise binding.

-# -#

To select row-wise binding, this field is set to the length of the structure or an instance of a buffer that will be bound to a set of dynamic parameters. This length must include space for all of the bound parameters and any padding of the structure or buffer to ensure that when the address of a bound parameter is incremented with the specified length, the result will point to the beginning of the same parameter in the next set of parameters. When using the sizeof operator in ANSI C, this behavior is guaranteed.

-# -#

For more information, see "Binding Arrays of Parameters" in Chapter 9: Executing Statements.

-# -#

Setting this statement attribute sets the SQL_DESC_ BIND_TYPE field in the APD header.

-#
SQL_ATTR_PARAM_OPERATION_PTR
-# (ODBC 3.0)
An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values used to ignore a parameter during execution of an SQL statement. Each value is set to either SQL_PARAM_PROCEED (for the parameter to be executed) or SQL_PARAM_IGNORE (for the parameter to be ignored). -#

A set of parameters can be ignored during processing by setting the status value in the array pointed to by SQL_DESC_ARRAY_STATUS_PTR in the APD to SQL_PARAM_IGNORE. A set of parameters is processed if its status value is set to SQL_PARAM_PROCEED or if no elements in the array are set.

-# -#

This statement attribute can be set to a null pointer, in which case the driver does not return parameter status values. This attribute can be set at any time, but the new value is not used until the next time SQLExecDirect or SQLExecute is called.

-# -#

For more information, see "Using Arrays of Parameters" in Chapter 9: Executing Statements.

-# -#

Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the APD header.

-#
SQL_ATTR_PARAM_STATUS_PTR
-# (ODBC 3.0)
An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values containing status information for each row of parameter values after a call to SQLExecute or SQLExecDirect. This field is required only if PARAMSET_SIZE is greater than 1. -#

The status values can contain the following values:

-# -#

SQL_PARAM_SUCCESS: The SQL statement was successfully executed for this set of parameters.

-# -#

SQL_PARAM_SUCCESS_WITH_INFO: The SQL statement was successfully executed for this set of parameters; however, warning information is available in the diagnostics data structure.

-# -#

SQL_PARAM_ERROR: There was an error in processing this set of parameters. Additional error information is available in the diagnostics data structure.

-# -#

SQL_PARAM_UNUSED: This parameter set was unused, possibly due to the fact that some previous parameter set caused an error that aborted further processing, or because SQL_PARAM_IGNORE was set for that set of parameters in the array specified by the SQL_ATTR_PARAM_OPERATION_PTR.

-# -#

SQL_PARAM_DIAG_UNAVAILABLE: The driver treats arrays of parameters as a monolithic unit and so does not generate this level of error information.

-# -#

This statement attribute can be set to a null pointer, in which case the driver does not return parameter status values. This attribute can be set at any time, but the new value is not used until the next time SQLExecute or SQLExecDirect is called. Note that setting this attribute can affect the output parameter behavior implemented by the driver.

-# -#

For more information, see "Using Arrays of Parameters" in Chapter 9: Executing Statements.

-# -#

Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the IPD header.

-#
SQL_ATTR_PARAMS_PROCESSED_PTR
-# (ODBC 3.0)
An SQLUINTEGER * record field that points to a buffer in which to return the number of sets of parameters that have been processed, including error sets. No number will be returned if this is a null pointer. -#

Setting this statement attribute sets the SQL_DESC_ROWS_PROCESSED_PTR field in the IPD header.

-# -#

If the call to SQLExecDirect or SQLExecute that fills in the buffer pointed to by this attribute does not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined.

-# -#

For more information, see "Using Arrays of Parameters" in Chapter 9: Executing Statements.

-#
SQL_ATTR_PARAMSET_SIZE
-# (ODBC 3.0)
An SQLUINTEGER value that specifies the number of values for each parameter. If SQL_ATTR_PARAMSET_SIZE is greater than 1, SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR of the APD point to arrays. The cardinality of each array is equal to the value of this field. -#

For more information, see "Using Arrays of Parameters" in Chapter 9: Executing Statements.

-# -#

Setting this statement attribute sets the SQL_DESC_ARRAY_SIZE field in the APD header.

-#
SQL_ATTR_QUERY_TIMEOUT
-# (ODBC 1.0)
An SQLUINTEGER value corresponding to the number of seconds to wait for an SQL statement to execute before returning to the application. If ValuePtr is equal to 0 (default), there is no timeout. -#

If the specified timeout exceeds the maximum timeout in the data source or is smaller than the minimum timeout, SQLSetStmtAttr substitutes that value and returns SQLSTATE 01S02 (Option value changed).

-# -#

Note that the application need not call SQLCloseCursor to reuse the statement if a SELECT statement timed out.

-# -#

The query timeout set in this statement attribute is valid in both synchronous and asynchronous modes.

-#
SQL_ATTR_RETRIEVE_DATA
-# (ODBC 2.0)
An SQLUINTEGER value: -#

SQL_RD_ON = SQLFetchScroll and, in ODBC 3.x, SQLFetch retrieve data after it positions the cursor to the specified location. This is the default.

-# -#

SQL_RD_OFF = SQLFetchScroll and, in ODBC 3.x, SQLFetch do not retrieve data after it positions the cursor.

-# -#

By setting SQL_RETRIEVE_DATA to SQL_RD_OFF, an application can verify that a row exists or retrieve a bookmark for the row without incurring the overhead of retrieving rows. For more information, see "Scrolling and Fetching Rows" in Chapter 11: Retrieving Results (Advanced).

-# -#

The value of this attribute can be set on an open cursor; however, the setting might not take effect immediately, in which case the driver will return SQLSTATE 01S02 (Option value changed) and reset the attribute to its original value.

-#
SQL_ATTR_ROW_ARRAY_SIZE
-# (ODBC 3.0)
An SQLUINTEGER value that specifies the number of rows returned by each call to SQLFetch or SQLFetchScroll. It is also the number of rows in a bookmark array used in a bulk bookmark operation in SQLBulkOperations. The default value is 1. -#

If the specified rowset size exceeds the maximum rowset size supported by the data source, the driver substitutes that value and returns SQLSTATE 01S02 (Option value changed).

-# -#

For more information, see "Rowset Size" in Chapter 11: Retrieving Results (Advanced).

-# -#

Setting this statement attribute sets the SQL_DESC_ARRAY_SIZE field in the ARD header.

-#
SQL_ATTR_ROW_BIND_OFFSET_PTR
-# (ODBC 3.0)
An SQLUINTEGER * value that points to an offset added to pointers to change binding of column data. If this field is non-null, the driver dereferences the pointer, adds the dereferenced value to each of the deferred fields in the descriptor record (SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR), and uses the new pointer values when binding. It is set to null by default. -#

Setting this statement attribute sets the SQL_DESC_BIND_OFFSET_PTR field in the ARD header.

-#
SQL_ATTR_ROW_BIND_TYPE
-# (ODBC 1.0)
An SQLUINTEGER value that sets the binding orientation to be used when SQLFetch or SQLFetchScroll is called on the associated statement. Column-wise binding is selected by setting the value to SQL_BIND_BY_COLUMN. Row-wise binding is selected by setting the value to the length of a structure or an instance of a buffer into which result columns will be bound. -#

If a length is specified, it must include space for all of the bound columns and any padding of the structure or buffer to ensure that when the address of a bound column is incremented with the specified length, the result will point to the beginning of the same column in the next row. When using the sizeof operator with structures or unions in ANSI C, this behavior is guaranteed.

-# -#

Column-wise binding is the default binding orientation for SQLFetch and SQLFetchScroll.

-# -#

For more information, see "Binding Columns for Use with Block Cursors" in Chapter 11: Retrieving Results (Advanced).

-# -#

Setting this statement attribute sets the SQL_DESC_BIND_TYPE field in the ARD header.

-#
SQL_ATTR_ROW_NUMBER
-# (ODBC 2.0)
An SQLUINTEGER value that is the number of the current row in the entire result set. If the number of the current row cannot be determined or there is no current row, the driver returns 0. -#

This attribute can be retrieved by a call to SQLGetStmtAttr but not set by a call to SQLSetStmtAttr.

-#
SQL_ATTR_ROW_OPERATION_PTR
-# (ODBC 3.0)
An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values used to ignore a row during a bulk operation using SQLSetPos. Each value is set to either SQL_ROW_PROCEED (for the row to be included in the bulk operation) or SQL_ROW_IGNORE (for the row to be excluded from the bulk operation). (Rows cannot be ignored by using this array during calls to SQLBulkOperations.) -#

This statement attribute can be set to a null pointer, in which case the driver does not return row status values. This attribute can be set at any time, but the new value is not used until the next time SQLSetPos is called.

-# -#

For more information, see "Updating Rows in the Rowset with SQLSetPos" and "Deleting Rows in the Rowset with SQLSetPos" in Chapter 12: Updating Data.

-# -#

Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the ARD.

-#
SQL_ATTR_ROW_STATUS_PTR
-# (ODBC 3.0)
An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values containing row status values after a call to SQLFetch or SQLFetchScroll. The array has as many elements as there are rows in the rowset. -#

This statement attribute can be set to a null pointer, in which case the driver does not return row status values. This attribute can be set at any time, but the new value is not used until the next time SQLBulkOperations, SQLFetch, SQLFetchScroll, or SQLSetPos is called.

-# -#

For more information, see "Number of Rows Fetched and Status" in Chapter 11: Retrieving Results (Advanced).

-# -#

Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the IRD header.

-# -#

This attribute is mapped by an ODBC 2.x driver to the rgbRowStatus array in a call to SQLExtendedFetch.

-#
SQL_ATTR_ROWS_FETCHED_PTR
-# (ODBC 3.0)
An SQLUINTEGER * value that points to a buffer in which to return the number of rows fetched after a call to SQLFetch or SQLFetchScroll; the number of rows affected by a bulk operation performed by a call to SQLSetPos with an Operation argument of SQL_REFRESH; or the number of rows affected by a bulk operation performed by SQLBulkOperations. This number includes error rows. -#

For more information, see "Number of Rows Fetched and Status" in Chapter 11: Retrieving Results (Advanced).

-# -#

Setting this statement attribute sets the SQL_DESC_ROWS_PROCESSED_PTR field in the IRD header.

-# -#

If the call to SQLFetch or SQLFetchScroll that fills in the buffer pointed to by this attribute does not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined.

-#
SQL_ATTR_SIMULATE_CURSOR
-# (ODBC 2.0)
An SQLUINTEGER value that specifies whether drivers that simulate positioned update and delete statements guarantee that such statements affect only one single row. -#

To simulate positioned update and delete statements, most drivers construct a searched UPDATE or DELETE statement containing a WHERE clause that specifies the value of each column in the current row. Unless these columns make up a unique key, such a statement can affect more than one row.

-# -#

To guarantee that such statements affect only one row, the driver determines the columns in a unique key and adds these columns to the result set. If an application guarantees that the columns in the result set make up a unique key, the driver is not required to do so. This may reduce execution time.

-# -#

SQL_SC_NON_UNIQUE = The driver does not guarantee that simulated positioned update or delete statements will affect only one row; it is the application's responsibility to do so. If a statement affects more than one row, SQLExecute, SQLExecDirect, or SQLSetPos returns SQLSTATE 01001 (Cursor operation conflict).

-# -#

SQL_SC_TRY_UNIQUE = The driver attempts to guarantee that simulated positioned update or delete statements affect only one row. The driver always executes such statements, even if they might affect more than one row, such as when there is no unique key. If a statement affects more than one row, SQLExecute, SQLExecDirect, or SQLSetPos returns SQLSTATE 01001 (Cursor operation conflict).

-# -#

SQL_SC_UNIQUE = The driver guarantees that simulated positioned update or delete statements affect only one row. If the driver cannot guarantee this for a given statement, SQLExecDirect or SQLPrepare returns an error.

-# -#

If the data source provides native SQL support for positioned update and delete statements and the driver does not simulate cursors, SQL_SUCCESS is returned when SQL_SC_UNIQUE is requested for SQL_SIMULATE_CURSOR. SQL_SUCCESS_WITH_INFO is returned if SQL_SC_TRY_UNIQUE or SQL_SC_NON_UNIQUE is requested. If the data source provides the SQL_SC_TRY_UNIQUE level of support and the driver does not, SQL_SUCCESS is returned for SQL_SC_TRY_UNIQUE and SQL_SUCCESS_WITH_INFO is returned for SQL_SC_NON_UNIQUE.

-# -#

If the specified cursor simulation type is not supported by the data source, the driver substitutes a different simulation type and returns SQLSTATE 01S02 (Option value changed). For SQL_SC_UNIQUE, the driver substitutes, in order, SQL_SC_TRY_UNIQUE or SQL_SC_NON_UNIQUE. For SQL_SC_TRY_UNIQUE, the driver substitutes SQL_SC_NON_UNIQUE.

-# -#

For more information, see "Simulating Positioned Update and Delete Statements" in Chapter 12: Updating Data.

-#
SQL_ATTR_USE_BOOKMARKS
-# (ODBC 2.0)
An SQLUINTEGER value that specifies whether an application will use bookmarks with a cursor: -#

SQL_UB_OFF = Off (the default)

-# -#

SQL_UB_VARIABLE = An application will use bookmarks with a cursor, and the driver will provide variable-length bookmarks if they are supported. SQL_UB_FIXED is deprecated in ODBC 3.x. ODBC 3.x applications should always use variable-length bookmarks, even when working with ODBC 2.x drivers (which supported only 4-byte, fixed-length bookmarks). This is because a fixed-length bookmark is just a special case of a variable-length bookmark. When working with an ODBC 2.x driver, the Driver Manager maps SQL_UB_VARIABLE to SQL_UB_FIXED.

-# -#

To use bookmarks with a cursor, the application must specify this attribute with the SQL_UB_VARIABLE value before opening the cursor.

-# -#

For more information, see "Retrieving Bookmarks" in Chapter 11: Retrieving Results (Advanced).

-#
-# -#

[1]   These functions can be called asynchronously only if the descriptor is an implementation descriptor, not an application descriptor.

-#

See "Column-Wise Binding" and "Row-Wise Binding" in Chapter 11: Retrieving Results (Advanced).

-# -#

Related Functions

-#
-# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
For information aboutSee
Canceling statement processingSQLCancel
Returning the setting of a connection attributeSQLGetConnectAttr
Returning the setting of a statement attributeSQLGetStmtAttr
Setting a connection attributeSQLSetConnectAttr
Setting a single field of the descriptorSQLSetDescField
-#

-# -#
-# -# -# -}; - -my $i3 = " " x 3; -my $i4 = " " x 4; -my $i8 = " " x 8; - -my $type2type = { - SQLSMALLINT => 'Smallint', - SQLUSMALLINT => 'Usmallint', - SQLINTEGER => 'Integer', - SQLUINTEGER => 'Uinteger', - SQLPOINTER => 'Pointer', - SQLCHAR => 'Sqlchar', -}; - -my $attr = - $type eq 'Env' ? $attrEnv : - $type eq 'Dbc' ? $attrDbc : - $type eq 'Stmt' ? $attrStmt : die "bad type $type"; - -my @name = sort { - $attr->{$a}{order} <=> $attr->{$b}{order} -} keys %$attr; - -print "#include \"Handle$type.hpp\"\n"; -my $class = "OdbcData"; - -for my $name (@name) { - my $p = $attr->{$name}; - my $odbctype = $type2type->{$p->{type}} or die $name; - $odbctype .= "Ptr" if $p->{ptr}; - print "\nstatic void\n"; - print "callback_${name}_set(Ctx& ctx, HandleBase* self, const $class& data)\n"; - print "{\n"; - print "${i4}Handle$type* p$type = dynamic_cast(self);\n"; - print "${i4}assert(p$type != 0 && data.type() == ${class}::$odbctype);\n"; - print "}\n"; - print "\nstatic void\n"; - print "callback_${name}_default(Ctx& ctx, HandleBase* self, $class& data)\n"; - print "{\n"; - print "${i4}Handle$type* p$type = dynamic_cast(self);\n"; - print "${i4}assert(p$type != 0);\n"; - print "${i4}data.set();\n"; - print "}\n"; -} - -print "\nAttrSpec Handle${type}::m_attrSpec\[\] = {\n"; -for my $name (@name) { - my $p = $attr->{$name}; - my $odbctype = $type2type->{$p->{type}} or die $name; - $odbctype .= "Ptr" if $p->{ptr}; - print "${i4}\{${i3}$name,\n"; - print "${i8}${class}::$odbctype,\n"; - my $attrmode = - $p->{mode} eq 'rw' ? 'Attr_mode_readwrite' : - $p->{mode} eq 'ro' ? 'Attr_mode_readonly' : die "bad mode $p->{mode}"; - print "${i8}$attrmode,\n"; - print "${i8}callback_${name}_set,\n"; - print "${i8}callback_${name}_default,\n"; - print "${i4}\},\n"; -} -print "${i4}\{${i3}0,\n"; -print "${i8}${class}::Undef,\n"; -print "${i8}Attr_mode_undef,\n"; -print "${i8}0,\n"; -print "${i8}0,\n"; -print "${i4}\},\n"; - -print "};\n"; diff --git a/ndb/src/old_files/client/odbc/docs/main.hpp b/ndb/src/old_files/client/odbc/docs/main.hpp deleted file mode 100644 index ebb5b1f235a..00000000000 --- a/ndb/src/old_files/client/odbc/docs/main.hpp +++ /dev/null @@ -1,104 +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 */ - -/** - @mainpage NDB ODBC - - The ODBC Driver Frontend has: - -# HandleBase : Various ODBC handles - -# AttrArea : Attributes of handles - -# ConnArea : Communication area on connection level between driver parts - -# StmtArea : Communication area on statement level between driver parts - - and controls the following steps: - -# SQL_compiler : Compiles SQL into SQL_code_tree:s - -# Parser : Bison grammar - -# Analyzer : Syntactic and semantic checks (binds names) - -# PlanGen : Generate initial (execution) plan (PlanTree) - -# CodeGen : Generates CodeTree:s out of PlanTree:s - -# Optimizer : Optimizes PlanTree:s - -# Output : Outputs executable CodeTree:s - -# Executor : Executes CodeTree:s - -# CodeTree::allocRun : Allocates runtime data structures (RunTree:s) - -# Dataflow machine : Executes and evaluates statement and expressions - - The Dataflow machine works in four different ways: - -# Non-query statements - -# CodeStmt::execute : Executes (non-query) statement - -# Query statements - -# CodeQuery::execute : Execute Query statement - -# CodeQuery::fetch : Fetch row from CodeQuery node - -# Boolean expressions - -# CodePred::evaluate : Evaluates boolean expression - -# Arithmetical expressions - -# CodeExpr::evaluate : Evaluates arithmetic expression - - The following components are used throughout the NDB ODBC: - -# Context (Ctx) : Info regarding execution/evaluation - -# Diagnostic area (DiagArea) : Errors and warnings (for ODBC user) - -# DescArea : Description of ODBC user input/output bind varibles/columns - -# Dictionary (DictBase) : Lookup info stored in NDB Dictionary - and info regarding temporary - materialized results - -# ResultArea : Execution (temporary) results - - - @section secCompiler SQL_compiler : SQL to SQL_code_tree - - The SQL_compiler takes an SQL statement and translates - it into an SQL_code_tree. The compiler uses an SQL_code_tree - internally during the compilation and the result of the compilation - is a simlified SQL_code_tree. - - The compiler works in the following steps: - -# Parse SQL statments and create SQL_code_tree representing the - statement. - -# Apply Syntax Rules to the SQL_code_tree. Syntax rules are - rules which are not expressed in the SQL grammar, - but are expressed in natural language in the SQL specification. - -# Apply Access Rules to the SQL_code_tree - (this is not implemented, since NDB Cluster has no access control) - -# Apply General Rules to the SQL_code_tree - -# Apply Conformance Rules to the SQL_code_tree - - The resulting simplified SQL_code_tree is represented by a - tree of C++ objects. - - - @section secCodegen Codegen : SQL_code_tree to CodeTree - - CodeGen takes simplified SQL_code_tree:s and transforms them into - CodeTree:s. - - - @section secOptimizer Optimizer : CodeTree to CodeTree - - The implementation of the ODBC optimizer will uses the - PlanTree:s to represent statements and transforms them - into executable format (still PlanTree format). - - @note In the future, more optimizations can be implemented. - - - @section secExecutor Executor : Execute CodeTree - - The Executor uses the following data structures: - -# CodeTree : A read-only quary evaluation plan - -# RunTree : Runtime data structures containing ResultSet:s - - The execution mechanism is actually implemented as a - part of the CodeTree. -*/ diff --git a/ndb/src/old_files/client/odbc/docs/ndbodbc.html b/ndb/src/old_files/client/odbc/docs/ndbodbc.html deleted file mode 100644 index 6be624dfa1b..00000000000 --- a/ndb/src/old_files/client/odbc/docs/ndbodbc.html +++ /dev/null @@ -1,659 +0,0 @@ - - - -ODBC and SQL - - - -

ODBC and SQL - NDB Cluster v2.11

- -

-NDB Cluster v2.11 includes a version of ODBC and SQL. -

-This document has 4 sections. -

    -
  1. PLATFORMS -
  2. ODBC -
  3. SQL -
  4. DIAGNOSTICS -
-

-Features which are currently incomplete or planned for next release -are marked with v2.x. - -

1. PLATFORMS

- -

1.1 Linux / Unix

-

-We use RedHat package names to describe supporting software. -Packages starting with perl- are perl modules. -If your installation does not include them you can get them -from a CPAN archive ( ftp://ftp.funet.fi/pub/languages/perl/CPAN ). -

-Version numbers are given only as examples. -Other versions will work. -

-An ODBC driver manager is required, one of: -

    -
  • unixODBC-2.2.3 (this is more common) -
  • libiodbc-3.0.5 -
-

-Additional packages are convenient. -Following include perl scripting interface -and an "interactive SQL" tool dbish: -

    -
  • perl-DBI-1.30 -
  • perl-DBD-ODBC-0.43 -
  • readline-4.2 -
  • perl-Term-ReadLine-Gnu-1.11 -
-

-The NDB ODBC driver is located under NDB Cluster installation -directory and is named libNDB_ODBC.so. -It includes NDB API. -To use it create a text file -/etc/odbc.ini or $HOME/.odbc.ini -containing at least: -

- - -[ndb] -
-Driver = <path-to-your-NDB-installation>/lib/libNDB_ODBC.so -
-
-

-Then try the shell command dbish dbi:ODBC:ndb -in an NDB API node directory. - -

1.2 Windows

- -[ TODO - documentation ] - -

2. ODBC

- -

2.1 External data types

- -Usual external data types are supported and converted to and from SQL -data types. -

- - - - - - -
type description
SQL_C_CHARcharacter buffers
SQL_C_SLONG, etcinteger types
SQL_C_DOUBLE, etcfloating types
SQL_C_TYPE_TIMESTAMPtimestamp
- -

2.2 ODBC functions

-

-The driver implements basic ODBC functions. -Main exceptions are: -

    -
  • no named cursors -
  • no scrollable cursors -
  • no bulk operations -
  • no asynchronous execution -
-

-Following lists main ODBC 3.0 functions and -their status in the driver. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
functionsupported
SQLAllocHandle -yes -
SQLConnect -yes -
SQLGetInfo -yes -
SQLGetFunctions -yes -
SQLGetTypeInfo -yes -
SQLSetConnectAttr -yes -
SQLGetConnectAttr -yes -
SQLSetEnvAttr -yes -
SQLGetEnvAttr -yes -
SQLSetStmtAttr -yes -
SQLGetStmtAttr -yes -
SQLGetDescField -yes -
SQLGetDescRec -yes -
SQLSetDescField -yes -
SQLSetDescRec -yes -
SQLPrepare -yes -
SQLBindParameter -yes -
SQLGetCursorName -yes, but cursor names cannot be used in SQL -
SQLSetCursorName -yes, but cursor names cannot be used in SQL -
SQLSetScrollOptions -not implemented -
SQLExecute -yes -
SQLExecDirect -yes -
SQLNativeSql -not implemented -
SQLDescribeParam -not supported -
SQLNumParams -yes -
SQLParamData -yes -
SQLPutData -yes -
SQLRowCount -yes -
SQLNumResultCols -yes -
SQLDescribeCol -yes -
SQLColAttribute -yes -
SQLBindCol -yes -
SQLFetch -yes -
SQLFetchScroll -not implemented -
SQLGetData -yes -
SQLSetPos -not implemented -
SQLBulkOperations -not implemented -
SQLMoreResults -yes, but multiple result sets are not supported -
SQLGetDiagField -yes -
SQLGetDiagRec -yes -
SQLColumnPrivileges -not applicable -
SQLColumns -yes -
SQLForeignKeys -not applicable -
SQLPrimaryKeys -yes -
SQLProcedureColumns -not applicable -
SQLProcedures -not applicable -
SQLSpecialColumns -yes v2.x -
SQLStatistics -not applicable -
SQLTablePrivileges -not applicable -
SQLTables -yes -
SQLFreeStmt -yes -
SQLCloseCursor -yes -
SQLCancel -yes -
SQLEndTran -yes -
SQLDisconnect -yes -
SQLFreeHandle -yes -
- -

3. SQL

- -

3.1 Data types

- - - - - - - - - - - - -
type description
CHAR(n)fixed-width blank-padded string
VARCHAR(n)variable length string
INT
INTEGER
integer 32 bits
BIGINTinteger 64 bits
DECIMAL(m,n)exact number with precision and scale v2.x
REALfloat 32 bits
FLOAT
DOUBLE PRECISION
float, at least 64 bits
DATEdate with precision 1 second v2.x
DATETIMEdate with precision 1 nanosecond (SQL_TYPE_TIMESTAMP)
-

- -Integer types may be qualified as UNSIGNED. -

-Strings and numbers are not converted to each other automatically. -Following is an error (unlike in oracle). -
-

select 123 + '456' from tab
- -

3.2 Expressions

- - - - - - - - -
syntax description
NULLnull value
12.34e5integer or decimal or float constant
'abc'string constant
+ - * / ( )arithmetic operations
||string concatenation v2.x
- -
-Integer and decimal arithmetic is done in BIGINT. -
-Floating arithmetic is done in DOUBLE PRECISION. -
-Numeric literals use largest applicable type. -
-String operations are done in CHAR or in VARCHAR (if any operand is VARCHAR). -
-String literals have type CHAR. - -

3.3 Functions : non-aggregate

- - - - - - - -
syntax description
SUBSTR() LEFT() RIGHT()substring
TO_NUMBER() TO_CHAR()basic conversions v2.x
ROWNUMrow number in query
SYSDATEcurrent date as DATETIME
- -

3.4 Functions : aggregate

- - - - - - -
syntax description
COUNT(*) COUNT(expr)count rows or non-NULL values
MIN(expr) MAX(expr)min and max of strings and numbers
SUM(expr) AVG(expr)sum and average of numbers
-
-GROUP BY and HAVING are supported. - -

3.5 Predicates

- - - - - - - -
syntax description
IS NULL / IS NOT NULLtest if value is null
< <= = != > >=comparisons
LIKE / NOT LIKEstring matching
AND OR NOT ( )boolean operators
- -

3.6 Tables

- -An NDB table requires a primary key. -There are 2 ways to specify it. - -

-

Case 1

-
create table t (
-    a integer not null,
-    b char(20) not null,
-    c float,
-    primary key(a, b)
-)
-
-

-

Case 2

-

-A column can be specified as AUTO_INCREMENT. -The column has following requirements. -

    -
  • it must be the primary key (not just part of one) -
  • its type must be one of the integer types -
-
create table t (
-    a int unsigned auto_increment primary key,
-    b char(20) not null,
-    c float
-)
-
-

-The values of an AUTO_INCREMENT column are unique (until wrap-around) -and form an ascending sequence. -Gaps in the sequence are possible. -

Default values

-Columns can be specified with DEFAULT value -which is used on insert if the column is not on the insert list. -

-

create table t (
-    a int primary key,
-    b int default 100
-)
-insert into t(a) values(1) -- inserts (1,100)
-
-

-The value must evaluate to constant. -Using SYSDATE (if allowed at all) evaluates to table creation time. -

- -

Logging / nologging

- -By default tables are created in logging mode, meaning the data -is preserved across database restart. -The mode can be specified explicitly: -

-create table t1 (a int primary key, b int) logging -
-create table t1 (a int primary key, b int) nologging - -

Schemas

- -Schemas do not exist in current NDB Cluster. -As a convenience, a single period is allowed in table names: -

-

create table mydb.mytable (a int primary key)
-

- -

Drop table

- -Deletes a table, all of its indexes, and all data: -

-drop table t - -

3.7 Indexes

-Only unique non-ordered indexes exist currently. -The columns must be not nullable and are stored in same -order as underlying table columns. -

-create unique hash index x1 on t1(b, c) logging -

-Internally, a unique hash index is a table where index key is primary key. -If the index is nologging, it is rebuilt on database restart -before the database is opened. -

-Indexes can of course be dropped: -

-drop index x1 - -

3.8 Select

- -Features: - -
    -
  • Expressions and predicates -
    select a + b * c from t where a < b + c and (b > c or c > 10) -
  • JOIN to any depth -
    select a.x, b.y, c.z from t1 a, t2 b, t2 c where a.x + b.y < c.z -
  • ORDER BY -
    select * from t1, t2 where a1 > 5 order by b1 + b2, c1 desc -
  • DISTINCT -
    select distinct a, b + c from t -
  • Aggregates without grouping. -
    select count(*), max(a), 1 + sum(b) + avg(c * d) from t -
  • Aggregates with grouping. -
    select a, sum(b) from t group by a having sum(c) > 0 order by a, sum(d) -
- -Major omissions: -
    -
  • no OUTER JOIN -
  • no subqueries and no EXISTS clause -
- -Queries are optimized to minimize scans, -by using primary keys and existing unique hash indexes. -Simple predicates in scans (column compared to constant) -are passed to an interpreter in NDB kernel. -Joins are done via nested loops only. -

-

    -
  • SCAN -
    select * from t where a < b -
  • INTERPRETED SCAN (much faster) -
    select * from t1, t2 where t1.a < 10 and t2.b > t1.c -
  • PRIMARY KEY lookup -
    select * from t where pk = 5 and b > 10 -
  • NESTED LOOPS -
    select * from t1, t2, t3 where t1.pk = t2.x and t2.pk = t3.y -
- -

3.9 Insert and write

- -Both VALUES and subquery variants can be used. -

-

insert into t(a, c) values (123, 'abc')
-insert into t1(a, c) select a + 10 * b, c from t2
-
-

-For convenience, the non-standard MySql syntax is also supported. -

-

insert into t set a = 123, c = 'abc'
-

-The non-standard operation WRITE is used exactly like INSERT. -The record is updated if it exists. -Otherwise a new record is inserted. -

-

write into t(a, c) values (123, 'abc')
-
- -

3.10 Update

- -Update allows no subqueries. -Update is optimized to minimize scans and reads, -by using primary keys and existing unique hash indexes. -

-

    -
  • SCAN -
    update t set a = b + 5, c = d where c > 10 -
  • PRIMARY KEY or INDEX lookup -
    update t set a = b + 5, c = d where pk = 5 and c > 10 -
  • PRIMARY KEY or INDEX direct -
    update t set a = 5, c = 7 where pk = 5 -
- -

3.11 Delete

- -Delete allows no subqueries. -Delete is optimized to minimize scans and reads, -by using primary keys and existing unique hash indexes. -

-

    -
  • SCAN -
    delete from t where c > 10 -
  • PRIMARY KEY or INDEX lookup -
    delete from t where pk = 5 and c > 10 -
  • PRIMARY KEY or INDEX direct -
    delete from t where pk = 5 -
- -

3.12 Virtual tables

- -The driver implements some virtual tables. -They can only be queried, not modified. -

-

    -
  • DUAL -
    A 1-row table - example: select SYSDATE from DUAL. -
  • ODBC$TYPEINFO -
    Corresponds to SQLGetTypeInfo. -
  • ODBC$TABLES -
    Corresponds to SQLTables but shows all NDB kernel objects. -
  • ODBC$COLUMNS -
    Corresponds to SQLColumns. -
  • ODBC$PRIMARYKEYS -
    Corresponds to SQLPrimaryKeys. -
- -

4. DIAGNOSTICS

- -

4.1 Diagnostic records

- -The driver manager and driver return 3 main diagnostics -(see SQLGetDiagRec). -
    -
  • SQLSTATE (a string of 5 characters) -
  • Native error code -
  • Message text -
-

-Message text format is -

-[Alzato][ODBC driver][NDB Cluster] NDB-ssccnnn error text (in SQLXxx) -

-Here ssccnnnn is native error code (decimal number), with following parts: -

-

  • ss - status -
  • cc - classification -
  • nnnn - error code - -

    -See NDB API guide for further information. -

    -For non-database errors the last prefix [NDB Cluster] is omitted -and native error code is always 02015001. - -

    4.2 Tracing

    - -Following environment variables may be useful. -
      -
    • NDB_ODBC_TRACE -
      -Values ≥ 2 cause SQL execution plan -to be printed on standard output. -
      -Values ≥ 3 show the ODBC API functions -called by the driver manager. -

      -
    • NDB_ODBC_DEBUG -
      -Non-zero value makes the driver abort -the application on unhandled conditions. -
      -By default the ODBC API function is aborted gracefully. -
    - -

    4.3 Thread safety

    -

    -The driver has same thread-safety model as NDB API. -In NDB API each thread must use its own Ndb object. -In NDB ODBC a SQLConnect corresponds to an Ndb object. -It is required that each thread allocates its -own ODBC handles (of all types). - -

    4.4 Data formats

    -

    -SQL types are represented as (old) NDB types as follows. -

    - - - - - - - -
    SQL type NDB type
    CHAR(n)String(n), blank-padded to n
    VARCHAR(n)String(n+2), zero-padded to n, length in last 2 bytes (big-endian)
    integersSigned(x) or UnSigned(x), x=16,32,64, native format
    floatsFloat(x), x=32,64, native format
    DATETIMEString(12) = cc yy mm dd HH MM SS \0 ff ff ff ff (big-endian)
    -

    -Note: SQL types exist now in NDB API in NdbDictionary class. -However they are not yet understood by NDB API operations. - -

    4.5 NDB Cluster limitations

    -

    -

      -
    • Isolation level is READ COMMITTED. -A scan (non-primary-key select of several rows) does not see consistent data. -

      -
    • Inserting into a table from itself is likely to cause a deadlock -or a random result. -
      no: insert into t(a, b) select a*100, b+100 from t -

      -
    • Number of uncommitted rows is limited by NDB configuration -parameter MaxNoOfConcurrentOperations (typical default 4096). -To delete all rows from a large table one may need to do repeatedly: -
      delete from t where rownum < 4000 -
    - -

    4.6 Known problems v2.11

    -

    -Following lists specific known problems. -

      -
    • ORDER BY works only with expressions, -not with column aliases or positions. -
      no: select a+b x from t order by x -
      no: select * from t order by 1, 2, 3 -

      -
    • Join optimizer does not always minimize number of scans. -Changing the order of tables in the statement may help. -
    - -

    4.7 Useful links

    -

    -Microsoft ODBC page -
    -unixODBC home page -
    -iODBC home page - - - diff --git a/ndb/src/old_files/client/odbc/docs/select.fig b/ndb/src/old_files/client/odbc/docs/select.fig deleted file mode 100644 index 4f51a2085b4..00000000000 --- a/ndb/src/old_files/client/odbc/docs/select.fig +++ /dev/null @@ -1,94 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -A4 -92.00 -Single --2 -1200 2 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 2700 2700 1500 3900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 3150 2700 3150 3900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 3600 4500 4800 5700 -2 1 1 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 3600 2700 4800 3900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 2775 4500 1200 5700 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 3150 4500 3150 5700 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 2100 4500 2100 3900 600 3900 600 4500 2100 4500 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 2100 6300 2100 5700 600 5700 600 6300 2100 6300 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 3900 4500 3900 3900 2400 3900 2400 4500 3900 4500 -2 4 1 1 0 7 50 0 -1 4.000 0 0 7 0 0 5 - 5700 4500 5700 3900 4200 3900 4200 4500 5700 4500 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 3900 6300 3900 5700 2400 5700 2400 6300 3900 6300 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 5700 6300 5700 5700 4200 5700 4200 6300 5700 6300 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 8400 2700 8400 2100 6900 2100 6900 2700 8400 2700 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 8400 6300 8400 5700 6900 5700 6900 6300 8400 6300 -2 1 0 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 7650 2700 7650 5700 -2 1 0 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 7650 6300 7650 7500 -2 1 1 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 8100 6300 10575 6900 -2 1 0 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 8100 2700 10575 3300 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 11700 3900 11700 3300 10200 3300 10200 3900 11700 3900 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 9900 5400 9900 4800 8400 4800 8400 5400 9900 5400 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 11700 5400 11700 4800 10200 4800 10200 5400 11700 5400 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 13500 5400 13500 4800 12000 4800 12000 5400 13500 5400 -2 1 0 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 10500 3900 9300 4800 -2 1 0 1 0 7 50 0 -1 4.000 0 0 7 1 0 2 - 0 0 1.00 60.00 120.00 - 11400 3900 12600 4800 -2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 - 0 0 1.00 60.00 120.00 - 10950 3900 10950 4800 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 8400 8100 8400 7500 6900 7500 6900 8100 8400 8100 -2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 - 3900 2700 3900 2100 2400 2100 2400 2700 3900 2700 -2 4 1 1 0 7 50 0 -1 4.000 0 0 7 0 0 5 - 11700 7500 11700 6900 10200 6900 10200 7500 11700 7500 -4 0 0 50 0 14 12 0.0000 4 135 840 900 4275 table T1\001 -4 0 0 50 0 14 20 0.0000 4 240 4125 900 1125 select A, C, 123 from T1/\001 -4 0 0 50 0 14 12 0.0000 4 135 840 825 6075 column A\001 -4 0 0 50 0 14 12 0.0000 4 135 840 2775 6075 column C\001 -4 0 0 50 0 14 12 0.0000 4 135 945 4425 6075 const 123\001 -4 0 0 50 0 14 12 0.0000 4 135 630 4575 4275 clause\001 -4 0 0 50 0 14 12 0.0000 4 90 315 2925 4275 row\001 -4 0 0 50 0 14 12 0.0000 4 180 735 7200 2475 project\001 -4 0 0 50 0 14 12 0.0000 4 135 630 7200 6000 filter\001 -4 0 0 50 0 14 12 0.0000 4 135 840 8625 5100 column 1\001 -4 0 0 50 0 14 12 0.0000 4 135 840 10500 5100 column 2\001 -4 0 0 50 0 14 12 0.0000 4 135 945 12300 5100 const 123\001 -4 0 0 50 0 14 12 0.0000 4 90 315 10650 3600 row\001 -4 0 0 50 0 14 12 0.0000 4 150 840 7200 7800 scan 1,2\001 -4 0 0 50 0 14 12 0.0000 4 135 630 2850 2475 select\001 -4 0 0 50 0 14 12 0.0000 4 135 630 10500 7200 clause\001 diff --git a/ndb/src/old_files/client/odbc/docs/systables.pl b/ndb/src/old_files/client/odbc/docs/systables.pl deleted file mode 100644 index 728d966a7a4..00000000000 --- a/ndb/src/old_files/client/odbc/docs/systables.pl +++ /dev/null @@ -1,2192 +0,0 @@ -# usage: perl systables.pl {typeinfo|tables|columns|primarykeys} {-l|-c} -use strict; -my $what = shift; -my $opt = shift; -my $listWhat = {}; - -# -# odbcsqlgettypeinfo.htm -# -$listWhat->{typeinfo} = [ -# -# -# -# SQLGetTypeInfo -# -# -# -# -# -# -#

    -#
    -# -# -# -# -#
    -# ODBC Programmer's Reference -#
    -#
    -#
    -#
    -# -#

    SQLGetTypeInfo

    -# -#

    Conformance

    -# -#

    Version Introduced: ODBC 1.0
    -# Standards Compliance: ISO 92

    -# -#

    Summary

    -# -#

    SQLGetTypeInfo returns information about data types supported by the data source. The driver returns the information in the form of an SQL result set. The data types are intended for use in Data Definition Language (DDL) statements.

    -# -#

    Important   Applications must use the type names returned in the TYPE_NAME column of the SQLGetTypeInfo result set in ALTER TABLE and CREATE TABLE statements. SQLGetTypeInfo may return more than one row with the same value in the DATA_TYPE column.

    -# -#

    Syntax

    -# -#
    SQLRETURN SQLGetTypeInfo(
    -#	     SQLHSTMT     StatementHandle,
    -#	     SQLSMALLINT     DataType);
    -# -#

    Arguments -# -#

    -#
    StatementHandle
    -# -#
    [Input]
    -# Statement handle for the result set.
    -# -#
    DataType
    -# -#
    [Input]
    -# The SQL data type. This must be one of the values in the "SQL Data Types" section of Appendix D: Data Types, or a driver-specific SQL data type. SQL_ALL_TYPES specifies that information about all data types should be returned.
    -#
    -# -#

    Returns

    -# -#

    SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

    -# -#

    Diagnostics

    -# -#

    When SQLGetTypeInfo returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLGetTypeInfo and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    SQLSTATEErrorDescription
    01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
    01S02Option value changedA specified statement attribute was invalid because of implementation working conditions, so a similar value was temporarily substituted. (Call SQLGetStmtAttr to determine the temporarily substituted value.) The substitute value is valid for the StatementHandle until the cursor is closed. The statement attributes that can be changed are: SQL_ATTR_CONCURRENCY, SQL_ATTR_CURSOR_TYPE, SQL_ATTR_KEYSET_SIZE, SQL_ATTR_MAX_LENGTH, SQL_ATTR_MAX_ROWS, SQL_ATTR_QUERY_TIMEOUT, and SQL_ATTR_SIMULATE_CURSOR. (Function returns SQL_SUCCESS_WITH_INFO.)
    08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
    24000Invalid cursor stateA cursor was open on the StatementHandle, and SQLFetch or SQLFetchScroll had been called. This error is returned by the Driver Manager if SQLFetch or SQLFetchScroll has not returned SQL_NO_DATA, and is returned by the driver if SQLFetch or SQLFetchScroll has returned SQL_NO_DATA. -#

    A result set was open on the StatementHandle, but SQLFetch or SQLFetchScroll had not been called.

    -#
    40001Serialization failureThe transaction was rolled back due to a resource deadlock with another transaction.
    40003Statement completion unknownThe associated connection failed during the execution of this function and the state of the transaction cannot be determined.
    HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
    HY001Memory allocation errorThe driver was unable to allocate memory required to support execution or completion of the function.
    HY004Invalid SQL data typeThe value specified for the argument DataType was neither a valid ODBC SQL data type identifier nor a driver-specific data type identifier supported by the driver.
    HY008Operation canceledAsynchronous processing was enabled for the StatementHandle, then the function was called and, before it completed execution, SQLCancel was called on the StatementHandle. Then the function was called again on the StatementHandle. -#

    The function was called and, before it completed execution, SQLCancel was called on the StatementHandle from a different thread in a multithread application.

    -#
    HY010Function sequence error(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called. -#

    (DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

    -#
    HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
    HYC00Optional feature not implementedThe combination of the current settings of the SQL_ATTR_CONCURRENCY and SQL_ATTR_CURSOR_TYPE statement attributes was not supported by the driver or data source. -#

    The SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_VARIABLE, and the SQL_ATTR_CURSOR_TYPE statement attribute was set to a cursor type for which the driver does not support bookmarks.

    -#
    HYT00Timeout expiredThe query timeout period expired before the data source returned the result set. The timeout period is set through SQLSetStmtAttr, SQL_ATTR_QUERY_TIMEOUT.
    HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
    IM001Driver does not support this function(DM) The driver corresponding to the StatementHandle does not support the function.
    -# -#

    Comments

    -# -#

    SQLGetTypeInfo returns the results as a standard result set, ordered by DATA_TYPE and then by how closely the data type maps to the corresponding ODBC SQL data type. Data types defined by the data source take precedence over user-defined data types. Consequently, the sort order is not necessarily consistent but can be generalized as DATA_TYPE first, followed by TYPE_NAME, both ascending. For example, suppose that a data source defined INTEGER and COUNTER data types, where COUNTER is auto-incrementing, and that a user-defined data type WHOLENUM has also been defined. These would be returned in the order INTEGER, WHOLENUM, and COUNTER, because WHOLENUM maps closely to the ODBC SQL data type SQL_INTEGER, while the auto-incrementing data type, even though supported by the data source, does not map closely to an ODBC SQL data type. For information about how this information might be used, see "DDL Statements" in Chapter 8: SQL Statements.

    -# -#

    If the DataType argument specifies a data type which is valid for the version of ODBC supported by the driver, but is not supported by the driver, then it will return an empty result set.

    -# -#

    Note   For more information about the general use, arguments, and returned data of ODBC catalog functions, see Chapter 7: Catalog Functions.

    -# -#

    The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility because applications bind by column number.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    ODBC 2.0 columnODBC 3.x column
    PRECISIONCOLUMN_SIZE
    MONEYFIXED_PREC_SCALE
    AUTO_INCREMENTAUTO_UNIQUE_VALUE
    -# -#

    The following columns have been added to the results set returned by SQLGetTypeInfo for ODBC 3.x: -# -#

      -#
    • SQL_DATA_TYPE
    • -# -#
    • INTERVAL_PRECISION
    • -# -#
    • SQL_DATETIME_SUB
    • -# -#
    • NUM_PREC_RADIX
    • -#
    -# -#

    The following table lists the columns in the result set. Additional columns beyond column 19 (INTERVAL_PRECISION) can be defined by the driver. An application should gain access to driver-specific columns by counting down from the end of the result set rather than specifying an explicit ordinal position. For more information, see "Data Returned by Catalog Functions" in Chapter 7: Catalog Functions.

    -# -#

    Note   SQLGetTypeInfo might not return all data types. For example, a driver might not return user-defined data types. Applications can use any valid data type, regardless of whether it is returned by SQLGetTypeInfo.

    -# -#

    The data types returned by SQLGetTypeInfo are those supported by the data source. They are intended for use in Data Definition Language (DDL) statements. Drivers can return result-set data using data types other than the types returned by SQLGetTypeInfo. In creating the result set for a catalog function, the driver might use a data type that is not supported by the data source.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# - { name => "type_name", - type => "varchar", - length => 20, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "column_size", - type => "integer", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "literal_prefix", - type => "varchar", - length => 1, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "literal_suffix", - type => "varchar", - length => 1, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "create_params", - type => "varchar", - length => 20, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "nullable", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "case_sensitive", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "searchable", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "unsigned_attribute", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "fixed_prec_scale", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "auto_unique_value", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "local_type_name", - type => "varchar", - length => 20, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "minimum_scale", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "maximum_scale", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "sql_data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "sql_datetime_sub", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "num_prec_radix", - type => "integer", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "interval_precision", - type => "smallint", - length => undef, - nullable => 1, - }, -#

    -# Column name
    Column
    -# number

    -# Data type

    -# Comments
    TYPE_NAME
    -# (ODBC 2.0)
    1Varchar
    -# not NULL
    Data source–dependent data-type name; for example, "CHAR()", "VARCHAR()", "MONEY", "LONG VARBINARY", or "CHAR ( ) FOR BIT DATA". Applications must use this name in CREATE TABLE and ALTER TABLE statements.
    DATA_TYPE
    -# (ODBC 2.0)
    2Smallint
    -# not NULL
    SQL data type. This can be an ODBC SQL data type or a driver-specific SQL data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). For a list of valid ODBC SQL data types, see "SQL Data Types" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver’s documentation.
    COLUMN_SIZE
    -# (ODBC 2.0)
    3IntegerThe maximum column size that the server supports for this data type. For numeric data, this is the maximum precision. For string data, this is the length in characters. For datetime data types, this is the length in characters of the string representation (assuming the maximum allowed precision of the fractional seconds component). NULL is returned for data types where column size is not applicable. For interval data types, this is the number of characters in the character representation of the interval literal (as defined by the interval leading precision; see "Interval Data Type Length" in Appendix D: Data Types). -#

    For more information on column size, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.

    -#
    LITERAL_PREFIX
    -# (ODBC 2.0)
    4VarcharCharacter or characters used to prefix a literal; for example, a single quotation mark (') for character data types or 0x for binary data types; NULL is returned for data types where a literal prefix is not applicable.
    LITERAL_SUFFIX
    -# (ODBC 2.0)
    5VarcharCharacter or characters used to terminate a literal; for example, a single quotation mark (') for character data types; NULL is returned for data types where a literal suffix is not applicable.
    CREATE_PARAMS
    -# (ODBC 2.0)
    6VarcharA list of keywords, separated by commas, corresponding to each parameter that the application may specify in parentheses when using the name that is returned in the TYPE_NAME field. The keywords in the list can be any of the following: length, precision, or scale. They appear in the order that the syntax requires them to be used. For example, CREATE_PARAMS for DECIMAL would be "precision,scale"; CREATE_PARAMS for VARCHAR would equal "length." NULL is returned if there are no parameters for the data type definition; for example, INTEGER. -#

    The driver supplies the CREATE_PARAMS text in the language of the country where it is used.

    -#
    NULLABLE
    -# (ODBC 2.0)
    7Smallint
    -# not NULL
    Whether the data type accepts a NULL value: -#

    SQL_NO_NULLS if the data type does not accept NULL values.

    -# -#

    SQL_NULLABLE if the data type accepts NULL values.

    -# -#

    SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values.

    -#
    CASE_SENSITIVE
    -# (ODBC 2.0)
    8Smallint
    -# not NULL
    Whether a character data type is case-sensitive in collations and comparisons: -#

    SQL_TRUE if the data type is a character data type and is case-sensitive.

    -# -#

    SQL_FALSE if the data type is not a character data type or is not case-sensitive.

    -#
    SEARCHABLE
    -# (ODBC 2.0)
    9Smallint
    -# not NULL
    How the data type is used in a WHERE clause: -#

    SQL_PRED_NONE if the column cannot be used in a WHERE clause. (This is the same as the SQL_UNSEARCHABLE value in ODBC 2.x.)

    -# -#

    SQL_PRED_CHAR if the column can be used in a WHERE clause, but only with the LIKE predicate. (This is the same as the SQL_LIKE_ONLY value in ODBC 2.x.)

    -# -#

    SQL_PRED_BASIC if the column can be used in a WHERE clause with all the comparison operators except LIKE (comparison, quantified comparison, BETWEEN, DISTINCT, IN, MATCH, and UNIQUE). (This is the same as the SQL_ALL_EXCEPT_LIKE value in ODBC 2.x.)

    -# -#

    SQL_SEARCHABLE if the column can be used in a WHERE clause with any comparison operator.

    -#
    UNSIGNED_ATTRIBUTE
    -# (ODBC 2.0)
    10SmallintWhether the data type is unsigned: -#

    SQL_TRUE if the data type is unsigned.

    -# -#

    SQL_FALSE if the data type is signed.

    -# -#

    NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.

    -#
    FIXED_PREC_SCALE
    -# (ODBC 2.0)
    11Smallint
    -# not NULL
    Whether the data type has predefined fixed precision and scale (which are data source–specific), such as a money data type: -#

    SQL_TRUE if it has predefined fixed precision and scale.

    -# -#

    SQL_FALSE if it does not have predefined fixed precision and scale.

    -#
    AUTO_UNIQUE_VALUE
    -# (ODBC 2.0)
    12SmallintWhether the data type is autoincrementing: -#

    SQL_TRUE if the data type is autoincrementing.

    -# -#

    SQL_FALSE if the data type is not autoincrementing.

    -# -#

    NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.

    -# -#

    An application can insert values into a column having this attribute, but typically cannot update the values in the column.

    -# -#

    When an insert is made into an auto-increment column, a unique value is inserted into the column at insert time. The increment is not defined, but is data source–specific. An application should not assume that an auto-increment column starts at any particular point or increments by any particular value.

    -#
    LOCAL_TYPE_NAME
    -# (ODBC 2.0)
    13VarcharLocalized version of the data source–dependent name of the data type. NULL is returned if a localized name is not supported by the data source. This name is intended for display only, such as in dialog boxes.
    MINIMUM_SCALE
    -# (ODBC 2.0)
    14SmallintThe minimum scale of the data type on the data source. If a data type has a fixed scale, the MINIMUM_SCALE and MAXIMUM_SCALE columns both contain this value. For example, an SQL_TYPE_TIMESTAMP column might have a fixed scale for fractional seconds. NULL is returned where scale is not applicable. For more information, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.
    MAXIMUM_SCALE
    -# (ODBC 2.0)
    15SmallintThe maximum scale of the data type on the data source. NULL is returned where scale is not applicable. If the maximum scale is not defined separately on the data source, but is instead defined to be the same as the maximum precision, this column contains the same value as the COLUMN_SIZE column. For more information, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.
    SQL_DATA_TYPE
    -# (ODBC 3.0)
    16Smallint NOT NULLThe value of the SQL data type as it appears in the SQL_DESC_TYPE field of the descriptor. This column is the same as the DATA_TYPE column, except for interval and datetime data types. -#

    For interval and datetime data types, the SQL_DATA_TYPE field in the result set will return SQL_INTERVAL or SQL_DATETIME, and the SQL_DATETIME_SUB field will return the subcode for the specific interval or datetime data type. (See Appendix D: Data Types.)

    -#
    SQL_DATETIME_SUB
    -# (ODBC 3.0)
    17SmallintWhen the value of SQL_DATA_TYPE is SQL_DATETIME or SQL_INTERVAL, this column contains the datetime/interval subcode. For data types other than datetime and interval, this field is NULL. -#

    For interval or datetime data types, the SQL_DATA_TYPE field in the result set will return SQL_INTERVAL or SQL_DATETIME, and the SQL_DATETIME_SUB field will return the subcode for the specific interval or datetime data type. (See Appendix D: Data Types.)

    -#
    NUM_PREC_RADIX
    -# (ODBC 3.0)
    18IntegerIf the data type is an approximate numeric type, this column contains the value 2 to indicate that COLUMN_SIZE specifies a number of bits. For exact numeric types, this column contains the value 10 to indicate that COLUMN_SIZE specifies a number of decimal digits. Otherwise, this column is NULL.
    INTERVAL_PRECISION
    -# (ODBC 3.0)
    19SmallintIf the data type is an interval data type, then this column contains the value of the interval leading precision. (See "Interval Data Type Precision" in Appendix D: Data Types.) Otherwise, this column is NULL.
    -# -#

    Attribute information can apply to data types or to specific columns in a result set. SQLGetTypeInfo returns information about attributes associated with data types; SQLColAttribute returns information about attributes associated with columns in a result set.

    -# -#

    Related Functions

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    For information aboutSee
    Binding a buffer to a column in a result setSQLBindCol
    Canceling statement processingSQLCancel
    Returning information about a column in a result setSQLColAttribute
    Fetching a block of data or scrolling through a result setSQLFetchScroll
    Fetching a single row or a block of data in a forward-only directionSQLFetch
    Returning information about a driver or data sourceSQLGetInfo
    -#

    -# -#
    -# -# -# -]; - -# -# odbcsqltables.htm -# -$listWhat->{tables} = [ -# -# -# -# SQLTables -# -# -# -# -# -# -#
    -#
    -# -# -# -# -#
    -# ODBC Programmer's Reference -#
    -#
    -#
    -#
    -# -#

    SQLTables

    -# -#

    Conformance

    -# -#

    Version Introduced: ODBC 1.0
    -# Standards Compliance: X/Open

    -# -#

    Summary

    -# -#

    SQLTables returns the list of table, catalog, or schema names, and table types, stored in a specific data source. The driver returns the information as a result set.

    -# -#

    Syntax

    -# -#
    SQLRETURN SQLTables(
    -#	     SQLHSTMT     StatementHandle,
    -#	     SQLCHAR *     CatalogName,
    -#	     SQLSMALLINT     NameLength1,
    -#	     SQLCHAR *     SchemaName,
    -#	     SQLSMALLINT     NameLength2,
    -#	     SQLCHAR *     TableName,
    -#	     SQLSMALLINT     NameLength3,
    -#	     SQLCHAR *     TableType,
    -#	     SQLSMALLINT     NameLength4);
    -# -#

    Arguments -# -#

    -#
    StatementHandle
    -# -#
    [Input]
    -# Statement handle for retrieved results.
    -# -#
    CatalogName
    -# -#
    [Input]
    -# Catalog name. The CatalogName argument accepts search patterns if the SQL_ODBC_VERSION environment attribute is SQL_OV_ODBC3; it does not accept search patterns if SQL_OV_ODBC2 is set. If a driver supports catalogs for some tables but not for others, such as when a driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have catalogs. -# -#

    If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, CatalogName is treated as an identifier and its case is not significant. If it is SQL_FALSE, CatalogName is a pattern value argument; it is treated literally, and its case is significant. For more information, see "Arguments in Catalog Functions" in Chapter 7: Catalog Functions. -#

    -# -#
    NameLength1
    -# -#
    [Input]
    -# Length of *CatalogName.
    -# -#
    SchemaName
    -# -#
    [Input]
    -# String search pattern for schema names. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have schemas. -# -#

    If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, SchemaName is treated as an identifier and its case is not significant. If it is SQL_FALSE, SchemaName is a pattern value argument; it is treated literally, and its case is significant. -#

    -# -#
    NameLength2
    -# -#
    [Input]
    -# Length of *SchemaName.
    -# -#
    TableName
    -# -#
    [Input]
    -# String search pattern for table names. -# -#

    If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, TableName is treated as an identifier and its case is not significant. If it is SQL_FALSE, TableName is a pattern value argument; it is treated literally, and its case is significant. -#

    -# -#
    NameLength3
    -# -#
    [Input]
    -# Length of *TableName.
    -# -#
    TableType
    -# -#
    [Input]
    -# List of table types to match. -# -#

    Note that the SQL_ATTR_METADATA_ID statement attribute has no effect upon the TableType argument. TableType is a value list argument, no matter what the setting of SQL_ATTR_METADATA_ID. -#

    -# -#
    NameLength4
    -# -#
    [Input]
    -# Length of *TableType.
    -#
    -# -#

    Returns

    -# -#

    SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

    -# -#

    Diagnostics

    -# -#

    When SQLTables returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLTables and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    SQLSTATEErrorDescription
    01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
    08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
    24000Invalid cursor stateA cursor was open on the StatementHandle, and SQLFetch or SQLFetchScroll had been called. This error is returned by the Driver Manager if SQLFetch or SQLFetchScroll has not returned SQL_NO_DATA and is returned by the driver if SQLFetch or SQLFetchScroll has returned SQL_NO_DATA. -#

    A cursor was open on the StatementHandle, but SQLFetch or SQLFetchScroll had not been called.

    -#
    40001Serialization failureThe transaction was rolled back due to a resource deadlock with another transaction.
    40003Statement completion unknownThe associated connection failed during the execution of this function, and the state of the transaction cannot be determined.
    HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
    HY001Memory allocation
    -# error
    The driver was unable to allocate memory required to support execution or completion of the function.
    HY008Operation canceledAsynchronous processing was enabled for the StatementHandle. The function was called, and before it completed execution, SQLCancel was called on the StatementHandle. Then the function was called again on the StatementHandle. -#

    The function was called, and before it completed execution, SQLCancel was called on the StatementHandle from a different thread in a multithread application.

    -#
    HY009Invalid use of null pointerThe SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, the CatalogName argument was a null pointer, and the SQL_CATALOG_NAME InfoType returns that catalog names are supported. -#

    (DM) The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, and the SchemaName or TableName argument was a null pointer.

    -#
    HY010Function sequence error(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called. -#

    (DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

    -#
    HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
    HY090Invalid string or buffer length(DM) The value of one of the length arguments was less than 0 but not equal to SQL_NTS. -#

    The value of one of the name length arguments exceeded the maximum length value for the corresponding name.

    -#
    HYC00Optional feature not implementedA catalog was specified, and the driver or data source does not support catalogs. -#

    A schema was specified, and the driver or data source does not support schemas.

    -# -#

    A string search pattern was specified for the catalog name, table schema, or table name, and the data source does not support search patterns for one or more of those arguments.

    -# -#

    The combination of the current settings of the SQL_ATTR_CONCURRENCY and SQL_ATTR_CURSOR_TYPE statement attributes was not supported by the driver or data source.

    -# -#

    The SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_VARIABLE, and the SQL_ATTR_CURSOR_TYPE statement attribute was set to a cursor type for which the driver does not support bookmarks.

    -#
    HYT00Timeout expiredThe query timeout period expired before the data source returned the requested result set. The timeout period is set through SQLSetStmtAttr, SQL_ATTR_QUERY_TIMEOUT.
    HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
    IM001Driver does not support this function(DM) The driver associated with the StatementHandle does not support the function.
    -# -#

    Comments

    -# -#

    SQLTables lists all tables in the requested range. A user may or may not have SELECT privileges to any of these tables. To check accessibility, an application can: -# -#

      -#
    • Call SQLGetInfo and check the SQL_ACCESSIBLE_TABLES information type.
    • -# -#
    • Call SQLTablePrivileges to check the privileges for each table.
    • -#
    -# -#

    Otherwise, the application must be able to handle a situation where the user selects a table for which SELECT privileges are not granted.

    -# -#

    The SchemaName and TableName arguments accept search patterns. The CatalogName argument accepts search patterns if the SQL_ODBC_VERSION environment attribute is SQL_OV_ODBC3; it does not accept search patterns if SQL_OV_ODBC2 is set. If SQL_OV_ODBC3 is set, an ODBC 3.x driver will require that wildcard characters in the CatalogName argument be escaped to be treated literally. For more information about valid search patterns, see "Pattern Value Arguments" in Chapter 7: Catalog Functions.

    -# -#

    Note   For more information about the general use, arguments, and returned data of ODBC catalog functions, see Chapter 7: Catalog Functions.

    -# -#

    To support enumeration of catalogs, schemas, and table types, the following special semantics are defined for the CatalogName, SchemaName, TableName, and TableType arguments of SQLTables: -# -#

      -#
    • If CatalogName is SQL_ALL_CATALOGS and SchemaName and TableName are empty strings, the result set contains a list of valid catalogs for the data source. (All columns except the TABLE_CAT column contain NULLs.)
    • -# -#
    • If SchemaName is SQL_ALL_SCHEMAS and CatalogName and TableName are empty strings, the result set contains a list of valid schemas for the data source. (All columns except the TABLE_SCHEM column contain NULLs.)
    • -# -#
    • If TableType is SQL_ALL_TABLE_TYPES and CatalogName, SchemaName, and TableName are empty strings, the result set contains a list of valid table types for the data source. (All columns except the TABLE_TYPE column contain NULLs.)
    • -#
    -# -#

    If TableType is not an empty string, it must contain a list of comma-separated values for the types of interest; each value may be enclosed in single quotation marks (') or unquoted—for example, 'TABLE', 'VIEW' or TABLE, VIEW. An application should always specify the table type in uppercase; the driver should convert the table type to whatever case is needed by the data source. If the data source does not support a specified table type, SQLTables does not return any results for that type.

    -# -#

    SQLTables returns the results as a standard result set, ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, and TABLE_NAME. For information about how this information might be used, see "Uses of Catalog Data" in Chapter 7: Catalog Functions.

    -# -#

    To determine the actual lengths of the TABLE_CAT, TABLE_SCHEM, and TABLE_NAME columns, an application can call SQLGetInfo with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, and SQL_MAX_TABLE_NAME_LEN information types.

    -# -#

    The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility because applications bind by column number.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    ODBC 2.0 columnODBC 3.x column
    TABLE_QUALIFIERTABLE_CAT
    TABLE_OWNERTABLE_SCHEM
    -# -#

    The following table lists the columns in the result set. Additional columns beyond column 5 (REMARKS) can be defined by the driver. An application should gain access to driver-specific columns by counting down from the end of the result set rather than specifying an explicit ordinal position. For more information, see "Data Returned by Catalog Functions" in Chapter 7: Catalog Functions.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# - { name => "table_cat", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "table_schem", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "table_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "table_type", - type => "varchar", - length => 20, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "remarks", - type => "varchar", - length => 200, - nullable => 1, - }, -#

    -# Column name
    Column number
    -# Data type

    -# Comments
    TABLE_CAT
    -# (ODBC 1.0)
    1VarcharCatalog name; NULL if not applicable to the data source. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have catalogs.
    TABLE_SCHEM
    -# (ODBC 1.0)
    2VarcharSchema name; NULL if not applicable to the data source. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have schemas.
    TABLE_NAME
    -# (ODBC 1.0)
    3VarcharTable name.
    TABLE_TYPE
    -# (ODBC 1.0)
    4VarcharTable type name; one of the following: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM", or a data source–specific type name. -#

    The meanings of "ALIAS" and "SYNONYM" are driver-specific.

    -#
    REMARKS
    -# (ODBC 1.0)
    5VarcharA description of the table.
    -# -#

    Code Example

    -# -#

    For a code example of a similar function, see SQLColumns.

    -# -#

    Related Functions

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    For information aboutSee
    Binding a buffer to a column in a result setSQLBindCol
    Canceling statement processingSQLCancel
    Returning privileges for a column or columnsSQLColumnPrivileges
    Returning the columns in a table or tablesSQLColumns
    Fetching a single row or a block of data in a forward-only directionSQLFetch
    Fetching a block of data or scrolling through a result setSQLFetchScroll
    Returning table statistics and indexesSQLStatistics
    Returning privileges for a table or tablesSQLTablePrivileges
    -#

    -# -#
    -# -# -# -]; - -# -# odbcsqlcolumns.htm -# -$listWhat->{columns} = [ -# -# -# -# SQLColumns -# -# -# -# -# -# -#
    -#
    -# -# -# -# -#
    -# ODBC Programmer's Reference -#
    -#
    -#
    -#
    -# -#

    SQLColumns

    -# -#

    Conformance

    -# -#

    Version Introduced: ODBC 1.0
    -# Standards Compliance: X/Open

    -# -#

    Summary

    -# -#

    SQLColumns returns the list of column names in specified tables. The driver returns this information as a result set on the specified StatementHandle.

    -# -#

    Syntax

    -# -#
    SQLRETURN SQLColumns(
    -#	     SQLHSTMT     StatementHandle,
    -#	     SQLCHAR *     CatalogName,
    -#	     SQLSMALLINT     NameLength1,
    -#	     SQLCHAR *     SchemaName,
    -#	     SQLSMALLINT     NameLength2,
    -#	     SQLCHAR *     TableName,
    -#	     SQLSMALLINT     NameLength3,
    -#	     SQLCHAR *     ColumnName,
    -#	     SQLSMALLINT     NameLength4);
    -# -#

    Arguments -# -#

    -#
    StatementHandle
    -# -#
    [Input]
    -# Statement handle.
    -# -#
    CatalogName
    -# -#
    [Input]
    -# Catalog name. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have catalogs. CatalogName cannot contain a string search pattern.
    -#
    -# -#
    -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, CatalogName is treated as an identifier and its case is not significant. If it is SQL_FALSE, CatalogName is an ordinary argument; it is treated literally, and its case is significant. For more information, see "Arguments in Catalog Functions" in Chapter 7: Catalog Functions.
    -# -#
    -#
    NameLength1
    -# -#
    [Input]
    -# Length of *CatalogName.
    -# -#
    SchemaName
    -# -#
    [Input]
    -# String search pattern for schema names. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have schemas.
    -#
    -# -#
    -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, SchemaName is treated as an identifier and its case is not significant. If it is SQL_FALSE, SchemaName is a pattern value argument; it is treated literally, and its case is significant.
    -# -#
    -#
    NameLength2
    -# -#
    [Input]
    -# Length of *SchemaName.
    -# -#
    TableName
    -# -#
    [Input]
    -# String search pattern for table names.
    -#
    -# -#
    -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, TableName is treated as an identifier and its case is not significant. If it is SQL_FALSE, TableName is a pattern value argument; it is treated literally, and its case is significant.
    -# -#
    -#
    NameLength3
    -# -#
    [Input]
    -# Length of *TableName.
    -# -#
    ColumnName
    -# -#
    [Input]
    -# String search pattern for column names.
    -#
    -# -#
    -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, ColumnName is treated as an identifier and its case is not significant. If it is SQL_FALSE, ColumnName is a pattern value argument; it is treated literally, and its case is significant.
    -# -#
    -#
    NameLength4
    -# -#
    [Input]
    -# Length of *ColumnName.
    -#
    -# -#

    Returns

    -# -#

    SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

    -# -#

    Diagnostics

    -# -#

    When SQLColumns returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLColumns and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    SQLSTATEErrorDescription
    01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
    08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
    24000Invalid cursor stateA cursor was open on the StatementHandle, and SQLFetch or SQLFetchScroll had been called. This error is returned by the Driver Manager if SQLFetch or SQLFetchScroll has not returned SQL_NO_DATA, and is returned by the driver if SQLFetch or SQLFetchScroll has returned SQL_NO_DATA. -#

    A cursor was open on the StatementHandle but SQLFetch or SQLFetchScroll had not been called.

    -#
    40001Serialization failureThe transaction was rolled back due to a resource deadlock with another transaction.
    40003Statement completion unknownThe associated connection failed during the execution of this function, and the state of the transaction cannot be determined.
    HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
    HY001Memory allocation errorThe driver was unable to allocate memory required to support execution or completion of the function.
    HY008Operation canceledAsynchronous processing was enabled for the StatementHandle. The function was called, and before it completed execution, SQLCancel was called on the StatementHandle. Then the function was called again on the StatementHandle. -#

    The function was called, and before it completed execution, SQLCancel was called on the StatementHandle from a different thread in a multithread application.

    -#
    HY009Invalid use of null pointerThe SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, the CatalogName argument was a null pointer, and the SQL_CATALOG_NAME InfoType returns that catalog names are supported. -#

    (DM) The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, and the SchemaName, TableName, or ColumnName argument was a null pointer.

    -#
    HY010Function sequence error(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called. -#

    (DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

    -#
    HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
    HY090Invalid string or buffer length(DM) The value of one of the name length arguments was less than 0 but not equal to SQL_NTS.
      The value of one of the name length arguments exceeded the maximum length value for the corresponding catalog or name. The maximum length of each catalog or name may be obtained by calling SQLGetInfo with the InfoType values. (See "Comments.")
    HYC00Optional feature not implementedA catalog name was specified, and the driver or data source does not support catalogs. -#

    A schema name was specified, and the driver or data source does not support schemas.

    -# -#

    A string search pattern was specified for the schema name, table name, or column name, and the data source does not support search patterns for one or more of those arguments.

    -# -#

    The combination of the current settings of the SQL_ATTR_CONCURRENCY and SQL_ATTR_CURSOR_TYPE statement attributes was not supported by the driver or data source.

    -# -#

    The SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_VARIABLE, and the SQL_ATTR_CURSOR_TYPE statement attribute was set to a cursor type for which the driver does not support bookmarks.

    -#
    HYT00Timeout expiredThe query timeout period expired before the data source returned the result set. The timeout period is set through SQLSetStmtAttr, SQL_ATTR_QUERY_TIMEOUT.
    HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
    IM001Driver does not support this function(DM) The driver associated with the StatementHandle does not support the function.
    -# -#

    Comments

    -# -#

    This function typically is used before statement execution to retrieve information about columns for a table or tables from the data source's catalog. SQLColumns can be used to retrieve data for all types of items returned by SQLTables. In addition to base tables, this may include (but is not limited to) views, synonyms, system tables, and so on. By contrast, the functions SQLColAttribute and SQLDescribeCol describe the columns in a result set and the function SQLNumResultCols returns the number of columns in a result set. For more information, see "Uses of Catalog Data" in Chapter 7: Catalog Functions.

    -# -#

    Note   For more information about the general use, arguments, and returned data of ODBC catalog functions, see Chapter 7: Catalog Functions.

    -# -#

    SQLColumns returns the results as a standard result set, ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and ORDINAL_POSITION.

    -# -#

    Note   When an application works with an ODBC 2.x driver, no ORDINAL_POSITION column is returned in the result set. As a result, when working with ODBC 2.x drivers, the order of the columns in the column list returned by SQLColumns is not necessarily the same as the order of the columns returned when the application performs a SELECT statement on all columns in that table.

    -# -#

    Note   SQLColumns might not return all columns. For example, a driver might not return information about pseudo-columns, such as Oracle ROWID. Applications can use any valid column, whether or not it is returned by SQLColumns.

    -# -#

    Some columns that can be returned by SQLStatistics are not returned by SQLColumns. For example, SQLColumns does not return the columns in an index created over an expression or filter, such as SALARY + BENEFITS or DEPT = 0012.

    -# -#

    The lengths of VARCHAR columns are not shown in the table; the actual lengths depend on the data source. To determine the actual lengths of the TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and COLUMN_NAME columns, an application can call SQLGetInfo with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, SQL_MAX_TABLE_NAME_LEN, and SQL_MAX_COLUMN_NAME_LEN options.

    -# -#

    The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility because applications bind by column number.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    ODBC 2.0 columnODBC 3.x column
    TABLE_QUALIFIERTABLE_CAT
    TABLE_OWNERTABLE_SCHEM
    PRECISIONCOLUMN_SIZE
    LENGTHBUFFER_LENGTH
    SCALEDECIMAL_DIGITS
    RADIXNUM_PREC_RADIX
    -# -#

    The following columns have been added to the result set returned by SQLColumns for ODBC 3.x:

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
       CHAR_OCTET_LENGTH ORDINAL_POSITION
       COLUMN_DEFSQL_DATA_TYPE
       IS_NULLABLE SQL_DATETIME_SUB
    -# -#

    The following table lists the columns in the result set. Additional columns beyond column 18 (IS_NULLABLE) can be defined by the driver. An application should gain access to driver-specific columns by counting down from the end of the result set rather than specifying an explicit ordinal position. For more information, see "Data Returned by Catalog Functions" in Chapter 7: Catalog Functions.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# - { name => "table_cat", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "table_schem", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "table_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "column_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "type_name", - type => "varchar", - length => 20, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "column_size", - type => "integer", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "buffer_length", - type => "integer", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "decimal_digits", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "num_prec_radix", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "nullable", - type => "smallint", - length => 16, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "remarks", - type => "varchar", - length => 200, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "column_def", - type => "varchar", - length => 100, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "sql_data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "sql_datetime_sub", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "char_octet_length", - type => "integer", - length => undef, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "ordinal_position", - type => "integer", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "is_nullable", - type => "varchar", - length => 3, - nullable => 1, - }, -#

    -# Column name
    Column
    -# number

    -# Data type

    -# Comments
    TABLE_CAT
    -# (ODBC 1.0)
    1VarcharCatalog name; NULL if not applicable to the data source. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have catalogs.
    TABLE_SCHEM
    -# (ODBC 1.0)
    2Varchar Schema name; NULL if not applicable to the data source. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have schemas.
    TABLE_NAME
    -# (ODBC 1.0)
    3Varchar not NULLTable name.
    COLUMN_NAME
    -# (ODBC 1.0)
    4Varchar not NULLColumn name. The driver returns an empty string for a column that does not have a name.
    DATA_TYPE
    -# (ODBC 1.0)
    5Smallint not NULLSQL data type. This can be an ODBC SQL data type or a driver-specific SQL data type. For datetime and interval data types, this column returns the concise data type (such as SQL_TYPE_DATE or SQL_INTERVAL_YEAR_TO_MONTH, rather than the nonconcise data type such as SQL_DATETIME or SQL_INTERVAL). For a list of valid ODBC SQL data types, see "SQL Data Types" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver's documentation. -#

    The data types returned for ODBC 3.x and ODBC 2.x applications may be different. For more information, see "Backward Compatibility and Standards Compliance" in Chapter 17: Programming Considerations.

    -#
    TYPE_NAME
    -# (ODBC 1.0)
    6Varchar not NULLData source–dependent data type name; for example, "CHAR", "VARCHAR", "MONEY", "LONG VARBINAR", or "CHAR ( ) FOR BIT DATA".
    COLUMN_SIZE
    -# (ODBC 1.0)
    7IntegerIf DATA_TYPE is SQL_CHAR or SQL_VARCHAR, this column contains the maximum length in characters of the column. For datetime data types, this is the total number of characters required to display the value when converted to characters. For numeric data types, this is either the total number of digits or the total number of bits allowed in the column, according to the NUM_PREC_RADIX column. For interval data types, this is the number of characters in the character representation of the interval literal (as defined by the interval leading precision, see "Interval Data Type Length" in Appendix D: Data Types). For more information, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.
    BUFFER_LENGTH
    -# (ODBC 1.0)
    8IntegerThe length in bytes of data transferred on an SQLGetData, SQLFetch, or SQLFetchScroll operation if SQL_C_DEFAULT is specified. For numeric data, this size may be different than the size of the data stored on the data source. This value might be different than COLUMN_SIZE column for character data. For more information about length, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types.
    DECIMAL_DIGITS
    -# (ODBC 1.0)
    9SmallintThe total number of significant digits to the right of the decimal point. For SQL_TYPE_TIME and SQL_TYPE_TIMESTAMP, this column contains the number of digits in the fractional seconds component. For the other data types, this is the decimal digits of the column on the data source. For interval data types that contain a time component, this column contains the number of digits to the right of the decimal point (fractional seconds). For interval data types that do not contain a time component, this column is 0. For more information about decimal digits, see "Column Size, Decimal Digits, Transfer Octet Length, and Display Size" in Appendix D: Data Types. NULL is returned for data types where DECIMAL_DIGITS is not applicable.
    NUM_PREC_RADIX
    -# (ODBC 1.0)
    10SmallintFor numeric data types, either 10 or 2. If it is 10, the values in COLUMN_SIZE and DECIMAL_DIGITS give the number of decimal digits allowed for the column. For example, a DECIMAL(12,5) column would return a NUM_PREC_RADIX of 10, a COLUMN_SIZE of 12, and a DECIMAL_DIGITS of 5; a FLOAT column could return a NUM_PREC_RADIX of 10, a COLUMN_SIZE of 15, and a DECIMAL_DIGITS of NULL. -#

    If it is 2, the values in COLUMN_SIZE and DECIMAL_DIGITS give the number of bits allowed in the column. For example, a FLOAT column could return a RADIX of 2, a COLUMN_SIZE of 53, and a DECIMAL_DIGITS of NULL.

    -# -#

    NULL is returned for data types where NUM_PREC_RADIX is not applicable.

    -#
    NULLABLE
    -# (ODBC 1.0)
    11Smallint not NULLSQL_NO_NULLS if the column could not include NULL values. -#

    SQL_NULLABLE if the column accepts NULL values.

    -# -#

    SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values.

    -# -#

    The value returned for this column is different from the value returned for the IS_NULLABLE column. The NULLABLE column indicates with certainty that a column can accept NULLs, but cannot indicate with certainty that a column does not accept NULLs. The IS_NULLABLE column indicates with certainty that a column cannot accept NULLs, but cannot indicate with certainty that a column accepts NULLs.

    -#
    REMARKS
    -# (ODBC 1.0)
    12VarcharA description of the column.
    COLUMN_DEF
    -# (ODBC 3.0)
    13VarcharThe default value of the column. The value in this column should be interpreted as a string if it is enclosed in quotation marks. -#

    If NULL was specified as the default value, then this column is the word NULL, not enclosed in quotation marks. If the default value cannot be represented without truncation, then this column contains TRUNCATED, with no enclosing single quotation marks. If no default value was specified, then this column is NULL.

    -# -#

    The value of COLUMN_DEF can be used in generating a new column definition, except when it contains the value TRUNCATED.

    -#
    SQL_DATA_TYPE
    -# (ODBC 3.0)
    14Smallint not NULLSQL data type, as it appears in the SQL_DESC_TYPE record field in the IRD. This can be an ODBC SQL data type or a driver-specific SQL data type. This column is the same as the DATA_TYPE column, with the exception of datetime and interval data types. This column returns the nonconcise data type (such as SQL_DATETIME or SQL_INTERVAL), rather than the concise data type (such as SQL_TYPE_DATE or SQL_INTERVAL_YEAR_TO_MONTH) for datetime and interval data types. If this column returns SQL_DATETIME or SQL_INTERVAL, the specific data type can be determined from the SQL_DATETIME_SUB column. For a list of valid ODBC SQL data types, see "SQL Data Types" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver's documentation. -#

    The data types returned for ODBC 3.x and ODBC 2.x applications may be different. For more information, see "Backward Compatibility and Standards Compliance" in Chapter 17: Programming Considerations.

    -#
    SQL_DATETIME_SUB
    -# (ODBC 3.0)
    15SmallintThe subtype code for datetime and interval data types. For other data types, this column returns a NULL. For more information about datetime and interval subcodes, see "SQL_DESC_DATETIME_INTERVAL_CODE" in SQLSetDescField.
    CHAR_OCTET_LENGTH
    -# (ODBC 3.0)
    16IntegerThe maximum length in bytes of a character or binary data type column. For all other data types, this column returns a NULL.
    ORDINAL_POSITION
    -# (ODBC 3.0)
    17Integer not NULLThe ordinal position of the column in the table. The first column in the table is number 1.
    IS_NULLABLE
    -# (ODBC 3.0)
    18Varchar"NO" if the column does not include NULLs. -#

    "YES" if the column could include NULLs.

    -# -#

    This column returns a zero-length string if nullability is unknown.

    -# -#

    ISO rules are followed to determine nullability. An ISO SQL–compliant DBMS cannot return an empty string.

    -# -#

    The value returned for this column is different from the value returned for the NULLABLE column. (See the description of the NULLABLE column.)

    -#
    -# -#

    Code Example

    -# -#

    In the following example, an application declares buffers for the result set returned by SQLColumns. It calls SQLColumns to return a result set that describes each column in the EMPLOYEE table. It then calls SQLBindCol to bind the columns in the result set to the buffers. Finally, the application fetches each row of data with SQLFetch and processes it.

    -# -#
    #define STR_LEN 128+1
    -#	#define REM_LEN 254+1
    -#	
    -#	/* Declare buffers for result set data */
    -#	
    -#	SQLCHAR       szCatalog[STR_LEN], szSchema[STR_LEN];
    -#	SQLCHAR       szTableName[STR_LEN], szColumnName[STR_LEN];
    -#	SQLCHAR       szTypeName[STR_LEN], szRemarks[REM_LEN];
    -#	SQLCHAR       szColumnDefault[STR_LEN], szIsNullable[STR_LEN];
    -#	SQLINTEGER    ColumnSize, BufferLength, CharOctetLength, OrdinalPosition;
    -#	SQLSMALLINT   DataType, DecimalDigits, NumPrecRadix, Nullable;
    -#	SQLSMALLINT   SQLDataType, DatetimeSubtypeCode;
    -#	SQLRETURN     retcode;
    -#	SQLHSTMT      hstmt;
    -#	
    -#	/* Declare buffers for bytes available to return */
    -#	
    -#	SQLINTEGER cbCatalog, cbSchema, cbTableName, cbColumnName;
    -#	SQLINTEGER cbDataType, cbTypeName, cbColumnSize, cbBufferLength;
    -#	SQLINTEGER cbDecimalDigits, cbNumPrecRadix, cbNullable, cbRemarks;
    -#	SQLINTEGER cbColumnDefault, cbSQLDataType, cbDatetimeSubtypeCode, cbCharOctetLength;
    -#	SQLINTEGER cbOrdinalPosition, cbIsNullable;
    -#	
    -#	retcode = SQLColumns(hstmt,
    -#	         NULL, 0,                /* All catalogs */
    -#	         NULL, 0,                /* All schemas */
    -#	         "CUSTOMERS", SQL_NTS,   /* CUSTOMERS table */
    -#	         NULL, 0);               /* All columns */
    -#	
    -#	if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
    -#	
    -#	   /* Bind columns in result set to buffers */
    -#	
    -#	   SQLBindCol(hstmt, 1, SQL_C_CHAR, szCatalog, STR_LEN,&cbCatalog);
    -#	   SQLBindCol(hstmt, 2, SQL_C_CHAR, szSchema, STR_LEN, &cbSchema);
    -#	   SQLBindCol(hstmt, 3, SQL_C_CHAR, szTableName, STR_LEN,&cbTableName);
    -#	   SQLBindCol(hstmt, 4, SQL_C_CHAR, szColumnName, STR_LEN, &cbColumnName);
    -#	   SQLBindCol(hstmt, 5, SQL_C_SSHORT, &DataType, 0, &cbDataType);
    -#	   SQLBindCol(hstmt, 6, SQL_C_CHAR, szTypeName, STR_LEN, &cbTypeName);
    -#	   SQLBindCol(hstmt, 7, SQL_C_SLONG, &ColumnSize, 0, &cbColumnSize);
    -#	   SQLBindCol(hstmt, 8, SQL_C_SLONG, &BufferLength, 0, &cbBufferLength);
    -#	   SQLBindCol(hstmt, 9, SQL_C_SSHORT, &DecimalDigits, 0, &cbDecimalDigits);
    -#	   SQLBindCol(hstmt, 10, SQL_C_SSHORT, &NumPrecRadix, 0, &cbNumPrecRadix);
    -#	   SQLBindCol(hstmt, 11, SQL_C_SSHORT, &Nullable, 0, &cbNullable);
    -#	   SQLBindCol(hstmt, 12, SQL_C_CHAR, szRemarks, REM_LEN, &cbRemarks);
    -#	   SQLBindCol(hstmt, 13, SQL_C_CHAR, szColumnDefault, STR_LEN, &cbColumnDefault);
    -#	SQLBindCol(hstmt, 14, SQL_C_SSHORT, &SQLDataType, 0, &cbSQLDataType);
    -#	   SQLBindCol(hstmt, 15, SQL_C_SSHORT, &DatetimeSubtypeCode, 0,
    -#	      &cbDatetimeSubtypeCode);
    -#	   SQLBindCol(hstmt, 16, SQL_C_SLONG, &CharOctetLength, 0, &cbCharOctetLength);
    -#	   SQLBindCol(hstmt, 17, SQL_C_SLONG, &OrdinalPosition, 0, &cbOrdinalPosition);
    -#	   SQLBindCol(hstmt, 18, SQL_C_CHAR, szIsNullable, STR_LEN, &cbIsNullable);
    -#	   while(TRUE) {
    -#	      retcode = SQLFetch(hstmt);
    -#	      if (retcode == SQL_ERROR || retcode == SQL_SUCCESS_WITH_INFO) {
    -#	         show_error( );
    -#	      }
    -#	      if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){
    -#	            ;   /* Process fetched data */
    -#	      } else {
    -#	         break;
    -#	      }
    -#	   }
    -#	}
    -# -#

    Related Functions

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    For information aboutSee
    Binding a buffer to a column in a result setSQLBindCol
    Canceling statement processingSQLCancel
    Returning privileges for a column or columnsSQLColumnPrivileges
    Fetching a block of data or scrolling through a result setSQLFetchScroll
    Fetching multiple rows of dataSQLFetch
    Returning columns that uniquely identify a row, or columns automatically updated by a transactionSQLSpecialColumns
    Returning table statistics and indexesSQLStatistics
    Returning a list of tables in a data sourceSQLTables
    Returning privileges for a table or tablesSQLTablePrivileges
    -#

    -# -#
    -# -# -# -]; - -# -# odbcsqlprimarykeys.htm -# -$listWhat->{primarykeys} = [ -# -# -# -# SQLPrimaryKeys -# -# -# -# -# -# -#
    -#
    -# -# -# -# -#
    -# ODBC Programmer's Reference -#
    -#
    -#
    -#
    -# -#

    SQLPrimaryKeys

    -# -#

    Conformance

    -# -#

    Version Introduced: ODBC 1.0
    -# Standards Compliance: ODBC

    -# -#

    Summary

    -# -#

    SQLPrimaryKeys returns the column names that make up the primary key for a table. The driver returns the information as a result set. This function does not support returning primary keys from multiple tables in a single call.

    -# -#

    Syntax

    -# -#
    SQLRETURN SQLPrimaryKeys(
    -#	     SQLHSTMT     StatementHandle,
    -#	     SQLCHAR *     CatalogName,
    -#	     SQLSMALLINT     NameLength1,
    -#	     SQLCHAR *     SchemaName,
    -#	     SQLSMALLINT     NameLength2,
    -#	     SQLCHAR *     TableName,
    -#	     SQLSMALLINT     NameLength3);
    -# -#

    Arguments -# -#

    -#
    StatementHandle
    -# -#
    [Input]
    -# Statement handle.
    -# -#
    CatalogName
    -# -#
    [Input]
    -# Catalog name. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have catalogs. CatalogName cannot contain a string search pattern. -# -#

    If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, CatalogName is treated as an identifier and its case is not significant. If it is SQL_FALSE, CatalogName is an ordinary argument; it is treated literally, and its case is significant. For more information, see "Arguments in Catalog Functions" in Chapter 7: Catalog Functions. -#

    -# -#
    NameLength1
    -# -#
    [Input]
    -# Length in bytes of *CatalogName.
    -# -#
    SchemaName
    -# -#
    [Input]
    -# Schema name. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have schemas. SchemaName cannot contain a string search pattern. -# -#

    If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, SchemaName is treated as an identifier and its case is not significant. If it is SQL_FALSE, SchemaName is an ordinary argument; it is treated literally, and its case is not significant. -#

    -# -#
    NameLength2
    -# -#
    [Input]
    -# Length in bytes of *SchemaName.
    -# -#
    TableName
    -# -#
    [Input]
    -# Table name. This argument cannot be a null pointer. TableName cannot contain a string search pattern. -# -#

    If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, TableName is treated as an identifier and its case is not significant. If it is SQL_FALSE, TableName is an ordinary argument; it is treated literally, and its case is not significant. -#

    -# -#
    NameLength3
    -# -#
    [Input]
    -# Length in bytes of *TableName.
    -#
    -# -#

    Returns

    -# -#

    SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

    -# -#

    Diagnostics

    -# -#

    When SQLPrimaryKeys returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by SQLPrimaryKeys and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    SQLSTATEErrorDescription
    01000General warningDriver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)
    08S01Communication link failureThe communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
    24000Invalid cursor state(DM) A cursor was open on the StatementHandle, and SQLFetch or SQLFetchScroll had been called. -#

    A cursor was open on the StatementHandle, but SQLFetch or SQLFetchScroll had not been called.

    -#
    40001Serialization failureThe transaction was rolled back due to a resource deadlock with another transaction.
    40003Statement completion unknownThe associated connection failed during the execution of this function, and the state of the transaction cannot be determined.
    HY000General errorAn error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
    HY001Memory allocation errorThe driver was unable to allocate memory required to support execution or completion of the function.
    HY008Operation canceledAsynchronous processing was enabled for the StatementHandle. The function was called, and before it completed execution, SQLCancel was called on the StatementHandle. Then the function was called again on the StatementHandle. -#

    The function was called, and before it completed execution, SQLCancel was called on the StatementHandle from a different thread in a multithread application.

    -#
    HY009Invalid use of null pointer(DM) The TableName argument was a null pointer. -#

    The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, the CatalogName argument was a null pointer, and SQLGetInfo with the SQL_CATALOG_NAME information type returns that catalog names are supported.

    -# -#

    (DM) The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, and the SchemaName argument was a null pointer.

    -#
    HY010Function sequence error(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called. -#

    (DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.

    -#
    HY013Memory management errorThe function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
    HY090Invalid string or buffer length(DM) The value of one of the name length arguments was less than 0 but not equal to SQL_NTS, and the associated name argument is not a null pointer. -#

    The value of one of the name length arguments exceeded the maximum length value for the corresponding name.

    -#
    HYC00Optional feature not implementedA catalog was specified, and the driver or data source does not support catalogs. -#

    A schema was specified and the driver or data source does not support schemas.

    -# -#

    The combination of the current settings of the SQL_ATTR_CONCURRENCY and SQL_ATTR_CURSOR_TYPE statement attributes was not supported by the driver or data source.

    -# -#

    The SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_VARIABLE, and the SQL_ATTR_CURSOR_TYPE statement attribute was set to a cursor type for which the driver does not support bookmarks.

    -#
    HYT00Timeout expiredThe timeout period expired before the data source returned the requested result set. The timeout period is set through SQLSetStmtAttr, SQL_ATTR_QUERY_TIMEOUT.
    HYT01Connection timeout expiredThe connection timeout period expired before the data source responded to the request. The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
    IM001Driver does not support this function(DM) The driver associated with the StatementHandle does not support the function.
    -# -#

    Comments

    -# -#

    SQLPrimaryKeys returns the results as a standard result set, ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and KEY_SEQ. For information about how this information might be used, see "Uses of Catalog Data" in Chapter 7: Catalog Functions.

    -# -#

    The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility because applications bind by column number.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    ODBC 2.0 columnODBC 3.x column
    TABLE_QUALIFIERTABLE_CAT
    TABLE_OWNERTABLE_SCHEM
    -# -#

    To determine the actual lengths of the TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and COLUMN_NAME columns, call SQLGetInfo with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, SQL_MAX_TABLE_NAME_LEN, and SQL_MAX_COLUMN_NAME_LEN options.

    -# -#

    Note   For more information about the general use, arguments, and returned data of ODBC catalog functions, see Chapter 7: Catalog Functions.

    -# -#

    The following table lists the columns in the result set. Additional columns beyond column 6 (PK_NAME) can be defined by the driver. An application should gain access to driver-specific columns by counting down from the end of the result set rather than specifying an explicit ordinal position. For more information, see "Data Returned by Catalog Functions" in Chapter 7: Catalog Functions.

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# - { name => "table_cat", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "table_schem", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# -# -# -# -# -# - { name => "table_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "column_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "key_seq", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# -# -# -# -# -# - { name => "pk_name", - type => "varchar", - length => 16, - nullable => 1, - }, -#

    -# Column name
    Column number
    -# Data type

    -# Comments
    TABLE_CAT
    -# (ODBC 1.0)
    1VarcharPrimary key table catalog name; NULL if not applicable to the data source. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have catalogs.
    TABLE_SCHEM
    -# (ODBC 1.0)
    2VarcharPrimary key table schema name; NULL if not applicable to the data source. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have schemas.
    TABLE_NAME
    -# (ODBC 1.0)
    3Varchar
    -# not NULL
    Primary key table name.
    COLUMN_NAME
    -# (ODBC 1.0)
    4Varchar
    -# not NULL
    Primary key column name. The driver returns an empty string for a column that does not have a name.
    KEY_SEQ
    -# (ODBC 1.0)
    5Smallint
    -# not NULL
    Column sequence number in key (starting with 1).
    PK_NAME
    -# (ODBC 2.0)
    6VarcharPrimary key name. NULL if not applicable to the data source.
    -# -#

    Code Example

    -# -#

    See SQLForeignKeys.

    -# -#

    Related Functions

    -#
    -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -# -#
    For information aboutSee
    Binding a buffer to a column in a result setSQLBindCol
    Canceling statement processingSQLCancel
    Fetching a block of data or scrolling through a result setSQLFetchScroll
    Fetching a single row or a block of data in a forward-only directionSQLFetch
    Returning the columns of foreign keysSQLForeignKeys
    Returning table statistics and indexesSQLStatistics
    -#

    -# -#
    -# -# -# -]; - -my $list = $listWhat->{$what} or die "$what?"; -my $i4 = " " x 4; -if ($opt eq '-l') { - print join(", ", map($_->{name}, @$list)), "\n"; - exit; -} -if ($opt eq '-c') { - my $pos = 0; - for my $p (@$list) { - print "${i4}ConnSys::Column::Column(\n"; - $pos++; - print "\t$pos,\n"; - print "\t\"" . uc($p->{name}) . "\",\n"; - print "\tfalse,\n"; - print "\tNdbType(NdbType::"; - if ($p->{type} eq 'varchar') { - print "String, 8, $p->{length}"; - } else { - print "Signed, 32, 1"; - } - print ", " . ($p->{nullable} ? "true" : "false"); - print ")\n"; - print "${i4}),\n"; - } - exit; -} -print "$opt?\n"; - -# vim: set sw=4: diff --git a/ndb/src/old_files/client/odbc/docs/type.txt b/ndb/src/old_files/client/odbc/docs/type.txt deleted file mode 100644 index d7b391afc55..00000000000 --- a/ndb/src/old_files/client/odbc/docs/type.txt +++ /dev/null @@ -1,333 +0,0 @@ -ODBC Programmer's Reference -****** SQL Data Types ****** -Each DBMS defines its own SQL types. Each ODBC driver exposes only those SQL -data types that the associated DBMS defines. How a driver maps DBMS SQL types -to the ODBC-defined SQL type identifiers and how a driver maps DBMS SQL types -to its own driver-specific SQL type identifiers are returned through a call to -SQLGetTypeInfo. A driver also returns the SQL data types when describing the -data types of columns and parameters through calls to SQLColAttribute, -SQLColumns, SQLDescribeCol, SQLDescribeParam, SQLProcedureColumns, and -SQLSpecialColumns. -Note The SQL data types are contained in the SQL_DESC_ CONCISE_TYPE, -SQL_DESC_TYPE, and SQL_DESC_DATETIME_INTERVAL_CODE fields of the implementation -descriptors. Characteristics of the SQL data types are contained in the -SQL_DESC_PRECISION, SQL_DESC_SCALE, SQL_DESC_LENGTH, and SQL_DESC_OCTET_LENGTH -fields of the implementation descriptors. For more information, see "Data_Type -Identifiers_and_Descriptors" later in this appendix. -A given driver and data source do not necessarily support all of the SQL data -types defined in this appendix. A driver's support for SQL data types depends -on the level of SQL-92 that the driver conforms to. To determine the level of -SQL-92 grammar supported by the driver, an application calls SQLGetInfo with -the SQL_SQL_CONFORMANCE information type. Furthermore, a given driver and data -source may support additional, driver-specific SQL data types. To determine -which data types a driver supports, an application calls SQLGetTypeInfo. For -information about driver-specific SQL data types, see the driver's -documentation. For information about the data types in a specific data source, -see the documentation for that data source. -Important The tables throughout this appendix are only guidelines and show -commonly used names, ranges, and limits of SQL data types. A given data source -might support only some of the listed data types, and the characteristics of -the supported data types can differ from those listed. -The following table lists valid SQL type identifiers for all SQL data types. -The table also lists the name and description of the corresponding data type -from SQL-92 (if one exists). -SQL type identifier[1] Typical SQL data Typical type description - type[2] -SQL_CHAR CHAR(n) Character string of fixed - string length n. -SQL_VARCHAR VARCHAR(n) Variable-length character - string with a maximum - string length n. -SQL_LONGVARCHAR LONG VARCHAR Variable length character - data. Maximum length is - data source–dependent.[9] -SQL_WCHAR WCHAR(n) Unicode character string - of fixed string length n -SQL_WVARCHAR VARWCHAR(n) Unicode variable-length - character string with a - maximum string length n -SQL_WLONGVARCHAR LONGWVARCHAR Unicode variable-length - character data. Maximum - length is data - source–dependent -SQL_DECIMAL DECIMAL(p,s) Signed, exact, numeric - value with a precision of - at least p and scale s. - (The maximum precision is - driver-defined.) - (1 <= p <= 15; s <= p). - [4] -SQL_NUMERIC NUMERIC(p,s) Signed, exact, numeric - value with a precision p - and scale s - (1 <= p <= 15; s <= p). - [4] -SQL_SMALLINT SMALLINT Exact numeric value with - precision 5 and scale 0 - (signed: - –32,768 <= n <= 32,767, - unsigned: - 0 <= n <= 65,535)[3]. -SQL_INTEGER INTEGER Exact numeric value with - precision 10 and scale 0 - (signed: - –2[31] <= n <= 2[31] – 1, - unsigned: - 0 <= n <= 2[32] – 1)[3]. -SQL_REAL REAL Signed, approximate, - numeric value with a - binary precision 24 (zero - or absolute value 10[–38] - to 10[38]). -SQL_FLOAT FLOAT(p) Signed, approximate, - numeric value with a - binary precision of at - least p. (The maximum - precision is driver- - defined.)[5] -SQL_DOUBLE DOUBLE PRECISION Signed, approximate, - numeric value with a - binary precision 53 (zero - or absolute value 10 - [–308] to 10[308]). -SQL_BIT BIT Single bit binary data. - [8] -SQL_TINYINT TINYINT Exact numeric value with - precision 3 and scale 0 - (signed: - –128 <= n <= 127, - unsigned: - 0 <= n <= 255)[3]. -SQL_BIGINT BIGINT Exact numeric value with - precision 19 (if signed) - or 20 (if unsigned) and - scale 0 - (signed: - –2[63] <= n <= 2[63] – 1, - - unsigned: - 0 <= n <= 2[64] – 1)[3], - [9]. -SQL_BINARY BINARY(n) Binary data of fixed - length n.[9] -SQL_VARBINARY VARBINARY(n) Variable length binary - data of maximum length n. - The maximum is set by the - user.[9] -SQL_LONGVARBINARY LONG VARBINARY Variable length binary - data. Maximum length is - data source–dependent.[9] -SQL_TYPE_DATE[6] DATE Year, month, and day - fields, conforming to the - rules of the Gregorian - calendar. (See - "Constraints_of_the - Gregorian_Calendar," - later in this appendix.) -SQL_TYPE_TIME[6] TIME(p) Hour, minute, and second - fields, with valid values - for hours of 00 to 23, - valid values for minutes - of 00 to 59, and valid - values for seconds of 00 - to 61. Precision p - indicates the seconds - precision. -SQL_TYPE_TIMESTAMP[6] TIMESTAMP(p) Year, month, day, hour, - minute, and second - fields, with valid values - as defined for the DATE - and TIME data types. -SQL_INTERVAL_MONTH[7] INTERVAL MONTH(p) Number of months between - two dates; p is the - interval leading - precision. -SQL_INTERVAL_YEAR[7] INTERVAL YEAR(p) Number of years between - two dates; p is the - interval leading - precision. -SQL_INTERVAL_YEAR_TO_MONTH[7] INTERVAL YEAR(p) TO Number of years and - MONTH months between two dates; - p is the interval leading - precision. -SQL_INTERVAL_DAY[7] INTERVAL DAY(p) Number of days between - two dates; p is the - interval leading - precision. -SQL_INTERVAL_HOUR[7] INTERVAL HOUR(p) Number of hours between - two date/times; p is the - interval leading - precision. -SQL_INTERVAL_MINUTE[7] INTERVAL MINUTE(p) Number of minutes between - two date/times; p is the - interval leading - precision. -SQL_INTERVAL_SECOND[7] INTERVAL SECOND(p,q) Number of seconds between - two date/times; p is the - interval leading - precision and q is the - interval seconds - precision. -SQL_INTERVAL_DAY_TO_HOUR[7] INTERVAL DAY(p) TO HOUR Number of days/hours - between two date/times; p - is the interval leading - precision. -SQL_INTERVAL_DAY_TO_MINUTE[7] INTERVAL DAY(p) TO Number of days/hours/ - MINUTE minutes between two date/ - times; p is the interval - leading precision. -SQL_INTERVAL_DAY_TO_SECOND[7] INTERVAL DAY(p) TO Number of days/hours/ - SECOND(q) minutes/seconds between - two date/times; p is the - interval leading - precision and q is the - interval seconds - precision. -SQL_INTERVAL_HOUR_TO_MINUTE INTERVAL HOUR(p) TO Number of hours/minutes -[7] MINUTE between two date/times; p - is the interval leading - precision. -SQL_INTERVAL_HOUR_TO_SECOND INTERVAL HOUR(p) TO Number of hours/minutes/ -[7] SECOND(q) seconds between two date/ - times; p is the interval - leading precision and q - is the interval seconds - precision. -SQL_INTERVAL_MINUTE_TO_SECOND INTERVAL MINUTE(p) TO Number of minutes/seconds -[7] SECOND(q) between two date/times; p - is the interval leading - precision and q is the - interval seconds - precision. -SQL_GUID GUID Fixed length Globally - Unique Identifier. -[1] This is the value returned in the DATA_TYPE column by a call to -SQLGetTypeInfo. -[2] This is the value returned in the NAME and CREATE PARAMS column by a call -to SQLGetTypeInfo. The NAME column returns the designation—for example, -CHAR—while the CREATE PARAMS column returns a comma-separated list of creation -parameters such as precision, scale, and length. -[3] An application uses SQLGetTypeInfo or SQLColAttribute to determine if a -particular data type or a particular column in a result set is unsigned. -[4] SQL_DECIMAL and SQL_NUMERIC data types differ only in their precision. -The precision of a DECIMAL(p,s) is an implementation-defined decimal precision -that is no less than p, while the precision of a NUMERIC(p,s) is exactly equal -to p. -[5] Depending on the implementation, the precision of SQL_FLOAT can be either -24 or 53: if it is 24, the SQL_FLOAT data type is the same as SQL_REAL; if it -is 53, the SQL_FLOAT data type is the same as SQL_DOUBLE. -[6] In ODBC 3.x, the SQL date, time, and timestamp data types are -SQL_TYPE_DATE, SQL_TYPE_TIME, and SQL_TYPE_TIMESTAMP, respectively; in ODBC -2.x, the data types are SQL_DATE, SQL_TIME, and SQL_TIMESTAMP. -[7] For more information on the interval SQL data types, see the "Interval -Data_Types" section, later in this appendix. -[8] The SQL_BIT data type has different characteristics than the BIT type in -SQL-92. -[9] This data type has no corresponding data type in SQL-92. -ODBC Programmer's Reference -************ CC DDaattaa TTyyppeess ************ -ODBC C data types indicate the data type of C buffers used to store data in the -application. -All drivers must support all C data types. This is required because all drivers -must support all C types to which SQL types that they support can be converted, -and all drivers support at least one character SQL type. Because the character -SQL type can be converted to and from all C types, all drivers must support all -C types. -The C data type is specified in the SSQQLLBBiinnddCCoolland SSQQLLGGeettDDaattaa functions with the -TargetType argument and in the SSQQLLBBiinnddPPaarraammeetteerr function with the ValueType -argument. It can also be specified by calling SSQQLLSSeettDDeessccFFiieelldd to set the -SQL_DESC_CONCISE_TYPE field of an ARD or APD, or by calling SSQQLLSSeettDDeessccRReecc with -the Type argument (and the SubType argument if needed) and the DescriptorHandle -argument set to the handle of an ARD or APD. -The following table lists valid type identifiers for the C data types. The -table also lists the ODBC C data type that corresponds to each identifier and -the definition of this data type. -CC ttyyppee iiddeennttiiffiieerr OODDBBCC CC ttyyppeeddeeff CC ttyyppee -SQL_C_CHAR SQLCHAR * unsigned char * -SQL_C_SSHORT[j] SQLSMALLINT short int -SQL_C_USHORT[j] SQLUSMALLINT unsigned short int -SQL_C_SLONG[j] SQLINTEGER long int -SQL_C_ULONG[j] SQLUINTEGER unsigned long int -SQL_C_FLOAT SQLREAL float -SQL_C_DOUBLE SQLDOUBLE, SQLFLOAT double -SQL_C_BIT SQLCHAR unsigned char -SQL_C_STINYINT[j] SQLSCHAR signed char -SQL_C_UTINYINT[j] SQLCHAR unsigned char -SQL_C_SBIGINT SQLBIGINT _int64[h] -SQL_C_UBIGINT SQLUBIGINT unsigned _int64[h] -SQL_C_BINARY SQLCHAR * unsigned char * -SQL_C_BOOKMARK[i] BOOKMARK unsigned long int[d] -SQL_C_VARBOOKMARK SQLCHAR * unsigned char * -SQL_C_TYPE_DATE[c] SQL_DATE_STRUCT struct tagDATE_STRUCT { - SQLSMALLINT year; - SQLUSMALLINT month; - SQLUSMALLINT day; - } DATE_STRUCT;[a] -SQL_C_TYPE_TIME[c] SQL_TIME_STRUCT struct tagTIME_STRUCT { - SQLUSMALLINT hour; - SQLUSMALLINT minute; - SQLUSMALLINT second; - } TIME_STRUCT;[a] -SQL_C_TYPE_TIMESTAMP[c] SQL_TIMESTAMP_STRUCT struct tagTIMESTAMP_STRUCT { - SQLSMALLINT year; - SQLUSMALLINT month; - SQLUSMALLINT day; - SQLUSMALLINT hour; - SQLUSMALLINT minute; - SQLUSMALLINT second; - SQLUINTEGER fraction;[b] - } TIMESTAMP_STRUCT;[a] -SQL_C_NUMERIC SQL_NUMERIC_STRUCT struct tagSQL_NUMERIC_STRUCT { - SQLCHAR precision; - SQLSCHAR scale; - SQLCHAR sign[g]; - SQLCHAR - val - [SQL_MAX_NUMERIC_L EN]; - [e], [f] - } SQL_NUMERIC_STRUCT; -SQL_C_GUID SQLGUID struct tagSQLGUID { - DWORD Data1; - WORD Data2; - WORD Data3; - BYTE Data4[8]; - } SQLGUID;[k] -All C interval data SQL_INTERVAL_STRUCT See the "_C_ _I_n_t_e_r_v_a_l_ _S_t_r_u_c_t_u_r_e" -types section, later in this appendix. -[a] The values of the year, month, day, hour, minute, and second fields in -the datetime C data types must conform to the constraints of the Gregorian -calendar. (See "_C_o_n_s_t_r_a_i_n_t_s_ _o_f_ _t_h_e_ _G_r_e_g_o_r_i_a_n_ _C_a_l_e_n_d_a_r" later in this appendix.) -[b] The value of the fraction field is the number of billionths of a second -and ranges from 0 through 999,999,999 (1 less than 1 billion). For example, the -value of the fraction field for a half-second is 500,000,000, for a thousandth -of a second (one millisecond) is 1,000,000, for a millionth of a second (one -microsecond) is 1,000, and for a billionth of a second (one nanosecond) is 1. -[c] In ODBC 2.x, the C date, time, and timestamp data types are SQL_C_DATE, -SQL_C_TIME, and SQL_C_TIMESTAMP. -[d] ODBC 3.x applications should use SQL_C_VARBOOKMARK, not SQL_C_BOOKMARK. -When an ODBC 3.x application works with an ODBC 2.x driver, the ODBC 3.x Driver -Manager will map SQL_C_VARBOOKMARK to SQL_C_BOOKMARK. -[e] A number is stored in the val field of the SQL_NUMERIC_STRUCT structure -as a scaled integer, in little endian mode (the leftmost byte being the least- -significant byte). For example, the number 10.001 base 10, with a scale of 4, -is scaled to an integer of 100010. Because this is 186AA in hexadecimal format, -the value in SQL_NUMERIC_STRUCT would be "AA 86 01 00 00 … 00", with the number -of bytes defined by the SQL_MAX_NUMERIC_LEN ##ddeeffiinnee. -[f] The precision and scale fields of the SQL_C_NUMERIC data type are never -used for input from an application, only for output from the driver to the -application. When the driver writes a numeric value into the -SQL_NUMERIC_STRUCT, it will use its own driver-specific default as the value -for the precision field, and it will use the value in the SQL_DESC_SCALE field -of the application descriptor (which defaults to 0) for the scale field. An -application can provide its own values for precision and scale by setting the -SQL_DESC_PRECISION and SQL_DESC_SCALE fields of the application descriptor. -[g] The sign field is 1 if positive, 0 if negative. -[h] _int64 might not be supplied by some compilers. -[i] _SQL_C_BOOKMARK has been deprecated in ODBC 3.x. -[j] _SQL_C_SHORT, SQL_C_LONG, and SQL_C_TINYINT have been replaced in ODBC by -signed and unsigned types: SQL_C_SSHORT and SQL_C_USHORT, SQL_C_SLONG and -SQL_C_ULONG, and SQL_C_STINYINT and SQL_C_UTINYINT. An ODBC 3.x driver that -should work with ODBC 2.x applications should support SQL_C_SHORT, SQL_C_LONG, -and SQL_C_TINYINT, because when they are called, the Driver Manager passes them -through to the driver. -[k] SQL_C_GUID can be converted only to SQL_CHAR or SQL_WCHAR. diff --git a/ndb/src/old_files/client/odbc/driver/Func.data b/ndb/src/old_files/client/odbc/driver/Func.data deleted file mode 100644 index c32671e1135..00000000000 --- a/ndb/src/old_files/client/odbc/driver/Func.data +++ /dev/null @@ -1,2822 +0,0 @@ -$func = { - SQLAllocConnect => { - type => 'SQLRETURN', - name => 'SQLAllocConnect', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - { - type => 'SQLHDBC', - ptr => 1, - name => 'ConnectionHandle', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLAllocEnv => { - type => 'SQLRETURN', - name => 'SQLAllocEnv', - param => [ - { - type => 'SQLHENV', - ptr => 1, - name => 'EnvironmentHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLAllocHandle => { - type => 'SQLRETURN', - name => 'SQLAllocHandle', - param => [ - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'HandleType', - index => 0, - }, - { - type => 'SQLHANDLE', - ptr => 0, - name => 'InputHandle', - index => 1, - }, - { - type => 'SQLHANDLE', - ptr => 1, - name => 'OutputHandle', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLAllocHandleStd => { - type => 'SQLRETURN', - name => 'SQLAllocHandleStd', - param => [ - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'fHandleType', - index => 0, - }, - { - type => 'SQLHANDLE', - ptr => 0, - name => 'hInput', - index => 1, - }, - { - type => 'SQLHANDLE', - ptr => 1, - name => 'phOutput', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLAllocStmt => { - type => 'SQLRETURN', - name => 'SQLAllocStmt', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLHSTMT', - ptr => 1, - name => 'StatementHandle', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLBindCol => { - type => 'SQLRETURN', - name => 'SQLBindCol', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ColumnNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'TargetType', - index => 2, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'TargetValue', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 4, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StrLen_or_Ind', - index => 5, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLBindParam => { - type => 'SQLRETURN', - name => 'SQLBindParam', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ParameterNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ValueType', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ParameterType', - index => 3, - }, - { - type => 'SQLUINTEGER', - ptr => 0, - name => 'LengthPrecision', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ParameterScale', - index => 5, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'ParameterValue', - index => 6, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StrLen_or_Ind', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLBindParameter => { - type => 'SQLRETURN', - name => 'SQLBindParameter', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ipar', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'fParamType', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'fCType', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'fSqlType', - index => 4, - }, - { - type => 'SQLUINTEGER', - ptr => 0, - name => 'cbColDef', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ibScale', - index => 6, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'rgbValue', - index => 7, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'cbValueMax', - index => 8, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'pcbValue', - index => 9, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLBrowseConnect => { - type => 'SQLRETURN', - name => 'SQLBrowseConnect', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'hdbc', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szConnStrIn', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbConnStrIn', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szConnStrOut', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbConnStrOutMax', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pcbConnStrOut', - index => 5, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLBulkOperations => { - type => 'SQLRETURN', - name => 'SQLBulkOperations', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'Operation', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLCancel => { - type => 'SQLRETURN', - name => 'SQLCancel', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLCloseCursor => { - type => 'SQLRETURN', - name => 'SQLCloseCursor', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLColAttribute => { - type => 'SQLRETURN', - name => 'SQLColAttribute', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ColumnNumber', - index => 1, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'FieldIdentifier', - index => 2, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'CharacterAttribute', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'StringLength', - index => 5, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'NumericAttribute', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLColAttributes => { - type => 'SQLRETURN', - name => 'SQLColAttributes', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'icol', - index => 1, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fDescType', - index => 2, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'rgbDesc', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbDescMax', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pcbDesc', - index => 5, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'pfDesc', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLColumnPrivileges => { - type => 'SQLRETURN', - name => 'SQLColumnPrivileges', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szCatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbCatalogName', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbSchemaName', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szTableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbTableName', - index => 6, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szColumnName', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbColumnName', - index => 8, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLColumns => { - type => 'SQLRETURN', - name => 'SQLColumns', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'CatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength1', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'SchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength2', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'TableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength3', - index => 6, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'ColumnName', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength4', - index => 8, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLConnect => { - type => 'SQLRETURN', - name => 'SQLConnect', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'ServerName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength1', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'UserName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength2', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'Authentication', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength3', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLCopyDesc => { - type => 'SQLRETURN', - name => 'SQLCopyDesc', - param => [ - { - type => 'SQLHDESC', - ptr => 0, - name => 'SourceDescHandle', - index => 0, - }, - { - type => 'SQLHDESC', - ptr => 0, - name => 'TargetDescHandle', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLDataSources => { - type => 'SQLRETURN', - name => 'SQLDataSources', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Direction', - index => 1, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'ServerName', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength1', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'NameLength1', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'Description', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength2', - index => 6, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'NameLength2', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLDescribeCol => { - type => 'SQLRETURN', - name => 'SQLDescribeCol', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ColumnNumber', - index => 1, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'ColumnName', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'NameLength', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'DataType', - index => 5, - }, - { - type => 'SQLUINTEGER', - ptr => 1, - name => 'ColumnSize', - index => 6, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'DecimalDigits', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'Nullable', - index => 8, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLDescribeParam => { - type => 'SQLRETURN', - name => 'SQLDescribeParam', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ipar', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pfSqlType', - index => 2, - }, - { - type => 'SQLUINTEGER', - ptr => 1, - name => 'pcbParamDef', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pibScale', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pfNullable', - index => 5, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLDisconnect => { - type => 'SQLRETURN', - name => 'SQLDisconnect', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLDriverConnect => { - type => 'SQLRETURN', - name => 'SQLDriverConnect', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'hdbc', - index => 0, - }, - { - type => 'SQLHWND', - ptr => 0, - name => 'hwnd', - index => 1, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szConnStrIn', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbConnStrIn', - index => 3, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szConnStrOut', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbConnStrOutMax', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pcbConnStrOut', - index => 6, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fDriverCompletion', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLDrivers => { - type => 'SQLRETURN', - name => 'SQLDrivers', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'henv', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fDirection', - index => 1, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szDriverDesc', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbDriverDescMax', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pcbDriverDesc', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szDriverAttributes', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbDrvrAttrMax', - index => 6, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pcbDrvrAttr', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLEndTran => { - type => 'SQLRETURN', - name => 'SQLEndTran', - param => [ - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'HandleType', - index => 0, - }, - { - type => 'SQLHANDLE', - ptr => 0, - name => 'Handle', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'CompletionType', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLError => { - type => 'SQLRETURN', - name => 'SQLError', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 1, - }, - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'Sqlstate', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'NativeError', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'MessageText', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 6, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'TextLength', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLExecDirect => { - type => 'SQLRETURN', - name => 'SQLExecDirect', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'StatementText', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'TextLength', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLExecute => { - type => 'SQLRETURN', - name => 'SQLExecute', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLExtendedFetch => { - type => 'SQLRETURN', - name => 'SQLExtendedFetch', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fFetchType', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'irow', - index => 2, - }, - { - type => 'SQLUINTEGER', - ptr => 1, - name => 'pcrow', - index => 3, - }, - { - type => 'SQLUSMALLINT', - ptr => 1, - name => 'rgfRowStatus', - index => 4, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLFetch => { - type => 'SQLRETURN', - name => 'SQLFetch', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLFetchScroll => { - type => 'SQLRETURN', - name => 'SQLFetchScroll', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'FetchOrientation', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'FetchOffset', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLForeignKeys => { - type => 'SQLRETURN', - name => 'SQLForeignKeys', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szPkCatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbPkCatalogName', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szPkSchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbPkSchemaName', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szPkTableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbPkTableName', - index => 6, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szFkCatalogName', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbFkCatalogName', - index => 8, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szFkSchemaName', - index => 9, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbFkSchemaName', - index => 10, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szFkTableName', - index => 11, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbFkTableName', - index => 12, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLFreeConnect => { - type => 'SQLRETURN', - name => 'SQLFreeConnect', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLFreeEnv => { - type => 'SQLRETURN', - name => 'SQLFreeEnv', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLFreeHandle => { - type => 'SQLRETURN', - name => 'SQLFreeHandle', - param => [ - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'HandleType', - index => 0, - }, - { - type => 'SQLHANDLE', - ptr => 0, - name => 'Handle', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLFreeStmt => { - type => 'SQLRETURN', - name => 'SQLFreeStmt', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Option', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetConnectAttr => { - type => 'SQLRETURN', - name => 'SQLGetConnectAttr', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Attribute', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StringLength', - index => 4, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetConnectOption => { - type => 'SQLRETURN', - name => 'SQLGetConnectOption', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Option', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetCursorName => { - type => 'SQLRETURN', - name => 'SQLGetCursorName', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'CursorName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'NameLength', - index => 3, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetData => { - type => 'SQLRETURN', - name => 'SQLGetData', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ColumnNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'TargetType', - index => 2, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'TargetValue', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 4, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StrLen_or_Ind', - index => 5, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetDescField => { - type => 'SQLRETURN', - name => 'SQLGetDescField', - param => [ - { - type => 'SQLHDESC', - ptr => 0, - name => 'DescriptorHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'RecNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'FieldIdentifier', - index => 2, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 4, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StringLength', - index => 5, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetDescRec => { - type => 'SQLRETURN', - name => 'SQLGetDescRec', - param => [ - { - type => 'SQLHDESC', - ptr => 0, - name => 'DescriptorHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'RecNumber', - index => 1, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'Name', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'StringLength', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'Type', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'SubType', - index => 6, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'Length', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'Precision', - index => 8, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'Scale', - index => 9, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'Nullable', - index => 10, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetDiagField => { - type => 'SQLRETURN', - name => 'SQLGetDiagField', - param => [ - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'HandleType', - index => 0, - }, - { - type => 'SQLHANDLE', - ptr => 0, - name => 'Handle', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'RecNumber', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'DiagIdentifier', - index => 3, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'DiagInfo', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'StringLength', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetDiagRec => { - type => 'SQLRETURN', - name => 'SQLGetDiagRec', - param => [ - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'HandleType', - index => 0, - }, - { - type => 'SQLHANDLE', - ptr => 0, - name => 'Handle', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'RecNumber', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'Sqlstate', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'NativeError', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'MessageText', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 6, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'TextLength', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetEnvAttr => { - type => 'SQLRETURN', - name => 'SQLGetEnvAttr', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Attribute', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StringLength', - index => 4, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetFunctions => { - type => 'SQLRETURN', - name => 'SQLGetFunctions', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'FunctionId', - index => 1, - }, - { - type => 'SQLUSMALLINT', - ptr => 1, - name => 'Supported', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetInfo => { - type => 'SQLRETURN', - name => 'SQLGetInfo', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'InfoType', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'InfoValue', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'BufferLength', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'StringLength', - index => 4, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetStmtAttr => { - type => 'SQLRETURN', - name => 'SQLGetStmtAttr', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Attribute', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StringLength', - index => 4, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLGetStmtOption => { - type => 'SQLRETURN', - name => 'SQLGetStmtOption', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Option', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLGetTypeInfo => { - type => 'SQLRETURN', - name => 'SQLGetTypeInfo', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'DataType', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLMoreResults => { - type => 'SQLRETURN', - name => 'SQLMoreResults', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLNativeSql => { - type => 'SQLRETURN', - name => 'SQLNativeSql', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'hdbc', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSqlStrIn', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'cbSqlStrIn', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSqlStr', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'cbSqlStrMax', - index => 4, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'pcbSqlStr', - index => 5, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLNumParams => { - type => 'SQLRETURN', - name => 'SQLNumParams', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'pcpar', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLNumResultCols => { - type => 'SQLRETURN', - name => 'SQLNumResultCols', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 1, - name => 'ColumnCount', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLParamData => { - type => 'SQLRETURN', - name => 'SQLParamData', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLPOINTER', - ptr => 1, - name => 'Value', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLParamOptions => { - type => 'SQLRETURN', - name => 'SQLParamOptions', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUINTEGER', - ptr => 0, - name => 'crow', - index => 1, - }, - { - type => 'SQLUINTEGER', - ptr => 1, - name => 'pirow', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLPrepare => { - type => 'SQLRETURN', - name => 'SQLPrepare', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'StatementText', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'TextLength', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLPrimaryKeys => { - type => 'SQLRETURN', - name => 'SQLPrimaryKeys', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szCatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbCatalogName', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbSchemaName', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szTableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbTableName', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLProcedureColumns => { - type => 'SQLRETURN', - name => 'SQLProcedureColumns', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szCatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbCatalogName', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbSchemaName', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szProcName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbProcName', - index => 6, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szColumnName', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbColumnName', - index => 8, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLProcedures => { - type => 'SQLRETURN', - name => 'SQLProcedures', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szCatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbCatalogName', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbSchemaName', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szProcName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbProcName', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLPutData => { - type => 'SQLRETURN', - name => 'SQLPutData', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Data', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'StrLen_or_Ind', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLRowCount => { - type => 'SQLRETURN', - name => 'SQLRowCount', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'RowCount', - index => 1, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSetConnectAttr => { - type => 'SQLRETURN', - name => 'SQLSetConnectAttr', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Attribute', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'StringLength', - index => 3, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLSetConnectOption => { - type => 'SQLRETURN', - name => 'SQLSetConnectOption', - param => [ - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Option', - index => 1, - }, - { - type => 'SQLUINTEGER', - ptr => 0, - name => 'Value', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSetCursorName => { - type => 'SQLRETURN', - name => 'SQLSetCursorName', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'CursorName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSetDescField => { - type => 'SQLRETURN', - name => 'SQLSetDescField', - param => [ - { - type => 'SQLHDESC', - ptr => 0, - name => 'DescriptorHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'RecNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'FieldIdentifier', - index => 2, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'BufferLength', - index => 4, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLSetDescRec => { - type => 'SQLRETURN', - name => 'SQLSetDescRec', - param => [ - { - type => 'SQLHDESC', - ptr => 0, - name => 'DescriptorHandle', - index => 0, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'RecNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'Type', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'SubType', - index => 3, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Length', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'Precision', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'Scale', - index => 6, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Data', - index => 7, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StringLength', - index => 8, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'Indicator', - index => 9, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLSetEnvAttr => { - type => 'SQLRETURN', - name => 'SQLSetEnvAttr', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Attribute', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'StringLength', - index => 3, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLSetParam => { - type => 'SQLRETURN', - name => 'SQLSetParam', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'ParameterNumber', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ValueType', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ParameterType', - index => 3, - }, - { - type => 'SQLUINTEGER', - ptr => 0, - name => 'LengthPrecision', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'ParameterScale', - index => 5, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'ParameterValue', - index => 6, - }, - { - type => 'SQLINTEGER', - ptr => 1, - name => 'StrLen_or_Ind', - index => 7, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSetPos => { - type => 'SQLRETURN', - name => 'SQLSetPos', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'irow', - index => 1, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fOption', - index => 2, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fLock', - index => 3, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSetScrollOptions => { - type => 'SQLRETURN', - name => 'SQLSetScrollOptions', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'fConcurrency', - index => 1, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'crowKeyset', - index => 2, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'crowRowset', - index => 3, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSetStmtAttr => { - type => 'SQLRETURN', - name => 'SQLSetStmtAttr', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'Attribute', - index => 1, - }, - { - type => 'SQLPOINTER', - ptr => 0, - name => 'Value', - index => 2, - }, - { - type => 'SQLINTEGER', - ptr => 0, - name => 'StringLength', - index => 3, - }, - ], - odbcver => 'ODBCVER >= 0x0300', - }, - SQLSetStmtOption => { - type => 'SQLRETURN', - name => 'SQLSetStmtOption', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Option', - index => 1, - }, - { - type => 'SQLUINTEGER', - ptr => 0, - name => 'Value', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLSpecialColumns => { - type => 'SQLRETURN', - name => 'SQLSpecialColumns', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'IdentifierType', - index => 1, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'CatalogName', - index => 2, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength1', - index => 3, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'SchemaName', - index => 4, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength2', - index => 5, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'TableName', - index => 6, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength3', - index => 7, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Scope', - index => 8, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Nullable', - index => 9, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLStatistics => { - type => 'SQLRETURN', - name => 'SQLStatistics', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'CatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength1', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'SchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength2', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'TableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength3', - index => 6, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Unique', - index => 7, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'Reserved', - index => 8, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLTablePrivileges => { - type => 'SQLRETURN', - name => 'SQLTablePrivileges', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'hstmt', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szCatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbCatalogName', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szSchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbSchemaName', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'szTableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'cbTableName', - index => 6, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLTables => { - type => 'SQLRETURN', - name => 'SQLTables', - param => [ - { - type => 'SQLHSTMT', - ptr => 0, - name => 'StatementHandle', - index => 0, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'CatalogName', - index => 1, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength1', - index => 2, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'SchemaName', - index => 3, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength2', - index => 4, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'TableName', - index => 5, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength3', - index => 6, - }, - { - type => 'SQLCHAR', - ptr => 1, - name => 'TableType', - index => 7, - }, - { - type => 'SQLSMALLINT', - ptr => 0, - name => 'NameLength4', - index => 8, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, - SQLTransact => { - type => 'SQLRETURN', - name => 'SQLTransact', - param => [ - { - type => 'SQLHENV', - ptr => 0, - name => 'EnvironmentHandle', - index => 0, - }, - { - type => 'SQLHDBC', - ptr => 0, - name => 'ConnectionHandle', - index => 1, - }, - { - type => 'SQLUSMALLINT', - ptr => 0, - name => 'CompletionType', - index => 2, - }, - ], - odbcver => 'ODBCVER >= 0x0000', - }, -}; diff --git a/ndb/src/old_files/client/odbc/driver/Func.pl b/ndb/src/old_files/client/odbc/driver/Func.pl deleted file mode 100644 index 1064a6a6c6e..00000000000 --- a/ndb/src/old_files/client/odbc/driver/Func.pl +++ /dev/null @@ -1,352 +0,0 @@ -# - -use strict; -select(STDOUT); -$| = 1; -use vars qw($func); - -my $action = shift; -my @args = @ARGV; -if (! $action) { - print < ... -data -unixodbc -- write new Func.data to stdout -name [-[no]auto -type] [suffix] -- list function names -code -- write auto/*.cpp -diff -- diff against auto/*.cpp -move -- move auto/*.cpp to . -functab -- write struct entiries for SQLGetFunctions -END - exit(0); -} - -# indents -my $i1 = " " x (1*4); -my $i2 = " " x (2*4); -my $i3 = " " x (3*4); -my $i4 = " " x (4*4); - -if ($action eq 'data') { - my @entry = (); - while (@args) { - my $file = shift(@args); - if ($file eq '-unixodbc') { - unshift(@args, ); - next; - } - if ($file eq '-iodbc') { - unshift(@args, ); - next; - } - warn "read $file\n"; - open(F, "<$file") || die "$file: $!"; - my $text = undef; - my $odbcver = undef; - while ($_ = ) { - chomp; - if (/^\s*$/) { - next; - } - if (/^\s*#\s*if\s+(.*\bODBCVER\b.*)$/) { - $odbcver = $1; - $odbcver =~ s/^\s+|\s+$//g; - $odbcver =~ s/^\(+|\)+$//g; - next; - } - if (/^\s*#\s*endif\b/) { - $odbcver = undef; - next; - } - if (/^\s*SQLRETURN\b/) { - $text = ""; - } - if (defined($text)) { - $text .= $_; - if (/;\s*$/) { - push(@entry, { - text => $text, - odbcver => $odbcver || 'ODBCVER >= 0x0000', - }); - $text = undef; - } - } - } - close(F); - } - warn "@{[ scalar @entry ]} entries\n"; - $func = {}; - for my $e (@entry) { - my $text = $e->{text}; - $text =~ s!/\*.+?\*/!!g; - $text =~ s/^\s+|\s+$//g; - $text =~ s/\s\s*/\040/g; - $text =~ /^(SQLRETURN)\s+(SQL_API\s+)?(\w+)\s*\((.*)\)\s*;/ - or warn "discard: $_\n", next; - my $type = $1; - my $name = $3; - my $body = $4; - my $f = {}; - $f->{type} = $type; - $f->{name} = $name; - my @body = split(/,/, $body); - my $param = []; - for my $s (@body) { - $s =~ s/^\s+|\s+$//g; - my($ptype, $pptr, $pname); - if ($s =~ /^(\w+)\s+(\w+)$/) { - $ptype = $1; - $pptr = 0; - $pname = $2; - } elsif ($s =~ /^(\w+)\s*\*\s*(\w+)$/) { - $ptype = $1; - $pptr = 1; - $pname = $2; - } else { - warn "discard: $name: param $s\n"; - $param = undef; - last; - } - my $pindex = scalar @$param; - push(@$param, { - type => $ptype, - ptr => $pptr, - name => $pname, - index => $pindex, - }); - } - $param or next; - $f->{param} = $param; - $f->{odbcver} = $e->{odbcver}; - $func->{$name} - and warn "duplicate: $name\n", next; - $func->{$name} = $f; - } - print "\$func = {\n"; - for my $name (sort keys %$func) { - my $f = $func->{$name}; - print "${i1}$name => {\n"; - print "${i2}type => '$f->{type}',\n"; - print "${i2}name => '$f->{name}',\n"; - print "${i2}param => [\n"; - for my $p (@{$f->{param}}) { - print "${i3}\{\n"; - print "${i4}type => '$p->{type}',\n"; - print "${i4}ptr => $p->{ptr},\n"; - print "${i4}name => '$p->{name}',\n"; - print "${i4}index => $p->{index},\n"; - print "${i3}\},\n"; - } - print "${i2}],\n"; - print "${i2}odbcver => '$f->{odbcver}',\n"; - print "${i1}},\n"; - } - printf "};\n"; - $action = undef; -} - -if ($action eq 'name') { - my %functab = (); # bit in FuncTab - my $functab = "../handles/FuncTab.cpp"; - if (! open(F, "<$functab")) { - warn "$functab: $!"; - } else { - while ($_ = ) { - if (/SQL_API_([A-Z]+)[\s,]*([01])/) { - defined $functab{$1} and die "$_"; - $functab{$1} = $2; - } - } - close(F); - } - require './Func.data'; - my $auto = 1; - my $noauto = 1; - my $type = 0; - while ($args[0] =~ /^-(\w+)$/) { - $noauto = 0 if $1 eq 'auto'; - $auto = 0 if $1 eq 'noauto'; - $type = 1 if $1 eq 'type'; - shift(@args); - } - my $suffix = shift(@args); - for my $name (sort keys %$func) { - my $f = $func->{$name}; - local $/ = undef; - my($x1); - if (open(F, "<$name.cpp")) { - $x1 = ; - close(F); - if ($x1 =~ /\bauto_$name\b/) { - $auto || next; - print "A " if $type; - } else { - $noauto || next; - print "- " if $type; - } - if ($type) { - my $y = $functab{uc $name}; - $y = "?" if $y !~ /^[01]$/; - print "$y "; - my $z = $f->{odbcver}; - $z =~ s/^.*(...)$/$1/; - print "$z "; - } - } - print "$name$suffix\n"; - } - $action = undef; -} - -if ($action eq 'code') { - require './Func.data'; - system("rm -rf auto; mkdir auto"); - for my $name (sort keys %$func) { - my $f = $func->{$name}; - my $file = "auto/$name.cpp"; - open(F, ">$file") || die "$file: $!\n"; - print F "#include \"driver.hpp\"\n"; - print F "\n"; - printf F "#if $f->{odbcver}\n"; - print F "$f->{type} SQL_API\n"; - print F "$f->{name}("; - for my $p (@{$f->{param}}) { - print F "," if $p->{index} > 0; - print F "\n${i1}$p->{type}"; - for (my $i = 0; $i < $p->{ptr}; $i++) { - print F "*"; - } - print F " $p->{name}"; - } - print F ")\n"; - print F "{\n"; - print F "${i1}const char* const sqlFunction = \"$f->{name}\";\n"; - print F "#ifndef auto_$name\n"; - print F "${i1}Ctx ctx;\n"; - print F "${i1}ctx.log(1, \"*** not implemented: %s\", sqlFunction);\n"; - print F "${i1}return SQL_ERROR;\n"; - print F "#else\n"; - my @ihandle = (); - my @ohandle = (); - for my $p (@{$f->{param}}) { - if ($p->{type} =~ /^SQLH(ENV|DBC|STMT|DESC)$/) { - $p->{btype} = lc $1; - my $h = ! $p->{ptr} ? \@ihandle : \@ohandle; - push(@$h, $p); - } - } - if (! @ihandle) { # use root handle instance - push(@ihandle, { - type => 'SQLHROOT', - name => '(SQLHANDLE*)0', - }); - } - for my $p (@ihandle, @ohandle) { - $p->{htype} = "Handle" . (ucfirst lc $p->{btype}); - $p->{hname} = "p" . (ucfirst lc $p->{btype}); - } - if (@ihandle) { - print F "${i1}HandleRoot* const pRoot = HandleRoot::instance();\n"; - } - for my $p (@ihandle) { - print F "${i1}$p->{htype}* $p->{hname} = "; - print F "pRoot->find" . ucfirst($p->{btype}). "($p->{name});\n"; - print F "${i1}if ($p->{hname} == 0)\n"; - print F "${i2}return SQL_INVALID_HANDLE;\n"; - } - { - my $p = $ihandle[0]; - print F "${i1}Ctx& ctx = $p->{hname}->initCtx();\n"; - print F "${i1}ctx.logSqlEnter(sqlFunction);\n"; - } - for my $p (@ohandle) { - print F "${i1}$p->{htype}* $p->{hname} = 0;\n"; - } - { - my $p = $ihandle[0]; - my $fname = $f->{name}; - $fname =~ s/^SQL/sql/; # keep sql prefix - print F "${i1}if (ctx.ok())\n"; - print F "${i2}$p->{hname}->$fname(\n"; - print F "${i3}ctx"; - } - for my $p (@{$f->{param}}) { - if ($p == $ihandle[0]) { - next; - } - print F ","; - print F "\n${i3}"; - if (grep($_ == $p, @ihandle)) { - print F "$p->{hname}"; - } elsif (grep($_ == $p, @ohandle)) { - print F "$p->{name} != 0 ? &$p->{hname} : 0"; - } else { - print F "&" if $p->{ptr} > 0; - print F "$p->{name}"; - } - } - print F "\n${i2});\n"; - for my $p (@ohandle) { - print F "${i1}if ($p->{name} != 0)\n"; - print F "${i2}*$p->{name} = "; - print F "pRoot->from" . ucfirst($p->{btype}) . "($p->{hname});\n"; - } - { - my $p = $ihandle[0]; - print F "${i1}$p->{hname}->saveCtx(ctx);\n"; - } - print F "${i1}ctx.logSqlExit();\n"; - print F "${i1}return ctx.getCode();\n"; - print F "#endif\n"; - print F "}\n"; - print F "#endif // $f->{odbcver}\n"; - close(F); - } - $action = undef; -} - -if ($action eq 'diff' || $action eq 'move') { - require './Func.data'; - for my $name (sort keys %$func) { - local $/ = undef; - my($x1, $x2); - if (open(F, "<$name.cpp")) { - $x1 = ; - close(F); - if ($x1 !~ /\bauto_$name\b/) { - warn "$name.cpp: not auto-generated\n" if $action eq 'move'; - next; - } - } - if (! open(F, "; - close(F); - if ($x1 eq $x2) { - warn "$name: no changes\n" if $action eq 'move'; - next; - } - if ($action eq 'diff') { - print "=" x 40, "\n"; - print "diff $name.cpp auto/", "\n"; - system("diff $name.cpp auto/$name.cpp"); - } else { - rename("auto/$name.cpp", "$name.cpp") - or die "rename $name: $!\n"; - warn "$name: updated\n" if 0; - } - } - $action = undef; -} - -if ($action eq 'functab') { - require './Func.data'; - for my $name (sort keys %$func) { - printf "%4s{%3s%-30s, 0 },\n", "", "", uc "SQL_API_$name"; - } - $action = undef; -} - -$action && die "$action: undefined\n"; - -# vim: set sw=4: diff --git a/ndb/src/old_files/client/odbc/driver/Makefile b/ndb/src/old_files/client/odbc/driver/Makefile deleted file mode 100644 index 62f82371da4..00000000000 --- a/ndb/src/old_files/client/odbc/driver/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include .defs.mk - -TYPE = * - -NONPIC_ARCHIVE = N - -PIC_ARCHIVE = Y - -ARCHIVE_TARGET = odbcdriver - -SOURCES = driver.cpp - -SOURCES_EXTRA = $(shell perl Func.pl name .cpp) - -include ../Extra.mk -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp deleted file mode 100644 index a7ffd8c89d1..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp +++ /dev/null @@ -1,52 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLAllocConnect( - SQLHENV EnvironmentHandle, - SQLHDBC* ConnectionHandle) -{ - driver_enter(SQL_API_SQLALLOCCONNECT); - const char* const sqlFunction = "SQLAllocConnect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLALLOCCONNECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleDbc* pDbc = 0; - HandleDbc** ppDbc = 0; - if (ConnectionHandle != 0) - ppDbc = &pDbc; - try { - pEnv->sqlAllocConnect(ctx, ppDbc); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (ConnectionHandle != 0) - *ConnectionHandle = static_cast(pDbc); - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCCONNECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp deleted file mode 100644 index a62dae61008..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp +++ /dev/null @@ -1,46 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLAllocEnv( - SQLHENV* EnvironmentHandle) -{ - driver_enter(SQL_API_SQLALLOCENV); - const char* const sqlFunction = "SQLAllocEnv"; - HandleRoot* const pRoot = HandleRoot::instance(); - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleEnv* pEnv = 0; - HandleEnv** ppEnv = 0; - if (EnvironmentHandle != 0) - ppEnv = &pEnv; - try { - pRoot->sqlAllocEnv(ctx, ppEnv); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (EnvironmentHandle != 0) - *EnvironmentHandle = static_cast(pEnv); - pRoot->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCENV); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp deleted file mode 100644 index 9daf6ead946..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp +++ /dev/null @@ -1,62 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLAllocHandle( - SQLSMALLINT HandleType, - SQLHANDLE InputHandle, - SQLHANDLE* OutputHandle) -{ - driver_enter(SQL_API_SQLALLOCHANDLE); - const char* const sqlFunction = "SQLAllocHandle"; - HandleRoot* const pRoot = HandleRoot::instance(); - SQLSMALLINT parentType = pRoot->findParentType(HandleType); - if (parentType == -1) { - driver_exit(SQL_API_SQLALLOCHANDLE); - return SQL_INVALID_HANDLE; - } - HandleBase* pParent = pRoot->findBase(parentType, InputHandle); - if (pParent == 0) { - driver_exit(SQL_API_SQLALLOCHANDLE); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleBase* pChild = 0; - HandleBase** ppChild = 0; - if (OutputHandle != 0) - ppChild = &pChild; - try { - pParent->sqlAllocHandle(ctx, HandleType, ppChild); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (OutputHandle != 0) - *OutputHandle = static_cast(pChild); - if (pRoot == pParent) - pRoot->lockHandle(); - pParent->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - if (pRoot == pParent) - pRoot->unlockHandle(); - driver_exit(SQL_API_SQLALLOCHANDLE); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp deleted file mode 100644 index 61290e37b7b..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp +++ /dev/null @@ -1,56 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLAllocHandleStd( - SQLSMALLINT fHandleType, - SQLHANDLE hInput, - SQLHANDLE* phOutput) -{ -#ifndef auto_SQLAllocHandleStd - const char* const sqlFunction = "SQLAllocHandleStd"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLALLOCHANDLESTD); - const char* const sqlFunction = "SQLAllocHandleStd"; - HandleRoot* const pRoot = HandleRoot::instance(); - Handle* p = pRoot->find((SQLHANDLE*)0); - if (p == 0) { - driver_exit(SQL_API_SQLALLOCHANDLESTD); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - p->sqlAllocHandleStd( - ctx, - fHandleType, - hInput, - &phOutput - ); - p->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCHANDLESTD); - return ret; -#endif -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp deleted file mode 100644 index bf3f149f5de..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp +++ /dev/null @@ -1,52 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLAllocStmt( - SQLHDBC ConnectionHandle, - SQLHSTMT* StatementHandle) -{ - driver_enter(SQL_API_SQLALLOCSTMT); - const char* const sqlFunction = "SQLAllocStmt"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLALLOCSTMT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleStmt* pStmt = 0; - HandleStmt** ppStmt = 0; - if (StatementHandle != 0) - ppStmt = &pStmt; - try { - pDbc->sqlAllocStmt(ctx, ppStmt); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (StatementHandle != 0) - *StatementHandle = static_cast(pStmt); - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCSTMT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp b/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp deleted file mode 100644 index 5562334e8cc..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp +++ /dev/null @@ -1,50 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLBindCol( - SQLHSTMT StatementHandle, - SQLUSMALLINT ColumnNumber, - SQLSMALLINT TargetType, - SQLPOINTER TargetValue, - SQLINTEGER BufferLength, - SQLINTEGER* StrLen_or_Ind) -{ - driver_enter(SQL_API_SQLBINDCOL); - const char* const sqlFunction = "SQLBindCol"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLBINDCOL); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlBindCol(ctx, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLBINDCOL); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp b/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp deleted file mode 100644 index 2fcc17b872f..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp +++ /dev/null @@ -1,52 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLBindParam( - SQLHSTMT StatementHandle, - SQLUSMALLINT ParameterNumber, - SQLSMALLINT ValueType, - SQLSMALLINT ParameterType, - SQLUINTEGER LengthPrecision, - SQLSMALLINT ParameterScale, - SQLPOINTER ParameterValue, - SQLINTEGER* StrLen_or_Ind) -{ - driver_enter(SQL_API_SQLBINDPARAM); - const char* const sqlFunction = "SQLBindParam"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLBINDPARAM); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlBindParam(ctx, ParameterNumber, ValueType, ParameterType, LengthPrecision, ParameterScale, ParameterValue, StrLen_or_Ind); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLBINDPARAM); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp b/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp deleted file mode 100644 index e4ca5bbc731..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp +++ /dev/null @@ -1,54 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLBindParameter( - SQLHSTMT hstmt, - SQLUSMALLINT ipar, - SQLSMALLINT fParamType, - SQLSMALLINT fCType, - SQLSMALLINT fSqlType, - SQLUINTEGER cbColDef, - SQLSMALLINT ibScale, - SQLPOINTER rgbValue, - SQLINTEGER cbValueMax, - SQLINTEGER* pcbValue) -{ - driver_enter(SQL_API_SQLBINDPARAMETER); - const char* const sqlFunction = "SQLBindParameter"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLBINDPARAMETER); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlBindParameter(ctx, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax, pcbValue); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLBINDPARAMETER); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp deleted file mode 100644 index 7e629e199e5..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp +++ /dev/null @@ -1,61 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLBrowseConnect( - SQLHDBC hdbc, - SQLCHAR* szConnStrIn, - SQLSMALLINT cbConnStrIn, - SQLCHAR* szConnStrOut, - SQLSMALLINT cbConnStrOutMax, - SQLSMALLINT* pcbConnStrOut) -{ -#ifndef auto_SQLBrowseConnect - const char* const sqlFunction = "SQLBrowseConnect"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLBROWSECONNECT); - const char* const sqlFunction = "SQLBrowseConnect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(hdbc); - if (pDbc == 0) { - driver_exit(SQL_API_SQLBROWSECONNECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pDbc->sqlBrowseConnect( - ctx, - &szConnStrIn, - cbConnStrIn, - &szConnStrOut, - cbConnStrOutMax, - &pcbConnStrOut - ); - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLBROWSECONNECT); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp b/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp deleted file mode 100644 index 7d256d66e3f..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp +++ /dev/null @@ -1,53 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLBulkOperations( - SQLHSTMT StatementHandle, - SQLSMALLINT Operation) -{ -#ifndef auto_SQLBulkOperations - const char* const sqlFunction = "SQLBulkOperations"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLBULKOPERATIONS); - const char* const sqlFunction = "SQLBulkOperations"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLBULKOPERATIONS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlBulkOperations( - ctx, - Operation - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLBULKOPERATIONS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp b/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp deleted file mode 100644 index ac4e43c6e89..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp +++ /dev/null @@ -1,45 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLCancel( - SQLHSTMT StatementHandle) -{ - driver_enter(SQL_API_SQLCANCEL); - const char* const sqlFunction = "SQLCancel"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLCANCEL); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlCancel(ctx); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCANCEL); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp b/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp deleted file mode 100644 index 26d88c91e3b..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp +++ /dev/null @@ -1,45 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLCloseCursor( - SQLHSTMT StatementHandle) -{ - driver_enter(SQL_API_SQLCLOSECURSOR); - const char* const sqlFunction = "SQLCloseCursor"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLCLOSECURSOR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlCloseCursor(ctx); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCLOSECURSOR); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp b/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp deleted file mode 100644 index 0e7e5446932..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp +++ /dev/null @@ -1,51 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLColAttribute( - SQLHSTMT StatementHandle, - SQLUSMALLINT ColumnNumber, - SQLUSMALLINT FieldIdentifier, - SQLPOINTER CharacterAttribute, - SQLSMALLINT BufferLength, - SQLSMALLINT* StringLength, - SQLPOINTER NumericAttribute) -{ - driver_enter(SQL_API_SQLCOLATTRIBUTE); - const char* const sqlFunction = "SQLColAttribute"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLCOLATTRIBUTE); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlColAttribute(ctx, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, StringLength, NumericAttribute); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCOLATTRIBUTE); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp b/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp deleted file mode 100644 index 05a4c1d4d37..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp +++ /dev/null @@ -1,51 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLColAttributes( - SQLHSTMT hstmt, - SQLUSMALLINT icol, - SQLUSMALLINT fDescType, - SQLPOINTER rgbDesc, - SQLSMALLINT cbDescMax, - SQLSMALLINT* pcbDesc, - SQLINTEGER* pfDesc) -{ - driver_enter(SQL_API_SQLCOLATTRIBUTES); - const char* const sqlFunction = "SQLColAttributes"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLCOLATTRIBUTES); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlColAttributes(ctx, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCOLATTRIBUTES); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp b/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp deleted file mode 100644 index cfbc9c2bc57..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp +++ /dev/null @@ -1,67 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLColumnPrivileges( - SQLHSTMT hstmt, - SQLCHAR* szCatalogName, - SQLSMALLINT cbCatalogName, - SQLCHAR* szSchemaName, - SQLSMALLINT cbSchemaName, - SQLCHAR* szTableName, - SQLSMALLINT cbTableName, - SQLCHAR* szColumnName, - SQLSMALLINT cbColumnName) -{ -#ifndef auto_SQLColumnPrivileges - const char* const sqlFunction = "SQLColumnPrivileges"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLCOLUMNPRIVILEGES); - const char* const sqlFunction = "SQLColumnPrivileges"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLCOLUMNPRIVILEGES); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlColumnPrivileges( - ctx, - &szCatalogName, - cbCatalogName, - &szSchemaName, - cbSchemaName, - &szTableName, - cbTableName, - &szColumnName, - cbColumnName - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCOLUMNPRIVILEGES); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp b/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp deleted file mode 100644 index 4e0b646ee7d..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLColumns( - SQLHSTMT StatementHandle, - SQLCHAR* CatalogName, - SQLSMALLINT NameLength1, - SQLCHAR* SchemaName, - SQLSMALLINT NameLength2, - SQLCHAR* TableName, - SQLSMALLINT NameLength3, - SQLCHAR* ColumnName, - SQLSMALLINT NameLength4) -{ - driver_enter(SQL_API_SQLCOLUMNS); - const char* const sqlFunction = "SQLColumns"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLCOLUMNS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - pStmt->sqlColumns(ctx, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCOLUMNS); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp deleted file mode 100644 index d8f30ed47e7..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp +++ /dev/null @@ -1,51 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLConnect( - SQLHDBC ConnectionHandle, - SQLCHAR* ServerName, - SQLSMALLINT NameLength1, - SQLCHAR* UserName, - SQLSMALLINT NameLength2, - SQLCHAR* Authentication, - SQLSMALLINT NameLength3) -{ - driver_enter(SQL_API_SQLCONNECT); - const char* const sqlFunction = "SQLConnect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLCONNECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlConnect(ctx, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCONNECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp b/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp deleted file mode 100644 index b4d4b2e4122..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp +++ /dev/null @@ -1,58 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLCopyDesc( - SQLHDESC SourceDescHandle, - SQLHDESC TargetDescHandle) -{ -#ifndef auto_SQLCopyDesc - const char* const sqlFunction = "SQLCopyDesc"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLCOPYDESC); - const char* const sqlFunction = "SQLCopyDesc"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDesc* pDesc = pRoot->findDesc(SourceDescHandle); - if (pDesc == 0) { - driver_exit(SQL_API_SQLCOPYDESC); - return SQL_INVALID_HANDLE; - } - HandleDesc* pDesc = pRoot->findDesc(TargetDescHandle); - if (pDesc == 0) { - driver_exit(SQL_API_SQLCOPYDESC); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pDesc->sqlCopyDesc( - ctx, - pDesc - ); - pDesc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLCOPYDESC); - return ret; -#endif -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp b/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp deleted file mode 100644 index 6115e7175f9..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp +++ /dev/null @@ -1,65 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLDataSources( - SQLHENV EnvironmentHandle, - SQLUSMALLINT Direction, - SQLCHAR* ServerName, - SQLSMALLINT BufferLength1, - SQLSMALLINT* NameLength1, - SQLCHAR* Description, - SQLSMALLINT BufferLength2, - SQLSMALLINT* NameLength2) -{ -#ifndef auto_SQLDataSources - const char* const sqlFunction = "SQLDataSources"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLDATASOURCES); - const char* const sqlFunction = "SQLDataSources"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLDATASOURCES); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pEnv->sqlDataSources( - ctx, - Direction, - &ServerName, - BufferLength1, - &NameLength1, - &Description, - BufferLength2, - &NameLength2 - ); - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLDATASOURCES); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp b/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp deleted file mode 100644 index f15ce8962f1..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp +++ /dev/null @@ -1,53 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLDescribeCol( - SQLHSTMT StatementHandle, - SQLUSMALLINT ColumnNumber, - SQLCHAR* ColumnName, - SQLSMALLINT BufferLength, - SQLSMALLINT* NameLength, - SQLSMALLINT* DataType, - SQLUINTEGER* ColumnSize, - SQLSMALLINT* DecimalDigits, - SQLSMALLINT* Nullable) -{ - driver_enter(SQL_API_SQLDESCRIBECOL); - const char* const sqlFunction = "SQLDescribeCol"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLDESCRIBECOL); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlDescribeCol(ctx, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLDESCRIBECOL); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp b/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp deleted file mode 100644 index beff41396fe..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp +++ /dev/null @@ -1,50 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLDescribeParam( - SQLHSTMT hstmt, - SQLUSMALLINT ipar, - SQLSMALLINT* pfSqlType, - SQLUINTEGER* pcbParamDef, - SQLSMALLINT* pibScale, - SQLSMALLINT* pfNullable) -{ - driver_enter(SQL_API_SQLDESCRIBEPARAM); - const char* const sqlFunction = "SQLDescribeParam"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLDESCRIBEPARAM); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlDescribeParam(ctx, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLDESCRIBEPARAM); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp deleted file mode 100644 index 75db5604da8..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp +++ /dev/null @@ -1,45 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLDisconnect( - SQLHDBC ConnectionHandle) -{ - driver_enter(SQL_API_SQLDISCONNECT); - const char* const sqlFunction = "SQLDisconnect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLDISCONNECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlDisconnect(ctx); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLDISCONNECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp deleted file mode 100644 index 340babd8523..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp +++ /dev/null @@ -1,52 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLDriverConnect( - SQLHDBC hdbc, - SQLHWND hwnd, - SQLCHAR* szConnStrIn, - SQLSMALLINT cbConnStrIn, - SQLCHAR* szConnStrOut, - SQLSMALLINT cbConnStrOutMax, - SQLSMALLINT* pcbConnStrOut, - SQLUSMALLINT fDriverCompletion) -{ - driver_enter(SQL_API_SQLDRIVERCONNECT); - const char* const sqlFunction = "SQLDriverConnect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(hdbc); - if (pDbc == 0) { - driver_exit(SQL_API_SQLDRIVERCONNECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlDriverConnect(ctx, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLDRIVERCONNECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp b/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp deleted file mode 100644 index 9c52f900992..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp +++ /dev/null @@ -1,65 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLDrivers( - SQLHENV henv, - SQLUSMALLINT fDirection, - SQLCHAR* szDriverDesc, - SQLSMALLINT cbDriverDescMax, - SQLSMALLINT* pcbDriverDesc, - SQLCHAR* szDriverAttributes, - SQLSMALLINT cbDrvrAttrMax, - SQLSMALLINT* pcbDrvrAttr) -{ -#ifndef auto_SQLDrivers - const char* const sqlFunction = "SQLDrivers"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLDRIVERS); - const char* const sqlFunction = "SQLDrivers"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleEnv* pEnv = pRoot->findEnv(henv); - if (pEnv == 0) { - driver_exit(SQL_API_SQLDRIVERS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pEnv->sqlDrivers( - ctx, - fDirection, - &szDriverDesc, - cbDriverDescMax, - &pcbDriverDesc, - &szDriverAttributes, - cbDrvrAttrMax, - &pcbDrvrAttr - ); - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLDRIVERS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp b/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp deleted file mode 100644 index 20b0b2203f5..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp +++ /dev/null @@ -1,70 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLEndTran( - SQLSMALLINT HandleType, - SQLHANDLE Handle, - SQLSMALLINT CompletionType) -{ - driver_enter(SQL_API_SQLENDTRAN); - const char* const sqlFunction = "SQLEndTran"; - HandleRoot* const pRoot = HandleRoot::instance(); - if (HandleType == SQL_HANDLE_DBC) { - HandleDbc* pDbc = pRoot->findDbc(Handle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLENDTRAN); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlEndTran(ctx, CompletionType); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLENDTRAN); - return ret; - } - if (HandleType == SQL_HANDLE_ENV) { - HandleEnv* pEnv = pRoot->findEnv(Handle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLENDTRAN); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pEnv->sqlEndTran(ctx, CompletionType); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLENDTRAN); - return ret; - } - driver_exit(SQL_API_SQLENDTRAN); - return SQL_INVALID_HANDLE; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLError.cpp b/ndb/src/old_files/client/odbc/driver/SQLError.cpp deleted file mode 100644 index af78c931d37..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLError.cpp +++ /dev/null @@ -1,67 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLError( - SQLHENV EnvironmentHandle, - SQLHDBC ConnectionHandle, - SQLHSTMT StatementHandle, - SQLCHAR* Sqlstate, - SQLINTEGER* NativeError, - SQLCHAR* MessageText, - SQLSMALLINT BufferLength, - SQLSMALLINT* TextLength) -{ - driver_enter(SQL_API_SQLERROR); - const char* const sqlFunction = "SQLError"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0 && pDbc == 0 && pEnv == 0) { - driver_exit(SQL_API_SQLERROR); - return SQL_INVALID_HANDLE; - } - Ctx ctx; // discard diagnostics - ctx.logSqlEnter(sqlFunction); - if (pStmt != 0) { - try { - pStmt->sqlError(ctx, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - } else if (pDbc != 0) { - try { - pDbc->sqlError(ctx, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - } else { - try { - pEnv->sqlError(ctx, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLERROR); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp b/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp deleted file mode 100644 index 0ad99d29cd9..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLExecDirect( - SQLHSTMT StatementHandle, - SQLCHAR* StatementText, - SQLINTEGER TextLength) -{ - driver_enter(SQL_API_SQLEXECDIRECT); - const char* const sqlFunction = "SQLExecDirect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLEXECDIRECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlExecDirect(ctx, StatementText, TextLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLEXECDIRECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp b/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp deleted file mode 100644 index 9c30d418f09..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp +++ /dev/null @@ -1,45 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLExecute( - SQLHSTMT StatementHandle) -{ - driver_enter(SQL_API_SQLEXECUTE); - const char* const sqlFunction = "SQLExecute"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLEXECUTE); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlExecute(ctx); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLEXECUTE); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp b/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp deleted file mode 100644 index e0dd078b5d0..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp +++ /dev/null @@ -1,59 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLExtendedFetch( - SQLHSTMT hstmt, - SQLUSMALLINT fFetchType, - SQLINTEGER irow, - SQLUINTEGER* pcrow, - SQLUSMALLINT* rgfRowStatus) -{ -#ifndef auto_SQLExtendedFetch - const char* const sqlFunction = "SQLExtendedFetch"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLEXTENDEDFETCH); - const char* const sqlFunction = "SQLExtendedFetch"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLEXTENDEDFETCH); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlExtendedFetch( - ctx, - fFetchType, - irow, - &pcrow, - &rgfRowStatus - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLEXTENDEDFETCH); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp b/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp deleted file mode 100644 index addba7b998c..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp +++ /dev/null @@ -1,45 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLFetch( - SQLHSTMT StatementHandle) -{ - driver_enter(SQL_API_SQLFETCH); - const char* const sqlFunction = "SQLFetch"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLFETCH); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlFetch(ctx); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFETCH); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp b/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp deleted file mode 100644 index cfbfc813fca..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp +++ /dev/null @@ -1,55 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLFetchScroll( - SQLHSTMT StatementHandle, - SQLSMALLINT FetchOrientation, - SQLINTEGER FetchOffset) -{ -#ifndef auto_SQLFetchScroll - const char* const sqlFunction = "SQLFetchScroll"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLFETCHSCROLL); - const char* const sqlFunction = "SQLFetchScroll"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLFETCHSCROLL); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlFetchScroll( - ctx, - FetchOrientation, - FetchOffset - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFETCHSCROLL); - return ret; -#endif -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp b/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp deleted file mode 100644 index 886ac6bdaa5..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp +++ /dev/null @@ -1,75 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLForeignKeys( - SQLHSTMT hstmt, - SQLCHAR* szPkCatalogName, - SQLSMALLINT cbPkCatalogName, - SQLCHAR* szPkSchemaName, - SQLSMALLINT cbPkSchemaName, - SQLCHAR* szPkTableName, - SQLSMALLINT cbPkTableName, - SQLCHAR* szFkCatalogName, - SQLSMALLINT cbFkCatalogName, - SQLCHAR* szFkSchemaName, - SQLSMALLINT cbFkSchemaName, - SQLCHAR* szFkTableName, - SQLSMALLINT cbFkTableName) -{ -#ifndef auto_SQLForeignKeys - const char* const sqlFunction = "SQLForeignKeys"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLFOREIGNKEYS); - const char* const sqlFunction = "SQLForeignKeys"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLFOREIGNKEYS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlForeignKeys( - ctx, - &szPkCatalogName, - cbPkCatalogName, - &szPkSchemaName, - cbPkSchemaName, - &szPkTableName, - cbPkTableName, - &szFkCatalogName, - cbFkCatalogName, - &szFkSchemaName, - cbFkSchemaName, - &szFkTableName, - cbFkTableName - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFOREIGNKEYS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp deleted file mode 100644 index 9ac84710cce..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp +++ /dev/null @@ -1,53 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLFreeConnect( - SQLHDBC ConnectionHandle) -{ - driver_enter(SQL_API_SQLFREECONNECT); - const char* const sqlFunction = "SQLFreeConnect"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLFREECONNECT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleEnv* pEnv = pDbc->getEnv(); - try { - pEnv->sqlFreeConnect(ctx, pDbc); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (! ctx.ok()) { - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFREECONNECT); - return ret; - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - delete &ctx; - driver_exit(SQL_API_SQLFREECONNECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp deleted file mode 100644 index 7e35056feb5..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp +++ /dev/null @@ -1,52 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLFreeEnv( - SQLHENV EnvironmentHandle) -{ - driver_enter(SQL_API_SQLFREEENV); - const char* const sqlFunction = "SQLFreeEnv"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLFREEENV); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pRoot->sqlFreeEnv(ctx, pEnv); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (! ctx.ok()) { - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFREEENV); - return ret; - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - delete &ctx; - driver_exit(SQL_API_SQLFREEENV); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp deleted file mode 100644 index 284463cbb07..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp +++ /dev/null @@ -1,60 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLFreeHandle( - SQLSMALLINT HandleType, - SQLHANDLE Handle) -{ - driver_enter(SQL_API_SQLFREEHANDLE); - const char* const sqlFunction = "SQLFreeHandle"; - HandleRoot* const pRoot = HandleRoot::instance(); - SQLSMALLINT parentType = pRoot->findParentType(HandleType); - if (parentType == -1) { - driver_exit(SQL_API_SQLFREEHANDLE); - return SQL_INVALID_HANDLE; - } - HandleBase* pChild = pRoot->findBase(HandleType, Handle); - if (pChild == 0) { - driver_exit(SQL_API_SQLFREEHANDLE); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleBase* pParent = pChild->getParent(); - ctx_assert(pParent != 0); - try { - pParent->sqlFreeHandle(ctx, HandleType, pChild); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (! ctx.ok()) { - pChild->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFREEHANDLE); - return ret; - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - delete &ctx; - driver_exit(SQL_API_SQLFREEHANDLE); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp deleted file mode 100644 index 7af6623a37a..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp +++ /dev/null @@ -1,54 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLFreeStmt( - SQLHSTMT StatementHandle, - SQLUSMALLINT Option) -{ - driver_enter(SQL_API_SQLFREESTMT); - const char* const sqlFunction = "SQLFreeStmt"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLFREESTMT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - HandleDbc* pDbc = pStmt->getDbc(); - try { - pDbc->sqlFreeStmt(ctx, pStmt, Option); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - if (! ctx.ok() || Option != SQL_DROP) { - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLFREESTMT); - return ret; - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - delete &ctx; - driver_exit(SQL_API_SQLFREESTMT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp deleted file mode 100644 index 66c1f3827e1..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetConnectAttr( - SQLHDBC ConnectionHandle, - SQLINTEGER Attribute, - SQLPOINTER Value, - SQLINTEGER BufferLength, - SQLINTEGER* StringLength) -{ - driver_enter(SQL_API_SQLGETCONNECTATTR); - const char* const sqlFunction = "SQLGetConnectAttr"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLGETCONNECTATTR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlGetConnectAttr(ctx, Attribute, Value, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETCONNECTATTR); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp deleted file mode 100644 index 514bedb12b9..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetConnectOption( - SQLHDBC ConnectionHandle, - SQLUSMALLINT Option, - SQLPOINTER Value) -{ - driver_enter(SQL_API_SQLGETCONNECTOPTION); - const char* const sqlFunction = "SQLGetConnectOption"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLGETCONNECTOPTION); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlGetConnectOption(ctx, Option, Value); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETCONNECTOPTION); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp deleted file mode 100644 index d54bdf42005..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp +++ /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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetCursorName( - SQLHSTMT StatementHandle, - SQLCHAR* CursorName, - SQLSMALLINT BufferLength, - SQLSMALLINT* NameLength) -{ - driver_enter(SQL_API_SQLGETCURSORNAME); - const char* const sqlFunction = "SQLGetCursorName"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLGETCURSORNAME); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlGetCursorName(ctx, CursorName, BufferLength, NameLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETCURSORNAME); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp deleted file mode 100644 index 3b6987c515d..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp +++ /dev/null @@ -1,50 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetData( - SQLHSTMT StatementHandle, - SQLUSMALLINT ColumnNumber, - SQLSMALLINT TargetType, - SQLPOINTER TargetValue, - SQLINTEGER BufferLength, - SQLINTEGER* StrLen_or_Ind) -{ - driver_enter(SQL_API_SQLGETDATA); - const char* const sqlFunction = "SQLGetData"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLGETDATA); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlGetData(ctx, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETDATA); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp deleted file mode 100644 index 6cc390a58ed..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp +++ /dev/null @@ -1,50 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetDescField( - SQLHDESC DescriptorHandle, - SQLSMALLINT RecNumber, - SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, - SQLINTEGER BufferLength, - SQLINTEGER* StringLength) -{ - driver_enter(SQL_API_SQLGETDESCFIELD); - const char* const sqlFunction = "SQLGetDescField"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDesc* pDesc = pRoot->findDesc(DescriptorHandle); - if (pDesc == 0) { - driver_exit(SQL_API_SQLGETDESCFIELD); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDesc->sqlGetDescField(ctx, RecNumber, FieldIdentifier, Value, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDesc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETDESCFIELD); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp deleted file mode 100644 index c7e9631b075..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp +++ /dev/null @@ -1,55 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetDescRec( - SQLHDESC DescriptorHandle, - SQLSMALLINT RecNumber, - SQLCHAR* Name, - SQLSMALLINT BufferLength, - SQLSMALLINT* StringLength, - SQLSMALLINT* Type, - SQLSMALLINT* SubType, - SQLINTEGER* Length, - SQLSMALLINT* Precision, - SQLSMALLINT* Scale, - SQLSMALLINT* Nullable) -{ - driver_enter(SQL_API_SQLGETDESCREC); - const char* const sqlFunction = "SQLGetDescRec"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDesc* pDesc = pRoot->findDesc(DescriptorHandle); - if (pDesc == 0) { - driver_exit(SQL_API_SQLGETDESCREC); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDesc->sqlGetDescRec(ctx, RecNumber, Name, BufferLength, StringLength, Type, SubType, Length, Precision, Scale, Nullable); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDesc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETDESCREC); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp deleted file mode 100644 index 3eb34f7ebf6..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp +++ /dev/null @@ -1,50 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetDiagField( - SQLSMALLINT HandleType, - SQLHANDLE Handle, - SQLSMALLINT RecNumber, - SQLSMALLINT DiagIdentifier, - SQLPOINTER DiagInfo, - SQLSMALLINT BufferLength, - SQLSMALLINT* StringLength) -{ - driver_enter(SQL_API_SQLGETDIAGFIELD); - const char* const sqlFunction = "SQLGetDiagField"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleBase* pBase = pRoot->findBase(HandleType, Handle); - if (pBase == 0) { - driver_exit(SQL_API_SQLGETDIAGFIELD); - return SQL_INVALID_HANDLE; - } - Ctx ctx; // discard diagnostics - ctx.logSqlEnter(sqlFunction); - try { - pBase->sqlGetDiagField(ctx, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETDIAGFIELD); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp deleted file mode 100644 index 448c5206d76..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp +++ /dev/null @@ -1,51 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetDiagRec( - SQLSMALLINT HandleType, - SQLHANDLE Handle, - SQLSMALLINT RecNumber, - SQLCHAR* Sqlstate, - SQLINTEGER* NativeError, - SQLCHAR* MessageText, - SQLSMALLINT BufferLength, - SQLSMALLINT* TextLength) -{ - driver_enter(SQL_API_SQLGETDIAGREC); - const char* const sqlFunction = "SQLGetDiagRec"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleBase* pBase = pRoot->findBase(HandleType, Handle); - if (pBase == 0) { - driver_exit(SQL_API_SQLGETDIAGREC); - return SQL_INVALID_HANDLE; - } - Ctx ctx; // discard diagnostics - ctx.logSqlEnter(sqlFunction); - try { - pBase->sqlGetDiagRec(ctx, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETDIAGREC); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp deleted file mode 100644 index c93870326e4..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp +++ /dev/null @@ -1,66 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetEnvAttr( - SQLHENV EnvironmentHandle, - SQLINTEGER Attribute, - SQLPOINTER Value, - SQLINTEGER BufferLength, - SQLINTEGER* StringLength) -{ - driver_enter(SQL_API_SQLGETENVATTR); - const char* const sqlFunction = "SQLGetEnvAttr"; - HandleRoot* const pRoot = HandleRoot::instance(); - if (EnvironmentHandle == 0) { - // process-level attributes - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pRoot->sqlGetRootAttr(ctx, Attribute, Value, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pRoot->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETENVATTR); - return ret; - } else { - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLGETENVATTR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pEnv->sqlGetEnvAttr(ctx, Attribute, Value, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETENVATTR); - return ret; - } - return SQL_ERROR; // not reached -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp deleted file mode 100644 index 68416fab1a6..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetFunctions( - SQLHDBC ConnectionHandle, - SQLUSMALLINT FunctionId, - SQLUSMALLINT* Supported) -{ - driver_enter(SQL_API_SQLGETFUNCTIONS); - const char* const sqlFunction = "SQLGetFunctions"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLGETFUNCTIONS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlGetFunctions(ctx, FunctionId, Supported); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETFUNCTIONS); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp deleted file mode 100644 index 8f0a0d67cfa..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetInfo( - SQLHDBC ConnectionHandle, - SQLUSMALLINT InfoType, - SQLPOINTER InfoValue, - SQLSMALLINT BufferLength, - SQLSMALLINT* StringLength) -{ - driver_enter(SQL_API_SQLGETINFO); - const char* const sqlFunction = "SQLGetInfo"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLGETINFO); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlGetInfo(ctx, InfoType, InfoValue, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETINFO); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp deleted file mode 100644 index 990ab68808a..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLGetStmtAttr( - SQLHSTMT StatementHandle, - SQLINTEGER Attribute, - SQLPOINTER Value, - SQLINTEGER BufferLength, - SQLINTEGER* StringLength) -{ - driver_enter(SQL_API_SQLGETSTMTATTR); - const char* const sqlFunction = "SQLGetStmtAttr"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLGETSTMTATTR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlGetStmtAttr(ctx, Attribute, Value, BufferLength, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETSTMTATTR); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp deleted file mode 100644 index 0b5758b1212..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetStmtOption( - SQLHSTMT StatementHandle, - SQLUSMALLINT Option, - SQLPOINTER Value) -{ - driver_enter(SQL_API_SQLGETSTMTOPTION); - const char* const sqlFunction = "SQLGetStmtOption"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLGETSTMTOPTION); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlGetStmtOption(ctx, Option, Value); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETSTMTOPTION); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp deleted file mode 100644 index e6a016cc400..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp +++ /dev/null @@ -1,46 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLGetTypeInfo( - SQLHSTMT StatementHandle, - SQLSMALLINT DataType) -{ - driver_enter(SQL_API_SQLGETTYPEINFO); - const char* const sqlFunction = "SQLGetTypeInfo"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLGETTYPEINFO); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlGetTypeInfo(ctx, DataType); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLGETTYPEINFO); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp b/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp deleted file mode 100644 index d23d653a319..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp +++ /dev/null @@ -1,42 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLMoreResults( - SQLHSTMT hstmt) -{ - driver_enter(SQL_API_SQLMORERESULTS); - const char* const sqlFunction = "SQLMoreResults"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLMORERESULTS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlMoreResults(ctx); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLMORERESULTS); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp b/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp deleted file mode 100644 index fb8a9bbf3d9..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp +++ /dev/null @@ -1,61 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLNativeSql( - SQLHDBC hdbc, - SQLCHAR* szSqlStrIn, - SQLINTEGER cbSqlStrIn, - SQLCHAR* szSqlStr, - SQLINTEGER cbSqlStrMax, - SQLINTEGER* pcbSqlStr) -{ -#ifndef auto_SQLNativeSql - const char* const sqlFunction = "SQLNativeSql"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLNATIVESQL); - const char* const sqlFunction = "SQLNativeSql"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(hdbc); - if (pDbc == 0) { - driver_exit(SQL_API_SQLNATIVESQL); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pDbc->sqlNativeSql( - ctx, - &szSqlStrIn, - cbSqlStrIn, - &szSqlStr, - cbSqlStrMax, - &pcbSqlStr - ); - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLNATIVESQL); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp b/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp deleted file mode 100644 index 7b1a6a07aec..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp +++ /dev/null @@ -1,46 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLNumParams( - SQLHSTMT StatementHandle, - SQLSMALLINT* ParameterCountPtr) -{ - driver_enter(SQL_API_SQLNUMPARAMS); - const char* const sqlFunction = "SQLNumParams"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLNUMPARAMS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlNumParams(ctx, ParameterCountPtr); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLNUMPARAMS); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp b/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp deleted file mode 100644 index 2e70897a9a2..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp +++ /dev/null @@ -1,46 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLNumResultCols( - SQLHSTMT StatementHandle, - SQLSMALLINT* ColumnCount) -{ - driver_enter(SQL_API_SQLNUMRESULTCOLS); - const char* const sqlFunction = "SQLNumResultCols"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLNUMRESULTCOLS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlNumResultCols(ctx, ColumnCount); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLNUMRESULTCOLS); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp b/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp deleted file mode 100644 index 4eb38a010f4..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp +++ /dev/null @@ -1,46 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLParamData( - SQLHSTMT StatementHandle, - SQLPOINTER* Value) -{ - driver_enter(SQL_API_SQLPARAMDATA); - const char* const sqlFunction = "SQLParamData"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPARAMDATA); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlParamData(ctx, Value); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPARAMDATA); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp b/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp deleted file mode 100644 index 59b7dcf7fa9..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp +++ /dev/null @@ -1,55 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLParamOptions( - SQLHSTMT hstmt, - SQLUINTEGER crow, - SQLUINTEGER* pirow) -{ -#ifndef auto_SQLParamOptions - const char* const sqlFunction = "SQLParamOptions"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLPARAMOPTIONS); - const char* const sqlFunction = "SQLParamOptions"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPARAMOPTIONS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlParamOptions( - ctx, - crow, - &pirow - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPARAMOPTIONS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp b/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp deleted file mode 100644 index b1205fa6e3a..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLPrepare( - SQLHSTMT StatementHandle, - SQLCHAR* StatementText, - SQLINTEGER TextLength) -{ - driver_enter(SQL_API_SQLPREPARE); - const char* const sqlFunction = "SQLPrepare"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPREPARE); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlPrepare(ctx, StatementText, TextLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPREPARE); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp b/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp deleted file mode 100644 index 2d562ae3e19..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLPrimaryKeys( - SQLHSTMT hstmt, - SQLCHAR* szCatalogName, - SQLSMALLINT cbCatalogName, - SQLCHAR* szSchemaName, - SQLSMALLINT cbSchemaName, - SQLCHAR* szTableName, - SQLSMALLINT cbTableName) -{ - driver_enter(SQL_API_SQLPRIMARYKEYS); - const char* const sqlFunction = "SQLPrimaryKeys"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPRIMARYKEYS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - pStmt->sqlPrimaryKeys(ctx, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPRIMARYKEYS); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp b/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp deleted file mode 100644 index 2e42e428b87..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp +++ /dev/null @@ -1,67 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLProcedureColumns( - SQLHSTMT hstmt, - SQLCHAR* szCatalogName, - SQLSMALLINT cbCatalogName, - SQLCHAR* szSchemaName, - SQLSMALLINT cbSchemaName, - SQLCHAR* szProcName, - SQLSMALLINT cbProcName, - SQLCHAR* szColumnName, - SQLSMALLINT cbColumnName) -{ -#ifndef auto_SQLProcedureColumns - const char* const sqlFunction = "SQLProcedureColumns"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLPROCEDURECOLUMNS); - const char* const sqlFunction = "SQLProcedureColumns"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPROCEDURECOLUMNS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlProcedureColumns( - ctx, - &szCatalogName, - cbCatalogName, - &szSchemaName, - cbSchemaName, - &szProcName, - cbProcName, - &szColumnName, - cbColumnName - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPROCEDURECOLUMNS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp b/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp deleted file mode 100644 index 1f3a9f89073..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp +++ /dev/null @@ -1,63 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLProcedures( - SQLHSTMT hstmt, - SQLCHAR* szCatalogName, - SQLSMALLINT cbCatalogName, - SQLCHAR* szSchemaName, - SQLSMALLINT cbSchemaName, - SQLCHAR* szProcName, - SQLSMALLINT cbProcName) -{ -#ifndef auto_SQLProcedures - const char* const sqlFunction = "SQLProcedures"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLPROCEDURES); - const char* const sqlFunction = "SQLProcedures"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPROCEDURES); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlProcedures( - ctx, - &szCatalogName, - cbCatalogName, - &szSchemaName, - cbSchemaName, - &szProcName, - cbProcName - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPROCEDURES); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp b/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp deleted file mode 100644 index a4715a836d2..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLPutData( - SQLHSTMT StatementHandle, - SQLPOINTER Data, - SQLINTEGER StrLen_or_Ind) -{ - driver_enter(SQL_API_SQLPUTDATA); - const char* const sqlFunction = "SQLPutData"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLPUTDATA); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlPutData(ctx, Data, StrLen_or_Ind); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLPUTDATA); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp b/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp deleted file mode 100644 index d03f954386a..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp +++ /dev/null @@ -1,46 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLRowCount( - SQLHSTMT StatementHandle, - SQLINTEGER* RowCount) -{ - driver_enter(SQL_API_SQLROWCOUNT); - const char* const sqlFunction = "SQLRowCount"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLROWCOUNT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlRowCount(ctx, RowCount); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLROWCOUNT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp deleted file mode 100644 index 05bfce5e9cd..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp +++ /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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLSetConnectAttr( - SQLHDBC ConnectionHandle, - SQLINTEGER Attribute, - SQLPOINTER Value, - SQLINTEGER StringLength) -{ - driver_enter(SQL_API_SQLSETCONNECTATTR); - const char* const sqlFunction = "SQLSetConnectAttr"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLSETCONNECTATTR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlSetConnectAttr(ctx, Attribute, Value, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETCONNECTATTR); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp deleted file mode 100644 index a4794316971..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSetConnectOption( - SQLHDBC ConnectionHandle, - SQLUSMALLINT Option, - SQLUINTEGER Value) -{ - driver_enter(SQL_API_SQLSETCONNECTOPTION); - const char* const sqlFunction = "SQLSetConnectOption"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLSETCONNECTOPTION); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlSetConnectOption(ctx, Option, Value); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETCONNECTOPTION); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp deleted file mode 100644 index 291ad817d42..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSetCursorName( - SQLHSTMT StatementHandle, - SQLCHAR* CursorName, - SQLSMALLINT NameLength) -{ - driver_enter(SQL_API_SQLSETCURSORNAME); - const char* const sqlFunction = "SQLSetCursorName"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSETCURSORNAME); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlSetCursorName(ctx, CursorName, NameLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETCURSORNAME); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp deleted file mode 100644 index 19d34c2f46d..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLSetDescField( - SQLHDESC DescriptorHandle, - SQLSMALLINT RecNumber, - SQLSMALLINT FieldIdentifier, - SQLPOINTER Value, - SQLINTEGER BufferLength) -{ - driver_enter(SQL_API_SQLSETDESCFIELD); - const char* const sqlFunction = "SQLSetDescField"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDesc* pDesc = pRoot->findDesc(DescriptorHandle); - if (pDesc == 0) { - driver_exit(SQL_API_SQLSETDESCFIELD); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDesc->sqlSetDescField(ctx, RecNumber, FieldIdentifier, Value, BufferLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDesc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETDESCFIELD); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp deleted file mode 100644 index 80a00514a51..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp +++ /dev/null @@ -1,54 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLSetDescRec( - SQLHDESC DescriptorHandle, - SQLSMALLINT RecNumber, - SQLSMALLINT Type, - SQLSMALLINT SubType, - SQLINTEGER Length, - SQLSMALLINT Precision, - SQLSMALLINT Scale, - SQLPOINTER Data, - SQLINTEGER* StringLength, - SQLINTEGER* Indicator) -{ - driver_enter(SQL_API_SQLSETDESCREC); - const char* const sqlFunction = "SQLSetDescRec"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleDesc* pDesc = pRoot->findDesc(DescriptorHandle); - if (pDesc == 0) { - driver_exit(SQL_API_SQLSETDESCREC); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDesc->sqlSetDescRec(ctx, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, Indicator); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDesc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETDESCREC); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp deleted file mode 100644 index 86364eac5e8..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp +++ /dev/null @@ -1,65 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLSetEnvAttr( - SQLHENV EnvironmentHandle, - SQLINTEGER Attribute, - SQLPOINTER Value, - SQLINTEGER StringLength) -{ - driver_enter(SQL_API_SQLSETENVATTR); - const char* const sqlFunction = "SQLSetEnvAttr"; - HandleRoot* const pRoot = HandleRoot::instance(); - if (EnvironmentHandle == 0) { - // process-level attributes - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pRoot->sqlSetRootAttr(ctx, Attribute, Value, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pRoot->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETENVATTR); - return ret; - } else { - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLSETENVATTR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pEnv->sqlSetEnvAttr(ctx, Attribute, Value, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETENVATTR); - return ret; - } - return SQL_ERROR; // not reached -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp deleted file mode 100644 index 03bde1076d8..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp +++ /dev/null @@ -1,52 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSetParam( - SQLHSTMT StatementHandle, - SQLUSMALLINT ParameterNumber, - SQLSMALLINT ValueType, - SQLSMALLINT ParameterType, - SQLUINTEGER LengthPrecision, - SQLSMALLINT ParameterScale, - SQLPOINTER ParameterValue, - SQLINTEGER* StrLen_or_Ind) -{ - driver_enter(SQL_API_SQLSETPARAM); - const char* const sqlFunction = "SQLSetParam"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSETPARAM); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlSetParam(ctx, ParameterNumber, ValueType, ParameterType, LengthPrecision, ParameterScale, ParameterValue, StrLen_or_Ind); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETPARAM); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp deleted file mode 100644 index 653030f90bc..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp +++ /dev/null @@ -1,57 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSetPos( - SQLHSTMT hstmt, - SQLUSMALLINT irow, - SQLUSMALLINT fOption, - SQLUSMALLINT fLock) -{ -#ifndef auto_SQLSetPos - const char* const sqlFunction = "SQLSetPos"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLSETPOS); - const char* const sqlFunction = "SQLSetPos"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSETPOS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlSetPos( - ctx, - irow, - fOption, - fLock - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETPOS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp deleted file mode 100644 index a5e89d8568b..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp +++ /dev/null @@ -1,57 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSetScrollOptions( - SQLHSTMT hstmt, - SQLUSMALLINT fConcurrency, - SQLINTEGER crowKeyset, - SQLUSMALLINT crowRowset) -{ -#ifndef auto_SQLSetScrollOptions - const char* const sqlFunction = "SQLSetScrollOptions"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLSETSCROLLOPTIONS); - const char* const sqlFunction = "SQLSetScrollOptions"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSETSCROLLOPTIONS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlSetScrollOptions( - ctx, - fConcurrency, - crowKeyset, - crowRowset - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETSCROLLOPTIONS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp deleted file mode 100644 index 9ed6a83b563..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp +++ /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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0300 -SQLRETURN SQL_API -SQLSetStmtAttr( - SQLHSTMT StatementHandle, - SQLINTEGER Attribute, - SQLPOINTER Value, - SQLINTEGER StringLength) -{ - driver_enter(SQL_API_SQLSETSTMTATTR); - const char* const sqlFunction = "SQLSetStmtAttr"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSETSTMTATTR); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlSetStmtAttr(ctx, Attribute, Value, StringLength); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETSTMTATTR); - return ret; -} -#endif // ODBCVER >= 0x0300 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp deleted file mode 100644 index b403fc8408c..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp +++ /dev/null @@ -1,47 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSetStmtOption( - SQLHSTMT StatementHandle, - SQLUSMALLINT Option, - SQLUINTEGER Value) -{ - driver_enter(SQL_API_SQLSETSTMTOPTION); - const char* const sqlFunction = "SQLSetStmtOption"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSETSTMTOPTION); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pStmt->sqlSetStmtOption(ctx, Option, Value); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSETSTMTOPTION); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp b/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp deleted file mode 100644 index 5dd92c86053..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp +++ /dev/null @@ -1,69 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLSpecialColumns( - SQLHSTMT StatementHandle, - SQLUSMALLINT IdentifierType, - SQLCHAR* CatalogName, - SQLSMALLINT NameLength1, - SQLCHAR* SchemaName, - SQLSMALLINT NameLength2, - SQLCHAR* TableName, - SQLSMALLINT NameLength3, - SQLUSMALLINT Scope, - SQLUSMALLINT Nullable) -{ -#ifndef auto_SQLSpecialColumns - const char* const sqlFunction = "SQLSpecialColumns"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLSPECIALCOLUMNS); - const char* const sqlFunction = "SQLSpecialColumns"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSPECIALCOLUMNS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlSpecialColumns( - ctx, - IdentifierType, - &CatalogName, - NameLength1, - &SchemaName, - NameLength2, - &TableName, - NameLength3, - Scope, - Nullable - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSPECIALCOLUMNS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp b/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp deleted file mode 100644 index 941fb6249a5..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp +++ /dev/null @@ -1,67 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLStatistics( - SQLHSTMT StatementHandle, - SQLCHAR* CatalogName, - SQLSMALLINT NameLength1, - SQLCHAR* SchemaName, - SQLSMALLINT NameLength2, - SQLCHAR* TableName, - SQLSMALLINT NameLength3, - SQLUSMALLINT Unique, - SQLUSMALLINT Reserved) -{ -#ifndef auto_SQLStatistics - const char* const sqlFunction = "SQLStatistics"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLSTATISTICS); - const char* const sqlFunction = "SQLStatistics"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLSTATISTICS); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlStatistics( - ctx, - &CatalogName, - NameLength1, - &SchemaName, - NameLength2, - &TableName, - NameLength3, - Unique, - Reserved - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLSTATISTICS); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp b/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp deleted file mode 100644 index 23c6ad9fc4b..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp +++ /dev/null @@ -1,63 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLTablePrivileges( - SQLHSTMT hstmt, - SQLCHAR* szCatalogName, - SQLSMALLINT cbCatalogName, - SQLCHAR* szSchemaName, - SQLSMALLINT cbSchemaName, - SQLCHAR* szTableName, - SQLSMALLINT cbTableName) -{ -#ifndef auto_SQLTablePrivileges - const char* const sqlFunction = "SQLTablePrivileges"; - Ctx ctx; - ctx_log1(("*** not implemented: %s", sqlFunction)); - return SQL_ERROR; -#else - driver_enter(SQL_API_SQLTABLEPRIVILEGES); - const char* const sqlFunction = "SQLTablePrivileges"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(hstmt); - if (pStmt == 0) { - driver_exit(SQL_API_SQLTABLEPRIVILEGES); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - if (ctx.ok()) - pStmt->sqlTablePrivileges( - ctx, - &szCatalogName, - cbCatalogName, - &szSchemaName, - cbSchemaName, - &szTableName, - cbTableName - ); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLTABLEPRIVILEGES); - return ret; -#endif -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLTables.cpp b/ndb/src/old_files/client/odbc/driver/SQLTables.cpp deleted file mode 100644 index b2496bfba87..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLTables.cpp +++ /dev/null @@ -1,49 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLTables( - SQLHSTMT StatementHandle, - SQLCHAR* CatalogName, - SQLSMALLINT NameLength1, - SQLCHAR* SchemaName, - SQLSMALLINT NameLength2, - SQLCHAR* TableName, - SQLSMALLINT NameLength3, - SQLCHAR* TableType, - SQLSMALLINT NameLength4) -{ - driver_enter(SQL_API_SQLTABLES); - const char* const sqlFunction = "SQLTables"; - HandleRoot* const pRoot = HandleRoot::instance(); - HandleStmt* pStmt = pRoot->findStmt(StatementHandle); - if (pStmt == 0) { - driver_exit(SQL_API_SQLTABLES); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - pStmt->sqlTables(ctx, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4); - pStmt->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLTABLES); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp b/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp deleted file mode 100644 index da8b46b1596..00000000000 --- a/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp +++ /dev/null @@ -1,71 +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 */ - -#include "driver.hpp" - -#if ODBCVER >= 0x0000 -SQLRETURN SQL_API -SQLTransact( - SQLHENV EnvironmentHandle, - SQLHDBC ConnectionHandle, - SQLUSMALLINT CompletionType) -{ - driver_enter(SQL_API_SQLTRANSACT); - const char* const sqlFunction = "SQLTransact"; - HandleRoot* const pRoot = HandleRoot::instance(); - // check connection first and ignore environment - if (ConnectionHandle != SQL_NULL_HANDLE) { - HandleDbc* pDbc = pRoot->findDbc(ConnectionHandle); - if (pDbc == 0) { - driver_exit(SQL_API_SQLTRANSACT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pDbc->sqlTransact(ctx, CompletionType); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLTRANSACT); - return ret; - } - if (EnvironmentHandle != SQL_NULL_HANDLE) { - HandleEnv* pEnv = pRoot->findEnv(EnvironmentHandle); - if (pEnv == 0) { - driver_exit(SQL_API_SQLTRANSACT); - return SQL_INVALID_HANDLE; - } - Ctx& ctx = *new Ctx; - ctx.logSqlEnter(sqlFunction); - try { - pEnv->sqlTransact(ctx, CompletionType); - } catch (CtxAssert& ctxAssert) { - ctx.handleEx(ctxAssert); - } - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLTRANSACT); - return ret; - } - driver_exit(SQL_API_SQLTRANSACT); - return SQL_INVALID_HANDLE; -} -#endif // ODBCVER >= 0x0000 diff --git a/ndb/src/old_files/client/odbc/driver/driver.cpp b/ndb/src/old_files/client/odbc/driver/driver.cpp deleted file mode 100644 index f992fa70878..00000000000 --- a/ndb/src/old_files/client/odbc/driver/driver.cpp +++ /dev/null @@ -1,150 +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 */ - -#include "driver.hpp" -#include - -#undef NDB_ODBC_SIG_DFL -#ifdef NDB_ODBC_SIG_DFL -#include -#endif - -// The big mutex (just in case). - -#ifdef NDB_WIN32 -static NdbMutex & driver_mutex = * NdbMutex_Create(); -#else -static NdbMutex driver_mutex = NDB_MUTEX_INITIALIZER; -#endif - -static void -driver_lock() -{ - NdbMutex_Lock(&driver_mutex); -} - -static void -driver_unlock() -{ - NdbMutex_Unlock(&driver_mutex); -} - -// Hooks for function entry and exit. - -static inline void -driver_enter(SQLUSMALLINT functionId) -{ - switch (functionId) { - default: - break; - } -#ifdef NDB_ODBC_SIG_DFL - // XXX need to restore old sig - for (int i = 1; i <= 30; i++) - signal(i, SIG_DFL); -#endif -} - -static inline void -driver_exit(SQLUSMALLINT functionId) -{ - switch (functionId) { - default: - break; - } -} - -// Some C++ compilers (like gcc) cannot merge template code -// in different files. So compile all in one file. - -#include "SQLAllocConnect.cpp" -#include "SQLAllocEnv.cpp" -#include "SQLAllocHandle.cpp" -#include "SQLAllocHandleStd.cpp" -#include "SQLAllocStmt.cpp" -#include "SQLBindCol.cpp" -#include "SQLBindParam.cpp" -#include "SQLBindParameter.cpp" -#include "SQLBrowseConnect.cpp" -#include "SQLBulkOperations.cpp" -#include "SQLCancel.cpp" -#include "SQLCloseCursor.cpp" -#include "SQLColAttribute.cpp" -#include "SQLColAttributes.cpp" -#include "SQLColumnPrivileges.cpp" -#include "SQLColumns.cpp" -#include "SQLConnect.cpp" -#include "SQLCopyDesc.cpp" -#include "SQLDataSources.cpp" -#include "SQLDescribeCol.cpp" -#include "SQLDescribeParam.cpp" -#include "SQLDisconnect.cpp" -#include "SQLDriverConnect.cpp" -#include "SQLDrivers.cpp" -#include "SQLEndTran.cpp" -#include "SQLError.cpp" -#include "SQLExecDirect.cpp" -#include "SQLExecute.cpp" -#include "SQLExtendedFetch.cpp" -#include "SQLFetch.cpp" -#include "SQLFetchScroll.cpp" -#include "SQLForeignKeys.cpp" -#include "SQLFreeConnect.cpp" -#include "SQLFreeEnv.cpp" -#include "SQLFreeHandle.cpp" -#include "SQLFreeStmt.cpp" -#include "SQLGetConnectAttr.cpp" -#include "SQLGetConnectOption.cpp" -#include "SQLGetCursorName.cpp" -#include "SQLGetData.cpp" -#include "SQLGetDescField.cpp" -#include "SQLGetDescRec.cpp" -#include "SQLGetDiagField.cpp" -#include "SQLGetDiagRec.cpp" -#include "SQLGetEnvAttr.cpp" -#include "SQLGetFunctions.cpp" -#include "SQLGetInfo.cpp" -#include "SQLGetStmtAttr.cpp" -#include "SQLGetStmtOption.cpp" -#include "SQLGetTypeInfo.cpp" -#include "SQLMoreResults.cpp" -#include "SQLNativeSql.cpp" -#include "SQLNumParams.cpp" -#include "SQLNumResultCols.cpp" -#include "SQLParamData.cpp" -#include "SQLParamOptions.cpp" -#include "SQLPrepare.cpp" -#include "SQLPrimaryKeys.cpp" -#include "SQLProcedureColumns.cpp" -#include "SQLProcedures.cpp" -#include "SQLPutData.cpp" -#include "SQLRowCount.cpp" -#include "SQLSetConnectAttr.cpp" -#include "SQLSetConnectOption.cpp" -#include "SQLSetCursorName.cpp" -#include "SQLSetDescField.cpp" -#include "SQLSetDescRec.cpp" -#include "SQLSetEnvAttr.cpp" -#include "SQLSetParam.cpp" -#include "SQLSetPos.cpp" -#include "SQLSetScrollOptions.cpp" -#include "SQLSetStmtAttr.cpp" -#include "SQLSetStmtOption.cpp" -#include "SQLSpecialColumns.cpp" -#include "SQLStatistics.cpp" -#include "SQLTablePrivileges.cpp" -#include "SQLTables.cpp" -#include "SQLTransact.cpp" diff --git a/ndb/src/old_files/client/odbc/driver/driver.hpp b/ndb/src/old_files/client/odbc/driver/driver.hpp deleted file mode 100644 index 96d2e052c0d..00000000000 --- a/ndb/src/old_files/client/odbc/driver/driver.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 ODBC_DRIVER_driver_hpp -#define ODBC_DRIVER_driver_hpp - -#include -#include -#include - -#ifndef NDB_WIN32 -#define SQL_API -#endif - -#endif diff --git a/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp b/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp deleted file mode 100644 index 40d3950a592..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp +++ /dev/null @@ -1,518 +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 */ - -#include -#include -#include - -void -Exec_comp_op::execInterp(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - const unsigned arity = code.m_op.arity(); - const Comp_op::Opcode opcode = code.m_op.m_opcode; - Data& data = getData(); - ctx_assert(ctl.m_scanFilter != 0); - NdbScanFilter& scanFilter = *ctl.m_scanFilter; - if (code.m_interpColumn == 0) { - // args are constant on this level so evaluate entire predicate - evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (data.m_value == Pred_value_true) - scanFilter.istrue(); - else - scanFilter.isfalse(); - return; - } - const NdbAttrId interpAttrId = code.m_interpAttrId; - if (arity == 1) { - ctx_assert(m_expr[1] != 0); - const SqlType& t1 = m_expr[1]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = m_expr[1]->getData().sqlField(); - switch (code.m_op.m_opcode) { - case Comp_op::Isnull: - scanFilter.isnull(interpAttrId); - break; - case Comp_op::Isnotnull: - scanFilter.isnotnull(interpAttrId); - break; - default: - ctx_assert(false); - break; - } - } else if (arity == 2) { - ctx_assert(m_expr[1] != 0 && m_expr[2] != 0); - // one is column and the other is constant at this level - ctx_assert(code.m_interpColumn == 1 || code.m_interpColumn == 2); - const unsigned i = code.m_interpColumn; - const unsigned j = 3 - i; - // evaluate the constant - m_expr[j]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlType& t1 = m_expr[i]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = m_expr[i]->getData().sqlField(); - const SqlType& t2 = m_expr[j]->getCode().sqlSpec().sqlType(); - const SqlField& f2 = m_expr[j]->getData().sqlField(); - // handle null constant - if (f2.sqlNull()) { - scanFilter.isfalse(); - return; - } - // handle null in interpreter - scanFilter.begin(NdbScanFilter::AND); - scanFilter.isnotnull(interpAttrId); - if (t1.type() == SqlType::Char || t1.type() == SqlType::Varchar) { - const char* v2 = 0; - unsigned n2 = 0; - bool nopad = false; - if (t1.type() == SqlType::Char && t2.type() == SqlType::Char) { - v2 = reinterpret_cast(f2.sqlChar()); - n2 = t2.length(); - nopad = false; - } else if (t1.type() == SqlType::Char && t2.type() == SqlType::Varchar) { - v2 = reinterpret_cast(f2.sqlVarchar(&n2)); - nopad = true; - } else if (t1.type() == SqlType::Varchar && t2.type() == SqlType::Char) { - v2 = reinterpret_cast(f2.sqlChar()); - n2 = t2.length(); - nopad = true; - } else if (t1.type() == SqlType::Varchar && t2.type() == SqlType::Varchar) { - v2 = reinterpret_cast(f2.sqlVarchar(&n2)); - nopad = true; - } else { - ctx_assert(false); - } - switch (opcode) { - case Comp_op::Eq: - scanFilter.eq(interpAttrId, v2, n2, nopad); - break; - case Comp_op::Noteq: - scanFilter.ne(interpAttrId, v2, n2, nopad); - break; - case Comp_op::Lt: - if (i == 1) { - scanFilter.lt(interpAttrId, v2, n2, nopad); - } else { - scanFilter.gt(interpAttrId, v2, n2, nopad); - } - break; - case Comp_op::Lteq: - if (i == 1) { - scanFilter.le(interpAttrId, v2, n2, nopad); - } else { - scanFilter.ge(interpAttrId, v2, n2, nopad); - } - break; - case Comp_op::Gt: - if (i == 1) { - scanFilter.gt(interpAttrId, v2, n2, nopad); - } else { - scanFilter.lt(interpAttrId, v2, n2, nopad); - } - break; - case Comp_op::Gteq: - if (i == 1) { - scanFilter.ge(interpAttrId, v2, n2, nopad); - } else { - scanFilter.le(interpAttrId, v2, n2, nopad); - } - break; - case Comp_op::Like: - scanFilter.like(interpAttrId, v2, n2, nopad); - break; - case Comp_op::Notlike: - scanFilter.notlike(interpAttrId, v2, n2, nopad); - break; - default: - ctx_assert(false); - break; - } - } else if (t1.type() == SqlType::Smallint || t1.type() == SqlType::Integer || t1.type() == SqlType::Bigint) { - ctx_assert(t1.unSigned()); - bool s2 = ! t2.unSigned(); - SqlBigint v2; - SqlUbigint uv2; - if (s2) { - v2 = - t2.type() == SqlType::Smallint ? f2.sqlSmallint() : - t2.type() == SqlType::Integer ? f2.sqlInteger() : f2.sqlBigint(); - uv2 = v2; - } else { - uv2 = - t2.type() == SqlType::Smallint ? (SqlUsmallint)f2.sqlSmallint() : - t2.type() == SqlType::Integer ? (SqlUinteger)f2.sqlInteger() : (SqlUbigint)f2.sqlBigint(); - v2 = uv2; - } - switch (code.m_op.m_opcode) { - case Comp_op::Eq: - if (s2 && v2 < 0) - scanFilter.isfalse(); - else - scanFilter.eq(interpAttrId, uv2); - break; - case Comp_op::Noteq: - if (s2 && v2 < 0) - scanFilter.istrue(); - else - scanFilter.ne(interpAttrId, uv2); - break; - case Comp_op::Lt: - if (i == 1) { - if (s2 && v2 < 0) - scanFilter.isfalse(); - else - scanFilter.lt(interpAttrId, uv2); - } else { - if (s2 && v2 < 0) - scanFilter.istrue(); - else - scanFilter.gt(interpAttrId, uv2); - } - break; - case Comp_op::Lteq: - if (i == 1) { - if (s2 && v2 < 0) - scanFilter.isfalse(); - else - scanFilter.le(interpAttrId, uv2); - } else { - if (s2 && v2 < 0) - scanFilter.istrue(); - else - scanFilter.ge(interpAttrId, uv2); - } - break; - case Comp_op::Gt: - if (i == 1) { - if (s2 && v2 < 0) - scanFilter.istrue(); - else - scanFilter.gt(interpAttrId, uv2); - } else { - if (s2 && v2 < 0) - scanFilter.isfalse(); - else - scanFilter.lt(interpAttrId, uv2); - } - break; - case Comp_op::Gteq: - if (i == 1) { - if (s2 && v2 < 0) - scanFilter.istrue(); - else - scanFilter.ge(interpAttrId, uv2); - } else { - if (s2 && v2 < 0) - scanFilter.isfalse(); - else - scanFilter.le(interpAttrId, uv2); - } - break; - default: - ctx_assert(false); - break; - } - } else { - ctx_assert(false); - } - // end null guard - scanFilter.end(); - } else { - ctx_assert(false); - } -} - -static bool -do_sqlchar_comp(Comp_op::Opcode opcode, const SqlChar* s1, unsigned n1, const SqlChar* s2, unsigned n2, bool padded) -{ - int ret = NdbSqlUtil::char_compare(reinterpret_cast(s1), n1, reinterpret_cast(s2), n2, padded); - switch (opcode) { - case Comp_op::Eq: - return ret == 0; - case Comp_op::Noteq: - return ret != 0; - case Comp_op::Lt: - return ret < 0; - case Comp_op::Lteq: - return ret <= 0; - case Comp_op::Gt: - return ret > 0; - case Comp_op::Gteq: - return ret >= 0; - default: - break; - } - ctx_assert(false); - return false; -} - -static bool -do_sqlchar_like(const SqlChar* s1, unsigned n1, const SqlChar* s2, unsigned n2, bool padded) -{ - bool ret = NdbSqlUtil::char_like(reinterpret_cast(s1), n1, reinterpret_cast(s2), n2, padded); - return ret; -} - -static bool -do_datetime_comp(Comp_op::Opcode opcode, SqlDatetime v1, SqlDatetime v2) -{ - int k = v1.less(v2) ? -1 : v2.less(v1) ? 1 : 0; - switch (opcode) { - case Comp_op::Eq: - return k == 0; - case Comp_op::Noteq: - return k != 0; - case Comp_op::Lt: - return k < 0; - case Comp_op::Lteq: - return k <= 0; - case Comp_op::Gt: - return k > 0; - case Comp_op::Gteq: - return k >= 0; - default: - break; - } - ctx_assert(false); - return false; -} - -void -Exec_comp_op::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - const unsigned arity = code.m_op.arity(); - const Comp_op::Opcode opcode = code.m_op.m_opcode; - Data& data = getData(); - Pred_value v = Pred_value_unknown; - if (arity == 1) { - // evaluate sub-expression - ctx_assert(m_expr[1] != 0); - m_expr[1]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - // get type and value - const SqlType& t1 = m_expr[1]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = ctl.m_groupIndex == 0 ? m_expr[1]->getData().sqlField() : m_expr[1]->getData().groupField(ctl.m_groupIndex); - switch (code.m_op.m_opcode) { - case Comp_op::Isnull: - v = f1.sqlNull() ? Pred_value_true : Pred_value_false; - break; - case Comp_op::Isnotnull: - v = f1.sqlNull() ? Pred_value_false : Pred_value_true; - break; - default: - ctx_assert(false); - break; - } - } else if (arity == 2) { - // evaluate sub-expressions - ctx_assert(m_expr[1] != 0 && m_expr[2] != 0); - m_expr[1]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - m_expr[2]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - // get types and values - const SqlType& t1 = m_expr[1]->getCode().sqlSpec().sqlType(); - const SqlType& t2 = m_expr[2]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = ctl.m_groupIndex == 0 ? m_expr[1]->getData().sqlField() : m_expr[1]->getData().groupField(ctl.m_groupIndex); - const SqlField& f2 = ctl.m_groupIndex == 0 ? m_expr[2]->getData().sqlField() : m_expr[2]->getData().groupField(ctl.m_groupIndex); - // handle null - if (f1.sqlNull() || f2.sqlNull()) { - v = Pred_value_unknown; - } else if (t1.type() == SqlType::Char) { - const SqlChar* v1 = f1.sqlChar(); - unsigned n1 = t1.length(); - if (t2.type() == SqlType::Char) { - unsigned n2 = t2.length(); - const SqlChar* v2 = f2.sqlChar(); - bool b; - switch (opcode) { - case Comp_op::Like: - b = do_sqlchar_like(v1, n1, v2, n2, true); - break; - case Comp_op::Notlike: - b = ! do_sqlchar_like(v1, n1, v2, n2, true); - break; - default: - b = do_sqlchar_comp(opcode, v1, n1, v2, n2, true); - break; - } - v = b ? Pred_value_true : Pred_value_false; - } else if (t2.type() == SqlType::Varchar) { - unsigned n2 = 0; - const SqlChar* v2 = f2.sqlVarchar(&n2); - bool b; - switch (opcode) { - case Comp_op::Like: - b = do_sqlchar_like(v1, n1, v2, n2, true); - break; - case Comp_op::Notlike: - b = ! do_sqlchar_like(v1, n1, v2, n2, true); - break; - default: - b = do_sqlchar_comp(opcode, v1, n1, v2, n2, false); - break; - } - v = b ? Pred_value_true : Pred_value_false; - } else { - ctx_assert(false); - } - } else if (t1.type() == SqlType::Varchar) { - unsigned n1 = 0; - const SqlChar* v1 = f1.sqlVarchar(&n1); - if (t2.type() == SqlType::Char) { - unsigned n2 = t2.length(); - const SqlChar* v2 = f2.sqlChar(); - bool b; - switch (opcode) { - case Comp_op::Like: - b = do_sqlchar_like(v1, n1, v2, n2, false); - break; - case Comp_op::Notlike: - b = ! do_sqlchar_like(v1, n1, v2, n2, false); - break; - default: - b = do_sqlchar_comp(opcode, v1, n1, v2, n2, false); - break; - } - v = b ? Pred_value_true : Pred_value_false; - } else if (t2.type() == SqlType::Varchar) { - unsigned n2 = 0; - const SqlChar* v2 = f2.sqlVarchar(&n2); - bool b; - switch (opcode) { - case Comp_op::Like: - b = do_sqlchar_like(v1, n1, v2, n2, false); - break; - case Comp_op::Notlike: - b = ! do_sqlchar_like(v1, n1, v2, n2, false); - break; - default: - b = do_sqlchar_comp(opcode, v1, n1, v2, n2, false); - break; - } - v = b ? Pred_value_true : Pred_value_false; - } else { - ctx_assert(false); - } - } else if (t1.type() == SqlType::Smallint || t1.type() == SqlType::Integer || t1.type() == SqlType::Bigint) { - // convert to bigint - bool s1 = ! t1.unSigned(); - bool s2 = ! t2.unSigned(); - SqlBigint v1, v2; - SqlUbigint uv1, uv2; - if (s1) { - v1 = - t1.type() == SqlType::Smallint ? f1.sqlSmallint() : - t1.type() == SqlType::Integer ? f1.sqlInteger() : f1.sqlBigint(); - uv1 = v1; - } else { - uv1 = - t1.type() == SqlType::Smallint ? (SqlUsmallint)f1.sqlSmallint() : - t1.type() == SqlType::Integer ? (SqlUinteger)f1.sqlInteger() : (SqlUbigint)f1.sqlBigint(); - v1 = uv1; - } - if (s2) { - v2 = - t2.type() == SqlType::Smallint ? f2.sqlSmallint() : - t2.type() == SqlType::Integer ? f2.sqlInteger() : f2.sqlBigint(); - uv2 = v2; - } else { - uv2 = - t2.type() == SqlType::Smallint ? (SqlUsmallint)f2.sqlSmallint() : - t2.type() == SqlType::Integer ? (SqlUinteger)f2.sqlInteger() : (SqlUbigint)f2.sqlBigint(); - v2 = uv2; - } - bool b; - switch (opcode) { - case Comp_op::Eq: - b = s1 && s2 ? (v1 == v2) : s1 ? (v1 < 0 ? false : uv1 == uv2) : s2 ? (v2 < 0 ? false : uv1 == uv2) : (uv1 == uv2); - break; - case Comp_op::Noteq: - b = s1 && s2 ? (v1 == v2) : s1 ? (v1 < 0 ? true : uv1 != uv2) : s2 ? (v2 < 0 ? true : uv1 != uv2) : (uv1 != uv2); - break; - case Comp_op::Lt: - b = s1 && s2 ? (v1 < v2) : s1 ? (v1 < 0 ? true : uv1 < uv2) : s2 ? (v2 < 0 ? false : uv1 < uv2) : (uv1 < uv2); - break; - case Comp_op::Lteq: - b = s1 && s2 ? (v1 <= v2) : s1 ? (v1 < 0 ? true : uv1 <= uv2) : s2 ? (v2 < 0 ? false : uv1 <= uv2) : (uv1 <= uv2); - break; - case Comp_op::Gt: - b = s1 && s2 ? (v1 > v2) : s1 ? (v1 < 0 ? false : uv1 > uv2) : s2 ? (v2 < 0 ? true : uv1 > uv2) : (uv1 > uv2); - break; - case Comp_op::Gteq: - b = s1 && s2 ? (v1 >= v2) : s1 ? (v1 < 0 ? false : uv1 >= uv2) : s2 ? (v2 < 0 ? true : uv1 >= uv2) : (uv1 >= uv2); - break; - default: - ctx_assert(false); - break; - } - v = b ? Pred_value_true : Pred_value_false; - } else if (t1.type() == SqlType::Double) { - SqlDouble v1 = f1.sqlDouble(); - SqlDouble v2 = f2.sqlDouble(); - bool b; - switch (opcode) { - case Comp_op::Eq: - b = (v1 == v2); - break; - case Comp_op::Noteq: - b = (v1 != v2); - break; - case Comp_op::Lt: - b = (v1 < v2); - break; - case Comp_op::Lteq: - b = (v1 <= v2); - break; - case Comp_op::Gt: - b = (v1 > v2); - break; - case Comp_op::Gteq: - b = (v1 >= v2); - break; - default: - ctx_assert(false); - break; - } - v = b ? Pred_value_true : Pred_value_false; - } else if (t1.type() == SqlType::Datetime) { - SqlDatetime v1 = f1.sqlDatetime(); - SqlDatetime v2 = f2.sqlDatetime(); - bool b; - b = do_datetime_comp(opcode, v1, v2); - v = b ? Pred_value_true : Pred_value_false; - } else { - ctx_assert(false); - } - } else { - ctx_assert(false); - } - // set result - if (ctl.m_groupIndex == 0) - data.m_value = v; - else - data.groupValue(ctl.m_groupIndex, ctl.m_groupInit) = v; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp deleted file mode 100644 index 3966c6d5db2..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp +++ /dev/null @@ -1,46 +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 */ - -#include -#include -#include - -void -Exec_create_index::execute(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return; - } - NdbDictionary::Index ndbIndex(code.m_indexName.c_str()); - ndbIndex.setTable(code.m_tableName.c_str()); - ndbIndex.setType((NdbDictionary::Index::Type)code.m_type); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - ndbIndex.addIndexColumn(code.m_attrList[i]); - } - // setting fragment type not supported in ndb api - ndbIndex.setLogging(code.m_logging); - dictSchema().deleteTable(ctx, code.m_tableName); - if (ndbDictionary->createIndex(ndbIndex) == -1) { - ctx.pushStatus(ndbDictionary->getNdbError(), "createIndex %s", ndbIndex.getName()); - return; - } - ctx_log1(("index %s on %s created", ndbIndex.getName(), ndbIndex.getTable())); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp b/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp deleted file mode 100644 index d6274119371..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp +++ /dev/null @@ -1,83 +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 */ - -#include -#include -#include - -void -Exec_create_table::execute(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return; - } - NdbDictionary::Table ndbTable(code.m_tableName.c_str()); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const Code::Attr& attr = code.m_attrList[i]; - NdbDictionary::Column ndbColumn(attr.m_attrName.c_str()); - if (i == code.m_tupleId) - ndbColumn.setTupleKey(true); // XXX setTupleId() - if (ctx.logLevel() >= 3) { - char buf[100]; - attr.m_sqlType.print(buf, sizeof(buf)); - ctx_log3(("attr %s type %s", ndbColumn.getName(), buf)); - } - if (attr.m_tupleKey) - ndbColumn.setPrimaryKey(true); - attr.m_sqlType.getType(ctx, &ndbColumn); - if (! ctx.ok()) - return; - if (attr.m_autoIncrement) - ndbColumn.setAutoIncrement(true); - char defaultValue[MAX_ATTR_DEFAULT_VALUE_SIZE]; - defaultValue[0] = 0; - if (attr.m_defaultValue != 0) { - // XXX obviously should evalute it at insert time too - attr.m_defaultValue->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& f = attr.m_defaultValue->getData().sqlField(); - const SqlType& t = f.sqlSpec().sqlType(); - // XXX use SqlField cast method instead - SQLINTEGER ind = 0; - ExtType extType(ExtType::Char); - ExtSpec extSpec(extType); - ExtField extField(extSpec, (SQLPOINTER)defaultValue, sizeof(defaultValue), &ind); - f.copyout(ctx, extField); - if (! ctx.ok()) - return; - if (ind == SQL_NULL_DATA) // do not store NULL default - defaultValue[0] = 0; - } - if (defaultValue[0] != 0) - ndbColumn.setDefaultValue(defaultValue); - ndbTable.addColumn(ndbColumn); - } - if (code.m_fragmentType != NdbDictionary::Object::FragUndefined) - ndbTable.setFragmentType(code.m_fragmentType); - ndbTable.setLogging(code.m_logging); - dictSchema().deleteTable(ctx, code.m_tableName); - if (ndbDictionary->createTable(ndbTable) == -1) { - ctx.pushStatus(ndbDictionary->getNdbError(), "createTable %s", ndbTable.getName()); - return; - } - ctx_log1(("table %s created", ndbTable.getName())); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp deleted file mode 100644 index 10814654a58..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp +++ /dev/null @@ -1,82 +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 */ - -#include -#include -#include -#include -#include -#include - -void -Exec_delete_index::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - // delete each row from the query - data.setCount(0); - while (m_query->fetch(ctx, ctl)) { - NdbOperation* op = tcon->getNdbIndexOperation(code.m_indexName, code.m_tableName); - if (op == 0) { - ctx.pushStatus(ndb, tcon, 0, "getIndexNdbOperation"); - return; - } - if (op->deleteTuple() == -1) { - ctx.pushStatus(ndb, tcon, op, "deleteTuple"); - return; - } - bool done = false; - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - done = true; // match is not possible - break; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - if (op->equal(keyId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "equal attrId=%u", (unsigned)keyId); - return; - } - } - if (done) - continue; - if (tcon->execute(NoCommit) == -1) { - // XXX when did 626 move to connection level - if (tcon->getNdbError().code != 626 && op->getNdbError().code != 626) { - ctx.pushStatus(ndb, tcon, op, "execute without commit"); - return; - } - } else { - data.addCount(); - } - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp b/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp deleted file mode 100644 index d0795286122..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp +++ /dev/null @@ -1,82 +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 */ - -#include -#include -#include -#include -#include -#include - -void -Exec_delete_lookup::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - // delete each row from the query - data.setCount(0); - while (m_query->fetch(ctx, ctl)) { - NdbOperation* op = tcon->getNdbOperation(code.m_tableName); - if (op == 0) { - ctx.pushStatus(ndb, tcon, 0, "getNdbOperation"); - return; - } - if (op->deleteTuple() == -1) { - ctx.pushStatus(ndb, tcon, op, "deleteTuple"); - return; - } - bool done = false; - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - done = true; // match is not possible - break; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - if (op->equal(keyId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "equal attrId=%u", (unsigned)keyId); - return; - } - } - if (done) - continue; - if (tcon->execute(NoCommit) == -1) { - // XXX when did 626 move to connection level - if (tcon->getNdbError().code != 626 && op->getNdbError().code != 626) { - ctx.pushStatus(ndb, tcon, op, "execute without commit"); - return; - } - } else { - data.addCount(); - } - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp b/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp deleted file mode 100644 index a0b3b8314b8..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp +++ /dev/null @@ -1,54 +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 */ - -#include -#include -#include -#include -#include - -void -Exec_delete_scan::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - ctx_assert(ctl.m_scanOp != 0); - // delete each row from the scan - data.setCount(0); - while (m_query->fetch(ctx, ctl)) { - NdbOperation* toOp = ctl.m_scanOp->takeOverForDelete(tcon); - if (toOp == 0) { - ctx.pushStatus(ndb, tcon, ctl.m_scanOp, "takeOverScanOp"); - return; - } - if (tcon->execute(NoCommit) == -1) { - if (toOp->getNdbError().code != 626) { - ctx.pushStatus(ndb, tcon, toOp, "execute without commit"); - return; - } - } else { - data.addCount(); - } - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp deleted file mode 100644 index 6bf451f6911..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp +++ /dev/null @@ -1,38 +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 */ - -#include -#include -#include - -void -Exec_drop_index::execute(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return; - } - dictSchema().deleteTableByIndex(ctx, code.m_indexName); - if (ndbDictionary->dropIndex(code.m_indexName.c_str(), code.m_tableName.c_str()) == -1) { - ctx.pushStatus(ndbDictionary->getNdbError(), "dropIndex %s on %s", code.m_indexName.c_str(), code.m_tableName.c_str()); - return; - } - ctx_log1(("index %s on %s dropped", code.m_indexName.c_str(), code.m_tableName.c_str())); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp b/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp deleted file mode 100644 index 40d1d42fc61..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp +++ /dev/null @@ -1,38 +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 */ - -#include -#include -#include - -void -Exec_drop_table::execute(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return; - } - dictSchema().deleteTable(ctx, code.m_tableName); - if (ndbDictionary->dropTable(code.m_tableName.c_str()) == -1) { - ctx.pushStatus(ndbDictionary->getNdbError(), "dropTable %s", code.m_tableName.c_str()); - return; - } - ctx_log1(("table %s dropped", code.m_tableName.c_str())); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp b/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp deleted file mode 100644 index 636bfda7d59..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp +++ /dev/null @@ -1,54 +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 */ - -#include - -void -Exec_expr_conv::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - const SqlType& t1 = code.sqlSpec().sqlType(); - SqlField& f1 = ctl.m_groupIndex == 0 ? data.m_sqlField : data.groupField(code.sqlSpec().sqlType() , ctl.m_groupIndex, ctl.m_groupInit); - // evaluate the subexpression - ctx_assert(m_expr != 0); - m_expr->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - const SqlType& t2 = m_expr->getCode().sqlSpec().sqlType(); - const SqlField& f2 = ctl.m_groupIndex == 0 ? m_expr->getData().sqlField() : m_expr->getData().groupField(ctl.m_groupIndex); - // conversion to null type - if (t1.type() == SqlType::Null) { - f1.sqlNull(true); - return; - } - // conversion of null data - if (f2.sqlNull()) { - f1.sqlNull(true); - return; - } - // try to convert - if (! f2.cast(ctx, f1)) { - char b1[40], b2[40], b3[40]; - t1.print(b1, sizeof(b1)); - t2.print(b2, sizeof(b2)); - f2.print(b3, sizeof(b3)); - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "cannot convert %s [%s] to %s", b2, b3, b1); - return; - } -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp b/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp deleted file mode 100644 index 093d15c6e2b..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp +++ /dev/null @@ -1,284 +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 */ - -#include -#include -#include - -void -Exec_expr_func::init(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - const SqlType& t = code.sqlSpec().sqlType(); - SqlField& f = ctl.m_groupIndex == 0 ? data.m_sqlField : data.groupField(code.sqlSpec().sqlType(), ctl.m_groupIndex, ctl.m_groupInit); - if (ctl.m_groupIndex >= data.m_groupAcc.size()) - data.m_groupAcc.resize(1 + ctl.m_groupIndex); - Data::Acc& acc = data.m_groupAcc[ctl.m_groupIndex]; - acc.m_count = 0; - Expr_func::Code fc = code.m_func.m_code; - if (fc == Expr_func::Substr || fc == Expr_func::Left || fc == Expr_func::Right) { - } else if (fc == Expr_func::Count) { - f.sqlBigint(0); - } else if (fc == Expr_func::Min || fc == Expr_func::Max) { - f.sqlNull(true); - } else if (fc == Expr_func::Sum) { - f.sqlNull(true); - switch (t.type()) { - case SqlType::Bigint: - acc.m_bigint = 0; - break; - case SqlType::Double: - acc.m_double = 0; - break; - default: - ctx_assert(false); - break; - } - } else if (fc == Expr_func::Avg) { - f.sqlNull(true); - switch (t.type()) { - case SqlType::Double: - acc.m_double = 0.0; - break; - default: - ctx_assert(false); - break; - } - } else if (fc == Expr_func::Rownum) { - // uses only m_count - } else if (fc == Expr_func::Sysdate) { - // set time once - NDB_TICKS secs = 0; - Uint32 micros = 0; - NdbTick_CurrentMicrosecond(&secs, µs); - time_t clock = secs; - struct tm* t = gmtime(&clock); - SqlDatetime& d = acc.m_sysdate; - d.cc((1900 + t->tm_year) / 100); - d.yy((1900 + t->tm_year) % 100); - d.mm(1 + t->tm_mon); - d.dd(t->tm_mday); - d.HH(t->tm_hour); - d.MM(t->tm_min); - d.SS(t->tm_sec); - d.ff(1000 * micros); - } else { - ctx_assert(false); - } -} - -void -Exec_expr_func::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - const SqlType& t = code.sqlSpec().sqlType(); - if (ctl.m_groupInit) - init(ctx, ctl); - SqlField& f = ctl.m_groupIndex == 0 ? data.m_sqlField : data.groupField(code.sqlSpec().sqlType(), ctl.m_groupIndex, false); - Data::Acc& acc = data.m_groupAcc[ctl.m_groupIndex]; - Expr_func::Code fc = code.m_func.m_code; - const unsigned narg = code.m_narg; - Exec_expr** args = code.m_args; - ctx_assert(args != 0); - // evaluate arguments - for (unsigned i = 1; i <= narg; i++) { - ctx_assert(args[i] != 0); - unsigned save = ctl.m_groupIndex; - if (code.m_func.m_aggr) - ctl.m_groupIndex = 0; - args[i]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - ctl.m_groupIndex = save; - } - if (fc == Expr_func::Substr || fc == Expr_func::Left || fc == Expr_func::Right) { - ctx_assert((narg == (unsigned)2) || (narg == (unsigned)(fc == Expr_func::Substr ? 3 : 2))); - const SqlType& t1 = args[1]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = args[1]->getData().sqlField(); - int pos, len; - for (unsigned i = 2; i <= narg; i++) { - int& num = (fc == Expr_func::Substr ? (i == 2 ? pos : len) : len); - const SqlType& t2 = args[i]->getCode().sqlSpec().sqlType(); - const SqlField& f2 = args[i]->getData().sqlField(); - switch (t2.type()) { - case SqlType::Smallint: - num = static_cast(f2.sqlSmallint()); - break; - case SqlType::Integer: - num = static_cast(f2.sqlInteger()); - break; - case SqlType::Bigint: - num = static_cast(f2.sqlBigint()); - break; - default: - ctx_assert(false); - break; - } - } - int length = 0; - const SqlChar* data = 0; - switch (t1.type()) { - case SqlType::Char: - length = t1.length(); - data = f1.sqlChar(); - break; - case SqlType::Varchar: - unsigned ulength; - data = f1.sqlVarchar(&ulength); - length = ulength; - break; - default: - ctx_assert(false); - break; - } - if (fc == Expr_func::Left) - pos = 1; - else if (fc == Expr_func::Right) - pos = len > length ? 1 : length - len + 1; - else if (pos < 0) - pos += length + 1; - if (pos <= 0 || pos > length || len <= 0) { - f.sqlNull(true); // oracle-ish - return; - } - if (len > length - pos + 1) - len = length - pos + 1; - switch (t1.type()) { - case SqlType::Char: - f.sqlChar(data + (pos - 1), len); - break; - case SqlType::Varchar: - f.sqlVarchar(data + (pos - 1), len); - break; - default: - ctx_assert(false); - break; - } - } else if (fc == Expr_func::Count) { - ctx_assert(narg == 0 || narg == 1); - if (ctl.m_postEval) - return; - if (narg == 1) { - const SqlField& f1 = args[1]->getData().sqlField(); - if (f1.sqlNull()) - return; - } - f.sqlBigint(++acc.m_count); - } else if (fc == Expr_func::Min) { - ctx_assert(narg == 1); - if (ctl.m_postEval) - return; - const SqlField& f1 = args[1]->getData().sqlField(); - if (f1.sqlNull()) - return; - if (f.sqlNull() || f1.less(f)) - f1.copy(ctx, f); - } else if (fc == Expr_func::Max) { - ctx_assert(narg == 1); - if (ctl.m_postEval) - return; - const SqlField& f1 = args[1]->getData().sqlField(); - if (f1.sqlNull()) - return; - if (f.sqlNull() || f.less(f1)) - f1.copy(ctx, f); - } else if (fc == Expr_func::Sum) { - ctx_assert(narg == 1); - if (ctl.m_postEval) - return; - const SqlType& t1 = args[1]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = args[1]->getData().sqlField(); - if (f1.sqlNull()) - return; - switch (t.type()) { - case SqlType::Bigint: - switch (t1.type()) { - case SqlType::Integer: - acc.m_bigint += f1.sqlInteger(); - break; - case SqlType::Bigint: - acc.m_bigint += f1.sqlBigint(); - break; - default: - ctx_assert(false); - break; - } - f.sqlBigint(acc.m_bigint); - break; - case SqlType::Double: - switch (t1.type()) { - case SqlType::Real: - acc.m_double += f1.sqlReal(); - break; - case SqlType::Double: - acc.m_double += f1.sqlDouble(); - break; - default: - ctx_assert(false); - break; - } - f.sqlDouble(acc.m_double); - break; - default: - ctx_assert(false); - break; - } - } else if (fc == Expr_func::Avg) { - ctx_assert(narg == 1); - if (ctl.m_postEval) - return; - const SqlType& t1 = args[1]->getCode().sqlSpec().sqlType(); - const SqlField& f1 = args[1]->getData().sqlField(); - if (f1.sqlNull()) - return; - switch (t1.type()) { - case SqlType::Smallint: - acc.m_bigint += f1.sqlSmallint(); - break; - case SqlType::Integer: - acc.m_bigint += f1.sqlInteger(); - break; - case SqlType::Bigint: - acc.m_bigint += f1.sqlBigint(); - break; - case SqlType::Real: - acc.m_double += f1.sqlReal(); - break; - case SqlType::Double: - acc.m_double += f1.sqlDouble(); - break; - default: - ctx_assert(false); - break; - } - f.sqlDouble(acc.m_double / (SqlDouble)++acc.m_count); - } else if (fc == Expr_func::Rownum) { - ctx_assert(narg == 0); - if (! ctl.m_postEval) - f.sqlBigint(1 + acc.m_count); - else - acc.m_count++; - } else if (fc == Expr_func::Sysdate) { - ctx_assert(narg == 0); - if (ctl.m_postEval) - return; - f.sqlDatetime(acc.m_sysdate); - } else { - ctx_assert(false); - } -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp b/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp deleted file mode 100644 index fc8b6df9f5b..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp +++ /dev/null @@ -1,147 +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 */ - -#include - -void -Exec_expr_op::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - const SqlType& t = code.sqlSpec().sqlType(); - SqlField& f = ctl.m_groupIndex == 0 ? data.m_sqlField : data.groupField(code.sqlSpec().sqlType(), ctl.m_groupIndex, ctl.m_groupInit); - if (code.m_op.arity() == 1) { - // evaluate sub-expression - ctx_assert(m_expr[1] != 0); - m_expr[1]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - const SqlField& f1 = ctl.m_groupIndex == 0 ? m_expr[1]->getData().sqlField() : m_expr[1]->getData().groupField(ctl.m_groupIndex); - // handle null - if (f1.sqlNull()) { - f.sqlNull(true); - return; - } - if (t.type() == SqlType::Bigint) { - SqlBigint v = 0; - SqlBigint v1 = f1.sqlBigint(); - switch (code.m_op.m_opcode) { - case Expr_op::Plus: - v = v1; - break; - case Expr_op::Minus: - v = - v1; - break; - default: - ctx_assert(false); - break; - } - f.sqlBigint(v); - } else if (t.type() == SqlType::Double) { - SqlDouble v = 0; - SqlDouble v1 = f1.sqlDouble(); - switch (code.m_op.m_opcode) { - case Expr_op::Plus: - v = v1; - break; - case Expr_op::Minus: - v = - v1; - break; - default: - ctx_assert(false); - break; - } - f.sqlDouble(v); - } else { - ctx_assert(false); - } - } else if (code.m_op.arity() == 2) { - // evaluate sub-expressions - ctx_assert(m_expr[1] != 0 && m_expr[2] != 0); - m_expr[1]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - m_expr[2]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - const SqlField& f1 = ctl.m_groupIndex == 0 ? m_expr[1]->getData().sqlField() : m_expr[1]->getData().groupField(ctl.m_groupIndex); - const SqlField& f2 = ctl.m_groupIndex == 0 ? m_expr[2]->getData().sqlField() : m_expr[2]->getData().groupField(ctl.m_groupIndex); - // handle null - if (f1.sqlNull() || f2.sqlNull()) { - f.sqlNull(true); - return; - } - if (t.type() == SqlType::Bigint) { - SqlBigint v = 0; - SqlBigint v1 = f1.sqlBigint(); - SqlBigint v2 = f2.sqlBigint(); - switch (code.m_op.m_opcode) { - case Expr_op::Add: - v = v1 + v2; - break; - case Expr_op::Subtract: - v = v1 - v2; - break; - case Expr_op::Multiply: - v = v1 * v2; - break; - case Expr_op::Divide: - if (v2 == 0) { - ctx.pushStatus(Sqlstate::_22012, Error::Gen, "integer division by zero"); - return; - } - v = v1 / v2; - break; - default: - ctx_assert(false); - break; - } - f.sqlBigint(v); - } else if (t.type() == SqlType::Double) { - SqlDouble v = 0; - SqlDouble v1 = f1.sqlDouble(); - SqlDouble v2 = f2.sqlDouble(); - switch (code.m_op.m_opcode) { - case Expr_op::Add: - v = v1 + v2; - break; - case Expr_op::Subtract: - v = v1 - v2; - break; - case Expr_op::Multiply: - v = v1 * v2; - break; - case Expr_op::Divide: - v = v1 / v2; - break; - default: - ctx_assert(false); - break; - } - f.sqlDouble(v); // XXX isnan() - } else { - ctx_assert(false); - } - } else { - ctx_assert(false); - } - // result is not null - f.sqlNull(false); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp b/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp deleted file mode 100644 index c2612c6aaab..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp +++ /dev/null @@ -1,144 +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 */ - -#include -#include -#include -#include -#include - -#ifdef NDB_WIN32 -#define FMT_I64 "%I64d" -#else -#define FMT_I64 "%lld" -#endif - -void -Exec_insert::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - // insert each row from query - data.setCount(0); - while (m_query->fetch(ctx, ctl)) { - NdbOperation* op = tcon->getNdbOperation(code.m_tableName); - if (op == 0) { - ctx.pushStatus(ndb, tcon, 0, "getNdbOperation"); - return; - } - if (code.m_insertOp == Insert_op_insert) { - if (op->insertTuple() == -1) { - ctx.pushStatus(ndb, tcon, op, "insertTuple"); - return; - } - } else if (code.m_insertOp == Insert_op_write) { - if (op->writeTuple() == -1) { - ctx.pushStatus(ndb, tcon, op, "writeTuple"); - return; - } - } else { - ctx_assert(false); - } - const SqlRow& sqlRow = m_query->getData().sqlRow(); - if (code.m_tupleId != 0) { - Uint64 tid = op->setTupleId(); - if (tid == 0) { - ctx.pushStatus(ndb, tcon, op, "setTupleId attrId=%u", (unsigned)code.m_tupleId); - return; - } - ctx_log3(("generated TupleId " FMT_I64, tid)); - } else if (code.m_autoIncrement != 0) { - // XXX use cache size 1 for birdies and fishies - Uint64 tupleId = ndb->getAutoIncrementValue(code.m_tableName, 1); - if (tupleId == 0) { - ctx.pushStatus(ndb, "getTupleIdFromNdb"); - return; - } - NdbAttrId attrId = code.m_autoIncrement - 1; - SqlSmallint sqlSmallint = 0; - SqlInteger sqlInteger = 0; - SqlBigint sqlBigint = 0; - const char* value = 0; - if (code.m_idType.type() == SqlType::Smallint) { - sqlSmallint = tupleId; - value = (const char*)&sqlSmallint; - } else if (code.m_idType.type() == SqlType::Integer) { - sqlInteger = tupleId; - value = (const char*)&sqlInteger; - } else if (code.m_idType.type() == SqlType::Bigint) { - sqlBigint = tupleId; - value = (const char*)&sqlBigint; - } else { - ctx_assert(false); - } - if (op->equal(attrId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "equal attrId=%u", (unsigned)attrId); - return; - } - } else { - // normal key attributes - for (unsigned i = 1; i <= sqlRow.count(); i++) { - if (! code.m_isKey[i]) - continue; - NdbAttrId attrId = code.m_attrId[i]; - const SqlField& f = sqlRow.getEntry(i); - const void* addr = f.sqlNull() ? 0 : f.addr(); - const char* value = static_cast(addr); - if (op->equal(attrId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "equal attrId=%u", (unsigned)attrId); - return; - } - } - } - // non-key attributes - for (unsigned i = 1; i <= sqlRow.count(); i++) { - if (code.m_isKey[i]) - continue; - NdbAttrId attrId = code.m_attrId[i]; - const SqlField& f = sqlRow.getEntry(i); - const void* addr = f.sqlNull() ? 0 : f.addr(); - const char* value = static_cast(addr); - if (op->setValue(attrId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "setValue attrId=%u", (unsigned)attrId); - return; - } - } - // default non-key values - for (unsigned i = 1; i <= code.m_defaultCount; i++) { - NdbAttrId attrId = code.m_defaultId[i]; - const SqlField& f = code.m_defaultValue->getEntry(i); - const void* addr = f.sqlNull() ? 0 : f.addr(); - const char* value = static_cast(addr); - if (op->setValue(attrId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "setValue attrId=%u", (unsigned)attrId); - return; - } - } - if (tcon->execute(NoCommit) == -1) { - ctx.pushStatus(ndb, tcon, op, "execute without commit"); - return; - } - data.addCount(); - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp b/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp deleted file mode 100644 index 7caa4656473..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp +++ /dev/null @@ -1,197 +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 */ - -#include -#include - -struct TableUnary { - Pred_value value1; - Pred_value result; -}; - -struct TableBinary { - Pred_value value1; - Pred_value value2; - Pred_value result; -}; - -static TableUnary -tableNot[] = { - { Pred_value_unknown, Pred_value_unknown }, - { Pred_value_false, Pred_value_true }, - { Pred_value_true, Pred_value_false }, -}; - -static TableBinary -tableAnd[] = { - { Pred_value_unknown, Pred_value_unknown, Pred_value_unknown }, - { Pred_value_unknown, Pred_value_false, Pred_value_false }, - { Pred_value_unknown, Pred_value_true, Pred_value_unknown }, - { Pred_value_false, Pred_value_unknown, Pred_value_false }, - { Pred_value_false, Pred_value_false, Pred_value_false }, - { Pred_value_false, Pred_value_true, Pred_value_false }, - { Pred_value_true, Pred_value_unknown, Pred_value_unknown }, - { Pred_value_true, Pred_value_false, Pred_value_false }, - { Pred_value_true, Pred_value_true, Pred_value_true } -}; - -static TableBinary -tableOr[] = { - { Pred_value_unknown, Pred_value_unknown, Pred_value_unknown }, - { Pred_value_unknown, Pred_value_false, Pred_value_unknown }, - { Pred_value_unknown, Pred_value_true, Pred_value_true }, - { Pred_value_false, Pred_value_unknown, Pred_value_unknown }, - { Pred_value_false, Pred_value_false, Pred_value_false }, - { Pred_value_false, Pred_value_true, Pred_value_true }, - { Pred_value_true, Pred_value_unknown, Pred_value_true }, - { Pred_value_true, Pred_value_false, Pred_value_true }, - { Pred_value_true, Pred_value_true, Pred_value_true } -}; - -void -Exec_pred_op::execInterp(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - ctx_assert(ctl.m_scanFilter != 0); - NdbScanFilter& scanFilter = *ctl.m_scanFilter; - if (code.m_op.arity() == 1) { - ctx_assert(m_pred[1] != 0); - switch (code.m_op.m_opcode) { - case Pred_op::Not: - scanFilter.begin(NdbScanFilter::NAND); - m_pred[1]-> execInterp(ctx, ctl); - if (! ctx.ok()) - return; - scanFilter.end(); - break; - default: - ctx_assert(false); - break; - } - } else if (code.m_op.arity() == 2) { - ctx_assert(m_pred[1] != 0 && m_pred[2] != 0); - switch (code.m_op.m_opcode) { - case Pred_op::And: - scanFilter.begin(NdbScanFilter::AND); - m_pred[1]-> execInterp(ctx, ctl); - if (! ctx.ok()) - return; - m_pred[2]-> execInterp(ctx, ctl); - if (! ctx.ok()) - return; - scanFilter.end(); - break; - case Pred_op::Or: - scanFilter.begin(NdbScanFilter::OR); - m_pred[1]-> execInterp(ctx, ctl); - if (! ctx.ok()) - return; - m_pred[2]-> execInterp(ctx, ctl); - if (! ctx.ok()) - return; - scanFilter.end(); - break; - default: - ctx_assert(false); - break; - } - } else { - ctx_assert(false); - } -} - -void -Exec_pred_op::evaluate(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Pred_value v = Pred_value_unknown; - if (code.m_op.arity() == 1) { - // evaluate sub-expression - ctx_assert(m_pred[1] != 0); - m_pred[1]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - Pred_value v1 = ctl.m_groupIndex == 0 ? m_pred[1]->getData().getValue() : m_pred[1]->getData().groupValue(ctl.m_groupIndex); - // look up result - TableUnary* table = 0; - unsigned size = 0; - switch (code.m_op.m_opcode) { - case Pred_op::Not: - table = tableNot; - size = sizeof(tableNot) / sizeof(tableNot[0]); - break; - default: - ctx_assert(false); - break; - } - unsigned i; - for (i = 0; i < size; i++) { - if (table[i].value1 == v1) { - v = table[i].result; - break; - } - } - ctx_assert(i < size); - } else if (code.m_op.arity() == 2) { - // evaluate sub-expressions - ctx_assert(m_pred[1] != 0 && m_pred[2] != 0); - m_pred[1]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - m_pred[2]->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - if (ctl.m_postEval) - return; - Pred_value v1 = ctl.m_groupIndex == 0 ? m_pred[1]->getData().getValue() : m_pred[1]->getData().groupValue(ctl.m_groupIndex); - Pred_value v2 = ctl.m_groupIndex == 0 ? m_pred[2]->getData().getValue() : m_pred[2]->getData().groupValue(ctl.m_groupIndex); - // look up result - TableBinary* table = 0; - unsigned size = 0; - switch (code.m_op.m_opcode) { - case Pred_op::And: - table = tableAnd; - size = sizeof(tableAnd) / sizeof(tableAnd[0]); - break; - case Pred_op::Or: - table = tableOr; - size = sizeof(tableOr) / sizeof(tableOr[0]); - break; - default: - ctx_assert(false); - break; - } - unsigned i; - for (i = 0; i < size; i++) { - if (table[i].value1 == v1 && table[i].value2 == v2) { - v = table[i].result; - break; - } - } - ctx_assert(i < size); - } else { - ctx_assert(false); - } - // set result - if (ctl.m_groupIndex == 0) - data.m_value = v; - else - data.groupValue(ctl.m_groupIndex, ctl.m_groupInit) = v; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp deleted file mode 100644 index 919743beac2..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp +++ /dev/null @@ -1,136 +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 */ - -#include -#include -#include -#include -#include -#include - -void -Exec_query_index::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - data.m_done = false; - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - if (data.m_con != 0) { - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("lookup closed at re-execute")); - } - const bool unco = connArea().uncommitted(); - if (! unco) { - // use new transaction to not run out of operations - data.m_con = ndb->startTransaction(); - if (data.m_con == 0) { - ctx.pushStatus(ndb, "startTransaction"); - return; - } - } else { - ctx_log3(("lookup using main transaction")); - } - data.m_op = (unco ? tcon : data.m_con)->getNdbIndexOperation(code.m_indexName, code.m_tableName); - if (data.m_op == 0) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), 0, "getNdbIndexOperation"); - return; - } - if (data.m_op->readTuple() == -1) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "readTuple"); - return; - } - // key attributes - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - data.m_done = true; // match is not possible - return; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - if (data.m_op->equal(keyId, value) == -1) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "equal attrId=%u", (unsigned)keyId); - return; - } - } - // queried attributes - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const NdbAttrId attrId = code.m_attrId[i]; - SqlField& f = sqlRow.getEntry(i); - char* addr = static_cast(f.addr()); - NdbRecAttr* recAttr = data.m_op->getValue(attrId, addr); - if (recAttr == 0) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "getValue attrId=%u", (unsigned)attrId); - return; - } - data.m_recAttr[i] = recAttr; - } - if (code.m_attrCount == 0) { // NDB requires one - (void)data.m_op->getValue((NdbAttrId)0); - } - data.setCount(0); - if ((unco ? tcon : data.m_con)->execute(unco ? NoCommit : Commit) == -1) { - // XXX when did 626 move to connection level - if ((unco ? tcon : data.m_con)->getNdbError().code != 626 && data.m_op->getNdbError().code != 626) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "execute xxx"); - return; - } - data.m_done = true; - } else { - stmtArea().incTuplesFetched(); - data.m_done = false; - } - if (! unco) { - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log3(("index lookup closed at execute")); - } -} - -bool -Exec_query_index::fetchImpl(Ctx &ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - // returns at most one row - if (data.m_done) - return false; - // set null bits - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - NdbRecAttr* recAttr = data.m_recAttr[i]; - int isNULL = recAttr->isNULL(); - SqlField& f = sqlRow.getEntry(i); - ctx_assert(isNULL == 0 || isNULL == 1); - f.sqlNull(isNULL == 1); - } - data.m_done = true; - return true; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp deleted file mode 100644 index 599e1a36461..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp +++ /dev/null @@ -1,136 +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 */ - -#include -#include -#include -#include -#include -#include - -void -Exec_query_lookup::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - data.m_done = false; - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - if (data.m_con != 0) { - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("lookup closed at re-execute")); - } - const bool unco = connArea().uncommitted(); - if (! unco) { - // use new transaction to not run out of operations - data.m_con = ndb->startTransaction(); - if (data.m_con == 0) { - ctx.pushStatus(ndb, "startTransaction"); - return; - } - } else { - ctx_log3(("lookup using main transaction")); - } - data.m_op = (unco ? tcon : data.m_con)->getNdbOperation(code.m_tableName); - if (data.m_op == 0) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), 0, "getNdbOperation"); - return; - } - if (data.m_op->readTuple() == -1) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "readTuple"); - return; - } - // key attributes - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - data.m_done = true; // match is not possible - return; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - if (data.m_op->equal(keyId, value) == -1) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "equal attrId=%u", (unsigned)keyId); - return; - } - } - // queried attributes - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const NdbAttrId attrId = code.m_attrId[i]; - SqlField& f = sqlRow.getEntry(i); - char* addr = static_cast(f.addr()); - NdbRecAttr* recAttr = data.m_op->getValue(attrId, addr); - if (recAttr == 0) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "getValue attrId=%u", (unsigned)attrId); - return; - } - data.m_recAttr[i] = recAttr; - } - if (code.m_attrCount == 0) { // NDB requires one - (void)data.m_op->getValue((NdbAttrId)0); - } - data.setCount(0); - if ((unco ? tcon : data.m_con)->execute(unco ? NoCommit : Commit) == -1) { - // XXX when did 626 move to connection level - if ((unco ? tcon : data.m_con)->getNdbError().code != 626 && data.m_op->getNdbError().code != 626) { - ctx.pushStatus(ndb, (unco ? tcon : data.m_con), data.m_op, "execute xxx"); - return; - } - data.m_done = true; - } else { - stmtArea().incTuplesFetched(); - data.m_done = false; - } - if (! unco) { - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log3(("lookup closed at execute")); - } -} - -bool -Exec_query_lookup::fetchImpl(Ctx &ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - // returns at most one row - if (data.m_done) - return false; - // set null bits - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - NdbRecAttr* recAttr = data.m_recAttr[i]; - int isNULL = recAttr->isNULL(); - SqlField& f = sqlRow.getEntry(i); - ctx_assert(isNULL == 0 || isNULL == 1); - f.sqlNull(isNULL == 1); - } - data.m_done = true; - return true; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp deleted file mode 100644 index 0bc878d760d..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp +++ /dev/null @@ -1,143 +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 */ - -#include -#include -#include -#include -#include -#include - -#define startBuddyTransaction(x) hupp(x) - -void -Exec_query_range::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - data.m_done = false; - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - if (data.m_con != 0) { - data.m_con->stopScan(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("range scan closed at re-execute")); - } - data.m_con = ndb->startBuddyTransaction(tcon); - if (data.m_con == 0) { - ctx.pushStatus(ndb, tcon, 0, "startBuddyTransaction"); - return; - } - data.m_op = data.m_con->getNdbOperation(code.m_indexName, code.m_tableName); - if (data.m_op == 0) { - ctx.pushStatus(ndb, data.m_con, 0, "getNdbOperation"); - return; - } - if (! code.m_exclusive) { - if (data.m_op->openScanReadCommitted(data.m_parallel) == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "openScanReadCommitted"); - return; - } - } else { - if (data.m_op->openScanExclusive(data.m_parallel) == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "openScanExclusive"); - return; - } - } - // set bounds - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - data.m_done = true; // match is not possible - return; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - const unsigned len = f.allocSize(); - if (data.m_op->setBound(keyId, NdbOperation::BoundEQ, value, len) == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "setBound attrId=%u", (unsigned)keyId); - return; - } - } - // queried attributes - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const NdbAttrId attrId = code.m_attrId[i]; - SqlField& f = sqlRow.getEntry(i); - char* addr = static_cast(f.addr()); - NdbRecAttr* recAttr = data.m_op->getValue(attrId, addr); - if (recAttr == 0) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "getValue attrId=%u", (unsigned)attrId); - return; - } - data.m_recAttr[i] = recAttr; - } - if (code.m_attrCount == 0) { // NDB requires one - (void)data.m_op->getValue((NdbAttrId)0); - } - data.setCount(0); - if (data.m_con->executeScan() == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "executeScan"); - return; - } - ctx_log2(("range scan %s [%08x] started", ! code.m_exclusive ? "read" : "exclusive", (unsigned)this)); - ctl.m_scanOp = data.m_op; -} - -bool -Exec_query_range::fetchImpl(Ctx &ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - // if never started - if (data.m_done) - return false; - int ret = data.m_con->nextScanResult(); - if (ret != 0) { - if (ret == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "nextScanResult"); - } - data.m_con->stopScan(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("range scan [%08x] closed at last row", (unsigned)this)); - return false; - } - // set null bits - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - NdbRecAttr* recAttr = data.m_recAttr[i]; - int isNULL = recAttr->isNULL(); - SqlField& f = sqlRow.getEntry(i); - ctx_assert(isNULL == 0 || isNULL == 1); - f.sqlNull(isNULL == 1); - } - stmtArea().incTuplesFetched(); - return true; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp deleted file mode 100644 index 213dfdd616d..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp +++ /dev/null @@ -1,130 +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 */ - -#include -#include -#include -#include -#include -#include - -#define startBuddyTransaction(x) hupp(x) - -void -Exec_query_scan::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - if (data.m_con != 0) { - data.m_con->stopScan(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("scan closed at re-execute")); - } - data.m_con = ndb->startBuddyTransaction(tcon); - if (data.m_con == 0) { - ctx.pushStatus(ndb, tcon, 0, "startBuddyTransaction"); - return; - } - data.m_op = data.m_con->getNdbOperation(code.m_tableName); - if (data.m_op == 0) { - ctx.pushStatus(ndb, data.m_con, 0, "getNdbOperation"); - return; - } - if (! code.m_exclusive) { - if (data.m_op->openScanReadCommitted(data.m_parallel) == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "openScanReadCommitted"); - return; - } - } else { - if (data.m_op->openScanExclusive(data.m_parallel) == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "openScanExclusive"); - return; - } - } - if (m_interp == 0) { - // XXX unnecessary - if (data.m_op->interpret_exit_ok() == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "interpret_exit_ok"); - return; - } - } else { - NdbScanFilter scanFilter(data.m_op); - scanFilter.begin(NdbScanFilter::AND); - ctl.m_scanFilter = &scanFilter; - m_interp->execInterp(ctx, ctl); - if (! ctx.ok()) - return; - scanFilter.end(); - } - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const NdbAttrId attrId = code.m_attrId[i]; - SqlField& sqlField = sqlRow.getEntry(i); - char* addr = static_cast(sqlField.addr()); - NdbRecAttr* recAttr = data.m_op->getValue(attrId, addr); - if (recAttr == 0) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "getValue attrId=%u", (unsigned)attrId); - return; - } - data.m_recAttr[i] = recAttr; - } - if (code.m_attrCount == 0) { // NDB requires one - (void)data.m_op->getValue((NdbAttrId)0); - } - if (data.m_con->executeScan() == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "executeScan"); - return; - } - ctx_log2(("scan %s [%08x] started", ! code.m_exclusive ? "read" : "exclusive", (unsigned)this)); - ctl.m_scanOp = data.m_op; -} - -bool -Exec_query_scan::fetchImpl(Ctx &ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - int ret = data.m_con->nextScanResult(); - if (ret != 0) { - if (ret == -1) { - ctx.pushStatus(ndb, data.m_con, data.m_op, "nextScanResult"); - } - data.m_con->stopScan(); - ndb->closeTransaction(data.m_con); - data.m_con = 0; - data.m_op = 0; - ctx_log2(("scan [%08x] closed at last row", (unsigned)this)); - return false; - } - // set null bits - const SqlRow& sqlRow = data.sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - NdbRecAttr* recAttr = data.m_recAttr[i]; - int isNULL = recAttr->isNULL(); - SqlField& sqlField = sqlRow.getEntry(i); - ctx_assert(isNULL == 0 || isNULL == 1); - sqlField.sqlNull(isNULL == 1); - } - stmtArea().incTuplesFetched(); - return true; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp deleted file mode 100644 index acdc120e609..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp +++ /dev/null @@ -1,761 +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 */ - -#include -#include -#include -#include - -#define NULL_CHAR ((char*)0) -#define NULL_INT (-2147483647) - -struct Typeinfo { - const char* m_type_name; // 1 - int m_data_type; // 2 - int m_column_size; // 3 - const char* m_literal_prefix; // 4 - const char* m_literal_suffix; // 5 - const char* m_create_params; // 6 - int m_nullable; // 7 - int m_case_sensitive; // 8 - int m_searchable; // 9 - int m_unsigned_attribute; // 10 - int m_fixed_prec_scale; // 11 - int m_auto_unique_value; // 12 - const char* m_local_type_name; // 13 - int m_minimum_scale; // 14 - int m_maximum_scale; // 15 - int m_sql_data_type; // 16 - int m_sql_datetime_sub; // 17 - int m_num_prec_radix; // 18 - int m_interval_precision; // 19 -}; - -static const Typeinfo -typeinfoList[] = { - { "CHAR", // 1 - SQL_CHAR, // 2 - 8000, // 3 - "'", // 4 - "'", // 5 - "length", // 6 - SQL_NULLABLE, // 7 - SQL_TRUE, // 8 - SQL_SEARCHABLE, // 9 - NULL_INT, // 10 - SQL_FALSE, // 11 - NULL_INT, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_CHAR, // 16 - NULL_INT, // 17 - NULL_INT, // 18 - NULL_INT // 19 - }, - { "VARCHAR", // 1 - SQL_VARCHAR, // 2 - 8000, // 3 - "'", // 4 - "'", // 5 - "length", // 6 - SQL_NULLABLE, // 7 - SQL_TRUE, // 8 - SQL_SEARCHABLE, // 9 - NULL_INT, // 10 - SQL_FALSE, // 11 - NULL_INT, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_VARCHAR, // 16 - NULL_INT, // 17 - NULL_INT, // 18 - NULL_INT // 19 - }, - { "BINARY", // 1 - SQL_BINARY, // 2 - 8000, // 3 - "'", // 4 - "'", // 5 - "length", // 6 - SQL_NULLABLE, // 7 - SQL_TRUE, // 8 - SQL_SEARCHABLE, // 9 - NULL_INT, // 10 - SQL_FALSE, // 11 - NULL_INT, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_BINARY, // 16 - NULL_INT, // 17 - NULL_INT, // 18 - NULL_INT // 19 - }, - { "VARBINARY", // 1 - SQL_VARBINARY, // 2 - 8000, // 3 - "'", // 4 - "'", // 5 - "length", // 6 - SQL_NULLABLE, // 7 - SQL_TRUE, // 8 - SQL_SEARCHABLE, // 9 - NULL_INT, // 10 - SQL_FALSE, // 11 - NULL_INT, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_VARBINARY, // 16 - NULL_INT, // 17 - NULL_INT, // 18 - NULL_INT // 19 - }, - { "SMALLINT", // 1 - SQL_SMALLINT, // 2 - 4, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_FALSE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_SMALLINT, // 16 - NULL_INT, // 17 - 10, // 18 - NULL_INT // 19 - }, - { "SMALLINT UNSIGNED", // 1 - SQL_SMALLINT, // 2 - 4, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_TRUE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_SMALLINT, // 16 - NULL_INT, // 17 - 10, // 18 - NULL_INT // 19 - }, - { "INT", // 1 - SQL_INTEGER, // 2 - 9, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_FALSE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_INTEGER, // 16 - NULL_INT, // 17 - 10, // 18 - NULL_INT // 19 - }, - { "INT UNSIGNED", // 1 - SQL_INTEGER, // 2 - 9, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_TRUE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_INTEGER, // 16 - NULL_INT, // 17 - 10, // 18 - NULL_INT // 19 - }, - { "BIGINT", // 1 - SQL_BIGINT, // 2 - 19, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_FALSE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_BIGINT, // 16 - NULL_INT, // 17 - 10, // 18 - NULL_INT // 19 - }, - { "BIGINT UNSIGNED", // 1 - SQL_BIGINT, // 2 - 19, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_TRUE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_BIGINT, // 16 - NULL_INT, // 17 - 10, // 18 - NULL_INT // 19 - }, - { "REAL", // 1 - SQL_REAL, // 2 - 31, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_FALSE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_REAL, // 16 - NULL_INT, // 17 - 2, // 18 - NULL_INT // 19 - }, - { "FLOAT", // 1 - SQL_DOUBLE, // 2 - 63, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_FALSE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_DOUBLE, // 16 - NULL_INT, // 17 - 2, // 18 - NULL_INT // 19 - }, - { "DATETIME", // 1 - SQL_TYPE_TIMESTAMP, // 2 - 30, // 3 - NULL_CHAR, // 4 - NULL_CHAR, // 5 - NULL_CHAR, // 6 - SQL_NULLABLE, // 7 - SQL_FALSE, // 8 - SQL_SEARCHABLE, // 9 - SQL_FALSE, // 10 - SQL_TRUE, // 11 - SQL_FALSE, // 12 - NULL_CHAR, // 13 - NULL_INT, // 14 - NULL_INT, // 15 - SQL_DATETIME, // 16 XXX - NULL_INT, // 17 - 2, // 18 - NULL_INT // 19 - } -}; - -const unsigned -typeinfoCount = sizeof(typeinfoList)/sizeof(typeinfoList[0]); - -void -Exec_query_sys::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return; - } - if (code.m_sysId == DictSys::OdbcTypeinfo || code.m_sysId == DictSys::Dual) { - data.m_rowPos = 0; // at first entry - return; - } - if (code.m_sysId == DictSys::OdbcTables || code.m_sysId == DictSys::OdbcColumns || code.m_sysId == DictSys::OdbcPrimarykeys) { - // take all objects - if (ndbDictionary->listObjects(data.m_objectList) == -1) { - ctx.pushStatus(ndb, "listObjects"); - return; - } - data.m_tablePos = 0; // at first entry - data.m_attrPos = 0; - data.m_keyPos = 0; - return; - } - ctx_assert(false); -} - -static bool -isNdbTable(const NdbDictionary::Dictionary::List::Element& element) -{ - switch (element.type) { - //case NdbDictionary::Object::SystemTable: - case NdbDictionary::Object::UserTable: - case NdbDictionary::Object::UniqueHashIndex: - case NdbDictionary::Object::HashIndex: - case NdbDictionary::Object::UniqueOrderedIndex: - case NdbDictionary::Object::OrderedIndex: - return true; - default: - break; - } - return false; -} - - -bool -Exec_query_sys::fetchImpl(Ctx &ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbDictionary::Dictionary* ndbDictionary = ndb->getDictionary(); - if (ndbDictionary == 0) { - ctx.pushStatus(ndb, "getDictionary"); - return false; - } - if (code.m_sysId == DictSys::OdbcTypeinfo) { - if (data.m_rowPos >= typeinfoCount) { - return false; - } - SqlRow& row = data.m_sqlRow; - const Typeinfo& typeinfo = typeinfoList[data.m_rowPos++]; - for (unsigned i = 1; i <= code.m_attrCount; i++) { - SqlField& f = data.m_sqlRow.getEntry(i); - switch (1 + code.m_attrId[i]) { - case 1: - if (typeinfo.m_type_name == NULL_CHAR) - f.sqlNull(true); - else - f.sqlVarchar(typeinfo.m_type_name, SQL_NTS); - break; - case 2: - if (typeinfo.m_data_type == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_data_type); - break; - case 3: - if (typeinfo.m_column_size == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_column_size); - break; - case 4: - if (typeinfo.m_literal_prefix == NULL_CHAR) - f.sqlNull(true); - else - f.sqlVarchar(typeinfo.m_literal_prefix, SQL_NTS); - break; - case 5: - if (typeinfo.m_literal_suffix == NULL_CHAR) - f.sqlNull(true); - else - f.sqlVarchar(typeinfo.m_literal_suffix, SQL_NTS); - break; - case 6: - if (typeinfo.m_create_params == NULL_CHAR) - f.sqlNull(true); - else - f.sqlVarchar(typeinfo.m_create_params, SQL_NTS); - break; - case 7: - if (typeinfo.m_nullable == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_nullable); - break; - case 8: - if (typeinfo.m_case_sensitive == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_case_sensitive); - break; - case 9: - if (typeinfo.m_searchable == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_searchable); - break; - case 10: - if (typeinfo.m_unsigned_attribute == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_unsigned_attribute); - break; - case 11: - if (typeinfo.m_fixed_prec_scale == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_fixed_prec_scale); - break; - case 12: - if (typeinfo.m_auto_unique_value == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_auto_unique_value); - break; - case 13: - if (typeinfo.m_local_type_name == NULL_CHAR) - f.sqlNull(true); - else - f.sqlVarchar(typeinfo.m_local_type_name, SQL_NTS); - break; - case 14: - if (typeinfo.m_minimum_scale == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_minimum_scale); - break; - case 15: - if (typeinfo.m_maximum_scale == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_maximum_scale); - break; - case 16: - if (typeinfo.m_sql_data_type == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_sql_data_type); - break; - case 17: - if (typeinfo.m_sql_datetime_sub == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_sql_datetime_sub); - break; - case 18: - if (typeinfo.m_sql_datetime_sub == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_sql_datetime_sub); - break; - case 19: - if (typeinfo.m_interval_precision == NULL_INT) - f.sqlNull(true); - else - f.sqlInteger(typeinfo.m_interval_precision); - break; - default: - ctx_assert(false); - break; - } - } - return true; - } - if (code.m_sysId == DictSys::OdbcTables) { - if (data.m_tablePos >= data.m_objectList.count) { - return false; - } - NdbDictionary::Dictionary::List::Element& element = data.m_objectList.elements[data.m_tablePos++]; - for (unsigned i = 1; i <= code.m_attrCount; i++) { - SqlField& f = data.m_sqlRow.getEntry(i); - switch (1 + code.m_attrId[i]) { - case 1: // TABLE_CAT - f.sqlNull(true); - break; - case 2: // TABLE_SCHEM - f.sqlNull(true); - break; - case 3: // TABLE_NAME - f.sqlVarchar(element.name, SQL_NTS); - break; - case 4: { // TABLE_TYPE - if (element.type == NdbDictionary::Object::SystemTable) - f.sqlVarchar("SYSTEM TABLE", SQL_NTS); - else if (element.type == NdbDictionary::Object::UserTable) - f.sqlVarchar("TABLE", SQL_NTS); - else if (element.type == NdbDictionary::Object::UniqueHashIndex) - f.sqlVarchar("UNIQUE HASH INDEX", SQL_NTS); - else if (element.type == NdbDictionary::Object::HashIndex) - f.sqlVarchar("HASH INDEX", SQL_NTS); - else if (element.type == NdbDictionary::Object::UniqueOrderedIndex) - f.sqlVarchar("UNIQUE INDEX", SQL_NTS); - else if (element.type == NdbDictionary::Object::OrderedIndex) - f.sqlVarchar("INDEX", SQL_NTS); - else if (element.type == NdbDictionary::Object::IndexTrigger) - f.sqlVarchar("INDEX TRIGGER", SQL_NTS); - else if (element.type == NdbDictionary::Object::SubscriptionTrigger) - f.sqlVarchar("SUBSCRIPTION TRIGGER", SQL_NTS); - else if (element.type == NdbDictionary::Object::ReadOnlyConstraint) - f.sqlVarchar("READ ONLY CONSTRAINT", SQL_NTS); - else - f.sqlVarchar("UNKNOWN", SQL_NTS); - } - break; - case 5: // REMARKS - f.sqlNull(true); - break; - default: - ctx_assert(false); - break; - } - } - return true; - } - if (code.m_sysId == DictSys::OdbcColumns) { - if (data.m_tablePos >= data.m_objectList.count) { - return false; - } - const NdbDictionary::Dictionary::List::Element& element = data.m_objectList.elements[data.m_tablePos]; - unsigned nattr; - const NdbDictionary::Table* ndbTable; - nattr = 0; - if (isNdbTable(element)) { - ndbTable = ndbDictionary->getTable(element.name); - if (ndbTable == 0) { - ctx.pushStatus(ndbDictionary->getNdbError(), "getTable %s", element.name); - return false; - } - nattr = ndbTable->getNoOfColumns(); - } - while (data.m_attrPos >= nattr) { - if (++data.m_tablePos >= data.m_objectList.count) { - return false; - } - const NdbDictionary::Dictionary::List::Element& element = data.m_objectList.elements[data.m_tablePos]; - nattr = 0; - if (isNdbTable(element)) { - ndbTable = ndbDictionary->getTable(element.name); - if (ndbTable == 0) { - ctx.pushStatus(ndbDictionary->getNdbError(), "getTable %s", element.name); - return false; - } - data.m_attrPos = 0; - nattr = ndbTable->getNoOfColumns(); - } - } - int attrId = data.m_attrPos++; - const NdbDictionary::Column* ndbColumn = ndbTable->getColumn(attrId); - if (ndbColumn == 0) { - ctx.pushStatus(ndbDictionary->getNdbError(), "getColumn %s.%d", ndbTable->getName(), attrId); - return false; - } - SqlType sqlType(ctx, ndbColumn); - if (! ctx.ok()) - return false; - const char* p; - for (unsigned i = 1; i <= code.m_attrCount; i++) { - SqlField& f = data.m_sqlRow.getEntry(i); - switch (1 + code.m_attrId[i]) { - case 1: // TABLE_CAT - f.sqlNull(true); - break; - case 2: // TABLE_SCHEM - f.sqlNull(true); - break; - case 3: // TABLE_NAME - f.sqlVarchar(ndbTable->getName(), SQL_NTS); - break; - case 4: // COLUMN_NAME - f.sqlVarchar(ndbColumn->getName(), SQL_NTS); - break; - case 5: // DATA_TYPE - f.sqlInteger(sqlType.type()); - break; - case 6: // TYPE_NAME - f.sqlVarchar(sqlType.typeName(), SQL_NTS); - break; - case 7: // COLUMN_SIZE - f.sqlInteger(sqlType.displaySize()); - break; - case 8: // BUFFER_LENGTH - f.sqlInteger(sqlType.size()); - break; - case 9: // DECIMAL_DIGITS - if (sqlType.type() == SqlType::Char) - f.sqlNull(true); - else - f.sqlInteger(0); - break; - case 10: // NUM_PREC_RADIX - if (sqlType.type() == SqlType::Integer || sqlType.type() == SqlType::Bigint) - f.sqlInteger(10); - else - f.sqlNull(true); - break; - case 11: // NULLABLE - if (sqlType.nullable()) - f.sqlInteger(SQL_NULLABLE); - else - f.sqlInteger(SQL_NO_NULLS); - break; - case 12: // REMARKS - f.sqlNull(true); - break; - case 13: // COLUMN_DEF - if ((p = ndbColumn->getDefaultValue()) != 0) - f.sqlVarchar(p, SQL_NTS); - else - f.sqlNull(true); - break; - case 14: // SQL_DATA_TYPE - f.sqlInteger(sqlType.type()); - break; - case 15: // SQL_DATETIME_SUB - f.sqlNull(true); - break; - case 16: // CHAR_OCTET_LENGTH - if (sqlType.type() == SqlType::Char) - f.sqlInteger(sqlType.length()); - else - f.sqlNull(true); - break; - case 17: // ORDINAL_POSITION - f.sqlInteger(1 + attrId); - break; - case 18: // IS_NULLABLE - if (sqlType.nullable()) - f.sqlVarchar("YES", SQL_NTS); - else - f.sqlVarchar("NO", SQL_NTS); - break; - break; - default: - ctx_assert(false); - break; - } - } - return true; - } - if (code.m_sysId == DictSys::OdbcPrimarykeys) { - if (data.m_tablePos >= data.m_objectList.count) { - return false; - } - NdbDictionary::Dictionary::List::Element& element = data.m_objectList.elements[data.m_tablePos]; - unsigned nkeys; - const NdbDictionary::Table* ndbTable; - nkeys = 0; - if (isNdbTable(element)) { - ndbTable = ndbDictionary->getTable(element.name); - if (ndbTable == 0) { - ctx.pushStatus(ndbDictionary->getNdbError(), "getTable %s", element.name); - return false; - } - nkeys = ndbTable->getNoOfPrimaryKeys(); - } - while (data.m_keyPos >= nkeys) { - if (++data.m_tablePos >= data.m_objectList.count) { - return false; - } - NdbDictionary::Dictionary::List::Element& element = data.m_objectList.elements[data.m_tablePos]; - nkeys = 0; - if (isNdbTable(element)) { - ndbTable = ndbDictionary->getTable(element.name); - if (ndbTable == 0) { - ctx.pushStatus(ndbDictionary->getNdbError(), "getTable %s", element.name); - return false; - } - data.m_keyPos = 0; - nkeys = ndbTable->getNoOfPrimaryKeys(); - } - } - unsigned keyPos = data.m_keyPos++; - const char* keyName = ndbTable->getPrimaryKey(keyPos); - if (keyName == 0) - keyName = "?"; - for (unsigned i = 1; i <= code.m_attrCount; i++) { - SqlField& f = data.m_sqlRow.getEntry(i); - switch (1 + code.m_attrId[i]) { - case 1: // TABLE_CAT - f.sqlNull(true); - break; - case 2: // TABLE_SCHEM - f.sqlNull(true); - break; - case 3: // TABLE_NAME - f.sqlVarchar(ndbTable->getName(), SQL_NTS); - break; - case 4: // COLUMN_NAME - f.sqlVarchar(keyName, SQL_NTS); - break; - case 5: // KEY_SEQ - f.sqlInteger(1 + keyPos); - break; - case 6: // PK_NAME - f.sqlNull(true); - break; - default: - ctx_assert(false); - break; - } - } - return true; - } - if (code.m_sysId == DictSys::Dual) { - if (data.m_rowPos > 0) { - return false; - } - data.m_rowPos++; - for (unsigned i = 1; i <= code.m_attrCount; i++) { - SqlField& f = data.m_sqlRow.getEntry(i); - switch (1 + code.m_attrId[i]) { - case 1: // DUMMY - f.sqlVarchar("X", 1); - break; - default: - ctx_assert(false); - break; - } - } - return true; - } - ctx_assert(false); - return false; -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp deleted file mode 100644 index 35b6159d8ca..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp +++ /dev/null @@ -1,96 +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 */ - -#include -#include -#include -#include -#include -#include - -void -Exec_update_index::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - // update each row from the query - while (m_query->fetch(ctx, ctl)) { - NdbOperation* op = tcon->getNdbIndexOperation(code.m_indexName, code.m_tableName); - if (op == 0) { - ctx.pushStatus(ndb, tcon, 0, "getNdbIndexOperation"); - return; - } - if (op->updateTuple() == -1) { - ctx.pushStatus(ndb, tcon, op, "updateTuple"); - return; - } - // key attributes - bool done = false; - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - done = true; // match is not possible - break; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - if (op->equal(keyId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "equal attrId=%u", (unsigned)keyId); - return; - } - } - if (done) - continue; - // updated attributes - const SqlRow& sqlRow = m_query->getData().sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const NdbAttrId attrId = code.m_attrId[i]; - const SqlField& f = sqlRow.getEntry(i); - const void* addr = f.sqlNull() ? 0 : f.addr(); - const char* value = static_cast(addr); - if (op->setValue(attrId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "setValue attrId=%u", (unsigned)attrId); - return; - } - } - data.setCount(0); - if (tcon->execute(NoCommit) == -1) { - // XXX when did 626 move to connection level - if (tcon->getNdbError().code != 626 && op->getNdbError().code != 626) { - ctx.pushStatus(ndb, tcon, op, "execute without commit"); - return; - } - } else { - data.addCount(); - } - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp b/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp deleted file mode 100644 index 2c801372de3..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp +++ /dev/null @@ -1,96 +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 */ - -#include -#include -#include -#include -#include -#include - -void -Exec_update_lookup::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - // update each row from the query - while (m_query->fetch(ctx, ctl)) { - NdbOperation* op = tcon->getNdbOperation(code.m_tableName); - if (op == 0) { - ctx.pushStatus(ndb, tcon, 0, "getNdbOperation"); - return; - } - if (op->updateTuple() == -1) { - ctx.pushStatus(ndb, tcon, op, "updateTuple"); - return; - } - // key attributes - bool done = false; - for (unsigned k = 1; k <= code.m_keyCount; k++) { - Exec_expr* exprMatch = code.m_keyMatch[k]; - ctx_assert(exprMatch != 0); - exprMatch->evaluate(ctx, ctl); - if (! ctx.ok()) - return; - const SqlField& keyMatch = exprMatch->getData().sqlField(); - SqlField f(code.m_keySpecs.getEntry(k)); - if (! keyMatch.cast(ctx, f)) { - done = true; // match is not possible - break; - } - const NdbAttrId keyId = code.m_keyId[k]; - const void* addr = f.addr(); - const char* value = static_cast(addr); - if (op->equal(keyId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "equal attrId=%u", (unsigned)keyId); - return; - } - } - if (done) - continue; - // updated attributes - const SqlRow& sqlRow = m_query->getData().sqlRow(); - ctx_assert(sqlRow.count() == code.m_attrCount); - for (unsigned i = 1; i <= code.m_attrCount; i++) { - const NdbAttrId attrId = code.m_attrId[i]; - const SqlField& f = sqlRow.getEntry(i); - const void* addr = f.sqlNull() ? 0 : f.addr(); - const char* value = static_cast(addr); - if (op->setValue(attrId, value) == -1) { - ctx.pushStatus(ndb, tcon, op, "setValue attrId=%u", (unsigned)attrId); - return; - } - } - data.setCount(0); - if (tcon->execute(NoCommit) == -1) { - // XXX when did 626 move to connection level - if (tcon->getNdbError().code != 626 && op->getNdbError().code != 626) { - ctx.pushStatus(ndb, tcon, op, "execute without commit"); - return; - } - } else { - data.addCount(); - } - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp b/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp deleted file mode 100644 index a36fdd27142..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp +++ /dev/null @@ -1,61 +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 */ - -#include -#include -#include -#include -#include - -void -Exec_update_scan::execImpl(Ctx& ctx, Ctl& ctl) -{ - const Code& code = getCode(); - Data& data = getData(); - Ndb* const ndb = ndbObject(); - NdbConnection* const tcon = ndbConnection(); - // execute subquery - ctx_assert(m_query != 0); - m_query->execute(ctx, ctl); - if (! ctx.ok()) - return; - ctx_assert(ctl.m_scanOp != 0); - // update each row from query - data.setCount(0); - while (m_query->fetch(ctx, ctl)) { - NdbOperation* toOp = ctl.m_scanOp->takeOverForUpdate(tcon); - if (toOp == 0) { - ctx.pushStatus(ndb, tcon, ctl.m_scanOp, "takeOverScanOp"); - return; - } - const SqlRow& sqlRow = m_query->getData().sqlRow(); - for (unsigned i = 1; i <= sqlRow.count(); i++) { - const SqlField& f = sqlRow.getEntry(i); - const void* addr = f.sqlNull() ? 0 : f.addr(); - const char* value = static_cast(addr); - if (toOp->setValue(code.m_attrId[i], value) == -1) { - ctx.pushStatus(ndb, tcon, toOp, "setValue"); - return; - } - } - if (tcon->execute(NoCommit) == -1) { - ctx.pushStatus(ndb, tcon, toOp, "execute without commit"); - return; - } - data.addCount(); - } - stmtArea().setRowCount(ctx, data.getCount()); -} diff --git a/ndb/src/old_files/client/odbc/executor/Executor.cpp b/ndb/src/old_files/client/odbc/executor/Executor.cpp deleted file mode 100644 index adabb28a4a5..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Executor.cpp +++ /dev/null @@ -1,68 +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 */ - -#include -#include -#include -#include -#include "Executor.hpp" - -void -Executor::execute(Ctx& ctx) -{ - Exec_base::Ctl ctl(0); - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - rebind(ctx); - if (! ctx.ok()) - return; - execRoot->execute(ctx, ctl); - if (! ctx.ok()) - return; - ctx_log2(("Executor: execute done")); -} - -void -Executor::fetch(Ctx& ctx) -{ - Exec_base::Ctl ctl(0); - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - rebind(ctx); - if (! ctx.ok()) - return; - execRoot->fetch(ctx, ctl); - if (! ctx.ok()) - return; - ctx_log2(("Executor: fetch done")); -} - -void -Executor::rebind(Ctx& ctx) -{ - Exec_root* execRoot = static_cast(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - DescArea& apd = m_stmtArea.descArea(Desc_usage_APD); - DescArea& ard = m_stmtArea.descArea(Desc_usage_ARD); - if (! apd.isBound() || ! ard.isBound()) { - ctx_log2(("Executor: rebind required")); - execRoot->bind(ctx); - if (! ctx.ok()) - return; - apd.setBound(true); - ard.setBound(true); - } -} diff --git a/ndb/src/old_files/client/odbc/executor/Executor.hpp b/ndb/src/old_files/client/odbc/executor/Executor.hpp deleted file mode 100644 index 5edb9d509ac..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Executor.hpp +++ /dev/null @@ -1,52 +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 ODBC_EXECUTOR_Executor_hpp -#define ODBC_EXECUTOR_Executor_hpp - -#include -class StmtArea; - -/** - * @class Executor - * @brief Executes an ExecTree - */ -class Executor { -public: - Executor(StmtArea& stmtArea); - ~Executor(); - // execute prepared statement - void execute(Ctx& ctx); - // fetch next row from query - void fetch(Ctx& ctx); -private: - // rebind if necessary - void rebind(Ctx& ctx); - StmtArea m_stmtArea; -}; - -inline -Executor::Executor(StmtArea& stmtArea) : - m_stmtArea(stmtArea) -{ -} - -inline -Executor::~Executor() -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/executor/Makefile b/ndb/src/old_files/client/odbc/executor/Makefile deleted file mode 100644 index d86781e212c..00000000000 --- a/ndb/src/old_files/client/odbc/executor/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include .defs.mk - -TYPE = * - -NONPIC_ARCHIVE = N - -PIC_ARCHIVE = Y - -ARCHIVE_TARGET = odbcexecutor - -SOURCES = \ - Executor.cpp \ - Exec_query_lookup.cpp \ - Exec_query_index.cpp \ - Exec_query_scan.cpp \ - Exec_query_range.cpp \ - Exec_query_sys.cpp \ - Exec_pred_op.cpp \ - Exec_comp_op.cpp \ - Exec_expr_op.cpp \ - Exec_expr_func.cpp \ - Exec_expr_conv.cpp \ - Exec_insert.cpp \ - Exec_update_lookup.cpp \ - Exec_update_index.cpp \ - Exec_update_scan.cpp \ - Exec_delete_lookup.cpp \ - Exec_delete_index.cpp \ - Exec_delete_scan.cpp \ - Exec_create_table.cpp \ - Exec_create_index.cpp \ - Exec_drop_table.cpp \ - Exec_drop_index.cpp - -include ../Extra.mk -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp b/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp deleted file mode 100644 index 4768a8995a2..00000000000 --- a/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp +++ /dev/null @@ -1,473 +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 */ - -#include "HandleDbc.hpp" - -static void -callback_SQL_ATTR_ACCESS_MODE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_MODE_READ_ONLY: - break; - case SQL_MODE_READ_WRITE: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid access mode value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_ACCESS_MODE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = SQL_MODE_READ_WRITE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ASYNC_ENABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_ASYNC_ENABLE_OFF: - break; - case SQL_ASYNC_ENABLE_ON: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "async enable on not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid async enable value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_ASYNC_ENABLE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = SQL_ASYNC_ENABLE_OFF; - data.setValue(value); -} - -static void -callback_SQL_ATTR_AUTO_IPD_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - ctx_assert(false); // read-only -} - -static void -callback_SQL_ATTR_AUTO_IPD_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = SQL_FALSE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_AUTOCOMMIT_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_AUTOCOMMIT_OFF: - if (pDbc->autocommit()) { - pDbc->autocommit(false); - pDbc->useConnection(ctx, true); - } - break; - case SQL_AUTOCOMMIT_ON: - if (! pDbc->autocommit()) { - pDbc->autocommit(true); - pDbc->sqlEndTran(ctx, SQL_COMMIT); - pDbc->useConnection(ctx, false); - } - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid autocommit value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_AUTOCOMMIT_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = pDbc->autocommit() ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CONNECTION_DEAD_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - ctx_assert(false); // read-only -} - -static void -callback_SQL_ATTR_CONNECTION_DEAD_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = pDbc->getState() == HandleDbc::Free ? SQL_CD_TRUE : SQL_CD_FALSE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CONNECTION_TIMEOUT_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); -} - -static void -callback_SQL_ATTR_CONNECTION_TIMEOUT_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CURRENT_CATALOG_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_ATTR_CURRENT_CATALOG_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - const char* value = "DEFAULT"; - data.setValue(value); -} - -static void -callback_SQL_ATTR_LOGIN_TIMEOUT_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - callback_SQL_ATTR_CONNECTION_TIMEOUT_set(ctx, self, data); -} - -static void -callback_SQL_ATTR_LOGIN_TIMEOUT_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - callback_SQL_ATTR_CONNECTION_TIMEOUT_default(ctx, self, data); -} - -static void -callback_SQL_ATTR_METADATA_ID_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_FALSE: - break; - case SQL_TRUE: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid metadata id value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_METADATA_ID_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = SQL_FALSE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ODBC_CURSORS_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_CUR_USE_DRIVER: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cur use driver not supported"); - break; - case SQL_CUR_USE_IF_NEEDED: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cur use if needed not supported"); - break; - case SQL_CUR_USE_ODBC: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid odbc cursors value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_ODBC_CURSORS_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = SQL_CUR_USE_ODBC; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PACKET_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "packet size (%u) not supported", (unsigned)value); -} - -static void -callback_SQL_ATTR_PACKET_SIZE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_QUIET_MODE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Pointer); -} - -static void -callback_SQL_ATTR_QUIET_MODE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - data.setValue(); -} - -static void -callback_SQL_ATTR_TRACE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); -} - -static void -callback_SQL_ATTR_TRACE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - data.setValue(); -} - -static void -callback_SQL_ATTR_TRACEFILE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_ATTR_TRACEFILE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - data.setValue(); -} - -static void -callback_SQL_ATTR_TRANSLATE_LIB_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_ATTR_TRANSLATE_LIB_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - data.setValue(); -} - -static void -callback_SQL_ATTR_TRANSLATE_OPTION_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); -} - -static void -callback_SQL_ATTR_TRANSLATE_OPTION_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - data.setValue(); -} - -static void -callback_SQL_ATTR_TXN_ISOLATION_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0 && data.type() == OdbcData::Uinteger); - if (pDbc->getState() == HandleDbc::Free) { - ctx.pushStatus(Sqlstate::_08003, Error::Gen, "not connected"); - return; - } - if (pDbc->getState() == HandleDbc::Transacting) { - ctx.pushStatus(Sqlstate::_HY011, Error::Gen, "transaction is open"); - return; - } - SQLUINTEGER value = data.uinteger(); - SQLUINTEGER mask = SQL_TXN_READ_COMMITTED; - if (! (value & mask)) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "txn isolation level %u not supported", (unsigned)value); - return; - } -} - -static void -callback_SQL_ATTR_TXN_ISOLATION_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDbc* pDbc = static_cast(self); - ctx_assert(pDbc != 0); - SQLUINTEGER value = SQL_TXN_READ_COMMITTED; - data.setValue(value); -} - -AttrSpec HandleDbc::m_attrSpec[] = { - { SQL_ATTR_ACCESS_MODE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ACCESS_MODE_set, - callback_SQL_ATTR_ACCESS_MODE_default, - }, - { SQL_ATTR_ASYNC_ENABLE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ASYNC_ENABLE_set, - callback_SQL_ATTR_ASYNC_ENABLE_default, - }, - { SQL_ATTR_AUTO_IPD, - OdbcData::Uinteger, - Attr_mode_readonly, - callback_SQL_ATTR_AUTO_IPD_set, - callback_SQL_ATTR_AUTO_IPD_default, - }, - { SQL_ATTR_AUTOCOMMIT, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_AUTOCOMMIT_set, - callback_SQL_ATTR_AUTOCOMMIT_default, - }, - { SQL_ATTR_CONNECTION_DEAD, - OdbcData::Uinteger, - Attr_mode_readonly, - callback_SQL_ATTR_CONNECTION_DEAD_set, - callback_SQL_ATTR_CONNECTION_DEAD_default, - }, - { SQL_ATTR_CONNECTION_TIMEOUT, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CONNECTION_TIMEOUT_set, - callback_SQL_ATTR_CONNECTION_TIMEOUT_default, - }, - { SQL_ATTR_CURRENT_CATALOG, - OdbcData::Sqlchar, - Attr_mode_readwrite, - callback_SQL_ATTR_CURRENT_CATALOG_set, - callback_SQL_ATTR_CURRENT_CATALOG_default, - }, - { SQL_ATTR_LOGIN_TIMEOUT, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_LOGIN_TIMEOUT_set, - callback_SQL_ATTR_LOGIN_TIMEOUT_default, - }, - { SQL_ATTR_METADATA_ID, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_METADATA_ID_set, - callback_SQL_ATTR_METADATA_ID_default, - }, - { SQL_ATTR_ODBC_CURSORS, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ODBC_CURSORS_set, - callback_SQL_ATTR_ODBC_CURSORS_default, - }, - { SQL_ATTR_PACKET_SIZE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_PACKET_SIZE_set, - callback_SQL_ATTR_PACKET_SIZE_default, - }, - { SQL_ATTR_QUIET_MODE, - OdbcData::Pointer, - Attr_mode_readwrite, - callback_SQL_ATTR_QUIET_MODE_set, - callback_SQL_ATTR_QUIET_MODE_default, - }, - { SQL_ATTR_TRACE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_TRACE_set, - callback_SQL_ATTR_TRACE_default, - }, - { SQL_ATTR_TRACEFILE, - OdbcData::Sqlchar, - Attr_mode_readwrite, - callback_SQL_ATTR_TRACEFILE_set, - callback_SQL_ATTR_TRACEFILE_default, - }, - { SQL_ATTR_TRANSLATE_LIB, - OdbcData::Sqlchar, - Attr_mode_readwrite, - callback_SQL_ATTR_TRANSLATE_LIB_set, - callback_SQL_ATTR_TRANSLATE_LIB_default, - }, - { SQL_ATTR_TRANSLATE_OPTION, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_TRANSLATE_OPTION_set, - callback_SQL_ATTR_TRANSLATE_OPTION_default, - }, - { SQL_ATTR_TXN_ISOLATION, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_TXN_ISOLATION_set, - callback_SQL_ATTR_TXN_ISOLATION_default, - }, - { 0, - OdbcData::Undef, - Attr_mode_undef, - 0, - 0, - }, -}; diff --git a/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp b/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp deleted file mode 100644 index 3d57fddeb57..00000000000 --- a/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp +++ /dev/null @@ -1,123 +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 */ - -#include "HandleEnv.hpp" - -static void -callback_SQL_ATTR_CP_MATCH_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleEnv* pEnv = static_cast(self); - ctx_assert(pEnv != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_CP_STRICT_MATCH: - break; - case SQL_CP_RELAXED_MATCH: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid cp match value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CP_MATCH_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleEnv* pEnv = static_cast(self); - ctx_assert(pEnv != 0); - SQLUINTEGER value = SQL_CP_STRICT_MATCH; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ODBC_VERSION_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleEnv* pEnv = static_cast(self); - ctx_assert(pEnv != 0 && data.type() == OdbcData::Integer); - int version = data.integer(); - switch (version) { - case SQL_OV_ODBC2: - case SQL_OV_ODBC3: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid ODBC version %d", version); - return; - } - ctx_log1(("odbc version set to %d", version)); -} - -static void -callback_SQL_ATTR_ODBC_VERSION_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleEnv* pEnv = static_cast(self); - ctx_assert(pEnv != 0); - // no default - ctx_log1(("odbc version has not been set")); - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "odbc version has not been set"); -} - -static void -callback_SQL_ATTR_OUTPUT_NTS_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleEnv* pEnv = static_cast(self); - ctx_assert(pEnv != 0 && data.type() == OdbcData::Integer); - SQLINTEGER value = data.integer(); - switch (value) { - case SQL_TRUE: - break; - case SQL_FALSE: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "output nts FALSE not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid output nts value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_OUTPUT_NTS_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleEnv* pEnv = static_cast(self); - ctx_assert(pEnv != 0); - data.setValue(); -} - -AttrSpec HandleEnv::m_attrSpec[] = { - { SQL_ATTR_CP_MATCH, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CP_MATCH_set, - callback_SQL_ATTR_CP_MATCH_default, - }, - { SQL_ATTR_ODBC_VERSION, - OdbcData::Integer, - Attr_mode_readwrite, - callback_SQL_ATTR_ODBC_VERSION_set, - callback_SQL_ATTR_ODBC_VERSION_default, - }, - { SQL_ATTR_OUTPUT_NTS, - OdbcData::Integer, - Attr_mode_readwrite, - callback_SQL_ATTR_OUTPUT_NTS_set, - callback_SQL_ATTR_OUTPUT_NTS_default, - }, - { 0, - OdbcData::Undef, - Attr_mode_undef, - 0, - 0, - }, -}; diff --git a/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp b/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp deleted file mode 100644 index d1b264835b6..00000000000 --- a/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp +++ /dev/null @@ -1,92 +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 */ - -#include "HandleRoot.hpp" - -static void -callback_SQL_ATTR_CONNECTION_POOLING_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleRoot* pRoot = static_cast(self); - ctx_assert(pRoot != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_CP_OFF: - break; - case SQL_CP_ONE_PER_DRIVER: - case SQL_CP_ONE_PER_HENV: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "connection pooling not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid connection pooling value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CONNECTION_POOLING_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleRoot* pRoot = static_cast(self); - ctx_assert(pRoot != 0); - SQLUINTEGER value = SQL_CP_OFF; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CP_MATCH_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleRoot* pRoot = static_cast(self); - ctx_assert(pRoot != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_CP_STRICT_MATCH: - break; - case SQL_CP_RELAXED_MATCH: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid cp match value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CP_MATCH_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleRoot* pRoot = static_cast(self); - ctx_assert(pRoot != 0); - SQLUINTEGER value = SQL_CP_STRICT_MATCH; - data.setValue(value); -} - -AttrSpec HandleRoot::m_attrSpec[] = { - { SQL_ATTR_CONNECTION_POOLING, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CONNECTION_POOLING_set, - callback_SQL_ATTR_CONNECTION_POOLING_default, - }, - { SQL_ATTR_CP_MATCH, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CP_MATCH_set, - callback_SQL_ATTR_CP_MATCH_default, - }, - { 0, - OdbcData::Undef, - Attr_mode_undef, - 0, - 0, - }, -}; diff --git a/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp b/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp deleted file mode 100644 index ce9a9c03fd1..00000000000 --- a/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp +++ /dev/null @@ -1,1005 +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 */ - -#include "HandleDbc.hpp" -#include "HandleStmt.hpp" -#include "HandleDesc.hpp" - -static void -callback_SQL_ATTR_APP_PARAM_DESC_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Pointer); - pStmt->setHandleDesc(ctx, Desc_usage_APD, data.pointer()); -} - -static void -callback_SQL_ATTR_APP_PARAM_DESC_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - HandleDesc* apd = pStmt->getHandleDesc(ctx, Desc_usage_APD); - OdbcData value(reinterpret_cast(apd)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_APP_ROW_DESC_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Pointer); - pStmt->setHandleDesc(ctx, Desc_usage_ARD, data.pointer()); -} - -static void -callback_SQL_ATTR_APP_ROW_DESC_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - HandleDesc* ard = pStmt->getHandleDesc(ctx, Desc_usage_ARD); - OdbcData value(reinterpret_cast(ard)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_ASYNC_ENABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_ASYNC_ENABLE_OFF: - break; - case SQL_ASYNC_ENABLE_ON: -// ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "async enable ON not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid async enable value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_ASYNC_ENABLE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_ASYNC_ENABLE_OFF; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CONCURRENCY_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_CONCUR_READ_ONLY: - break; - case SQL_CONCUR_LOCK: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "concur lock not supported"); - break; - case SQL_CONCUR_ROWVER: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "concur rowver not supported"); - break; - case SQL_CONCUR_VALUES: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "concur values not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid concurrency value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CONCURRENCY_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_CONCUR_READ_ONLY; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CURSOR_SCROLLABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_NONSCROLLABLE: - break; - case SQL_SCROLLABLE: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cursor scrollable not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid concurrency value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CURSOR_SCROLLABLE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_NONSCROLLABLE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CURSOR_SENSITIVITY_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_UNSPECIFIED: - case SQL_INSENSITIVE: - break; - case SQL_SENSITIVE: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cursor sensitive not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid cursor sensitivity value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CURSOR_SENSITIVITY_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_INSENSITIVE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_CURSOR_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_CURSOR_FORWARD_ONLY: - break; - case SQL_CURSOR_STATIC: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cursor static not supported"); - break; - case SQL_CURSOR_KEYSET_DRIVEN: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cursor keyset driven not supported"); - break; - case SQL_CURSOR_DYNAMIC: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "cursor dynamic not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid cursor type value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_CURSOR_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_CURSOR_FORWARD_ONLY; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ENABLE_AUTO_IPD_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_FALSE: - break; - case SQL_TRUE: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "enable auto IPD not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid enable auto IPD value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_ENABLE_AUTO_IPD_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_FALSE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_FETCH_BOOKMARK_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Pointer); - SQLPOINTER value = data.pointer(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "fetch bookmark ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_FETCH_BOOKMARK_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLPOINTER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_IMP_PARAM_DESC_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Pointer); - ctx_assert(false); // read-only -} - -static void -callback_SQL_ATTR_IMP_PARAM_DESC_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - HandleDesc* ipd = pStmt->getHandleDesc(ctx, Desc_usage_IPD); - OdbcData value(reinterpret_cast(ipd)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_IMP_ROW_DESC_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Pointer); - ctx_assert(false); // read-only -} - -static void -callback_SQL_ATTR_IMP_ROW_DESC_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - HandleDesc* ird = pStmt->getHandleDesc(ctx, Desc_usage_IRD); - OdbcData value(reinterpret_cast(ird)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_KEYSET_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "keyset size not supported"); - return; - } -} - -static void -callback_SQL_ATTR_KEYSET_SIZE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_MAX_LENGTH_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "max length not supported"); - return; - } -} - -static void -callback_SQL_ATTR_MAX_LENGTH_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_MAX_ROWS_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "max rows not supported"); - return; - } -} - -static void -callback_SQL_ATTR_MAX_ROWS_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_METADATA_ID_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_FALSE: - break; - case SQL_TRUE: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid metadata id value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_METADATA_ID_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_FALSE; - data.setValue(value); -} - -static void -callback_SQL_ATTR_NOSCAN_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_NOSCAN_OFF: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "noscan OFF not supported"); - break; - case SQL_NOSCAN_ON: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid no scan value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_NOSCAN_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_NOSCAN_ON; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PARAM_BIND_OFFSET_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UintegerPtr); - SQLUINTEGER* value = data.uintegerPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "param bind offset ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_PARAM_BIND_OFFSET_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PARAM_BIND_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != SQL_PARAM_BIND_BY_COLUMN) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "row-wise param binding not supported"); - return; - } -} - -static void -callback_SQL_ATTR_PARAM_BIND_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_PARAM_BIND_BY_COLUMN; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PARAM_OPERATION_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UsmallintPtr); - SQLUSMALLINT* value = data.usmallintPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "param operation ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_PARAM_OPERATION_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUSMALLINT* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PARAM_STATUS_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UsmallintPtr); - SQLUSMALLINT* value = data.usmallintPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "param status ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_PARAM_STATUS_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUSMALLINT* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PARAMS_PROCESSED_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UintegerPtr); - SQLUINTEGER* value = data.uintegerPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "params processed ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_PARAMS_PROCESSED_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_PARAMSET_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != 1) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "paramset size %u not supported", (unsigned)value); - return; - } -} - -static void -callback_SQL_ATTR_PARAMSET_SIZE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = 1; - data.setValue(value); -} - -static void -callback_SQL_ATTR_QUERY_TIMEOUT_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_01S02, Error::Gen, "query timeout %u replaced by 0", (unsigned)value); - return; - } -} - -static void -callback_SQL_ATTR_QUERY_TIMEOUT_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_RETRIEVE_DATA_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_RD_ON: - break; - case SQL_RD_OFF: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "retrieve data OFF not supported"); - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid retrieve data value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_RETRIEVE_DATA_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_RD_ON; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROW_ARRAY_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != 1) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "row array size %u != 1 not supported", (unsigned)value); - return; - } -} - -static void -callback_SQL_ATTR_ROW_ARRAY_SIZE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = 1; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROW_BIND_OFFSET_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UintegerPtr); - SQLUINTEGER* value = data.uintegerPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "row bind offset ptr != 0 not supported"); - return; - } -} - -static void -callback_SQL_ATTR_ROW_BIND_OFFSET_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROW_BIND_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - if (value != SQL_BIND_BY_COLUMN) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "row-wise binding not supported"); - return; - } -} - -static void -callback_SQL_ATTR_ROW_BIND_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_BIND_BY_COLUMN; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROW_NUMBER_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - ctx_assert(false); // read-only -} - -static void -callback_SQL_ATTR_ROW_NUMBER_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = pStmt->getRowCount(); - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROW_OPERATION_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UsmallintPtr); - SQLUSMALLINT* value = data.usmallintPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "row operation ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_ROW_OPERATION_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUSMALLINT* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROW_STATUS_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UsmallintPtr); - SQLUSMALLINT* value = data.usmallintPtr(); - if (value != 0) { - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "row status ptr not supported"); - return; - } -} - -static void -callback_SQL_ATTR_ROW_STATUS_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUSMALLINT* value = 0; - data.setValue(value); -} - -static void -callback_SQL_ATTR_ROWS_FETCHED_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::UintegerPtr); - SQLUINTEGER* value = data.uintegerPtr(); - HandleDesc* ird = pStmt->getHandleDesc(ctx, Desc_usage_IRD); - ird->sqlSetDescField(ctx, 0, SQL_DESC_ROWS_PROCESSED_PTR, static_cast(value), SQL_IS_POINTER); -} - -static void -callback_SQL_ATTR_ROWS_FETCHED_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER* value = 0; - HandleDesc* ird = pStmt->getHandleDesc(ctx, Desc_usage_IRD); - ird->sqlGetDescField(ctx, 0, SQL_DESC_ROWS_PROCESSED_PTR, &value, SQL_IS_POINTER, 0); - data.setValue(value); -} - -static void -callback_SQL_ATTR_SIMULATE_CURSOR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_SC_NON_UNIQUE: - break; - case SQL_SC_TRY_UNIQUE: - break; - case SQL_SC_UNIQUE: - break; - default: - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "invalid simulate cursor value %u", (unsigned)value); - break; - } -} - -static void -callback_SQL_ATTR_SIMULATE_CURSOR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_SC_UNIQUE; // XXX if we did - data.setValue(value); -} - -static void -callback_SQL_ATTR_USE_BOOKMARKS_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - SQLUINTEGER value = data.uinteger(); - switch (value) { - case SQL_UB_OFF: - break; - case SQL_UB_VARIABLE: - case SQL_UB_FIXED: - ctx.pushStatus(Sqlstate::_HYC00, Error::Gen, "bookmarks not supported"); - return; - } -} - -static void -callback_SQL_ATTR_USE_BOOKMARKS_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = SQL_UB_OFF; - data.setValue(value); -} - -// driver specific - -static void -callback_SQL_ATTR_NDB_TUPLES_FETCHED_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0 && data.type() == OdbcData::Uinteger); - ctx_assert(false); // read-only -} - -static void -callback_SQL_ATTR_NDB_TUPLES_FETCHED_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast(self); - ctx_assert(pStmt != 0); - SQLUINTEGER value = pStmt->getTuplesFetched(); - data.setValue(value); -} - -AttrSpec HandleStmt::m_attrSpec[] = { - { SQL_ATTR_APP_PARAM_DESC, - OdbcData::Pointer, - Attr_mode_readwrite, - callback_SQL_ATTR_APP_PARAM_DESC_set, - callback_SQL_ATTR_APP_PARAM_DESC_default, - }, - { SQL_ATTR_APP_ROW_DESC, - OdbcData::Pointer, - Attr_mode_readwrite, - callback_SQL_ATTR_APP_ROW_DESC_set, - callback_SQL_ATTR_APP_ROW_DESC_default, - }, - { SQL_ATTR_ASYNC_ENABLE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ASYNC_ENABLE_set, - callback_SQL_ATTR_ASYNC_ENABLE_default, - }, - { SQL_ATTR_CONCURRENCY, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CONCURRENCY_set, - callback_SQL_ATTR_CONCURRENCY_default, - }, - { SQL_ATTR_CURSOR_SCROLLABLE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CURSOR_SCROLLABLE_set, - callback_SQL_ATTR_CURSOR_SCROLLABLE_default, - }, - { SQL_ATTR_CURSOR_SENSITIVITY, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CURSOR_SENSITIVITY_set, - callback_SQL_ATTR_CURSOR_SENSITIVITY_default, - }, - { SQL_ATTR_CURSOR_TYPE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_CURSOR_TYPE_set, - callback_SQL_ATTR_CURSOR_TYPE_default, - }, - { SQL_ATTR_ENABLE_AUTO_IPD, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ENABLE_AUTO_IPD_set, - callback_SQL_ATTR_ENABLE_AUTO_IPD_default, - }, - { SQL_ATTR_FETCH_BOOKMARK_PTR, - OdbcData::Pointer, - Attr_mode_readwrite, - callback_SQL_ATTR_FETCH_BOOKMARK_PTR_set, - callback_SQL_ATTR_FETCH_BOOKMARK_PTR_default, - }, - { SQL_ATTR_IMP_PARAM_DESC, - OdbcData::Pointer, - Attr_mode_readonly, - callback_SQL_ATTR_IMP_PARAM_DESC_set, - callback_SQL_ATTR_IMP_PARAM_DESC_default, - }, - { SQL_ATTR_IMP_ROW_DESC, - OdbcData::Pointer, - Attr_mode_readonly, - callback_SQL_ATTR_IMP_ROW_DESC_set, - callback_SQL_ATTR_IMP_ROW_DESC_default, - }, - { SQL_ATTR_KEYSET_SIZE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_KEYSET_SIZE_set, - callback_SQL_ATTR_KEYSET_SIZE_default, - }, - { SQL_ATTR_MAX_LENGTH, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_MAX_LENGTH_set, - callback_SQL_ATTR_MAX_LENGTH_default, - }, - { SQL_ATTR_MAX_ROWS, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_MAX_ROWS_set, - callback_SQL_ATTR_MAX_ROWS_default, - }, - { SQL_ATTR_METADATA_ID, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_METADATA_ID_set, - callback_SQL_ATTR_METADATA_ID_default, - }, - { SQL_ATTR_NOSCAN, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_NOSCAN_set, - callback_SQL_ATTR_NOSCAN_default, - }, - { SQL_ATTR_PARAM_BIND_OFFSET_PTR, - OdbcData::UintegerPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_PARAM_BIND_OFFSET_PTR_set, - callback_SQL_ATTR_PARAM_BIND_OFFSET_PTR_default, - }, - { SQL_ATTR_PARAM_BIND_TYPE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_PARAM_BIND_TYPE_set, - callback_SQL_ATTR_PARAM_BIND_TYPE_default, - }, - { SQL_ATTR_PARAM_OPERATION_PTR, - OdbcData::UsmallintPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_PARAM_OPERATION_PTR_set, - callback_SQL_ATTR_PARAM_OPERATION_PTR_default, - }, - { SQL_ATTR_PARAM_STATUS_PTR, - OdbcData::UsmallintPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_PARAM_STATUS_PTR_set, - callback_SQL_ATTR_PARAM_STATUS_PTR_default, - }, - { SQL_ATTR_PARAMS_PROCESSED_PTR, - OdbcData::UintegerPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_PARAMS_PROCESSED_PTR_set, - callback_SQL_ATTR_PARAMS_PROCESSED_PTR_default, - }, - { SQL_ATTR_PARAMSET_SIZE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_PARAMSET_SIZE_set, - callback_SQL_ATTR_PARAMSET_SIZE_default, - }, - { SQL_ATTR_QUERY_TIMEOUT, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_QUERY_TIMEOUT_set, - callback_SQL_ATTR_QUERY_TIMEOUT_default, - }, - { SQL_ATTR_RETRIEVE_DATA, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_RETRIEVE_DATA_set, - callback_SQL_ATTR_RETRIEVE_DATA_default, - }, - { SQL_ATTR_ROW_ARRAY_SIZE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ROW_ARRAY_SIZE_set, - callback_SQL_ATTR_ROW_ARRAY_SIZE_default, - }, - { SQL_ATTR_ROW_BIND_OFFSET_PTR, - OdbcData::UintegerPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_ROW_BIND_OFFSET_PTR_set, - callback_SQL_ATTR_ROW_BIND_OFFSET_PTR_default, - }, - { SQL_ATTR_ROW_BIND_TYPE, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_ROW_BIND_TYPE_set, - callback_SQL_ATTR_ROW_BIND_TYPE_default, - }, - { SQL_ATTR_ROW_NUMBER, - OdbcData::Uinteger, - Attr_mode_readonly, - callback_SQL_ATTR_ROW_NUMBER_set, - callback_SQL_ATTR_ROW_NUMBER_default, - }, - { SQL_ATTR_ROW_OPERATION_PTR, - OdbcData::UsmallintPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_ROW_OPERATION_PTR_set, - callback_SQL_ATTR_ROW_OPERATION_PTR_default, - }, - { SQL_ATTR_ROW_STATUS_PTR, - OdbcData::UsmallintPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_ROW_STATUS_PTR_set, - callback_SQL_ATTR_ROW_STATUS_PTR_default, - }, - { SQL_ATTR_ROWS_FETCHED_PTR, - OdbcData::UintegerPtr, - Attr_mode_readwrite, - callback_SQL_ATTR_ROWS_FETCHED_PTR_set, - callback_SQL_ATTR_ROWS_FETCHED_PTR_default, - }, - { SQL_ATTR_SIMULATE_CURSOR, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_SIMULATE_CURSOR_set, - callback_SQL_ATTR_SIMULATE_CURSOR_default, - }, - { SQL_ATTR_USE_BOOKMARKS, - OdbcData::Uinteger, - Attr_mode_readwrite, - callback_SQL_ATTR_USE_BOOKMARKS_set, - callback_SQL_ATTR_USE_BOOKMARKS_default, - }, - // driver specific - { SQL_ATTR_NDB_TUPLES_FETCHED, - OdbcData::Uinteger, - Attr_mode_readonly, - callback_SQL_ATTR_NDB_TUPLES_FETCHED_set, - callback_SQL_ATTR_NDB_TUPLES_FETCHED_default, - }, - { 0, - OdbcData::Undef, - Attr_mode_undef, - 0, - 0, - }, -}; diff --git a/ndb/src/old_files/client/odbc/handles/DescSpec.cpp b/ndb/src/old_files/client/odbc/handles/DescSpec.cpp deleted file mode 100644 index 83905cf9822..00000000000 --- a/ndb/src/old_files/client/odbc/handles/DescSpec.cpp +++ /dev/null @@ -1,1140 +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 */ - -#include "HandleDbc.hpp" -#include "HandleDesc.hpp" - -static void -callback_SQL_DESC_ALLOC_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_ALLOC_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_ARRAY_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Uinteger); -} - -static void -callback_SQL_DESC_ARRAY_SIZE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_ARRAY_STATUS_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::UsmallintPtr); -} - -static void -callback_SQL_DESC_ARRAY_STATUS_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_BIND_OFFSET_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::IntegerPtr); -} - -static void -callback_SQL_DESC_BIND_OFFSET_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_BIND_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_BIND_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_COUNT_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_COUNT_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_ROWS_PROCESSED_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::UintegerPtr); -} - -static void -callback_SQL_DESC_ROWS_PROCESSED_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_AUTO_UNIQUE_VALUE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_AUTO_UNIQUE_VALUE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_BASE_COLUMN_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_BASE_COLUMN_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_BASE_TABLE_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_BASE_TABLE_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_CASE_SENSITIVE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_CASE_SENSITIVE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_CATALOG_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_CATALOG_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_CONCISE_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_CONCISE_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_DATA_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Pointer); -} - -static void -callback_SQL_DESC_DATA_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_DATETIME_INTERVAL_CODE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_DATETIME_INTERVAL_CODE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_DATETIME_INTERVAL_PRECISION_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_DATETIME_INTERVAL_PRECISION_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_DISPLAY_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_DISPLAY_SIZE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_FIXED_PREC_SCALE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_FIXED_PREC_SCALE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_INDICATOR_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::IntegerPtr); -} - -static void -callback_SQL_DESC_INDICATOR_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_LABEL_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_LABEL_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_LENGTH_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Uinteger); -} - -static void -callback_SQL_DESC_LENGTH_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_LITERAL_PREFIX_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_LITERAL_PREFIX_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_LITERAL_SUFFIX_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_LITERAL_SUFFIX_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_LOCAL_TYPE_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_LOCAL_TYPE_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_NULLABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_NULLABLE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_NUM_PREC_RADIX_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_NUM_PREC_RADIX_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_OCTET_LENGTH_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Integer); -} - -static void -callback_SQL_DESC_OCTET_LENGTH_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_OCTET_LENGTH_PTR_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::IntegerPtr); -} - -static void -callback_SQL_DESC_OCTET_LENGTH_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_PARAMETER_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_PARAMETER_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_PRECISION_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_PRECISION_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_ROWVER_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_ROWVER_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_SCALE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_SCALE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_SCHEMA_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_SCHEMA_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_SEARCHABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_SEARCHABLE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_TABLE_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_TABLE_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_TYPE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_TYPE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_TYPE_NAME_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Sqlchar); -} - -static void -callback_SQL_DESC_TYPE_NAME_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_UNNAMED_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_UNNAMED_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_UNSIGNED_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_UNSIGNED_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -static void -callback_SQL_DESC_UPDATABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0 && data.type() == OdbcData::Smallint); -} - -static void -callback_SQL_DESC_UPDATABLE_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleDesc* pDesc = static_cast(self); - ctx_assert(pDesc != 0); - data.setValue(); -} - -DescSpec HandleDesc::m_descSpec[] = { - { Desc_pos_header, - SQL_DESC_ALLOC_TYPE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_readonly, - Desc_mode_readonly, - Desc_mode_readonly, - }, - callback_SQL_DESC_ALLOC_TYPE_set, - callback_SQL_DESC_ALLOC_TYPE_default, - }, - { Desc_pos_header, - SQL_DESC_ARRAY_SIZE, - OdbcData::Uinteger, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite - }, - callback_SQL_DESC_ARRAY_SIZE_set, - callback_SQL_DESC_ARRAY_SIZE_default, - }, - { Desc_pos_header, - SQL_DESC_ARRAY_STATUS_PTR, - OdbcData::UsmallintPtr, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readwrite - }, - callback_SQL_DESC_ARRAY_STATUS_PTR_set, - callback_SQL_DESC_ARRAY_STATUS_PTR_default, - }, - { Desc_pos_header, - SQL_DESC_BIND_OFFSET_PTR, - OdbcData::IntegerPtr, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite - }, - callback_SQL_DESC_BIND_OFFSET_PTR_set, - callback_SQL_DESC_BIND_OFFSET_PTR_default, - }, - { Desc_pos_header, - SQL_DESC_BIND_TYPE, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite - }, - callback_SQL_DESC_BIND_TYPE_set, - callback_SQL_DESC_BIND_TYPE_default, - }, - { Desc_pos_header, - SQL_DESC_COUNT, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_COUNT_set, - callback_SQL_DESC_COUNT_default, - }, - { Desc_pos_header, - SQL_DESC_ROWS_PROCESSED_PTR, - OdbcData::UintegerPtr, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused - }, - callback_SQL_DESC_ROWS_PROCESSED_PTR_set, - callback_SQL_DESC_ROWS_PROCESSED_PTR_default, - }, - { Desc_pos_record, - SQL_DESC_AUTO_UNIQUE_VALUE, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_AUTO_UNIQUE_VALUE_set, - callback_SQL_DESC_AUTO_UNIQUE_VALUE_default, - }, - { Desc_pos_record, - SQL_DESC_BASE_COLUMN_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_BASE_COLUMN_NAME_set, - callback_SQL_DESC_BASE_COLUMN_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_BASE_TABLE_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_BASE_TABLE_NAME_set, - callback_SQL_DESC_BASE_TABLE_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_CASE_SENSITIVE, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_CASE_SENSITIVE_set, - callback_SQL_DESC_CASE_SENSITIVE_default, - }, - { Desc_pos_record, - SQL_DESC_CATALOG_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_CATALOG_NAME_set, - callback_SQL_DESC_CATALOG_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_CONCISE_TYPE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_CONCISE_TYPE_set, - callback_SQL_DESC_CONCISE_TYPE_default, - }, - { Desc_pos_record, - SQL_DESC_DATA_PTR, - OdbcData::Pointer, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite - }, - callback_SQL_DESC_DATA_PTR_set, - callback_SQL_DESC_DATA_PTR_default, - }, - { Desc_pos_record, - SQL_DESC_DATETIME_INTERVAL_CODE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_DATETIME_INTERVAL_CODE_set, - callback_SQL_DESC_DATETIME_INTERVAL_CODE_default, - }, - { Desc_pos_record, - SQL_DESC_DATETIME_INTERVAL_PRECISION, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_DATETIME_INTERVAL_PRECISION_set, - callback_SQL_DESC_DATETIME_INTERVAL_PRECISION_default, - }, - { Desc_pos_record, - SQL_DESC_DISPLAY_SIZE, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_DISPLAY_SIZE_set, - callback_SQL_DESC_DISPLAY_SIZE_default, - }, - { Desc_pos_record, - SQL_DESC_FIXED_PREC_SCALE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_FIXED_PREC_SCALE_set, - callback_SQL_DESC_FIXED_PREC_SCALE_default, - }, - { Desc_pos_record, - SQL_DESC_INDICATOR_PTR, - OdbcData::IntegerPtr, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite - }, - callback_SQL_DESC_INDICATOR_PTR_set, - callback_SQL_DESC_INDICATOR_PTR_default, - }, - { Desc_pos_record, - SQL_DESC_LABEL, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_LABEL_set, - callback_SQL_DESC_LABEL_default, - }, - { Desc_pos_record, - SQL_DESC_LENGTH, - OdbcData::Uinteger, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_LENGTH_set, - callback_SQL_DESC_LENGTH_default, - }, - { Desc_pos_record, - SQL_DESC_LITERAL_PREFIX, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_LITERAL_PREFIX_set, - callback_SQL_DESC_LITERAL_PREFIX_default, - }, - { Desc_pos_record, - SQL_DESC_LITERAL_SUFFIX, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_LITERAL_SUFFIX_set, - callback_SQL_DESC_LITERAL_SUFFIX_default, - }, - { Desc_pos_record, - SQL_DESC_LOCAL_TYPE_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_LOCAL_TYPE_NAME_set, - callback_SQL_DESC_LOCAL_TYPE_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_NAME_set, - callback_SQL_DESC_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_NULLABLE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_NULLABLE_set, - callback_SQL_DESC_NULLABLE_default, - }, - { Desc_pos_record, - SQL_DESC_NUM_PREC_RADIX, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_NUM_PREC_RADIX_set, - callback_SQL_DESC_NUM_PREC_RADIX_default, - }, - { Desc_pos_record, - SQL_DESC_OCTET_LENGTH, - OdbcData::Integer, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_OCTET_LENGTH_set, - callback_SQL_DESC_OCTET_LENGTH_default, - }, - { Desc_pos_record, - SQL_DESC_OCTET_LENGTH_PTR, - OdbcData::IntegerPtr, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readwrite - }, - callback_SQL_DESC_OCTET_LENGTH_PTR_set, - callback_SQL_DESC_OCTET_LENGTH_PTR_default, - }, - { Desc_pos_record, - SQL_DESC_PARAMETER_TYPE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_unused - }, - callback_SQL_DESC_PARAMETER_TYPE_set, - callback_SQL_DESC_PARAMETER_TYPE_default, - }, - { Desc_pos_record, - SQL_DESC_PRECISION, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_PRECISION_set, - callback_SQL_DESC_PRECISION_default, - }, - { Desc_pos_record, - SQL_DESC_ROWVER, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_ROWVER_set, - callback_SQL_DESC_ROWVER_default, - }, - { Desc_pos_record, - SQL_DESC_SCALE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_SCALE_set, - callback_SQL_DESC_SCALE_default, - }, - { Desc_pos_record, - SQL_DESC_SCHEMA_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_SCHEMA_NAME_set, - callback_SQL_DESC_SCHEMA_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_SEARCHABLE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_SEARCHABLE_set, - callback_SQL_DESC_SEARCHABLE_default, - }, - { Desc_pos_record, - SQL_DESC_TABLE_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_TABLE_NAME_set, - callback_SQL_DESC_TABLE_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_TYPE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_readwrite, - Desc_mode_readonly, - Desc_mode_readwrite - }, - callback_SQL_DESC_TYPE_set, - callback_SQL_DESC_TYPE_default, - }, - { Desc_pos_record, - SQL_DESC_TYPE_NAME, - OdbcData::Sqlchar, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_TYPE_NAME_set, - callback_SQL_DESC_TYPE_NAME_default, - }, - { Desc_pos_record, - SQL_DESC_UNNAMED, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readwrite, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_UNNAMED_set, - callback_SQL_DESC_UNNAMED_default, - }, - { Desc_pos_record, - SQL_DESC_UNSIGNED, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_readonly, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_UNSIGNED_set, - callback_SQL_DESC_UNSIGNED_default, - }, - { Desc_pos_record, - SQL_DESC_UPDATABLE, - OdbcData::Smallint, - { Desc_mode_undef, - Desc_mode_unused, - Desc_mode_unused, - Desc_mode_readonly, - Desc_mode_unused - }, - callback_SQL_DESC_UPDATABLE_set, - callback_SQL_DESC_UPDATABLE_default, - }, - { Desc_pos_end, - 0, - OdbcData::Undef, - { Desc_mode_undef, - Desc_mode_undef, - Desc_mode_undef, - Desc_mode_undef, - Desc_mode_undef - }, - 0, - 0 - }, -}; diff --git a/ndb/src/old_files/client/odbc/handles/FuncTab.cpp b/ndb/src/old_files/client/odbc/handles/FuncTab.cpp deleted file mode 100644 index 6bd744d7a7f..00000000000 --- a/ndb/src/old_files/client/odbc/handles/FuncTab.cpp +++ /dev/null @@ -1,100 +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 */ - -#include "HandleDbc.hpp" - -HandleDbc::FuncTab -HandleDbc::m_funcTab[] = { - { SQL_API_SQLALLOCCONNECT , 1 }, - { SQL_API_SQLALLOCENV , 1 }, - { SQL_API_SQLALLOCHANDLE , 1 }, - { SQL_API_SQLALLOCHANDLESTD , 0 }, - { SQL_API_SQLALLOCSTMT , 1 }, - { SQL_API_SQLBINDCOL , 1 }, - { SQL_API_SQLBINDPARAM , 1 }, - { SQL_API_SQLBINDPARAMETER , 1 }, - { SQL_API_SQLBROWSECONNECT , 0 }, - { SQL_API_SQLBULKOPERATIONS , 0 }, - { SQL_API_SQLCANCEL , 1 }, - { SQL_API_SQLCLOSECURSOR , 1 }, - { SQL_API_SQLCOLATTRIBUTE , 1 }, - { SQL_API_SQLCOLATTRIBUTES , 1 }, - { SQL_API_SQLCOLUMNPRIVILEGES , 0 }, - { SQL_API_SQLCOLUMNS , 1 }, - { SQL_API_SQLCONNECT , 1 }, - { SQL_API_SQLCOPYDESC , 0 }, - { SQL_API_SQLDATASOURCES , 0 }, - { SQL_API_SQLDESCRIBECOL , 1 }, - { SQL_API_SQLDESCRIBEPARAM , 0 }, - { SQL_API_SQLDISCONNECT , 1 }, - { SQL_API_SQLDRIVERCONNECT , 1 }, - { SQL_API_SQLDRIVERS , 0 }, - { SQL_API_SQLENDTRAN , 1 }, - { SQL_API_SQLERROR , 1 }, - { SQL_API_SQLEXECDIRECT , 1 }, - { SQL_API_SQLEXECUTE , 1 }, - { SQL_API_SQLEXTENDEDFETCH , 0 }, - { SQL_API_SQLFETCH , 1 }, - { SQL_API_SQLFETCHSCROLL , 0 }, - { SQL_API_SQLFOREIGNKEYS , 0 }, - { SQL_API_SQLFREECONNECT , 1 }, - { SQL_API_SQLFREEENV , 1 }, - { SQL_API_SQLFREEHANDLE , 1 }, - { SQL_API_SQLFREESTMT , 1 }, - { SQL_API_SQLGETCONNECTATTR , 1 }, - { SQL_API_SQLGETCONNECTOPTION , 1 }, - { SQL_API_SQLGETCURSORNAME , 1 }, - { SQL_API_SQLGETDATA , 1 }, - { SQL_API_SQLGETDESCFIELD , 1 }, - { SQL_API_SQLGETDESCREC , 1 }, - { SQL_API_SQLGETDIAGFIELD , 1 }, - { SQL_API_SQLGETDIAGREC , 1 }, - { SQL_API_SQLGETENVATTR , 1 }, - { SQL_API_SQLGETFUNCTIONS , 1 }, - { SQL_API_SQLGETINFO , 1 }, - { SQL_API_SQLGETSTMTATTR , 1 }, - { SQL_API_SQLGETSTMTOPTION , 1 }, - { SQL_API_SQLGETTYPEINFO , 1 }, - { SQL_API_SQLMORERESULTS , 1 }, - { SQL_API_SQLNATIVESQL , 0 }, - { SQL_API_SQLNUMPARAMS , 1 }, - { SQL_API_SQLNUMRESULTCOLS , 1 }, - { SQL_API_SQLPARAMDATA , 1 }, - { SQL_API_SQLPARAMOPTIONS , 0 }, - { SQL_API_SQLPREPARE , 1 }, - { SQL_API_SQLPRIMARYKEYS , 1 }, - { SQL_API_SQLPROCEDURECOLUMNS , 0 }, - { SQL_API_SQLPROCEDURES , 0 }, - { SQL_API_SQLPUTDATA , 1 }, - { SQL_API_SQLROWCOUNT , 1 }, - { SQL_API_SQLSETCONNECTATTR , 1 }, - { SQL_API_SQLSETCONNECTOPTION , 1 }, - { SQL_API_SQLSETCURSORNAME , 1 }, - { SQL_API_SQLSETDESCFIELD , 1 }, - { SQL_API_SQLSETDESCREC , 1 }, - { SQL_API_SQLSETENVATTR , 1 }, - { SQL_API_SQLSETPARAM , 1 }, - { SQL_API_SQLSETPOS , 0 }, - { SQL_API_SQLSETSCROLLOPTIONS , 0 }, - { SQL_API_SQLSETSTMTATTR , 1 }, - { SQL_API_SQLSETSTMTOPTION , 1 }, - { SQL_API_SQLSPECIALCOLUMNS , 0 }, - { SQL_API_SQLSTATISTICS , 0 }, - { SQL_API_SQLTABLEPRIVILEGES , 0 }, - { SQL_API_SQLTABLES , 1 }, - { SQL_API_SQLTRANSACT , 1 }, - { 0 , -1 } -}; diff --git a/ndb/src/old_files/client/odbc/handles/HandleBase.cpp b/ndb/src/old_files/client/odbc/handles/HandleBase.cpp deleted file mode 100644 index 27379cdc3f8..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleBase.cpp +++ /dev/null @@ -1,162 +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 */ - -#include "HandleBase.hpp" - -HandleBase::~HandleBase() -{ - delete m_ctx; - m_ctx = 0; -} - -void -HandleBase::saveCtx(Ctx& ctx) -{ - delete m_ctx; - m_ctx = &ctx; -} - -// get diagnostics - -void -HandleBase::sqlGetDiagField(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT diagIdentifier, SQLPOINTER diagInfo, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength) -{ - const DiagSpec& spec = DiagSpec::find(diagIdentifier); - if (spec.m_pos == Diag_pos_end) { - ctx.setCode(SQL_ERROR); - return; - } - const bool header = (spec.m_pos == Diag_pos_header); - const bool status = (spec.m_pos == Diag_pos_status); - ctx_assert(header || status); - if (! (spec.m_handles & odbcHandle())) { - ctx.setCode(SQL_ERROR); - return; - } - if (header) { - recNumber = 0; // ignored for header fields, so fix it - if (m_ctx == 0) { - if (diagIdentifier == SQL_DIAG_NUMBER) { - SQLINTEGER n = 0; - OdbcData data(n); - data.copyout(ctx, diagInfo, bufferLength, 0, stringLength); - return; - } - if (diagIdentifier == SQL_DIAG_RETURNCODE) { - SQLSMALLINT n = 0; - OdbcData data(n); - data.copyout(ctx, diagInfo, bufferLength, 0, stringLength); - return; - } - return; - } - } - if (status) { - if (recNumber <= 0) { - ctx.setCode(SQL_ERROR); - return; - } - if (m_ctx == 0) { - if ((unsigned)recNumber > 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - return; - } - if ((unsigned)recNumber > m_ctx->diagArea().numStatus()) { - ctx.setCode(SQL_NO_DATA); - return; - } - } - OdbcData data; - ctx_assert(m_ctx != 0); - m_ctx->diagArea().getRecord(ctx, recNumber, diagIdentifier, data); - if (data.type() != OdbcData::Undef) - data.copyout(ctx, diagInfo, bufferLength, 0, stringLength); -} - -void -HandleBase::sqlGetDiagRec(Ctx& ctx, SQLSMALLINT recNumber, SQLCHAR* sqlstate, SQLINTEGER* nativeError, SQLCHAR* messageText, SQLSMALLINT bufferLength, SQLSMALLINT* textLength) -{ - sqlGetDiagField(ctx, recNumber, SQL_DIAG_SQLSTATE, static_cast(sqlstate), 5 + 1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_NATIVE, static_cast(nativeError), -1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_MESSAGE_TEXT, static_cast(messageText), bufferLength, textLength); -} - -void -HandleBase::sqlError(Ctx& ctx, SQLCHAR* sqlstate, SQLINTEGER* nativeError, SQLCHAR* messageText, SQLSMALLINT bufferLength, SQLSMALLINT* textLength) -{ - if (m_ctx == 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - const SQLSMALLINT recNumber = m_ctx->diagArea().nextRecNumber(); - if (recNumber == 0) { - ctx.setCode(SQL_NO_DATA); - return; - } - sqlGetDiagField(ctx, recNumber, SQL_DIAG_SQLSTATE, static_cast(sqlstate), 5 + 1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_NATIVE, static_cast(nativeError), -1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_MESSAGE_TEXT, static_cast(messageText), bufferLength, textLength); -} - -// common code for attributes - -void -HandleBase::baseSetHandleAttr(Ctx& ctx, AttrArea& attrArea, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength) -{ - const AttrSpec& spec = attrArea.findSpec(attribute); - if (spec.m_mode == Attr_mode_undef) { // not found - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "undefined attribute id %d", (int)attribute); - return; - } - if (spec.m_mode == Attr_mode_readonly) { // read only - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "read-only attribute id %d", (int)attribute); - return; - } - OdbcData data; - data.copyin(ctx, spec.m_type, value, stringLength); - if (! ctx.ok()) - return; - attrArea.setAttr(ctx, attribute, data); -} - -void -HandleBase::baseGetHandleAttr(Ctx& ctx, AttrArea& attrArea, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength) -{ - const AttrSpec& spec = attrArea.findSpec(attribute); - if (spec.m_mode == Attr_mode_undef) { // not found - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "undefined attribute id %d", (int)attribute); - return; - } - OdbcData data; - attrArea.getAttr(ctx, attribute, data); - if (! ctx.ok()) - return; - data.copyout(ctx, value, bufferLength, stringLength); -} - -void -HandleBase::baseSetHandleOption(Ctx& ctx, AttrArea& attrArea, SQLUSMALLINT option, SQLUINTEGER value) -{ - baseSetHandleAttr(ctx, attrArea, static_cast(option), reinterpret_cast(value), 0); -} - -void -HandleBase::baseGetHandleOption(Ctx& ctx, AttrArea& attrArea, SQLUSMALLINT option, SQLPOINTER value) -{ - baseGetHandleAttr(ctx, attrArea, static_cast(option), value, SQL_NTS, 0); -} diff --git a/ndb/src/old_files/client/odbc/handles/HandleBase.hpp b/ndb/src/old_files/client/odbc/handles/HandleBase.hpp deleted file mode 100644 index fc35c2b559b..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleBase.hpp +++ /dev/null @@ -1,67 +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 ODBC_HANDLES_HandleBase_hpp -#define ODBC_HANDLES_HandleBase_hpp - -#include -#include -#include -#include - -/** - * @class HandleBase - * @brief Base class for handles - * - * Following types of handles exist: - * - HandleRoot : root node - * - HandleEnv : environment handle (SQLHENV) - * - HandleDbc : connection handle (SQLHDBC) - * - HandleStmt : statement handle (SQLHSTMT) - * - HandleDesc : descriptor handle (SQLHDESC) - */ -class HandleRoot; -class HandleBase { -public: - HandleBase(); - virtual ~HandleBase() = 0; - virtual HandleBase* getParent() = 0; - virtual HandleRoot* getRoot() = 0; - virtual OdbcHandle odbcHandle() = 0; - void saveCtx(Ctx& ctx); - // allocate and free handles - virtual void sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild) = 0; - virtual void sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild) = 0; - // get diagnostics - void sqlGetDiagField(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT diagIdentifier, SQLPOINTER diagInfo, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength); - void sqlGetDiagRec(Ctx& ctx, SQLSMALLINT recNumber, SQLCHAR* sqlstate, SQLINTEGER* nativeError, SQLCHAR* messageText, SQLSMALLINT bufferLength, SQLSMALLINT* textLength); - void sqlError(Ctx& ctx, SQLCHAR* sqlstate, SQLINTEGER* nativeError, SQLCHAR* messageText, SQLSMALLINT bufferLength, SQLSMALLINT* textLength); // odbc2.0 - // common code for attributes - void baseSetHandleAttr(Ctx& ctx, AttrArea& attrArea, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength); - void baseGetHandleAttr(Ctx& ctx, AttrArea& attrArea, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength); - void baseSetHandleOption(Ctx& ctx, AttrArea& attrArea, SQLUSMALLINT option, SQLUINTEGER value); // odbc2.0 - void baseGetHandleOption(Ctx& ctx, AttrArea& attrArea, SQLUSMALLINT option, SQLPOINTER value); // odbc2.0 -protected: - Ctx* m_ctx; // saved from last ODBC function -}; - -inline -HandleBase::HandleBase() : - m_ctx(0) -{ -} - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp b/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp deleted file mode 100644 index 2d5ded2cc21..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp +++ /dev/null @@ -1,419 +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 */ - -#include -#include -#include -#include -#include -#include "HandleRoot.hpp" -#include "HandleEnv.hpp" -#include "HandleDbc.hpp" -#include "HandleStmt.hpp" -#include "HandleDesc.hpp" -#include "PoolNdb.hpp" - -#ifndef INT_MAX -#define INT_MAX 2147483647 -#endif - -HandleDbc::HandleDbc(HandleEnv* pEnv) : - m_env(pEnv), - m_attrArea(m_attrSpec) -{ - m_attrArea.setHandle(this); -} - -HandleDbc::~HandleDbc() -{ -} - -void -HandleDbc::ctor(Ctx& ctx) -{ -} - -void -HandleDbc::dtor(Ctx& ctx) -{ - if (m_state == Connected) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "cannot delete connection handle - connection is open"); - return; - } - if (m_state == Transacting) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "cannot delete connection handle - transaction is active"); - return; - } -} - -// allocate and free handles - -void -HandleDbc::sqlAllocStmt(Ctx& ctx, HandleStmt** ppStmt) -{ - if (ppStmt == 0) { - ctx.pushStatus(Sqlstate::_HY009, Error::Gen, "cannot allocate statement handle - null return address"); - return; - } - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_08003, Error::Gen, "cannot allocate statement handle - not connected to database"); - return; - } - HandleStmt* pStmt = new HandleStmt(this); - pStmt->ctor(ctx); - if (! ctx.ok()) { - pStmt->dtor(ctx); - delete pStmt; - return; - } - m_listStmt.push_back(pStmt); - getRoot()->record(SQL_HANDLE_STMT, pStmt, true); - *ppStmt = pStmt; -} - -void -HandleDbc::sqlAllocDesc(Ctx& ctx, HandleDesc** ppDesc) -{ - if (ppDesc == 0) { - ctx.pushStatus(Sqlstate::_HY009, Error::Gen, "cannot allocate descriptor handle - null return address"); - return; - } - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_08003, Error::Gen, "cannot allocate descriptor handle - not connected to database"); - return; - } - HandleDesc* pDesc = new HandleDesc(this); - pDesc->ctor(ctx); - if (! ctx.ok()) { - pDesc->dtor(ctx); - delete pDesc; - return; - } - m_listDesc.push_back(pDesc); - getRoot()->record(SQL_HANDLE_DESC, pDesc, true); - *ppDesc = pDesc; -} - -void -HandleDbc::sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild) -{ - switch (childType) { - case SQL_HANDLE_STMT: - sqlAllocStmt(ctx, (HandleStmt**)ppChild); - return; - case SQL_HANDLE_DESC: - sqlAllocDesc(ctx, (HandleDesc**)ppChild); - return; - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid child handle type %d", (int)childType); -} - -void -HandleDbc::sqlFreeStmt(Ctx& ctx, HandleStmt* pStmt, SQLUSMALLINT iOption) -{ - switch (iOption) { - case SQL_CLOSE: - // no error if not open - if (pStmt->getState() == HandleStmt::Open) - pStmt->sqlCloseCursor(ctx); - return; - case SQL_DROP: - pStmt->dtor(ctx); - if (! ctx.ok()) - return; - m_listStmt.remove(pStmt); - getRoot()->record(SQL_HANDLE_STMT, pStmt, false); - delete pStmt; - return; - case SQL_UNBIND: { - DescArea& ard = pStmt->getHandleDesc(ctx, Desc_usage_ARD)->descArea(); - ard.setCount(ctx, 0); - return; - } - case SQL_RESET_PARAMS: { - DescArea& apd = pStmt->getHandleDesc(ctx, Desc_usage_APD)->descArea(); - apd.setCount(ctx, 0); - // SQLFreeStmt doc misses this part - DescArea& ipd = pStmt->getHandleDesc(ctx, Desc_usage_IPD)->descArea(); - ipd.setCount(ctx, 0); - return; - } - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid free statement option %u", (unsigned)iOption); -} - -void -HandleDbc::sqlFreeDesc(Ctx& ctx, HandleDesc* pDesc) -{ - pDesc->dtor(ctx); - if (! ctx.ok()) - return; - m_listDesc.remove(pDesc); - getRoot()->record(SQL_HANDLE_DESC, pDesc, false); - delete pDesc; -} - -void -HandleDbc::sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild) -{ - switch (childType) { - case SQL_HANDLE_STMT: - sqlFreeStmt(ctx, (HandleStmt*)pChild, SQL_DROP); - return; - case SQL_HANDLE_DESC: - sqlFreeDesc(ctx, (HandleDesc*)pChild); - return; - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid child handle type %d", (int)childType); -} - -// attributes and info functions - -static bool -ignore_attr(Ctx& ctx, SQLINTEGER attribute) -{ - switch (attribute) { - case 1246: - ctx_log2(("ignore unknown ADO.NET connect attribute %d", (int)attribute)); - return true; - } - return false; -} - -void -HandleDbc::sqlSetConnectAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength) -{ - if (ignore_attr(ctx, attribute)) - return; - baseSetHandleAttr(ctx, m_attrArea, attribute, value, stringLength); -} - -void -HandleDbc::sqlGetConnectAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength) -{ - if (ignore_attr(ctx, attribute)) - return; - baseGetHandleAttr(ctx, m_attrArea, attribute, value, bufferLength, stringLength); -} - -void -HandleDbc::sqlSetConnectOption(Ctx& ctx, SQLUSMALLINT option, SQLUINTEGER value) -{ - if (ignore_attr(ctx, option)) - return; - baseSetHandleOption(ctx, m_attrArea, option, value); -} - -void -HandleDbc::sqlGetConnectOption(Ctx& ctx, SQLUSMALLINT option, SQLPOINTER value) -{ - if (ignore_attr(ctx, option)) - return; - baseGetHandleOption(ctx, m_attrArea, option, value); -} - -void -HandleDbc::sqlGetFunctions(Ctx& ctx, SQLUSMALLINT functionId, SQLUSMALLINT* supported) -{ - if (functionId == SQL_API_ALL_FUNCTIONS) { - for (int i = 0; i < 100; i++) - supported[i] = SQL_FALSE; - FuncTab* f; - for (f = m_funcTab; f->m_supported != -1; f++) { - SQLUSMALLINT id = f->m_functionId; - if (id < 100 && f->m_supported) - supported[id] = SQL_TRUE; - } - } else if (functionId == SQL_API_ODBC3_ALL_FUNCTIONS) { - for (int i = 0; i < SQL_API_ODBC3_ALL_FUNCTIONS_SIZE; i++) - supported[i] = 0; - FuncTab* f; - for (f = m_funcTab; f->m_supported != -1; f++) { - SQLUSMALLINT id = f->m_functionId; - ctx_assert((id >> 4) < SQL_API_ODBC3_ALL_FUNCTIONS_SIZE); - if (f->m_supported) - supported[id >> 4] |= (1 << (id & 0xf)); - } - } else { - FuncTab* f; - for (f = m_funcTab; f->m_supported != -1; f++) { - if (f->m_functionId == functionId) - break; - } - if (f->m_supported != -1) - supported[0] = f->m_supported ? SQL_TRUE : SQL_FALSE; - else - ctx.pushStatus(Sqlstate::_HY095, Error::Gen, "invalid function id %u", (unsigned)functionId); - } -} - -void -HandleDbc::sqlGetInfo(Ctx& ctx, SQLUSMALLINT infoType, SQLPOINTER infoValue, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength) -{ - InfoTab* f; - for (f = m_infoTab; f->m_format != InfoTab::End; f++) { - if (f->m_id == infoType) - break; - } - if (f->m_format == InfoTab::End) { - ctx.pushStatus(Sqlstate::_HY096, Error::Gen, "invalid info type %u", (unsigned)infoType); - return; - } - if (f->m_format == InfoTab::Char || f->m_format == InfoTab::YesNo) { - ctx_log3(("SQLGetInfo: type=%u value='%s'", (unsigned)infoType, f->m_str)); - OdbcData data(f->m_str); - data.copyout(ctx, infoValue, bufferLength, 0, stringLength); - return; - } - if (f->m_format == InfoTab::Short) { - ctx_log3(("SQLGetInfo: type=%u value=%d", (unsigned)infoType, (int)f->m_int)); - OdbcData data((SQLUSMALLINT)f->m_int); - data.copyout(ctx, infoValue, 0, 0); - return; - } - if (f->m_format == InfoTab::Long || f->m_format == InfoTab::Bitmask) { - ctx_log3(("SQLGetInfo: type=%u value=0x%x", (unsigned)infoType, (int)f->m_int)); - OdbcData data((SQLUINTEGER)f->m_int); - data.copyout(ctx, infoValue, 0, 0); - return; - } - ctx_assert(false); -} - -int -HandleDbc::getOdbcVersion(Ctx& ctx) -{ - return m_env->getOdbcVersion(ctx); -} - -// connect and transactions - -void -HandleDbc::sqlConnect(Ctx& ctx, SQLCHAR* serverName, SQLSMALLINT nameLength1, SQLCHAR* userName, SQLSMALLINT nameLength2, SQLCHAR* authentication, SQLSMALLINT nameLength3) -{ - if (m_state != Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "already connected"); - return; - } - OdbcData data; - m_attrArea.getAttr(ctx, SQL_ATTR_CONNECTION_TIMEOUT, data); - int timeout = data.uinteger(); - if (timeout <= 0) - timeout = INT_MAX; - PoolNdb* poolNdb = getRoot()->getPoolNdb(); - Ndb* pNdb = poolNdb->allocate(ctx, timeout); - if (pNdb == 0) { - return; - } - m_ndbObject = pNdb; - m_state = Connected; - m_autocommit = true; -} - -void -HandleDbc::sqlDriverConnect(Ctx& ctx, SQLHWND hwnd, SQLCHAR* szConnStrIn, SQLSMALLINT cbConnStrIn, SQLCHAR* szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT* pcbConnStrOut, SQLUSMALLINT fDriverCompletion) -{ - ctx_log2(("driver connect %.*s", cbConnStrIn, szConnStrIn == 0 ? "" : (char*)szConnStrIn)); - sqlConnect(ctx, (SQLCHAR*)"", 0, (SQLCHAR*)"", 0, (SQLCHAR*)"", 0); - if (! ctx.ok()) - return; - OdbcData data("DNS=DEFAULT"); - if (szConnStrOut != 0) // ADO NET - data.copyout(ctx, static_cast(szConnStrOut), cbConnStrOutMax, 0, pcbConnStrOut); -} - -void -HandleDbc::sqlDisconnect(Ctx& ctx) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "already disconnected"); - return; - } - // XXX missing check for uncommited changes - ListStmt::iterator i = m_listStmt.begin(); - while (i != m_listStmt.end()) { - HandleStmt* pStmt = *i; - ListStmt::iterator j = i++; - pStmt->dtor(ctx); - getRoot()->record(SQL_HANDLE_STMT, pStmt, false); - delete pStmt; - m_listStmt.erase(j); - } - PoolNdb* poolNdb = getRoot()->getPoolNdb(); - poolNdb->release(ctx, m_ndbObject); - m_ndbObject = 0; - m_state = Free; - m_autocommit = true; -} - -void -HandleDbc::sqlEndTran(Ctx& ctx, SQLSMALLINT completionType) -{ - if (completionType != SQL_COMMIT && completionType != SQL_ROLLBACK) { - ctx.pushStatus(Sqlstate::_HY012, Error::Gen, "invalid completion type %d", (int)completionType); - return; - } - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_08003, Error::Gen, "not connected"); - return; - } - Ndb* ndb = m_ndbObject; - ctx_assert(ndb != 0); - if (m_state == Connected) { - ctx_log2(("sqlEndTran: no transaction active")); - return; - } - NdbConnection* tcon = m_ndbConnection; - ctx_assert(tcon != 0); - if (completionType == SQL_COMMIT) { - if (tcon->execute(Commit) == -1) { - if (tcon->getNdbError().code != 626) - ctx.pushStatus(ndb, tcon, 0, "execute commit"); - else - ctx_log1(("ignore no data (626) at execute commit")); - } else { - ctx_log2(("sqlEndTran: transaction commit done")); - m_uncommitted = false; - } - } else { - if (tcon->execute(Rollback) == -1) { - if (tcon->getNdbError().code != 626) - ctx.pushStatus(ndb, tcon, 0, "execute rollback"); - else - ctx_log1(("ignore no data (626) at execute rollback")); - } else { - ctx_log2(("sqlEndTran: transaction rollback done")); - m_uncommitted = false; - } - } - for (ListStmt::iterator i = m_listStmt.begin(); i != m_listStmt.end(); i++) { - HandleStmt* pStmt = *i; - if (pStmt->getState() == HandleStmt::Open) { - pStmt->sqlCloseCursor(ctx); // SQL_CB_CLOSE behaviour - } - pStmt->useConnection(ctx, false); - } - if (! m_autocommit) { - useConnection(ctx, false); - useConnection(ctx, true); - } -} - -void -HandleDbc::sqlTransact(Ctx& ctx, SQLUSMALLINT completionType) -{ - sqlEndTran(ctx, completionType); -} diff --git a/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp b/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp deleted file mode 100644 index 130df08d02c..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp +++ /dev/null @@ -1,111 +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 ODBC_HANDLES_HandleDbc_hpp -#define ODBC_HANDLES_HandleDbc_hpp - -#include -#include -#include -#include "HandleBase.hpp" - -class HandleRoot; -class HandleEnv; -class HandleStmt; -class HandleDesc; - -/** - * @class HandleDbc - * @brief Connection handle (SQLHDBC). - */ -class HandleDbc : public HandleBase, public ConnArea { -public: - HandleDbc(HandleEnv* pEnv); - ~HandleDbc(); - void ctor(Ctx& ctx); - void dtor(Ctx& ctx); - HandleEnv* getEnv(); - HandleBase* getParent(); - HandleRoot* getRoot(); - OdbcHandle odbcHandle(); - // allocate and free handles - void sqlAllocStmt(Ctx& ctx, HandleStmt** ppStmt); - void sqlAllocDesc(Ctx& ctx, HandleDesc** ppDesc); - void sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild); - void sqlFreeStmt(Ctx& ctx, HandleStmt* pStmt, SQLUSMALLINT iOption); - void sqlFreeDesc(Ctx& ctx, HandleDesc* pDesc); - void sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild); - // attributes and info functions - void sqlSetConnectAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength); - void sqlGetConnectAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength); - void sqlSetConnectOption(Ctx& ctx, SQLUSMALLINT option, SQLUINTEGER value); // odbc2.0 - void sqlGetConnectOption(Ctx& ctx, SQLUSMALLINT option, SQLPOINTER value); // odbc2.0 - void sqlGetFunctions(Ctx& ctx, SQLUSMALLINT functionId, SQLUSMALLINT* supported); - void sqlGetInfo(Ctx& ctx, SQLUSMALLINT infoType, SQLPOINTER infoValue, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength); - int getOdbcVersion(Ctx& ctx); - // connect and transactions - void sqlConnect(Ctx& ctx, SQLCHAR* serverName, SQLSMALLINT nameLength1, SQLCHAR* userName, SQLSMALLINT nameLength2, SQLCHAR* authentication, SQLSMALLINT nameLength3); - void sqlDriverConnect(Ctx& ctx, SQLHWND hwnd, SQLCHAR* szConnStrIn, SQLSMALLINT cbConnStrIn, SQLCHAR* szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT* pcbConnStrOut, SQLUSMALLINT fDriverCompletion); - void sqlDisconnect(Ctx& ctx); - void sqlEndTran(Ctx& ctx, SQLSMALLINT completionType); - void sqlTransact(Ctx& ctx, SQLUSMALLINT completionType); // odbc2.0 -private: - HandleEnv* const m_env; - typedef std::list ListStmt; - ListStmt m_listStmt; - typedef std::list ListDesc; - ListDesc m_listDesc; - static AttrSpec m_attrSpec[]; - AttrArea m_attrArea; - struct FuncTab { - SQLUSMALLINT m_functionId; - int m_supported; - }; - static FuncTab m_funcTab[]; - struct InfoTab { - SQLUSMALLINT m_id; - enum { Char, YesNo, Short, Long, Bitmask, End } m_format; - SQLUINTEGER m_int; - const char* m_str; - }; - static InfoTab m_infoTab[]; -}; - -inline HandleEnv* -HandleDbc::getEnv() -{ - return m_env; -} - -inline HandleBase* -HandleDbc::getParent() -{ - return (HandleBase*)getEnv(); -} - -inline HandleRoot* -HandleDbc::getRoot() -{ - return getParent()->getRoot(); -} - -inline OdbcHandle -HandleDbc::odbcHandle() -{ - return Odbc_handle_dbc; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp b/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp deleted file mode 100644 index 4cff1bb8892..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp +++ /dev/null @@ -1,254 +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 */ - -#include -#include -#include -#include "HandleRoot.hpp" -#include "HandleDbc.hpp" -#include "HandleDesc.hpp" - -HandleDesc::HandleDesc(HandleDbc* pDbc) : - m_dbc(pDbc), - m_descArea(this, m_descSpec) -{ -} - -HandleDesc::~HandleDesc() -{ -} - -void -HandleDesc::ctor(Ctx& ctx) -{ -} - -void -HandleDesc::dtor(Ctx& ctx) -{ -} - -// allocate and free handles (no valid case) - -void -HandleDesc::sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild) -{ - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "inappropriate handle type"); -} - -void -HandleDesc::sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* ppChild) -{ - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "inappropriate handle type"); -} - -// set and get descriptor values - -void -HandleDesc::sqlSetDescField(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT fieldIdentifier, SQLPOINTER value, SQLINTEGER bufferLength) -{ - const DescSpec& spec = m_descArea.findSpec(fieldIdentifier); - if (spec.m_pos == Desc_pos_end) { - ctx.pushStatus(Sqlstate::_HY091, Error::Gen, "invalid descriptor id %d", (int)fieldIdentifier); - return; - } - OdbcData data; - data.copyin(ctx, spec.m_type, value, bufferLength); - if (! ctx.ok()) - return; - const bool header = (spec.m_pos == Desc_pos_header); - const bool record = (spec.m_pos == Desc_pos_record); - ctx_assert(header || record); - DescArea& area = m_descArea; - if (header) { - area.getHeader().setField(ctx, fieldIdentifier, data); - } - if (record) { - if (recNumber < 0) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "invalid record number %d", (int)recNumber); - return; - } - if (recNumber == 0) { // bookmark record - if (area.getUsage() == Desc_usage_IPD) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "cannot set bookmark IPD"); - return; - } - if (area.getUsage() == Desc_usage_APD) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "cannot set bookmark APD"); - return; - } - } - area.getRecord(recNumber).setField(ctx, fieldIdentifier, data); - } -} - -void -HandleDesc::sqlGetDescField(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT fieldIdentifier, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength, SQLSMALLINT* stringLength2) -{ - const DescSpec& spec = m_descArea.findSpec(fieldIdentifier); - if (spec.m_pos == Desc_pos_end) { - ctx.pushStatus(Sqlstate::_HY091, Error::Gen, "invalid descriptor id %d", (int)fieldIdentifier); - return; - } - const bool header = (spec.m_pos == Desc_pos_header); - const bool record = (spec.m_pos == Desc_pos_record); - ctx_assert(header || record); - DescArea& area = m_descArea; - OdbcData data; - if (header) { - area.getHeader().getField(ctx, fieldIdentifier, data); - if (! ctx.ok()) - return; - } - if (record) { - if (recNumber < 0) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "invalid record number %d", (int)recNumber); - return; - } - if (recNumber == 0) { // bookmark record - if (area.getUsage() == Desc_usage_IPD) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "cannot get bookmark IPD"); - return; - } - if (area.getUsage() == Desc_usage_IRD) { - // XXX check SQL_ATTR_USE_BOOKMARK != SQL_UB_OFF - } - } - if ((unsigned)recNumber > area.getCount()) { - ctx.setCode(SQL_NO_DATA); - return; - } - area.getRecord(recNumber).getField(ctx, fieldIdentifier, data); - if (! ctx.ok()) - return; - } - // if no data, return success and undefined value - if (data.type() == OdbcData::Undef) - return; - data.copyout(ctx, value, bufferLength, stringLength, stringLength2); -} - -void -HandleDesc::sqlColAttribute(Ctx& ctx, SQLUSMALLINT columnNumber, SQLUSMALLINT fieldIdentifier, SQLPOINTER characterAttribute, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength, SQLPOINTER numericAttribute) -{ - ctx_log3(("sqlColAttribute col=%d id=%d", columnNumber, fieldIdentifier)); - if (fieldIdentifier == SQL_COLUMN_LENGTH) { // XXX iODBC workaround - fieldIdentifier = SQL_DESC_LENGTH; - } - if (fieldIdentifier == 1205 || fieldIdentifier == 1206) { - ctx_log2(("ignore unknown OSQL fieldIdentifier %d", (int)fieldIdentifier)); - if (characterAttribute != 0) - *(char*)characterAttribute = 0; - if (stringLength != 0) - *stringLength = 0; - return; - } - const DescSpec& spec = m_descArea.findSpec(fieldIdentifier); - if (spec.m_pos == Desc_pos_end) { - ctx.pushStatus(Sqlstate::_HY091, Error::Gen, "invalid descriptor id %d", (int)fieldIdentifier); - return; - } - if (spec.m_type == OdbcData::Sqlchar || spec.m_type == OdbcData::Sqlstate) - sqlGetDescField(ctx, columnNumber, fieldIdentifier, characterAttribute, bufferLength, 0, stringLength); - else { - sqlGetDescField(ctx, columnNumber, fieldIdentifier, numericAttribute, -1, 0); - } - if (ctx.getCode() == SQL_NO_DATA) { - ctx.setCode(SQL_SUCCESS); - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "invalid column number %d", (int)columnNumber); - } -} - -void -HandleDesc::sqlColAttributes(Ctx& ctx, SQLUSMALLINT icol, SQLUSMALLINT fdescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT* pcbDesc, SQLINTEGER* pfDesc) -{ - ctx_log3(("sqlColAttributes col=%hu id=%hu", icol, fdescType)); - SQLUSMALLINT columnNumber = icol; - SQLUSMALLINT fieldIdentifier; - // XXX incomplete - if (fdescType == SQL_COLUMN_TYPE) { - fieldIdentifier = SQL_DESC_TYPE; - } else if (fdescType == SQL_COLUMN_PRECISION) { - SQLSMALLINT type; - sqlGetDescField(ctx, columnNumber, SQL_DESC_TYPE, static_cast(&type), -1, 0); - if (! ctx.ok()) - return; - switch (type) { - case SQL_CHAR: - case SQL_VARCHAR: - case SQL_BINARY: - case SQL_VARBINARY: - case SQL_LONGVARCHAR: - case SQL_LONGVARBINARY: - case SQL_DATE: - fieldIdentifier = SQL_DESC_LENGTH; - break; - default: - fieldIdentifier = SQL_DESC_PRECISION; - break; - } - } else if (fdescType == SQL_COLUMN_SCALE) { - SQLSMALLINT type; - sqlGetDescField(ctx, columnNumber, SQL_DESC_TYPE, static_cast(&type), -1, 0); - if (! ctx.ok()) - return; - switch (type) { - default: - fieldIdentifier = SQL_DESC_SCALE; - break; - } - } else if (fdescType == SQL_COLUMN_LENGTH) { - SQLSMALLINT type; - sqlGetDescField(ctx, columnNumber, SQL_DESC_TYPE, static_cast(&type), -1, 0); - if (! ctx.ok()) - return; - switch (type) { - default: - fieldIdentifier = SQL_DESC_LENGTH; - break; - } - } else { - fieldIdentifier = fdescType; - } - sqlColAttribute(ctx, columnNumber, fieldIdentifier, rgbDesc, cbDescMax, pcbDesc, pfDesc); -} - -// set and get several common descriptor values - -void -HandleDesc::sqlSetDescRec(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT type, SQLSMALLINT subType, SQLINTEGER length, SQLSMALLINT precision, SQLSMALLINT scale, SQLPOINTER data, SQLINTEGER* stringLength, SQLINTEGER* indicator) -{ - sqlSetDescField(ctx, recNumber, SQL_DESC_TYPE, reinterpret_cast(type), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_DATETIME_INTERVAL_CODE, reinterpret_cast(subType), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_OCTET_LENGTH, reinterpret_cast(length), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_PRECISION, reinterpret_cast(precision), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_SCALE, reinterpret_cast(scale), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_DATA_PTR, data, -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_OCTET_LENGTH_PTR, reinterpret_cast(stringLength), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_INDICATOR_PTR, reinterpret_cast(indicator), -1); -} - -void -HandleDesc::sqlGetDescRec(Ctx& ctx, SQLSMALLINT recNumber, SQLCHAR* name, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength, SQLSMALLINT* type, SQLSMALLINT* subType, SQLINTEGER* length, SQLSMALLINT* precision, SQLSMALLINT* scale, SQLSMALLINT* nullable) -{ - sqlGetDescField(ctx, recNumber, SQL_DESC_NAME, reinterpret_cast(name), bufferLength, 0, stringLength); - sqlGetDescField(ctx, recNumber, SQL_DESC_TYPE, reinterpret_cast(type), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_DATETIME_INTERVAL_CODE, reinterpret_cast(subType), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_OCTET_LENGTH, reinterpret_cast(length), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_PRECISION, reinterpret_cast(precision), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_SCALE, reinterpret_cast(scale), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_NULLABLE, reinterpret_cast(nullable), -1, 0); -} diff --git a/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp b/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp deleted file mode 100644 index 9419697f134..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp +++ /dev/null @@ -1,89 +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 ODBC_HANDLES_HandleDesc_hpp -#define ODBC_HANDLES_HandleDesc_hpp - -#include -#include -#include "HandleBase.hpp" - -class HandleRoot; -class HandleDbc; - -/** - * @class HandleDesc - * @brief Descriptor handle (SQLHDESC). - */ -class HandleDesc : public HandleBase { -public: - HandleDesc(HandleDbc* pDbc); - ~HandleDesc(); - void ctor(Ctx& ctx); - void dtor(Ctx& ctx); - HandleDbc* getDbc(); - HandleBase* getParent(); - HandleRoot* getRoot(); - OdbcHandle odbcHandle(); - DescArea& descArea(); - // allocate and free handles (no valid case) - void sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild); - void sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild); - // set and get descriptor values (internal use) - void sqlSetDescField(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT fieldIdentifier, SQLPOINTER value, SQLINTEGER bufferLength); - void sqlGetDescField(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT fieldIdentifier, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength, SQLSMALLINT* stringLength2 = 0); - void sqlColAttribute(Ctx& ctx, SQLUSMALLINT columnNumber, SQLUSMALLINT fieldIdentifier, SQLPOINTER characterAttribute, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength, SQLPOINTER numericAttribute); - void sqlColAttributes(Ctx& ctx, SQLUSMALLINT icol, SQLUSMALLINT fdescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT* pcbDesc, SQLINTEGER* pfDesc); - // set and get several common descriptor values - void sqlSetDescRec(Ctx& ctx, SQLSMALLINT recNumber, SQLSMALLINT Type, SQLSMALLINT SubType, SQLINTEGER Length, SQLSMALLINT Precision, SQLSMALLINT Scale, SQLPOINTER Data, SQLINTEGER* StringLength, SQLINTEGER* Indicator); - void sqlGetDescRec(Ctx& ctx, SQLSMALLINT recNumber, SQLCHAR* Name, SQLSMALLINT BufferLength, SQLSMALLINT* StringLength, SQLSMALLINT* Type, SQLSMALLINT* SubType, SQLINTEGER* Length, SQLSMALLINT* Precision, SQLSMALLINT* Scale, SQLSMALLINT* Nullable); -private: - HandleDbc* const m_dbc; - static DescSpec m_descSpec[]; - DescArea m_descArea; -}; - -inline HandleDbc* -HandleDesc::getDbc() -{ - return m_dbc; -} - -inline HandleBase* -HandleDesc::getParent() -{ - return (HandleDbc*)getDbc(); -} - -inline HandleRoot* -HandleDesc::getRoot() -{ - return getParent()->getRoot(); -} - -inline OdbcHandle -HandleDesc::odbcHandle() -{ - return Odbc_handle_desc; -} - -inline DescArea& -HandleDesc::descArea() -{ - return m_descArea; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp b/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp deleted file mode 100644 index bc9d8b420a6..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp +++ /dev/null @@ -1,144 +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 */ - -#include -#include "HandleRoot.hpp" -#include "HandleEnv.hpp" -#include "HandleDbc.hpp" - -HandleEnv::HandleEnv(HandleRoot* pRoot) : - m_root(pRoot), - m_attrArea(m_attrSpec) -{ - m_attrArea.setHandle(this); -} - -HandleEnv::~HandleEnv() { -} - -void -HandleEnv::ctor(Ctx& ctx) -{ -} - -void -HandleEnv::dtor(Ctx& ctx) -{ - if (! m_listDbc.empty()) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "cannot delete environment handle - has %u associated connection handles", (unsigned)m_listDbc.size()); - return; - } -} - -// allocate and free handles - -void -HandleEnv::sqlAllocConnect(Ctx& ctx, HandleDbc** ppDbc) -{ - if (getOdbcVersion(ctx) == -1) - return; - if (ppDbc == 0) { - ctx.pushStatus(Sqlstate::_HY009, Error::Gen, "cannot allocate connection handle - null return address"); - return; - } - HandleDbc* pDbc = new HandleDbc(this); - pDbc->ctor(ctx); - if (! ctx.ok()) { - pDbc->dtor(ctx); - delete pDbc; - return; - } - m_listDbc.push_back(pDbc); - getRoot()->record(SQL_HANDLE_DBC, pDbc, true); - *ppDbc = pDbc; -} - -void -HandleEnv::sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild) -{ - if (getOdbcVersion(ctx) == -1) - return; - switch (childType) { - case SQL_HANDLE_DBC: - sqlAllocConnect(ctx, (HandleDbc**)ppChild); - return; - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid child handle type %d", (int)childType); -} - -void -HandleEnv::sqlFreeConnect(Ctx& ctx, HandleDbc* pDbc) -{ - if (getOdbcVersion(ctx) == -1) - return; - pDbc->dtor(ctx); - if (! ctx.ok()) - return; - m_listDbc.remove(pDbc); - getRoot()->record(SQL_HANDLE_DBC, pDbc, false); - delete pDbc; -} - -void -HandleEnv::sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild) -{ - if (getOdbcVersion(ctx) == -1) - return; - switch (childType) { - case SQL_HANDLE_DBC: - sqlFreeConnect(ctx, (HandleDbc*)pChild); - return; - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid child handle type %d", (int)childType); -} - -// attributes - -void -HandleEnv::sqlSetEnvAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength) -{ - baseSetHandleAttr(ctx, m_attrArea, attribute, value, stringLength); -} - -void -HandleEnv::sqlGetEnvAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength) -{ - baseGetHandleAttr(ctx, m_attrArea, attribute, value, bufferLength, stringLength); -} - -int -HandleEnv::getOdbcVersion(Ctx& ctx) -{ - OdbcData data; - m_attrArea.getAttr(ctx, SQL_ATTR_ODBC_VERSION, data); - if (! ctx.ok()) - return -1; - return data.integer(); -} - -// transactions - -void -HandleEnv::sqlEndTran(Ctx& ctx, SQLSMALLINT completionType) -{ - ctx_assert(false); // XXX -} - -void -HandleEnv::sqlTransact(Ctx& ctx, SQLUSMALLINT completionType) -{ - ctx_assert(false); // XXX -} diff --git a/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp b/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp deleted file mode 100644 index 2b13b0256bc..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp +++ /dev/null @@ -1,77 +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 ODBC_HANDLES_HandleEnv_hpp -#define ODBC_HANDLES_HandleEnv_hpp - -#include -#include -#include "HandleBase.hpp" - -class HandleRoot; -class HandleDbc; - -/** - * @class HandleEnv - * @brief Environment handle (SQLHENV). - */ -class HandleEnv : public HandleBase { -public: - HandleEnv(HandleRoot* pRoot); - ~HandleEnv(); - void ctor(Ctx& ctx); - void dtor(Ctx& ctx); - HandleRoot* getRoot(); - HandleBase* getParent(); - OdbcHandle odbcHandle(); - // allocate and free handles - void sqlAllocConnect(Ctx& ctx, HandleDbc** ppDbc); - void sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild); - void sqlFreeConnect(Ctx& ctx, HandleDbc* pDbc); - void sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild); - // attributes - void sqlSetEnvAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength); - void sqlGetEnvAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength); - int getOdbcVersion(Ctx& ctx); // returns -1 if not set - // transactions - void sqlEndTran(Ctx& ctx, SQLSMALLINT completionType); - void sqlTransact(Ctx& ctx, SQLUSMALLINT completionType); // odbc2.0 -private: - HandleRoot* const m_root; - std::list m_listDbc; - static AttrSpec m_attrSpec[]; - AttrArea m_attrArea; -}; - -inline HandleRoot* -HandleEnv::getRoot() -{ - return m_root; -} - -inline HandleBase* -HandleEnv::getParent() -{ - return (HandleBase*)getRoot(); -} - -inline OdbcHandle -HandleEnv::odbcHandle() -{ - return Odbc_handle_env; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp b/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp deleted file mode 100644 index 13560d55028..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp +++ /dev/null @@ -1,271 +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 */ - -#include -#include -#include -#include "HandleRoot.hpp" -#include "HandleEnv.hpp" -#include "HandleDbc.hpp" -#include "HandleStmt.hpp" -#include "HandleDesc.hpp" -#include "PoolNdb.hpp" - -HandleRoot::HandleRoot() : - m_attrArea(m_attrSpec) -{ - m_attrArea.setHandle(this); - m_poolNdb = new PoolNdb(); -} - -HandleRoot::~HandleRoot() -{ -} - -#ifdef NDB_WIN32 -static NdbMutex & root_mutex = * NdbMutex_Create(); -#else -static NdbMutex root_mutex = NDB_MUTEX_INITIALIZER; -#endif - -HandleRoot* -HandleRoot::instance() -{ - NdbMutex_Lock(&root_mutex); - if (m_instance == 0) - m_instance = new HandleRoot(); - NdbMutex_Unlock(&root_mutex); - return m_instance; -} - -void -HandleRoot::lockHandle() -{ - NdbMutex_Lock(&root_mutex); -} - -void -HandleRoot::unlockHandle() -{ - NdbMutex_Unlock(&root_mutex); -} - -// check and find handle types and handles - -SQLSMALLINT -HandleRoot::findParentType(SQLSMALLINT childType) -{ - switch (childType) { - case SQL_HANDLE_ENV: - return SQL_HANDLE_ROOT; - case SQL_HANDLE_DBC: - return SQL_HANDLE_ENV; - case SQL_HANDLE_STMT: - return SQL_HANDLE_DBC; - case SQL_HANDLE_DESC: - return SQL_HANDLE_DBC; - } - return -1; -} - -HandleBase* -HandleRoot::findBase(SQLSMALLINT handleType, void* pHandle) -{ - switch (handleType) { - case SQL_HANDLE_ROOT: - return getRoot(); - case SQL_HANDLE_ENV: - return findEnv(pHandle); - case SQL_HANDLE_DBC: - return findDbc(pHandle); - case SQL_HANDLE_STMT: - return findStmt(pHandle); - case SQL_HANDLE_DESC: - return findDesc(pHandle); - } - return 0; -} - -HandleEnv* -HandleRoot::findEnv(void* pHandle) -{ - lockHandle(); - ValidList::iterator i = m_validList.find(pHandle); - if (i == m_validList.end() || (*i).second != SQL_HANDLE_ENV) { - unlockHandle(); - return 0; - } - unlockHandle(); - ctx_assert(pHandle != 0); - return static_cast(pHandle); -} - -HandleDbc* -HandleRoot::findDbc(void* pHandle) -{ - lockHandle(); - ValidList::iterator i = m_validList.find(pHandle); - if (i == m_validList.end() || (*i).second != SQL_HANDLE_DBC) { - unlockHandle(); - return 0; - } - unlockHandle(); - ctx_assert(pHandle != 0); - return static_cast(pHandle); -} - -HandleStmt* -HandleRoot::findStmt(void* pHandle) -{ - lockHandle(); - ValidList::iterator i = m_validList.find(pHandle); - if (i == m_validList.end() || (*i).second != SQL_HANDLE_STMT) { - unlockHandle(); - return 0; - } - unlockHandle(); - ctx_assert(pHandle != 0); - return static_cast(pHandle); -} - -HandleDesc* -HandleRoot::findDesc(void* pHandle) -{ - lockHandle(); - ValidList::iterator i = m_validList.find(pHandle); - if (i == m_validList.end() || (*i).second != SQL_HANDLE_DESC) { - unlockHandle(); - return 0; - } - unlockHandle(); - ctx_assert(pHandle != 0); - return static_cast(pHandle); -} - -// add or remove handle from validation list - -void -HandleRoot::record(SQLSMALLINT handleType, HandleBase* pHandle, bool add) -{ - switch (handleType) { - case SQL_HANDLE_ENV: - case SQL_HANDLE_DBC: - case SQL_HANDLE_STMT: - case SQL_HANDLE_DESC: - break; - default: - ctx_assert(false); - break; - } - ctx_assert(pHandle != 0); - lockHandle(); - ValidList::iterator i = m_validList.find(pHandle); - if (add) { - if (i != m_validList.end()) { - unlockHandle(); - ctx_assert(false); - } - m_validList.insert(ValidList::value_type(pHandle, handleType)); - } else { - if (i == m_validList.end() || (*i).second != handleType) { - unlockHandle(); - ctx_assert(false); - } - m_validList.erase(i); - } - unlockHandle(); -} - -// allocate and free handles - -void -HandleRoot::sqlAllocEnv(Ctx& ctx, HandleEnv** ppEnv) -{ - if (ppEnv == 0) { - ctx.pushStatus(Sqlstate::_HY009, Error::Gen, "cannot allocate environment handle - null return address"); - return; - } - HandleEnv* pEnv = new HandleEnv(this); - pEnv->ctor(ctx); - if (! ctx.ok()) { - pEnv->dtor(ctx); - delete pEnv; - return; - } - lockHandle(); - m_listEnv.push_back(pEnv); - unlockHandle(); - getRoot()->record(SQL_HANDLE_ENV, pEnv, true); - *ppEnv = pEnv; -} - -void -HandleRoot::sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild) -{ - switch (childType) { - case SQL_HANDLE_ENV: - sqlAllocEnv(ctx, (HandleEnv**)ppChild); - return; - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid child handle type %d", (int)childType); -} - -void -HandleRoot::sqlFreeEnv(Ctx& ctx, HandleEnv* pEnv) -{ - pEnv->dtor(ctx); - if (! ctx.ok()) { - return; - } - lockHandle(); - m_listEnv.remove(pEnv); - unlockHandle(); - getRoot()->record(SQL_HANDLE_ENV, pEnv, false); - delete pEnv; -} - -void -HandleRoot::sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild) -{ - switch (childType) { - case SQL_HANDLE_ENV: - sqlFreeEnv(ctx, (HandleEnv*)pChild); - return; - } - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "invalid child handle type %d", (int)childType); -} - -// process-level attributes - -void -HandleRoot::sqlSetRootAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength) -{ - lockHandle(); - baseSetHandleAttr(ctx, m_attrArea, attribute, value, stringLength); - unlockHandle(); -} - -void -HandleRoot::sqlGetRootAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength) -{ - lockHandle(); - baseGetHandleAttr(ctx, m_attrArea, attribute, value, bufferLength, stringLength); - unlockHandle(); -} - -// the instance - -HandleRoot* HandleRoot::m_instance = 0; diff --git a/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp b/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp deleted file mode 100644 index 08a22b3e400..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp +++ /dev/null @@ -1,103 +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 ODBC_HANDLES_HandleRoot_hpp -#define ODBC_HANDLES_HandleRoot_hpp - -#include -#include -#include -#include "HandleBase.hpp" - -class HandleEnv; -class HandleDbc; -class HandleStmt; -class HandleDesc; -class PoolNdb; - -/** - * @class HandleRoot - * @brief The singleton root handle. - * - * This class is the level above HandleEnv. It has a single - * instance. The instance is the root node of dynamically - * allocated handles. The instance is also used to call methods - * not tied to any handle. - */ -class HandleRoot : public HandleBase { -protected: - HandleRoot(); - ~HandleRoot(); -public: - static HandleRoot* instance(); - HandleRoot* getRoot(); - HandleBase* getParent(); - PoolNdb* getPoolNdb(); - OdbcHandle odbcHandle(); - void lockHandle(); - void unlockHandle(); - // check and find handle types and handles - SQLSMALLINT findParentType(SQLSMALLINT childType); - HandleBase* findBase(SQLSMALLINT handleType, void* pHandle); - HandleEnv* findEnv(void* pHandle); - HandleDbc* findDbc(void* pHandle); - HandleStmt* findStmt(void* pHandle); - HandleDesc* findDesc(void* pHandle); - // add or remove handle from validation list - void record(SQLSMALLINT handleType, HandleBase* pHandle, bool add); - // allocate and free handles - void sqlAllocEnv(Ctx& ctx, HandleEnv** ppEnv); - void sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild); - void sqlFreeEnv(Ctx& ctx, HandleEnv* pEnv); - void sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild); - // process-level attributes - void sqlSetRootAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength); - void sqlGetRootAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength); -private: - static HandleRoot* m_instance; // the instance - std::list m_listEnv; - PoolNdb* m_poolNdb; - typedef std::map ValidList; - ValidList m_validList; - static AttrSpec m_attrSpec[]; - AttrArea m_attrArea; -}; - -inline HandleRoot* -HandleRoot::getRoot() -{ - return this; -} - -inline HandleBase* -HandleRoot::getParent() -{ - return 0; -} - -inline PoolNdb* -HandleRoot::getPoolNdb() -{ - return m_poolNdb; -} - -inline OdbcHandle -HandleRoot::odbcHandle() -{ - return Odbc_handle_root; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp b/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp deleted file mode 100644 index d33d33dbd5b..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp +++ /dev/null @@ -1,823 +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 */ - -#include -#include -#include "HandleRoot.hpp" -#include "HandleDbc.hpp" -#include "HandleStmt.hpp" -#include "HandleDesc.hpp" - -HandleStmt::HandleStmt(HandleDbc* pDbc) : - StmtArea(*pDbc), - m_dbc(pDbc), - m_attrArea(m_attrSpec) -{ - m_attrArea.setHandle(this); - for (unsigned i = 0; i <= 1; i++) { - for (unsigned u = 0; u <= 4; u++) { - m_handleDesc[i][u] = 0; - } - } -} - -HandleStmt::~HandleStmt() -{ -} - -void -HandleStmt::ctor(Ctx& ctx) -{ - for (unsigned u = 1; u <= 4; u++) { - HandleDesc** ppDesc = &m_handleDesc[0][u]; - m_dbc->sqlAllocDesc(ctx, ppDesc); - if (! ctx.ok()) - return; - m_descArea[u] = &(*ppDesc)->descArea(); - m_descArea[u]->setAlloc(Desc_alloc_auto); - m_descArea[u]->setUsage((DescUsage)u); - } -} - -void -HandleStmt::dtor(Ctx& ctx) -{ - free(ctx); - for (unsigned u = 1; u <= 4; u++) { - HandleDesc** ppDesc = &m_handleDesc[0][u]; - if (*ppDesc != 0) - m_dbc->sqlFreeDesc(ctx, *ppDesc); - *ppDesc = 0; - } -} - -// descriptor handles - -HandleDesc* -HandleStmt::getHandleDesc(Ctx& ctx, DescUsage u) const -{ - ctx_assert(1 <= u && u <= 4); - if (m_handleDesc[1][u] != 0) - return m_handleDesc[1][u]; - return m_handleDesc[0][u]; -} - -void -HandleStmt::setHandleDesc(Ctx& ctx, DescUsage u, SQLPOINTER handle) -{ - ctx_assert(1 <= u && u <= 4); - if (handle == SQL_NULL_HDESC) { - m_handleDesc[1][u] = 0; // revert to implicit - m_descArea[u] = &m_handleDesc[0][u]->descArea(); - return; - } - HandleDesc* pDesc = getRoot()->findDesc(handle); - if (pDesc == 0) { - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "cannot set %s handle to invalid descriptor handle %x", DescArea::nameUsage(u), (unsigned)handle); - return; - } - if (pDesc == m_handleDesc[0][u]) { - m_handleDesc[1][u] = 0; // revert to implicit - m_descArea[u] = &m_handleDesc[0][u]->descArea(); - return; - } - // XXX should check implicit handles on all statements - for (unsigned v = 1; v <= 4; v++) { - if (pDesc == m_handleDesc[0][v]) { - ctx.pushStatus(Sqlstate::_HY024, Error::Gen, "cannot set %s handle to implicitly allocated %s handle", DescArea::nameUsage(u), DescArea::nameUsage((DescUsage)v)); - return; - } - } - m_handleDesc[1][u] = pDesc; - m_descArea[u] = &m_handleDesc[1][u]->descArea(); -} - -// allocate and free handles (no valid case) - -void -HandleStmt::sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild) -{ - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "inappropriate handle type"); -} - -void -HandleStmt::sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* ppChild) -{ - ctx.pushStatus(Sqlstate::_HY092, Error::Gen, "inappropriate handle type"); -} - -// attributes and info - -static bool -ignore_attr(Ctx& ctx, SQLINTEGER attribute) -{ - switch (attribute) { - case 1211: - case 1227: - case 1228: - ctx_log2(("ignore unknown ADO.NET stmt attribute %d", (int)attribute)); - return true; - } - return false; -} - -void -HandleStmt::sqlSetStmtAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength) -{ - if (ignore_attr(ctx, attribute)) - return; - baseSetHandleAttr(ctx, m_attrArea, attribute, value, stringLength); -} - -void -HandleStmt::sqlGetStmtAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength) -{ - if (ignore_attr(ctx, attribute)) - return; - baseGetHandleAttr(ctx, m_attrArea, attribute, value, bufferLength, stringLength); -} - -void -HandleStmt::sqlSetStmtOption(Ctx& ctx, SQLUSMALLINT option, SQLUINTEGER value) -{ - if (ignore_attr(ctx, option)) - return; - baseSetHandleOption(ctx, m_attrArea, option, value); -} - -void -HandleStmt::sqlGetStmtOption(Ctx& ctx, SQLUSMALLINT option, SQLPOINTER value) -{ - if (ignore_attr(ctx, option)) - return; - baseGetHandleOption(ctx, m_attrArea, option, value); -} - -void -HandleStmt::sqlGetTypeInfo(Ctx& ctx, SQLSMALLINT dataType) -{ - BaseString text; - // odbc$typeinfo is a (possible unordered) view matching SQLGetTypeInfo result set - text.append("SELECT * FROM odbc$typeinfo"); - if (dataType != SQL_ALL_TYPES) { - switch (dataType) { - case SQL_CHAR: - case SQL_VARCHAR: - case SQL_BINARY: - case SQL_VARBINARY: - case SQL_SMALLINT: - case SQL_INTEGER: - case SQL_BIGINT: - case SQL_REAL: - case SQL_DOUBLE: - break; - default: - // XXX unsupported vs illegal - ctx_log1(("sqlGetTypeInfo: unknown data type %d", (int)dataType)); - break; - } - text.appfmt(" WHERE data_type = %d", (int)dataType); - } - // sort signed before unsigned - text.append(" ORDER BY data_type, unsigned_attribute, type_name"); - sqlExecDirect(ctx, (SQLCHAR*)text.c_str(), text.length()); -} - -void -HandleStmt::sqlTables(Ctx& ctx, SQLCHAR* catalogName, SQLSMALLINT nameLength1, SQLCHAR* schemaName, SQLSMALLINT nameLength2, SQLCHAR* tableName, SQLSMALLINT nameLength3, SQLCHAR* tableType, SQLSMALLINT nameLength4) -{ - BaseString text; - // odbc$tables is a (possibly unordered) view matching SQLTables result set - text.append("SELECT * FROM odbc$tables"); - SQLUINTEGER metadata_id = SQL_FALSE; - sqlGetStmtAttr(ctx, SQL_ATTR_METADATA_ID, (SQLPOINTER)&metadata_id, SQL_IS_POINTER, 0); - if (! ctx.ok()) - return; - unsigned count = 0; - if (catalogName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)catalogName, nameLength1); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (getOdbcVersion(ctx) == 2) - text.appfmt(" table_cat = '%s'", data.sqlchar()); - else if (metadata_id == SQL_TRUE) - text.appfmt(" table_cat = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_cat LIKE '%s'", data.sqlchar()); - } - if (schemaName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)schemaName, nameLength2); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" table_schem = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_schem LIKE '%s'", data.sqlchar()); - } - if (tableName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)tableName, nameLength3); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" table_name = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_name LIKE '%s'", data.sqlchar()); - } - if (tableType != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)tableType, nameLength4); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - text.appfmt(" table_type IN (%s)", data.sqlchar()); // XXX UPPER, quotes - } - text.append(" ORDER BY table_type, table_cat, table_schem, table_name"); - sqlExecDirect(ctx, (SQLCHAR*)text.c_str(), text.length()); -} - -void -HandleStmt::sqlColumns(Ctx& ctx, SQLCHAR* catalogName, SQLSMALLINT nameLength1, SQLCHAR* schemaName, SQLSMALLINT nameLength2, SQLCHAR* tableName, SQLSMALLINT nameLength3, SQLCHAR* columnName, SQLSMALLINT nameLength4) -{ - BaseString text; - // odbc$columns is a (possibly unordered) view matching SQLColumns result set - text.append("SELECT * FROM odbc$columns"); - SQLUINTEGER metadata_id = SQL_FALSE; - sqlGetStmtAttr(ctx, SQL_ATTR_METADATA_ID, (SQLPOINTER)&metadata_id, SQL_IS_POINTER, 0); - if (! ctx.ok()) - return; - unsigned count = 0; - if (catalogName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)catalogName, nameLength1); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (getOdbcVersion(ctx) == 2) - text.appfmt(" table_cat = '%s'", data.sqlchar()); - else if (metadata_id == SQL_TRUE) - text.appfmt(" table_cat = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_cat LIKE '%s'", data.sqlchar()); - } - if (schemaName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)schemaName, nameLength2); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" table_schem = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_schem LIKE '%s'", data.sqlchar()); - } - if (tableName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)tableName, nameLength3); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" table_name = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_name LIKE '%s'", data.sqlchar()); - } - if (columnName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)columnName, nameLength4); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" column_name = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" column_name LIKE '%s'", data.sqlchar()); - } - text.append(" ORDER BY table_cat, table_schem, table_name, ordinal_position"); - sqlExecDirect(ctx, (SQLCHAR*)text.c_str(), text.length()); -} - -void -HandleStmt::sqlPrimaryKeys(Ctx& ctx, SQLCHAR* szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR* szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR* szTableName, SQLSMALLINT cbTableName) -{ - BaseString text; - // odbc$primarykeys is a (possible unordered) view matching SQLPrimaryKeys result set - text.append("SELECT * FROM odbc$primarykeys"); - SQLUINTEGER metadata_id = SQL_FALSE; - sqlGetStmtAttr(ctx, SQL_ATTR_METADATA_ID, (SQLPOINTER)&metadata_id, SQL_IS_POINTER, 0); - if (! ctx.ok()) - return; - unsigned count = 0; - if (szCatalogName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)szCatalogName, cbCatalogName); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (getOdbcVersion(ctx) == 2) - text.appfmt(" table_cat = '%s'", data.sqlchar()); - else if (metadata_id == SQL_TRUE) - text.appfmt(" table_cat = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_cat = '%s'", data.sqlchar()); // no pattern - } - if (szSchemaName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)szSchemaName, cbSchemaName); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" table_schem = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_schem = '%s'", data.sqlchar()); // no pattern - } - if (szTableName != 0) { - OdbcData data; - data.copyin(ctx, OdbcData::Sqlchar, (SQLPOINTER)szTableName, cbTableName); - if (! ctx.ok()) - return; - text.append(++count == 1 ? " WHERE" : " AND"); - if (metadata_id == SQL_TRUE) - text.appfmt(" table_name = '%s'", data.sqlchar()); // XXX UPPER - else - text.appfmt(" table_name = '%s'", data.sqlchar()); // no pattern - } else { // no null - ctx.pushStatus(Sqlstate::_HY009, Error::Gen, "null table name"); - return; - } - text.append(" ORDER BY table_cat, table_schem, table_name, key_seq"); - sqlExecDirect(ctx, (SQLCHAR*)text.c_str(), text.length()); -} - -int -HandleStmt::getOdbcVersion(Ctx& ctx) -{ - return m_dbc->getOdbcVersion(ctx); -} - -// prepare and execute - -void -HandleStmt::sqlPrepare(Ctx& ctx, SQLCHAR* statementText, SQLINTEGER textLength) -{ - if (m_state == Open) { - ctx.pushStatus(Sqlstate::_24000, Error::Gen, "cursor is open"); - return; - } - free(ctx); - const char* text = reinterpret_cast(statementText); - if (textLength == SQL_NTS) { - m_sqlText.assign(text); - } else if (textLength >= 0) { - m_sqlText.assign(text, textLength); - } else { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "missing SQL text"); - return; - } - if (! useSchemaCon(ctx, true)) - return; - CodeGen codegen(*this); - codegen.prepare(ctx); - useSchemaCon(ctx, false); - if (! ctx.ok()) { - free(ctx); - return; - } - ctx_log2(("prepared %s statement", m_stmtInfo.getDesc())); - m_state = Prepared; -} - -void -HandleStmt::sqlExecute(Ctx& ctx) -{ - if (m_state == Open) { - ctx.pushStatus(Sqlstate::_24000, Error::Gen, "cursor is open"); - return; - } - StmtType stmtType = m_stmtInfo.getType(); - switch (stmtType) { - case Stmt_type_DDL: - if (! useSchemaCon(ctx, true)) - return; - break; - case Stmt_type_query: - case Stmt_type_DML: - if (! useConnection(ctx, true)) - return; - break; - default: - ctx_assert(false); - break; - } - CodeGen codegen(*this); - codegen.execute(ctx); - // valid only after execute says M$ XXX create this diag only on demand - setFunction(ctx); - if (ctx.getCode() == SQL_NEED_DATA) { - m_state = NeedData; - return; - } - ctx_log2(("execute: fetched %u tuples from NDB", (unsigned)m_tuplesFetched)); - switch (stmtType) { - case Stmt_type_DDL: - codegen.close(ctx); - useSchemaCon(ctx, false); - m_state = Prepared; - break; - case Stmt_type_query: - if (! ctx.ok()) { - codegen.close(ctx); - useConnection(ctx, false); - m_state = Prepared; - } else { - m_state = Open; - } - break; - case Stmt_type_DML: - codegen.close(ctx); - if (m_dbc->autocommit()) { - // even if error - m_dbc->sqlEndTran(ctx, SQL_COMMIT); - } else { - m_dbc->uncommitted(true); // uncommitted changes possible - } - useConnection(ctx, false); - m_state = Prepared; - break; - default: - ctx_assert(false); - break; - } -} - -void -HandleStmt::sqlExecDirect(Ctx& ctx, SQLCHAR* statementText, SQLINTEGER textLength) -{ - sqlPrepare(ctx, statementText, textLength); - if (! ctx.ok()) - return; - sqlExecute(ctx); -} - -void -HandleStmt::sqlFetch(Ctx& ctx) -{ - if (m_state != Open) { - ctx.pushStatus(Sqlstate::_24000, Error::Gen, "cursor is not open"); - return; - } - StmtType stmtType = m_stmtInfo.getType(); - switch (stmtType) { - case Stmt_type_query: { - CodeGen codegen(*this); - codegen.fetch(ctx); - if (! ctx.ok()) { - codegen.close(ctx); - useConnection(ctx, false); - } - break; - } - default: - ctx_assert(false); - break; - } -} - -void -HandleStmt::sqlRowCount(Ctx& ctx, SQLINTEGER* rowCount) -{ - *rowCount = m_rowCount; -} - -void -HandleStmt::sqlMoreResults(Ctx& ctx) -{ - if (m_state == Open) { - sqlCloseCursor(ctx); - if (! ctx.ok()) - return; - } - ctx.setCode(SQL_NO_DATA); -} - -void -HandleStmt::sqlCancel(Ctx& ctx) -{ - if (m_state == NeedData) { - CodeGen codegen(*this); - codegen.close(ctx); - m_state = Prepared; - } -} - -void -HandleStmt::sqlCloseCursor(Ctx& ctx) -{ - if (m_state != Open) { - ctx.pushStatus(Sqlstate::_24000, Error::Gen, "cursor is not open"); - return; - } - ctx_log2(("execute: fetched %u tuples from NDB", (unsigned)m_tuplesFetched)); - StmtType stmtType = m_stmtInfo.getType(); - switch (stmtType) { - case Stmt_type_query: { - CodeGen codegen(*this); - codegen.close(ctx); - useConnection(ctx, false); - m_state = Prepared; - m_rowCount = 0; - m_tuplesFetched = 0; - break; - } - default: - ctx_assert(false); - break; - } -} - -void -HandleStmt::sqlGetCursorName(Ctx& ctx, SQLCHAR* cursorName, SQLSMALLINT bufferLength, SQLSMALLINT* nameLength) -{ - OdbcData name("SQL_CUR_DUMMY"); - name.copyout(ctx, cursorName, bufferLength, 0, nameLength); -} - -void -HandleStmt::sqlSetCursorName(Ctx& ctx, SQLCHAR* cursorName, SQLSMALLINT nameLength) -{ -} - -// special data access - -void -HandleStmt::sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind) -{ - if (m_state != Open) { - ctx.pushStatus(Sqlstate::_24000, Error::Gen, "cursor is not open"); - return; - } - if (bufferLength < 0) { - ctx.pushStatus(Sqlstate::_HY090, Error::Gen, "invalid buffer length %d", (int)bufferLength); - return; - } - CodeGen codegen(*this); - codegen.sqlGetData(ctx, columnNumber, targetType, targetValue, bufferLength, strlen_or_Ind); -} - -void -HandleStmt::sqlParamData(Ctx& ctx, SQLPOINTER* value) -{ - if (m_state != NeedData) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "not expecting data-at-exec"); - return; - } - CodeGen codegen(*this); - codegen.sqlParamData(ctx, value); - if (! ctx.ok()) - return; - sqlExecute(ctx); -} - -void -HandleStmt::sqlPutData(Ctx& ctx, SQLPOINTER data, SQLINTEGER strlen_or_Ind) -{ - if (m_state != NeedData) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "not expecting data-at-exec"); - return; - } - CodeGen codegen(*this); - codegen.sqlPutData(ctx, data, strlen_or_Ind); -} - -// describe statement - -void -HandleStmt::sqlNumParams(Ctx& ctx, SQLSMALLINT* parameterCountPtr) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "statement is not prepared"); - return; - } - HandleDesc* ipd = getHandleDesc(ctx, Desc_usage_IPD); - ipd->sqlGetDescField(ctx, 0, SQL_DESC_COUNT, static_cast(parameterCountPtr), -1, 0); -} - -void -HandleStmt::sqlDescribeParam(Ctx& ctx, SQLUSMALLINT ipar, SQLSMALLINT* pfSqlType, SQLUINTEGER* pcbParamDef, SQLSMALLINT* pibScale, SQLSMALLINT* pfNullable) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "statement is not prepared"); - return; - } - HandleDesc* ipd = getHandleDesc(ctx, Desc_usage_IPD); - ipd->sqlGetDescField(ctx, ipar, SQL_DESC_CONCISE_TYPE, static_cast(pfSqlType), -1, 0); - { // XXX fix it - OdbcData data((SQLUINTEGER)0); - data.copyout(ctx, (SQLPOINTER)pcbParamDef, -1, 0); - } - { // XXX fix it - OdbcData data((SQLSMALLINT)0); - data.copyout(ctx, (SQLPOINTER)pibScale, -1, 0); - } - ipd->sqlGetDescField(ctx, ipar, SQL_DESC_NULLABLE, static_cast(pfNullable), -1, 0); -} - -void -HandleStmt::sqlNumResultCols(Ctx& ctx, SQLSMALLINT* columnCount) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "statement is not prepared"); - return; - } - HandleDesc* const ird = getHandleDesc(ctx, Desc_usage_IRD); - ird->sqlGetDescField(ctx, 0, SQL_DESC_COUNT, static_cast(columnCount), -1, 0); - setFunction(ctx); // unixODBC workaround -} - -void -HandleStmt::sqlDescribeCol(Ctx& ctx, SQLUSMALLINT columnNumber, SQLCHAR* columnName, SQLSMALLINT bufferLength, SQLSMALLINT* nameLength, SQLSMALLINT* dataType, SQLUINTEGER* columnSize, SQLSMALLINT* decimalDigits, SQLSMALLINT* nullable) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "statement is not prepared"); - return; - } - HandleDesc* const ird = getHandleDesc(ctx, Desc_usage_IRD); - ird->sqlGetDescField(ctx, columnNumber, SQL_DESC_NAME, static_cast(columnName), bufferLength, 0, nameLength); - ird->sqlGetDescField(ctx, columnNumber, SQL_DESC_CONCISE_TYPE, static_cast(dataType), -1, 0); - if (! ctx.ok()) - return; - if (columnSize != 0) { - switch (*dataType) { - case SQL_CHAR: - case SQL_VARCHAR: - case SQL_BINARY: - case SQL_VARBINARY: - ird->sqlGetDescField(ctx, columnNumber, SQL_DESC_LENGTH, static_cast(columnSize), -1, 0); - break; - case SQL_SMALLINT: - *columnSize = 5; - break; - case SQL_INTEGER: - *columnSize = 10; - break; - case SQL_BIGINT: - *columnSize = 20; // XXX 19 for signed - break; - case SQL_REAL: - *columnSize = 7; - break; - case SQL_DOUBLE: - *columnSize = 15; - break; - case SQL_TYPE_TIMESTAMP: - *columnSize = 30; - break; - default: - *columnSize = 0; - break; - } - } - if (decimalDigits != 0) { - switch (*dataType) { - case SQL_SMALLINT: - case SQL_INTEGER: - case SQL_BIGINT: - *decimalDigits = 0; - break; - case SQL_TYPE_TIMESTAMP: - *decimalDigits = 10; - break; - default: - *decimalDigits = 0; - break; - } - } - ird->sqlGetDescField(ctx, columnNumber, SQL_DESC_NULLABLE, static_cast(nullable), -1, 0); -} - -void -HandleStmt::sqlColAttribute(Ctx& ctx, SQLUSMALLINT columnNumber, SQLUSMALLINT fieldIdentifier, SQLPOINTER characterAttribute, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength, SQLPOINTER numericAttribute) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "statement is not prepared"); - return; - } - HandleDesc* const ird = getHandleDesc(ctx, Desc_usage_IRD); - ird->sqlColAttribute(ctx, columnNumber, fieldIdentifier, characterAttribute, bufferLength, stringLength, numericAttribute); -} - -void -HandleStmt::sqlColAttributes(Ctx& ctx, SQLUSMALLINT icol, SQLUSMALLINT fdescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT* pcbDesc, SQLINTEGER* pfDesc) -{ - if (m_state == Free) { - ctx.pushStatus(Sqlstate::_HY010, Error::Gen, "statement is nor prepared"); - return; - } - HandleDesc* const ird = getHandleDesc(ctx, Desc_usage_IRD); - ird->sqlColAttributes(ctx, icol, fdescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); -} - -// descriptor manipulation - -void -HandleStmt::sqlBindCol(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind) -{ - HandleDesc* const ard = getHandleDesc(ctx, Desc_usage_ARD); - DescArea& desc = ard->descArea(); - if (desc.getCount() < columnNumber) { - desc.setCount(ctx, columnNumber); - } - DescRec& rec = desc.getRecord(columnNumber); - rec.setField(ctx, SQL_DESC_TYPE, targetType); - rec.setField(ctx, SQL_DESC_CONCISE_TYPE, targetType); - rec.setField(ctx, SQL_DESC_DATA_PTR, targetValue); - rec.setField(ctx, SQL_DESC_OCTET_LENGTH, bufferLength); - rec.setField(ctx, SQL_DESC_OCTET_LENGTH_PTR, strlen_or_Ind); - rec.setField(ctx, SQL_DESC_INDICATOR_PTR, strlen_or_Ind); -} - -void -HandleStmt::sqlBindParameter(Ctx& ctx, SQLUSMALLINT ipar, SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLUINTEGER cbColDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER* pcbValue) -{ - HandleDesc* const ipd = getHandleDesc(ctx, Desc_usage_IPD); - HandleDesc* const apd = getHandleDesc(ctx, Desc_usage_APD); - DescArea& descIPD = ipd->descArea(); - DescArea& descAPD = apd->descArea(); - if (ipar < 1) { - ctx.pushStatus(Sqlstate::_07009, Error::Gen, "invalid parameter index %u", (unsigned)ipar); - return; - } - if (descIPD.getCount() < ipar) { - descIPD.setCount(ctx, ipar); - } - if (descAPD.getCount() < ipar) { - descAPD.setCount(ctx, ipar); - } - DescRec& recIPD = descIPD.getRecord(ipar); - DescRec& recAPD = descAPD.getRecord(ipar); - recIPD.setField(ctx, SQL_DESC_PARAMETER_TYPE, fParamType); - recAPD.setField(ctx, SQL_DESC_TYPE, fCType); - recAPD.setField(ctx, SQL_DESC_CONCISE_TYPE, fCType); - recIPD.setField(ctx, SQL_DESC_TYPE, fSqlType); - recIPD.setField(ctx, SQL_DESC_CONCISE_TYPE, fSqlType); - switch (fSqlType) { - case SQL_CHAR: // XXX not complete - case SQL_VARCHAR: - case SQL_BINARY: - case SQL_VARBINARY: - recIPD.setField(ctx, SQL_DESC_LENGTH, cbColDef); - break; - case SQL_DECIMAL: - case SQL_NUMERIC: - case SQL_FLOAT: - case SQL_REAL: - case SQL_DOUBLE: - recIPD.setField(ctx, SQL_DESC_PRECISION, cbColDef); - break; - } - switch (fSqlType) { - case SQL_TYPE_TIME: // XXX not complete - case SQL_TYPE_TIMESTAMP: - recIPD.setField(ctx, SQL_DESC_PRECISION, ibScale); - break; - case SQL_NUMERIC: - case SQL_DECIMAL: - recIPD.setField(ctx, SQL_DESC_SCALE, ibScale); - break; - } - recAPD.setField(ctx, SQL_DESC_DATA_PTR, rgbValue); - recAPD.setField(ctx, SQL_DESC_OCTET_LENGTH, cbValueMax); - recAPD.setField(ctx, SQL_DESC_OCTET_LENGTH_PTR, pcbValue); - recAPD.setField(ctx, SQL_DESC_INDICATOR_PTR, pcbValue); -} - -void -HandleStmt::sqlBindParam(Ctx& ctx, SQLUSMALLINT parameterNumber, SQLSMALLINT valueType, SQLSMALLINT parameterType, SQLUINTEGER lengthPrecision, SQLSMALLINT parameterScale, SQLPOINTER parameterValue, SQLINTEGER* strLen_or_Ind) -{ - sqlBindParameter(ctx, parameterNumber, SQL_PARAM_INPUT_OUTPUT, valueType, parameterType, lengthPrecision, parameterScale, parameterValue, SQL_SETPARAM_VALUE_MAX, strLen_or_Ind); -} - -void -HandleStmt::sqlSetParam(Ctx& ctx, SQLUSMALLINT parameterNumber, SQLSMALLINT valueType, SQLSMALLINT parameterType, SQLUINTEGER lengthPrecision, SQLSMALLINT parameterScale, SQLPOINTER parameterValue, SQLINTEGER* strLen_or_Ind) -{ - sqlBindParameter(ctx, parameterNumber, SQL_PARAM_INPUT_OUTPUT, valueType, parameterType, lengthPrecision, parameterScale, parameterValue, SQL_SETPARAM_VALUE_MAX, strLen_or_Ind); -} diff --git a/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp b/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp deleted file mode 100644 index 0bee138bfc6..00000000000 --- a/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp +++ /dev/null @@ -1,117 +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 ODBC_HANDLES_HandleStmt_hpp -#define ODBC_HANDLES_HandleStmt_hpp - -#include -#include -#include -#include "HandleBase.hpp" - -class HandleDbc; -class HandleDesc; - -/** - * @class HandleStmt - * @brief Statement handle (SQLHSTMT). - */ -class HandleStmt : public HandleBase, public StmtArea { -public: - HandleStmt(HandleDbc* pDbc); - ~HandleStmt(); - void ctor(Ctx& ctx); - void dtor(Ctx& ctx); - HandleDbc* getDbc(); - HandleBase* getParent(); - HandleRoot* getRoot(); - OdbcHandle odbcHandle(); - // descriptor handles - HandleDesc* getHandleDesc(Ctx& ctx, DescUsage u) const; - void setHandleDesc(Ctx& ctx, DescUsage u, SQLPOINTER handle); - // allocate and free handles (no valid case) - void sqlAllocHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase** ppChild); - void sqlFreeHandle(Ctx& ctx, SQLSMALLINT childType, HandleBase* pChild); - // attributes and info - void sqlSetStmtAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER stringLength); - void sqlGetStmtAttr(Ctx& ctx, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER bufferLength, SQLINTEGER* stringLength); - void sqlSetStmtOption(Ctx& ctx, SQLUSMALLINT option, SQLUINTEGER value); // odbc2.0 - void sqlGetStmtOption(Ctx& ctx, SQLUSMALLINT option, SQLPOINTER value); // odbc2.0 - void sqlGetTypeInfo(Ctx& ctx, SQLSMALLINT dataType); - void sqlTables(Ctx& ctx, SQLCHAR* catalogName, SQLSMALLINT nameLength1, SQLCHAR* schemaName, SQLSMALLINT nameLength2, SQLCHAR* tableName, SQLSMALLINT nameLength3, SQLCHAR* tableType, SQLSMALLINT nameLength4); - void sqlColumns(Ctx& ctx, SQLCHAR* catalogName, SQLSMALLINT nameLength1, SQLCHAR* schemaName, SQLSMALLINT nameLength2, SQLCHAR* tableName, SQLSMALLINT nameLength3, SQLCHAR* columnName, SQLSMALLINT nameLength4); - void sqlPrimaryKeys(Ctx& ctx, SQLCHAR* szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR* szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR* szTableName, SQLSMALLINT cbTableName); - int getOdbcVersion(Ctx& ctx); - // prepare and execute - void sqlPrepare(Ctx& ctx, SQLCHAR* statementText, SQLINTEGER textLength); - void sqlExecute(Ctx& ctx); - void sqlExecDirect(Ctx& ctx, SQLCHAR* statementText, SQLINTEGER textLength); - void sqlFetch(Ctx& ctx); - void sqlRowCount(Ctx& ctx, SQLINTEGER* rowCount); - void sqlMoreResults(Ctx& ctx); - void sqlCancel(Ctx& ctx); - void sqlCloseCursor(Ctx& ctx); - void sqlGetCursorName(Ctx& ctx, SQLCHAR* cursorName, SQLSMALLINT bufferLength, SQLSMALLINT* nameLength); - void sqlSetCursorName(Ctx& ctx, SQLCHAR* cursorName, SQLSMALLINT nameLength); - // special data access - void sqlGetData(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind); - void sqlParamData(Ctx& ctx, SQLPOINTER* value); - void sqlPutData(Ctx& ctx, SQLPOINTER data, SQLINTEGER strlen_or_Ind); - // describe statement - void sqlNumParams(Ctx& ctx, SQLSMALLINT* ParameterCountPtr); - void sqlDescribeParam(Ctx& ctx, SQLUSMALLINT ipar, SQLSMALLINT* pfSqlType, SQLUINTEGER* pcbParamDef, SQLSMALLINT* pibScale, SQLSMALLINT* pfNullable); - void sqlNumResultCols(Ctx& ctx, SQLSMALLINT* columnCount); - void sqlDescribeCol(Ctx& ctx, SQLUSMALLINT columnNumber, SQLCHAR* columnName, SQLSMALLINT bufferLength, SQLSMALLINT* nameLength, SQLSMALLINT* dataType, SQLUINTEGER* columnSize, SQLSMALLINT* decimalDigits, SQLSMALLINT* nullable); - void sqlColAttribute(Ctx& ctx, SQLUSMALLINT columnNumber, SQLUSMALLINT fieldIdentifier, SQLPOINTER characterAttribute, SQLSMALLINT bufferLength, SQLSMALLINT* stringLength, SQLPOINTER numericAttribute); - void sqlColAttributes(Ctx& ctx, SQLUSMALLINT icol, SQLUSMALLINT fdescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT* pcbDesc, SQLINTEGER* pfDesc); // odbc2.0 - // descriptor manipulation - void sqlBindCol(Ctx& ctx, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValue, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_Ind); - void sqlBindParameter(Ctx& ctx, SQLUSMALLINT ipar, SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLUINTEGER cbColDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER* pcbValue); - void sqlBindParam(Ctx& ctx, SQLUSMALLINT parameterNumber, SQLSMALLINT valueType, SQLSMALLINT parameterType, SQLUINTEGER lengthPrecision, SQLSMALLINT parameterScale, SQLPOINTER parameterValue, SQLINTEGER* strLen_or_Ind); - void sqlSetParam(Ctx& ctx, SQLUSMALLINT parameterNumber, SQLSMALLINT valueType, SQLSMALLINT parameterType, SQLUINTEGER lengthPrecision, SQLSMALLINT parameterScale, SQLPOINTER parameterValue, SQLINTEGER* strLen_or_Ind); -private: - HandleDbc* const m_dbc; - static AttrSpec m_attrSpec[]; - AttrArea m_attrArea; - // descriptor handles (0-automatic 1-application) - HandleDesc* m_handleDesc[2][1+4]; -}; - -inline HandleDbc* -HandleStmt::getDbc() -{ - return m_dbc; -} - -inline HandleBase* -HandleStmt::getParent() -{ - return (HandleBase*)getDbc(); -} - -inline HandleRoot* -HandleStmt::getRoot() -{ - return getParent()->getRoot(); -} - -inline OdbcHandle -HandleStmt::odbcHandle() -{ - return Odbc_handle_stmt; -} - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/InfoTab.cpp b/ndb/src/old_files/client/odbc/handles/InfoTab.cpp deleted file mode 100644 index 1a93c4da264..00000000000 --- a/ndb/src/old_files/client/odbc/handles/InfoTab.cpp +++ /dev/null @@ -1,878 +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 */ - -#include "HandleDbc.hpp" - -HandleDbc::InfoTab -HandleDbc::m_infoTab[] = { - { SQL_ACCESSIBLE_PROCEDURES, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_ACCESSIBLE_TABLES, - InfoTab::YesNo, - 0L, - "Y" - }, - { SQL_ACTIVE_ENVIRONMENTS, - InfoTab::Short, - 0L, - 0 - }, - { SQL_AGGREGATE_FUNCTIONS, - InfoTab::Bitmask, - SQL_AF_AVG | SQL_AF_COUNT | SQL_AF_MAX | SQL_AF_MIN | SQL_AF_SUM, - 0 - }, - { SQL_ALTER_DOMAIN, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_ALTER_TABLE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_ASYNC_MODE, - InfoTab::Long, - SQL_AM_NONE, - 0 - }, - { SQL_BATCH_ROW_COUNT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_BATCH_SUPPORT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_BOOKMARK_PERSISTENCE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CATALOG_LOCATION, - InfoTab::Short, - 0L, - 0 - }, - { SQL_CATALOG_NAME, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_CATALOG_NAME_SEPARATOR, - InfoTab::Char, - 0L, - "" - }, - { SQL_CATALOG_TERM, - InfoTab::Char, - 0L, - "" - }, - { SQL_CATALOG_USAGE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_COLLATION_SEQ, - InfoTab::Char, - 0L, - "ISO 8859-1" - }, - { SQL_COLUMN_ALIAS, - InfoTab::YesNo, - 0L, - "Y" - }, - { SQL_CONCAT_NULL_BEHAVIOR, - InfoTab::Short, - 0L, - 0 - }, - { SQL_CONVERT_BIGINT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_BINARY, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_BIT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_CHAR, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_DATE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_DECIMAL, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_DOUBLE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_FLOAT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, -#if 0 - { SQL_CONVERT_GUID, - InfoTab::Bitmask, - 0L, - 0 - }, -#endif - { SQL_CONVERT_INTEGER, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_INTERVAL_DAY_TIME, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_INTERVAL_YEAR_MONTH, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_LONGVARBINARY, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_LONGVARCHAR, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_NUMERIC, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_REAL, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_SMALLINT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_TIME, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_TIMESTAMP, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_TINYINT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_VARBINARY, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CONVERT_VARCHAR, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CORRELATION_NAME, - InfoTab::Bitmask, - SQL_CN_ANY, - 0 - }, - { SQL_CREATE_ASSERTION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CREATE_CHARACTER_SET, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CREATE_COLLATION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CREATE_DOMAIN, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CREATE_SCHEMA, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CREATE_TABLE, - InfoTab::Bitmask, - SQL_CT_CREATE_TABLE, - 0 - }, - { SQL_CREATE_TRANSLATION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CREATE_VIEW, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_CURSOR_COMMIT_BEHAVIOR, - InfoTab::Short, - SQL_CB_CLOSE, - 0 - }, - { SQL_CURSOR_ROLLBACK_BEHAVIOR, - InfoTab::Short, - SQL_CB_CLOSE, - 0 - }, - { SQL_CURSOR_SENSITIVITY, - InfoTab::Long, - 0L, - 0 - }, - { SQL_DATABASE_NAME, - InfoTab::Char, - 0L, - "" - }, - { SQL_DATA_SOURCE_NAME, - InfoTab::Char, - 0L, - "" - }, - { SQL_DATA_SOURCE_READ_ONLY, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_DATETIME_LITERALS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DBMS_NAME, - InfoTab::Char, - 0L, - "" - }, - { SQL_DBMS_VER, - InfoTab::Char, - 0L, - "01.43.0000" - }, - { SQL_DDL_INDEX, - InfoTab::Long, - 0L, - 0 - }, - { SQL_DEFAULT_TXN_ISOLATION, - InfoTab::Long, - SQL_TXN_READ_COMMITTED, - 0 - }, - { SQL_DESCRIBE_PARAMETER, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_DM_VER, - InfoTab::Char, - 0L, - "" - }, - { SQL_DRIVER_HDBC, - InfoTab::Long, - 0L, - 0 - }, - { SQL_DRIVER_HDESC, - InfoTab::Long, - 0L, - 0 - }, - { SQL_DRIVER_HLIB, - InfoTab::Long, - 0L, - 0 - }, - { SQL_DRIVER_HSTMT, - InfoTab::Long, - 0L, - 0 - }, - { SQL_DRIVER_NAME, - InfoTab::Char, - 0L, - "" - }, - { SQL_DRIVER_ODBC_VER, - InfoTab::Char, - 0L, - "03.00" - }, - { SQL_DRIVER_VER, - InfoTab::Char, - 0L, - "00.10.0000" - }, - { SQL_DROP_ASSERTION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_CHARACTER_SET, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_COLLATION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_DOMAIN, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_SCHEMA, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_TABLE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_TRANSLATION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DROP_VIEW, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DTC_TRANSITION_COST, // not in older MS docs - InfoTab::Bitmask, - 0L, - 0 // SQL_DTC_ENLIST_EXPENSIVE | SQL_DTC_UNENLIST_EXPENSIVE - }, - { SQL_DYNAMIC_CURSOR_ATTRIBUTES1, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_DYNAMIC_CURSOR_ATTRIBUTES2, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_EXPRESSIONS_IN_ORDERBY, - InfoTab::Char, - 0L, - "Y" - }, - { SQL_FILE_USAGE, - InfoTab::Short, - 0L, - 0 - }, - { SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_GETDATA_EXTENSIONS, - InfoTab::Bitmask, - SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND, - 0 - }, - { SQL_GROUP_BY, - InfoTab::Short, - SQL_GB_NOT_SUPPORTED, - 0 - }, - { SQL_IDENTIFIER_CASE, - InfoTab::Short, - SQL_IC_UPPER, - 0 - }, - { SQL_IDENTIFIER_QUOTE_CHAR, - InfoTab::Char, - 0L, - "\"" - }, - { SQL_INDEX_KEYWORDS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_INFO_SCHEMA_VIEWS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_INSERT_STATEMENT, - InfoTab::Bitmask, - SQL_IS_INSERT_LITERALS | SQL_IS_SELECT_INTO, - 0 - }, - { SQL_INTEGRITY, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_KEYSET_CURSOR_ATTRIBUTES1, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_KEYSET_CURSOR_ATTRIBUTES2, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_KEYWORDS, - InfoTab::Char, - 0L, - "" - }, - { SQL_LIKE_ESCAPE_CLAUSE, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_MAX_ASYNC_CONCURRENT_STATEMENTS, - InfoTab::Long, - 0L, - 0 - }, - { SQL_MAX_BINARY_LITERAL_LEN, - InfoTab::Long, - 0L, - 0 - }, - { SQL_MAX_CATALOG_NAME_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_CHAR_LITERAL_LEN, - InfoTab::Long, - 0L, - 0 - }, - { SQL_MAX_COLUMN_NAME_LEN, - InfoTab::Short, - 16, - 0 - }, - { SQL_MAX_COLUMNS_IN_GROUP_BY, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_COLUMNS_IN_INDEX, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_COLUMNS_IN_ORDER_BY, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_COLUMNS_IN_SELECT, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_COLUMNS_IN_TABLE, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_CONCURRENT_ACTIVITIES, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_CURSOR_NAME_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_DRIVER_CONNECTIONS, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_IDENTIFIER_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_INDEX_SIZE, - InfoTab::Long, - 0L, - 0 - }, - { SQL_MAX_PROCEDURE_NAME_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_ROW_SIZE, - InfoTab::Long, - 8000, - 0 - }, - { SQL_MAX_ROW_SIZE_INCLUDES_LONG, - InfoTab::YesNo, - 0L, - "Y" - }, - { SQL_MAX_SCHEMA_NAME_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_STATEMENT_LEN, - InfoTab::Long, - 0L, - 0 - }, - { SQL_MAX_TABLE_NAME_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_TABLES_IN_SELECT, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MAX_USER_NAME_LEN, - InfoTab::Short, - 0L, - 0 - }, - { SQL_MULTIPLE_ACTIVE_TXN, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_MULT_RESULT_SETS, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_NEED_LONG_DATA_LEN, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_NON_NULLABLE_COLUMNS, - InfoTab::Short, - SQL_NNC_NON_NULL, - 0 - }, - { SQL_NULL_COLLATION, - InfoTab::Short, - SQL_NC_HIGH, - 0 - }, - { SQL_NUMERIC_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_ODBC_INTERFACE_CONFORMANCE, - InfoTab::Long, - SQL_OIC_CORE, - 0 - }, - { SQL_ODBC_VER, - InfoTab::Char, - 0L, - "" - }, - { SQL_OJ_CAPABILITIES, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_ORDER_BY_COLUMNS_IN_SELECT, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_PARAM_ARRAY_ROW_COUNTS, - InfoTab::Long, - 0L, - 0 - }, - { SQL_PARAM_ARRAY_SELECTS, - InfoTab::Long, - 0L, - 0 - }, - { SQL_POS_OPERATIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_PROCEDURES, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_PROCEDURE_TERM, - InfoTab::Char, - 0L, - "" - }, - { SQL_QUOTED_IDENTIFIER_CASE, - InfoTab::Short, - SQL_IC_SENSITIVE, - 0 - }, - { SQL_ROW_UPDATES, - InfoTab::YesNo, - 0L, - "N" - }, - { SQL_SCHEMA_TERM, - InfoTab::Char, - 0L, - "" - }, - { SQL_SCHEMA_USAGE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SCROLL_OPTIONS, - InfoTab::Bitmask, - SQL_SO_FORWARD_ONLY, - 0 - }, - { SQL_SEARCH_PATTERN_ESCAPE, - InfoTab::Char, - 0L, - "" - }, - { SQL_SERVER_NAME, - InfoTab::Char, - 0L, - "" - }, - { SQL_SPECIAL_CHARACTERS, - InfoTab::Char, - 0L, - "" - }, - { SQL_SQL92_DATETIME_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_FOREIGN_KEY_DELETE_RULE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_FOREIGN_KEY_UPDATE_RULE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_GRANT, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_NUMERIC_VALUE_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_PREDICATES, - InfoTab::Bitmask, - SQL_SP_COMPARISON | SQL_SP_IN | SQL_SP_ISNOTNULL | SQL_SP_ISNULL | SQL_SP_LIKE, - 0 - }, - { SQL_SQL92_RELATIONAL_JOIN_OPERATORS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_REVOKE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_ROW_VALUE_CONSTRUCTOR, - InfoTab::Bitmask, - SQL_SRVC_VALUE_EXPRESSION, - 0 - }, - { SQL_SQL92_STRING_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL92_VALUE_EXPRESSIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SQL_CONFORMANCE, - InfoTab::Long, - 0L, - 0 - }, - { SQL_STANDARD_CLI_CONFORMANCE, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_STATIC_CURSOR_ATTRIBUTES1, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_STATIC_CURSOR_ATTRIBUTES2, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_STRING_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SUBQUERIES, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_SYSTEM_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_TABLE_TERM, - InfoTab::Char, - 0L, - "TABLE" - }, - { SQL_TIMEDATE_ADD_INTERVALS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_TIMEDATE_DIFF_INTERVALS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_TIMEDATE_FUNCTIONS, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_TXN_CAPABLE, - InfoTab::Short, - SQL_TC_DDL_COMMIT, // XXX do it - 0 - }, - { SQL_TXN_ISOLATION_OPTION, - InfoTab::Bitmask, - SQL_TXN_READ_COMMITTED, - 0 - }, - { SQL_UNION, - InfoTab::Bitmask, - 0L, - 0 - }, - { SQL_USER_NAME, - InfoTab::Char, - 0L, - "" - }, - { SQL_XOPEN_CLI_YEAR, - InfoTab::Char, - 0L, - "" - }, - { 0, - InfoTab::End, - 0L, - 0 - } -}; diff --git a/ndb/src/old_files/client/odbc/handles/Makefile b/ndb/src/old_files/client/odbc/handles/Makefile deleted file mode 100644 index d37e7d286ba..00000000000 --- a/ndb/src/old_files/client/odbc/handles/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include .defs.mk - -TYPE = * - -NONPIC_ARCHIVE = N - -PIC_ARCHIVE = Y - -ARCHIVE_TARGET = odbchandles - -SOURCES = \ - HandleBase.cpp \ - HandleRoot.cpp \ - HandleEnv.cpp \ - HandleDbc.cpp \ - HandleStmt.cpp \ - HandleDesc.cpp \ - AttrRoot.cpp \ - AttrEnv.cpp \ - AttrDbc.cpp \ - AttrStmt.cpp \ - PoolNdb.cpp \ - DescSpec.cpp \ - FuncTab.cpp \ - InfoTab.cpp - -include ../Extra.mk -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp b/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp deleted file mode 100644 index 45d3c67ec77..00000000000 --- a/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp +++ /dev/null @@ -1,81 +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 */ - -#include -#include -#include -#include "PoolNdb.hpp" - -#ifdef NDB_WIN32 -static NdbMutex & ndb_mutex = * NdbMutex_Create(); -#else -static NdbMutex ndb_mutex = NDB_MUTEX_INITIALIZER; -#endif - -PoolNdb::PoolNdb() : - m_cntUsed(0), - m_cntFree(0) -{ -} - -PoolNdb::~PoolNdb() -{ -} - -Ndb* -PoolNdb::allocate(Ctx& ctx, int timeout) -{ - NdbMutex_Lock(&ndb_mutex); - Ndb* pNdb; - if (m_cntFree == 0) { - pNdb = new Ndb("TEST_DB"); - pNdb->useFullyQualifiedNames(true); - if (pNdb->init(64) < 0) { - ctx.pushStatus(pNdb, "init"); - delete pNdb; - NdbMutex_Unlock(&ndb_mutex); - return 0; - } - if (pNdb->waitUntilReady(timeout) < 0) { - ctx.pushStatus(Sqlstate::_HYT00, Error::Gen, "connection timeout after %d seconds", timeout); - ctx.pushStatus(pNdb, "waitUntilReady"); - delete pNdb; - NdbMutex_Unlock(&ndb_mutex); - return 0; - } - m_listFree.push_back(pNdb); - m_cntFree++; - } - pNdb = m_listFree.front(); - m_listFree.pop_front(); - m_cntFree--; - m_cntUsed++; - ctx_log1(("alloc Ndb: used=%u free=%u", m_cntUsed, m_cntFree)); - NdbMutex_Unlock(&ndb_mutex); - return pNdb; -} - -void -PoolNdb::release(Ctx& ctx, Ndb* pNdb) -{ - NdbMutex_Lock(&ndb_mutex); - m_listUsed.remove(pNdb); - m_listFree.push_back(pNdb); - m_cntFree++; - m_cntUsed--; - ctx_log1(("free Ndb: used=%u free=%u", m_cntUsed, m_cntFree)); - NdbMutex_Unlock(&ndb_mutex); -} diff --git a/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp b/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp deleted file mode 100644 index 35eac055c30..00000000000 --- a/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp +++ /dev/null @@ -1,44 +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 ODBC_HANDLES_PoolNdb_hpp -#define ODBC_HANDLES_PoolNdb_hpp - -#include -#include - -class Ndb; - -/** - * @class PoolNdb - * @brief Pool of Ndb objects. - * - * A class implementing pool of Ndb objects. - */ -class PoolNdb { -public: - PoolNdb(); - ~PoolNdb(); - Ndb* allocate(Ctx& ctx, int timeout); - void release(Ctx& ctx, Ndb* pNdb); -private: - std::list m_listUsed; - std::list m_listFree; - unsigned m_cntUsed; - unsigned m_cntFree; -}; - -#endif diff --git a/ndb/src/old_files/client/odbc/handles/handles.hpp b/ndb/src/old_files/client/odbc/handles/handles.hpp deleted file mode 100644 index a9f0fcae888..00000000000 --- a/ndb/src/old_files/client/odbc/handles/handles.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 OBDC_HANDLES_handles_hpp -#define OBDC_HANDLES_handles_hpp - -#include -#include "HandleBase.hpp" -#include "HandleRoot.hpp" -#include "HandleEnv.hpp" -#include "HandleDbc.hpp" -#include "HandleStmt.hpp" -#include "HandleDesc.hpp" - -#endif diff --git a/ndb/src/old_files/ndbbaseclient/Makefile b/ndb/src/old_files/ndbbaseclient/Makefile deleted file mode 100644 index f4c49a95ffa..00000000000 --- a/ndb/src/old_files/ndbbaseclient/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include .defs.mk - -TYPE := * - -PIC_ARCHIVE := Y -NONPIC_ARCHIVE := Y -ARCHIVE_TARGET := ndbbaseclient - -A_LIB := Y -SO_LIB := Y -PIC_LIB := Y -LIB_TARGET := ndbclient - -LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) \ - ndbapi \ - mgmapi \ - newtonapi \ - transporter \ - general \ - signaldataprint \ - mgmsrvcommon \ - portlib \ - logger \ - trace - -SOURCES = ndbbaseclient_dummy.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp b/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ndb/src/old_files/ndbclient/Makefile b/ndb/src/old_files/ndbclient/Makefile deleted file mode 100644 index 2c597eccfa1..00000000000 --- a/ndb/src/old_files/ndbclient/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -include .defs.mk - -TYPE := * - -PIC_ARCHIVE := Y -NONPIC_ARCHIVE := Y -ARCHIVE_TARGET := ndbclient - -A_LIB := N -SO_LIB := Y -PIC_LIB := Y -LIB_TARGET := ndbclient_extra - -LDFLAGS_LAST = -lstdc++ -lm - -LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) \ - ndbapi \ - mgmapi \ - newtonapi \ - transporter \ - general \ - signaldataprint \ - mgmsrvcommon \ - portlib \ - logger \ - trace \ - odbcdriver \ - odbchandles \ - odbcdictionary \ - odbccodegen \ - odbcexecutor \ - odbccommon - -SOURCES = ndbclient_dummy.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp b/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ndb/src/old_files/newtonapi/Makefile b/ndb/src/old_files/newtonapi/Makefile deleted file mode 100644 index bed179046a5..00000000000 --- a/ndb/src/old_files/newtonapi/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include .defs.mk - -TYPE := ndbapiclient - -PIC_ARCHIVE := Y -ARCHIVE_TARGET := newtonapi - -A_LIB := Y -SO_LIB := Y -PIC_LIB := Y - -LIB_TARGET := NEWTON_API -LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) NDB_API - -SOURCES = \ - dba_binding.cpp \ - dba_process.cpp \ - dba_dac.cpp \ - dba_init.cpp \ - dba_schema.cpp \ - dba_bulkread.cpp \ - dba_error.cpp \ - dba_config.cpp - -CCFLAGS_LOC += -I../include -I$(call fixpath,$(NDB_TOP)/include/portlib) -I$(call fixpath,$(NDB_TOP)/include/util) -I$(call fixpath,$(NDB_TOP)/include/newtonapi) -DDEBUG - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/newtonapi/dba_binding.cpp b/ndb/src/old_files/newtonapi/dba_binding.cpp deleted file mode 100644 index 63e48110b1d..00000000000 --- a/ndb/src/old_files/newtonapi/dba_binding.cpp +++ /dev/null @@ -1,439 +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 */ - - -#include "dba_internal.hpp" - -static bool matchType(NdbDictionary::Column::Type, DBA_DataTypes_t); -static bool matchSize(NdbDictionary::Column::Type, unsigned, Size_t); -static int computeChecksum(const DBA_Binding_t * bindings); - -struct DBA__Array { - int count; - int data[1]; - - bool exists(int value) const { - for(int i = 0; igetDictionary(); - if(dict == 0){ - DBA__SetLatestError(DBA_NDB_ERROR, 0, - "Internal NDB error: No dictionary"); - return 0; - } - - const NdbDictionary::Table * table = dict->getTable(TableName); - if(table == 0){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "No such table: %s", TableName); - return 0; - } - - /** - * Keys/Columns in table - */ - const int tabColumns = table->getNoOfColumns(); - const int tabKeys = table->getNoOfPrimaryKeys(); - - /** - * Ok, ok... I alloc four bytes extra so what... - */ - struct DBA__Array * keys = (struct DBA__Array *)malloc - (sizeof(struct DBA__Array)+tabKeys*sizeof(int)); - - if(keys == 0){ - DBA__SetLatestError(DBA_ERROR, 0, - "malloc(%d) failed", - sizeof(struct DBA__Array)+tabKeys*sizeof(int)); - return 0; - } - - struct DBA__Array * columns = (struct DBA__Array *)malloc - (sizeof(struct DBA__Array)+tabColumns*sizeof(int)); - - if(columns == 0){ - DBA__SetLatestError(DBA_ERROR, 0, - "malloc(%d) failed", - sizeof(struct DBA__Array)+tabColumns*sizeof(int)); - free(keys); - return 0; - } - - columns->count = 0; - keys->count = 0; - - DBA_Binding_t * bindings = createBinding(TableName, - NbCol, - ColsBindings, - StructSz, - table, - keys, - columns); - - for(int i = 0; igetColumn(i); - if(col->getPrimaryKey()){ - if(!keys->exists(i)){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Key column: %s not specified in binding", - col->getName()); - - free(keys); free(columns); - DBA_DestroyBinding(bindings); - return 0; - } - } - } - - free(keys); free(columns); - - DBA__ValidBinding(bindings); - - return bindings; -} - -DBA_Binding_t * -createBinding(const char* TableName, - int NbCol, - const DBA_ColumnBinding_t ColsBindings[], - Size_t StructSz, - const NdbDictionary::Table * table, - struct DBA__Array * keys, - struct DBA__Array * columns){ - /** - * Counters for this part of binding - */ - int noOfKeys = 0; - int noOfColumns = 0; - int noOfSubBindings = 0; - - /** - * Check names and types and sizes - */ - for(int i = 0; igetColumn(ColsBindings[i].Name); - const Uint32 attrId = col->getColumnNo(); - - if(col == 0){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Unknown column: %s", ColsBindings[i].Name); - return 0; - } - const NdbDictionary::Column::Type type = col->getType(); - if(!matchType(type, ColsBindings[i].DataType)){ - DBA_DEBUG("Incorrect type for: " << ColsBindings[i].Name); - DBA_DEBUG("type: " << type); - DBA_DEBUG("ColsBindings[i].DataType: " << ColsBindings[i].DataType); - - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Incorrect type for column: %s", - ColsBindings[i].Name); - - return 0; - } - - if(!matchSize(type, col->getLength(), ColsBindings[i].Size)){ - DBA_DEBUG("Incorrect size for: " << ColsBindings[i].Name); - DBA_DEBUG("type: " << type); - DBA_DEBUG("length: " << col->getLength()); - DBA_DEBUG("ColsBindings[i].Size" << (Uint64)ColsBindings[i].Size); - - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Incorrect size for column: %s", - ColsBindings[i].Name); - return 0; - } - - if(col->getPrimaryKey()){ - noOfKeys++; - } else { - noOfColumns++; - } - - /** - * Check only in "validate" phase - */ - if(columns != 0 && keys != 0){ - if(columns->exists(attrId) || keys->exists(attrId)){ - DBA_DEBUG("Column bound multiple times: " << ColsBindings[i].Name); - - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Column bound multiple times: %s", - ColsBindings[i].Name); - return 0; - } - - if(col->getPrimaryKey()){ - keys->insert(attrId); - } else { - columns->insert(attrId); - } - } - } - } - - /** - * Validation is all set - */ - - /** - * Allocate memory - */ - const int szOfStruct = - sizeof(DBA_Binding_t) - + strlen(TableName) + 4 - + (2 * sizeof(int) * noOfKeys) - + (2 * sizeof(int) * noOfColumns) - + ((sizeof(struct DBA_Binding *) + sizeof(int)) * noOfSubBindings) - - 4; - - DBA_Binding * ret = (DBA_Binding *)malloc(szOfStruct); - if(ret == 0){ - DBA__SetLatestError(DBA_ERROR, 0, - "malloc(%d) failed", szOfStruct); - return 0; - } - - for(int i = 0; imagic[i] = DBA__TheMagic[i]; - - ret->noOfKeys = noOfKeys; - ret->noOfColumns = noOfColumns; - ret->noOfSubBindings = noOfSubBindings; - - ret->keyIds = (int *)&(ret->data[0]); - ret->keyOffsets = ret->keyIds + noOfKeys; - - ret->columnIds = ret->keyOffsets + noOfKeys; - ret->columnOffsets = ret->columnIds + noOfColumns; - - ret->subBindingOffsets = ret->columnOffsets + noOfColumns; - ret->subBindings = (DBA_Binding **) - (ret->subBindingOffsets + noOfSubBindings); - - ret->tableName = (char *)(ret->subBindings + noOfSubBindings); - ret->structSz = StructSz; - ret->checkSum = computeChecksum(ret); - - /** - * Populate arrays - */ - strcpy(ret->tableName, TableName); - - int k = 0; - int c = 0; - int p = 0; - - for(int i = 0; isubBindings[p] = createBinding(TableName, - ColsBindings[i].Size, - ColsBindings[i].SubBinding, - StructSz, - table, - 0, - 0); - - DBA__ValidBinding(ret->subBindings[p]); - - ret->subBindingOffsets[p] = ColsBindings[i].Offset; - p++; - } else { - const NdbDictionary::Column * col = - table->getColumn(ColsBindings[i].Name); - - if(col->getPrimaryKey()){ - ret->keyIds[k] = col->getColumnNo(); - ret->keyOffsets[k] = ColsBindings[i].Offset; - k++; - } else { - ret->columnIds[c] = col->getColumnNo(); - ret->columnOffsets[c] = ColsBindings[i].Offset; - c++; - } - } - } - - return ret; -} - - -extern "C" -DBA_Error_t -DBA_DestroyBinding( DBA_Binding_t* Binding ){ - - for(int i = 0; inoOfSubBindings; i++) - DBA_DestroyBinding(Binding->subBindings[i]); - - free(Binding); - - return DBA_NO_ERROR; -} - -static -bool -matchType(NdbDictionary::Column::Type t1, DBA_DataTypes_t t2){ - for(int i = 0; imagic[i] != DBA__TheMagic[i]){ - DBA_DEBUG("Invalid magic in validBinding"); - return false; - } - - const int cs = computeChecksum(bindings); - if(cs != bindings->checkSum){ - DBA_DEBUG("Invalid checksum in validBinding"); - DBA_DEBUG("cs = " << cs << " b->cs= " << bindings->checkSum); - return false; - } - - return true; -} - -bool -DBA__ValidBindings(const DBA_Binding_t * const * pBindings, int n){ - for(int i = 0; istructSz; -} diff --git a/ndb/src/old_files/newtonapi/dba_bulkread.cpp b/ndb/src/old_files/newtonapi/dba_bulkread.cpp deleted file mode 100644 index 1f75037046b..00000000000 --- a/ndb/src/old_files/newtonapi/dba_bulkread.cpp +++ /dev/null @@ -1,267 +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 */ - - -#include "dba_internal.hpp" - -struct DBA__BulkReadData { - const DBA_Binding_t * const * pBindings; // The bindings - DBA_BulkReadResultSet_t * pData; // The data - - int NbRows; // NbRows per binding - int NbBindings; // NbBindings - int TotalRows; // Total rows (NbRows*NbBindings) - - DBA_AsyncCallbackFn_t CbFunc; // Users callback - DBA_ReqId_t RequestId; // Users request id - DBA_Error_t Status; // Request status - DBA_ErrorCode_t ErrorCode; /**< Request error - Only valid if request is - aborted */ - - int RowsSubmitted; // No of read sent to NDB - int RowsAcknowledged; // No of read responses - int OpPerTrans; // Operations per transaction - - struct Index { - int binding; - int row; - int datarow; - - void init() { row = binding = datarow = 0;} - void next(int rows) { - datarow++; row++; - if(row == rows){ row = 0; binding++; } - } - }; - Index lastSend; - Index nextSend; - - /** - * If "simple" bulkread - * use this storage - */ - const DBA_Binding_t * bindings[1]; - - DBA__BulkReadData() { - RequestId = DBA_INVALID_REQID; - } - void ProcessBulkRead(); - bool ProcessCallback(int errorCode, NdbConnection * connection); -}; - -static -void -NewtonCallback(int errorCode, - NdbConnection * connection, - void * anyObject){ - - DBA__BulkReadData * brd = (DBA__BulkReadData*)anyObject; - - brd->ProcessCallback(errorCode, connection); - - DBA__TheNdb->closeTransaction(connection); - - if(brd->RowsSubmitted == brd->TotalRows){ - - /** - * The entire bulk read is finished, - * call users callback - */ - DBA_ReqId_t reqId = brd->RequestId; - - // Invalidate BulkReadData - brd->RequestId = DBA_INVALID_REQID; - - brd->CbFunc(reqId, brd->Status, brd->ErrorCode); - return; - } - - brd->ProcessBulkRead(); -} - -/** - * A BulkReadData structure - */ -static DBA__BulkReadData theBRD; - -#define CHECK_BINDINGS(Bindings) \ - if(!DBA__ValidBinding(Bindings)){ \ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Invalid bindings"); \ - return DBA_INVALID_REQID; \ - } - -#define CHECK_BINDINGS2(Bindings, NbBindings) \ - if(!DBA__ValidBindings(Bindings, NbBindings)){ \ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Invalid bindings"); \ - return DBA_INVALID_REQID; \ - } - -DBA_ReqId_t -DBA_BulkReadRows(const DBA_Binding_t * pBindings, - DBA_BulkReadResultSet_t pData[], - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - - CHECK_BINDINGS(pBindings); - - DBA__BulkReadData * brd = &theBRD; - - NdbMutex_Lock(DBA__TheNewtonMutex); - - if(brd->RequestId != DBA_INVALID_REQID){ - DBA__SetLatestError(DBA_ERROR, 0, - "DBA only permits 1 concurrent bulkread"); - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return DBA_ERROR; - } - - theBRD.RequestId = 1; - - /** - * - */ - brd->bindings[0] = pBindings; - brd->pBindings = brd->bindings; - brd->pData = pData; - - /** - * Control data - */ - brd->NbRows = NbRows; - brd->NbBindings = 1; - brd->TotalRows = NbRows; - brd->CbFunc = CbFunc; - brd->Status = DBA_NO_ERROR; - brd->ErrorCode = 0; - brd->OpPerTrans = DBA__BulkReadCount; - - brd->RowsSubmitted = 0; - brd->RowsAcknowledged = 0; - - brd->lastSend.init(); - brd->nextSend.init(); - - brd->ProcessBulkRead(); - NdbMutex_Unlock(DBA__TheNewtonMutex); - - return brd->RequestId; -} - -DBA_ReqId_t -DBA_BulkMultiReadRows(const DBA_Binding_t * const * pBindings, - DBA_BulkReadResultSet_t pData[], - int NbBindings, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - - CHECK_BINDINGS2(pBindings, NbBindings); - - DBA__BulkReadData * brd = &theBRD; - - NdbMutex_Lock(DBA__TheNewtonMutex); - - if(brd->RequestId != DBA_INVALID_REQID){ - DBA__SetLatestError(DBA_ERROR, 0, - "DBA only permits 1 concurrent bulkread"); - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return DBA_ERROR; - } - - brd->RequestId = 1; - - /** - * - */ - brd->pBindings = pBindings; - brd->pData = pData; - - /** - * Control data - */ - brd->NbRows = NbRows; - brd->NbBindings = NbBindings; - brd->TotalRows = (NbRows * NbBindings); - brd->CbFunc = CbFunc; - brd->Status = DBA_NO_ERROR; - brd->ErrorCode = 0; - brd->OpPerTrans = DBA__BulkReadCount; - - brd->RowsSubmitted = 0; - brd->RowsAcknowledged = 0; - - brd->lastSend.init(); - brd->nextSend.init(); - - brd->ProcessBulkRead(); - - NdbMutex_Unlock(DBA__TheNewtonMutex); - - return brd->RequestId; -} - -bool -DBA__BulkReadData::ProcessCallback(int errorCode, NdbConnection * con){ - - Index tmp = lastSend; - const NdbOperation * op = con->getNextCompletedOperation(0); - - for(int i = 0; igetNdbError().code == 0) - pData[tmp.datarow].RowFoundIndicator = 1; - else - pData[tmp.datarow].RowFoundIndicator = 0; - - RowsAcknowledged++; - tmp.next(NbRows); - op = con->getNextCompletedOperation(op); - } - return true; -} - -void -DBA__BulkReadData::ProcessBulkRead(){ - - NdbConnection * con = DBA__TheNdb->startTransaction(); - - Index tmp = nextSend; - - for(int i = 0; igetNdbOperation(binding->tableName); - - op->simpleRead(); - - require(DBA__EqualGetValue(op, binding, data)); - - RowsSubmitted++; - tmp.next(NbRows); - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)this, - CommitAsMuchAsPossible); - - lastSend = nextSend; - nextSend = tmp; -} diff --git a/ndb/src/old_files/newtonapi/dba_config.cpp b/ndb/src/old_files/newtonapi/dba_config.cpp deleted file mode 100644 index d84386a9438..00000000000 --- a/ndb/src/old_files/newtonapi/dba_config.cpp +++ /dev/null @@ -1,115 +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 */ - - -#include "dba_internal.hpp" - -int DBA__NBP_Intervall = 10; -int DBA__BulkReadCount = 1000; -int DBA__StartTransactionTimout = 0; -int DBA__NBP_Force = 1; - -struct DBA__Config { - int ParamId; - int * Param; - int min; - int max; - const char * Description; -}; - -static -DBA__Config Parameters[] = { - { 0, &DBA__NBP_Intervall, 4, INT_MAX, - "Newton Batch Process Interval(ms)" }, - { 1, &DBA__BulkReadCount, 1, 5000, - "Operations per transaction during bulkread" }, - { 2, &DBA__StartTransactionTimout, 0, INT_MAX, - "Start transaction timeout(ms)" }, - { 3, &DBA__NBP_Force, 0, 2, - "Newton Batch Process Force send algorithm" } -}; - -static const int Params = sizeof(Parameters)/sizeof(DBA__Config); - -static -DBA__Config * -getParam(int id){ - for(int i = 0; imin){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Value too small for parameter %d (min = %d)", - Value, p->min); - return DBA_APPLICATION_ERROR; - } - - if(Value > p->max){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Value too big for parameter %d (max = %d)", - Value, p->max); - return DBA_APPLICATION_ERROR; - } - - * p->Param = Value; - return DBA_NO_ERROR; -} - -extern "C" -DBA_Error_t -DBA_GetParameter(int ParameterId, int * Value){ - if(ParameterId == -1){ - if(DBA__TheNdb == 0){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "DBA_Open() is not called" - ); - return DBA_APPLICATION_ERROR; - } - * Value = DBA__TheNdb->getNodeId(); - return DBA_NO_ERROR; - } - - DBA__Config * p = getParam(ParameterId); - if(p == 0){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Invalid parameter id: %d", - ParameterId); - return DBA_APPLICATION_ERROR; - } - - * Value = * p->Param; - - return DBA_NO_ERROR; -} - diff --git a/ndb/src/old_files/newtonapi/dba_dac.cpp b/ndb/src/old_files/newtonapi/dba_dac.cpp deleted file mode 100644 index fcb4e676e46..00000000000 --- a/ndb/src/old_files/newtonapi/dba_dac.cpp +++ /dev/null @@ -1,842 +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 */ - - -#include "dba_internal.hpp" -#include - -static void -DBA__ErrorMapping(const NdbError & err, DBA_Error_t * status){ - switch(err.classification){ - case NdbError::ConstraintViolation: - * status = DBA_CONSTRAINT_VIOLATION; - break; - - case NdbError::NoDataFound: - * status = DBA_NO_DATA; - break; - - case NdbError::TemporaryResourceError: - case NdbError::NodeRecoveryError: - * status = DBA_TEMPORARY_ERROR; - break; - - case NdbError::InsufficientSpace: - * status = DBA_INSUFFICIENT_SPACE; - break; - - case NdbError::UnknownResultError: - * status = DBA_UNKNOWN_RESULT; - break; - - case NdbError::OverloadError: - * status = DBA_OVERLOAD; - break; - - case NdbError::TimeoutExpired: - * status = DBA_TIMEOUT; - break; - - case NdbError::SchemaError: - * status = DBA_SCHEMA_ERROR; - break; - - case NdbError::ApplicationError: - * status = DBA_APPLICATION_ERROR; - break; - - case NdbError::InternalError: - default: - * status = DBA_NDB_ERROR; - break; - } -} - -/** - * Map between NDB error codes and DBA error codes - */ -static -void -DBA__CallbackErrorCodeMapping(int errorCode, - NdbConnection * connection, - DBA_Error_t * status, - DBA_ErrorCode_t * errCode) { - if(errorCode == 0){ - * status = DBA_NO_ERROR; - * errCode = 0; - return; - } - const NdbError & err = connection->getNdbError(); - DBA__ErrorMapping(err, status); - * errCode = err.code; -} - -/** - * When startTransaction fails - */ -static -void -DBA__ConnectionErrorMapping(Ndb * theNdb){ - const NdbError & err = theNdb->getNdbError(); - - DBA_Error_t status; - DBA__ErrorMapping(err, &status); - - DBA__SetLatestError(status, err.code, - err.message); -} - -/** - * When getNdbOperation fails - */ -static -void -DBA__OperationErrorMapping(Ndb * theNdb, NdbConnection * con){ - const NdbError & err = theNdb->getNdbError(); - - DBA_Error_t status; - DBA__ErrorMapping(err, &status); - - DBA__SetLatestError(status, err.code, - err.message); -} - -/** - * When equal/get/set value fails - */ -static -void -DBA__EqualErrorMapping(Ndb * theNdb, NdbConnection * con, NdbOperation * op){ - const NdbError & err = theNdb->getNdbError(); - - DBA_Error_t status; - DBA__ErrorMapping(err, &status); - - DBA__SetLatestError(status, err.code, - err.message); -} - -static -void -NewtonCallback(int errorCode, - NdbConnection * connection, - void * anyObject){ - - DBA_AsyncCallbackFn_t CbFunc = (DBA_AsyncCallbackFn_t)anyObject; - DBA_ReqId_t ReqId = (DBA_ReqId_t) connection; - - DBA_Error_t Status = (DBA_Error_t) errorCode; - DBA_ErrorCode_t Impl_Status ; - - DBA__CallbackErrorCodeMapping(errorCode, connection, &Status, &Impl_Status); - - DBA__TheNdb->closeTransaction(connection); - - DBA__RecvTransactions++; - - CbFunc(ReqId, Status, Impl_Status); -} - -/** - * Start transaction - */ -NdbConnection * -startTransaction(){ - NdbConnection * con = DBA__TheNdb->startTransaction(); - if(con != 0) - return con; - - const int _t = (DBA__SentTransactions - DBA__RecvTransactions); - const int t = (_t>0?_t:-_t); - - if(!(DBA__TheNdb->getNdbError().code == 4006 && t > 1000)){ - DBA_DEBUG("DBA__TheNdb->getNdbError() = " << - DBA__TheNdb->getNdbError()); - } - - int sum = 0; - int sleepTime = 10; - for(; con == 0 && sum < DBA__StartTransactionTimout; ){ - NdbMutex_Unlock(DBA__TheNewtonMutex); - NdbSleep_MilliSleep(sleepTime); - NdbMutex_Lock(DBA__TheNewtonMutex); - con = DBA__TheNdb->startTransaction(); - - sum += sleepTime; - sleepTime += 10; - } - - return con; -} - -#define CHECK_BINDINGS(Bindings) \ - if(!DBA__ValidBinding(Bindings)){ \ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Invalid bindings"); \ - return DBA_INVALID_REQID; \ - } - -#define CHECK_BINDINGS2(Bindings, NbBindings) \ - if(!DBA__ValidBindings(Bindings, NbBindings)){ \ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Invalid bindings"); \ - return DBA_INVALID_REQID; \ - } - -#define CHECK_CONNECTION(Connection) \ - if(Connection == 0){ \ - DBA__ConnectionErrorMapping(DBA__TheNdb); \ - NdbMutex_Unlock(DBA__TheNewtonMutex); \ - return DBA_INVALID_REQID; \ - } - -#define CHECK_OPERATION(Connection, Operation) \ - if(Operation == 0){ \ - DBA__OperationErrorMapping(DBA__TheNdb, Connection); \ - DBA__TheNdb->closeTransaction(Connection); \ - NdbMutex_Unlock(DBA__TheNewtonMutex); \ - return DBA_INVALID_REQID; \ - } - -#define EQUAL_ERROR(Connection, Operation) { \ - DBA__EqualErrorMapping(DBA__TheNdb, Connection, Operation); \ - DBA__TheNdb->closeTransaction(Connection); \ - NdbMutex_Unlock(DBA__TheNewtonMutex); \ - return DBA_INVALID_REQID; \ - } - -/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ - -extern "C" -DBA_ReqId_t -DBA_ReadRows( const DBA_Binding_t* pBindings, void* const * _pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ) { - - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->simpleRead(); - - void * pData = _pData[i]; - - if(!DBA__EqualGetValue(op, pBindings, pData)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_ArrayReadRows( const DBA_Binding_t* pBindings, void * pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->simpleRead(); - - if(!DBA__EqualGetValue(op, pBindings, - ((char*)pData)+i*pBindings->structSz)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_MultiReadRow(const DBA_Binding_t * const * pBindings, - void * const * pData, - int NbBindings, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS2(pBindings, NbBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings[i]->tableName); - - CHECK_OPERATION(con, op); - - op->simpleRead(); - - if(!DBA__EqualGetValue(op, pBindings[i], pData[i])){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ - -extern "C" -DBA_ReqId_t -DBA_InsertRows( const DBA_Binding_t* pBindings, const void * const * _pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->insertTuple(); - - const void * pData = _pData[i]; - - if(!DBA__EqualSetValue(op, pBindings, pData)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_ArrayInsertRows( const DBA_Binding_t* pBindings, const void * pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->insertTuple(); - - if(!DBA__EqualSetValue(op, pBindings, - ((char*)pData)+i*pBindings->structSz)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_MultiInsertRow(const DBA_Binding_t * const * pBindings, - const void * const * pData, - int NbBindings, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS2(pBindings, NbBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings[i]->tableName); - - CHECK_OPERATION(con, op); - - op->insertTuple(); - - if(!DBA__EqualSetValue(op, pBindings[i], pData[i])){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ - -extern "C" -DBA_ReqId_t -DBA_UpdateRows( const DBA_Binding_t* pBindings, const void * const * _pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->updateTuple(); - - const void * pData = _pData[i]; - - if(!DBA__EqualSetValue(op, pBindings, pData)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_ArrayUpdateRows( const DBA_Binding_t* pBindings, const void * pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->updateTuple(); - - if(!DBA__EqualSetValue(op, pBindings, - ((char*)pData)+i*pBindings->structSz)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_MultiUpdateRow(const DBA_Binding_t * const * pBindings, - const void * const * pData, - int NbBindings, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS2(pBindings, NbBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings[i]->tableName); - - CHECK_OPERATION(con, op); - - op->updateTuple(); - - if(!DBA__EqualSetValue(op, pBindings[i], pData[i])){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ - -extern "C" -DBA_ReqId_t -DBA_WriteRows( const DBA_Binding_t* pBindings, const void * const * _pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->writeTuple(); - - const void * pData = _pData[i]; - - if(!DBA__EqualSetValue(op, pBindings, pData)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_ArrayWriteRows( const DBA_Binding_t* pBindings, const void * pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->writeTuple(); - - if(!DBA__EqualSetValue(op, pBindings, - ((char*)pData)+i*pBindings->structSz)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_MultiWriteRow(const DBA_Binding_t * const * pBindings, - const void * const * pData, - int NbBindings, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS2(pBindings, NbBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings[i]->tableName); - - CHECK_OPERATION(con, op); - - op->writeTuple(); - - if(!DBA__EqualSetValue(op, pBindings[i], pData[i])){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ - -extern "C" -DBA_ReqId_t -DBA_DeleteRows( const DBA_Binding_t* pBindings, const void * const * _pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->deleteTuple(); - - const void * pData = _pData[i]; - - if(!DBA__Equal(op, pBindings, pData)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_ArrayDeleteRows( const DBA_Binding_t* pBindings, const void * pData, - int NbRows, - DBA_AsyncCallbackFn_t CbFunc ){ - CHECK_BINDINGS(pBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings->tableName); - - CHECK_OPERATION(con, op); - - op->deleteTuple(); - - if(!DBA__Equal(op, pBindings, - ((char*)pData)+i*pBindings->structSz)){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -extern "C" -DBA_ReqId_t -DBA_MultiDeleteRow(const DBA_Binding_t * const * pBindings, - const void * const * pData, - int NbBindings, - DBA_AsyncCallbackFn_t CbFunc ) { - CHECK_BINDINGS2(pBindings, NbBindings); - - NdbMutex_Lock(DBA__TheNewtonMutex); - NdbConnection * con = startTransaction(); - - CHECK_CONNECTION(con); - - for(int i = 0; igetNdbOperation(pBindings[i]->tableName); - - CHECK_OPERATION(con, op); - - op->deleteTuple(); - - if(!DBA__Equal(op, pBindings[i], pData[i])){ - EQUAL_ERROR(con, op); - } - } - - con->executeAsynchPrepare(Commit, - NewtonCallback, - (void*)CbFunc); - - DBA__SentTransactions++; - - NdbMutex_Unlock(DBA__TheNewtonMutex); - return (DBA_ReqId_t) con; -} - -/****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ - -bool -DBA__EqualGetValue(NdbOperation * op, - const DBA_Binding_t* pBindings, - void * pData){ - for(int i = 0; inoOfKeys; i++){ - if(op->equal(pBindings->keyIds[i], - (const char*)pData+pBindings->keyOffsets[i]) == -1){ - return false; - } - } - - for(int i = 0; inoOfColumns; i++){ - if(op->getValue(pBindings->columnIds[i], - (char*)pData+pBindings->columnOffsets[i]) == 0){ - return false; - } - } - - for(int i = 0; inoOfSubBindings; i++){ - void * tData = *(void**)((char *)pData+pBindings->subBindingOffsets[i]); - const DBA_Binding_t * tBinding = pBindings->subBindings[i]; - if(!DBA__EqualGetValue(op, tBinding, tData)) - return false; - } - - return true; -} - -bool -DBA__EqualSetValue(NdbOperation * op, - const DBA_Binding_t* pBindings, - const void * pData){ - - for(int i = 0; inoOfKeys; i++){ - if(op->equal(pBindings->keyIds[i], - (const char*)pData+pBindings->keyOffsets[i]) == -1){ - return false; - } - } - - for(int i = 0; inoOfColumns; i++){ - if(op->setValue(pBindings->columnIds[i], - (char*)pData+pBindings->columnOffsets[i]) == -1){ - return false; - } - } - - for(int i = 0; inoOfSubBindings; i++){ - void * tData = * (void**)((char *)pData+pBindings->subBindingOffsets[i]); - const DBA_Binding_t * tBinding = pBindings->subBindings[i]; - if(!DBA__EqualSetValue(op, tBinding, tData)) - return false; - } - - return true; -} - -bool -DBA__Equal(NdbOperation * op, - const DBA_Binding_t* pBindings, - const void * pData){ - - for(int i = 0; inoOfKeys; i++) - if(op->equal(pBindings->keyIds[i], - (const char*)pData+pBindings->keyOffsets[i]) == -1){ - return false; - } - - for(int i = 0; inoOfSubBindings; i++){ - void * tData = *(void**)((char *)pData+pBindings->subBindingOffsets[i]); - const DBA_Binding_t * tBinding = pBindings->subBindings[i]; - if(!DBA__Equal(op, tBinding, tData)) - return false; - } - - return true; -} - diff --git a/ndb/src/old_files/newtonapi/dba_error.cpp b/ndb/src/old_files/newtonapi/dba_error.cpp deleted file mode 100644 index f05446522b0..00000000000 --- a/ndb/src/old_files/newtonapi/dba_error.cpp +++ /dev/null @@ -1,118 +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 */ - - -#include - -#include "dba_internal.hpp" - -static DBA_Error_t latestError = DBA_NO_ERROR; -static DBA_ErrorCode_t latestNdbError = 0; -static char latestMsg[1024]; - -/** - * Private - */ -void -DBA__SetLatestError(DBA_Error_t le, - DBA_ErrorCode_t lnb, - const char * msg, ...){ - - require(msg != 0); - - latestError = le; - latestNdbError = lnb; - - va_list ap; - - va_start(ap, msg); - vsnprintf(latestMsg, sizeof(latestMsg)-1, msg, ap); - va_end(ap); -} - -/** - * Get latest DBA error - */ -extern "C" -DBA_Error_t -DBA_GetLatestError(){ - return latestError; -} - -/** - * Get latest error string associated with GetLatestError - * - * String must not be free by caller of this method - */ -extern "C" -const char * -DBA_GetLatestErrorMsg(){ - return latestMsg; -} - -/** - * Get the latest NDB error - * - * Note only applicable to synchronous methods - */ -extern "C" -DBA_ErrorCode_t -DBA_GetLatestNdbError(){ - return latestNdbError; -} - -extern "C" -const -char * -DBA_GetNdbErrorMsg(DBA_ErrorCode_t code){ - return DBA__TheNdb->getNdbError(code).message; -} - -struct DBA_ErrorTxtMap { - DBA_Error_t Error; - const char * Msg; -}; - -static -const DBA_ErrorTxtMap errMap[] = { - { DBA_NO_ERROR, "No error" }, - { DBA_NOT_IMPLEMENTED, "Function Not Implemented" }, - { DBA_NDB_ERROR, "Uncategorised NDB error" }, - { DBA_ERROR, "Uncategorised DBA implementation error" }, - { DBA_APPLICATION_ERROR, - "Function called with invalid argument(s)/invalid sequence(s)" }, - { DBA_NO_DATA, "No row with specified PK existed" }, - { DBA_CONSTRAINT_VIOLATION, "There already existed a row with that PK" }, - - { DBA_TEMPORARY_ERROR, "Request failed due to temporary reasons" }, - { DBA_INSUFFICIENT_SPACE, - "The DB is full" }, - { DBA_OVERLOAD, "Request was rejected in NDB due to high load situation" }, - { DBA_TIMEOUT, "The request timed out, probably due to dead-lock" } -}; - -static const int ErrMsgs = sizeof(errMap)/sizeof(DBA_ErrorTxtMap); - -extern "C" -const -char * -DBA_GetErrorMsg(DBA_Error_t e){ - for(int i = 0; i - - -#ifdef NDB_WIN32 -static NdbMutex & DBA__InitMutex = * NdbMutex_Create(); -#else -static NdbMutex DBA__InitMutex = NDB_MUTEX_INITIALIZER; -#endif - -Ndb * DBA__TheNdb = 0; -NdbMutex * DBA__TheNewtonMutex = 0; -unsigned DBA__SentTransactions = 0; -unsigned DBA__RecvTransactions = 0; -NewtonBatchProcess * DBA__TheNBP = 0; - -extern "C" -DBA_Error_t -DBA_Open( ) { - NdbMutex_Lock(&DBA__InitMutex); - - if(DBA__TheNdb != 0){ - NdbMutex_Unlock(&DBA__InitMutex); - return DBA_NO_ERROR; - } - - DBA__TheNdb = new Ndb("Newton"); - DBA__TheNdb->init(1024); - if(DBA__TheNdb->waitUntilReady() != 0){ - delete DBA__TheNdb; DBA__TheNdb = 0; - NdbMutex_Unlock(&DBA__InitMutex); - return DBA_NDB_ERROR; - } - DBA__TheNewtonMutex = NdbMutex_Create(); - DBA__TheNBP = new NewtonBatchProcess(* DBA__TheNdb, * DBA__TheNewtonMutex); - DBA__TheNBP->doStart(); - NdbMutex_Unlock(&DBA__InitMutex); - return DBA_NO_ERROR; -} - - -/** - * Closes the database. - * - * @return Error status - */ -extern "C" -DBA_Error_t -DBA_Close(void){ - - NdbMutex_Lock(&DBA__InitMutex); - - if(DBA__TheNBP != 0) - DBA__TheNBP->doStop(true); - delete DBA__TheNBP; - DBA__TheNBP = 0; - - if(DBA__TheNdb != 0) - delete DBA__TheNdb; - DBA__TheNdb = 0; - - if(DBA__TheNewtonMutex != 0) - NdbMutex_Destroy(DBA__TheNewtonMutex); - DBA__TheNewtonMutex = 0; - - NdbMutex_Unlock(&DBA__InitMutex); - return DBA_NO_ERROR; -} diff --git a/ndb/src/old_files/newtonapi/dba_internal.hpp b/ndb/src/old_files/newtonapi/dba_internal.hpp deleted file mode 100644 index 84ae7ba222b..00000000000 --- a/ndb/src/old_files/newtonapi/dba_internal.hpp +++ /dev/null @@ -1,122 +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 DBA_INTERNAL_HPP -#define DBA_INTERNAL_HPP - -#include - -extern "C" { -#include "dba.h" -} - -#include -#include -#include - -#ifndef INT_MAX -#define INT_MAX 2147483647 -#endif - -#ifdef DEBUG -#define DBA_DEBUG(x) ndbout << x << endl -#else -#define DBA_DEBUG(x) -#endif - -extern Ndb * DBA__TheNdb; -extern NdbMutex * DBA__TheNewtonMutex; - -extern unsigned DBA__SentTransactions; -extern unsigned DBA__RecvTransactions; - -/** - * Configuration - */ -extern int DBA__NBP_Intervall; // Param 0 -extern int DBA__BulkReadCount; // Param 1 -extern int DBA__StartTransactionTimout; // Param 2 -extern int DBA__NBP_Force; // Param 3 - -/** - * Error handling - */ -void DBA__SetLatestError(DBA_Error_t, DBA_ErrorCode_t, const char *, ...); - -/** - * Magic string - * - * Used to make sure that user passes correct pointers - */ -const int DBA__MagicLength = 4; -const char DBA__TheMagic[DBA__MagicLength] = { 'K', 'E', 'S', 'O' }; - -struct DBA_Binding { - char magic[DBA__MagicLength]; - int checkSum; - - char * tableName; - int structSz; - - int noOfKeys; - int *keyIds; - int *keyOffsets; - - int noOfColumns; - int *columnIds; - int *columnOffsets; - - int noOfSubBindings; - struct DBA_Binding **subBindings; - int * subBindingOffsets; - - int data[1]; -}; - -struct DBA__DataTypesMapping { - DBA_DataTypes_t newtonType; - NdbDictionary::Column::Type ndbType; -}; - -const DBA__DataTypesMapping DBA__DataTypesMappings[] = { - { DBA_CHAR, NdbDictionary::Column::Char }, - { DBA_INT, NdbDictionary::Column::Int } -}; - -const int DBA__NoOfMappings = sizeof(DBA__DataTypesMappings)/ - sizeof(DBA__DataTypesMapping); - -/** - * Validate magic string and checksum of a binding - */ -bool DBA__ValidBinding(const DBA_Binding_t * bindings); -bool DBA__ValidBindings(const DBA_Binding_t * const * pBindings, int n); - -/** - * Recursive equalGetValue (used for read) - * equalSetValue (used for write) - * equal (used for delete) - */ -bool DBA__EqualGetValue(NdbOperation *, const DBA_Binding_t *, void *); -bool DBA__EqualSetValue(NdbOperation *, const DBA_Binding_t *, const void *); -bool DBA__Equal (NdbOperation *, const DBA_Binding_t *, const void *); - -inline void require(bool test){ - if(!test) - abort(); -} - -#endif diff --git a/ndb/src/old_files/newtonapi/dba_process.cpp b/ndb/src/old_files/newtonapi/dba_process.cpp deleted file mode 100644 index ddb6e62f180..00000000000 --- a/ndb/src/old_files/newtonapi/dba_process.cpp +++ /dev/null @@ -1,123 +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 */ - - -#include "dba_process.hpp" - -NewtonBatchProcess::NewtonBatchProcess(Ndb & ndb, NdbMutex & mutex) : - theNdb(ndb), - theMutex(mutex) -{ - theThread = 0; - startStopMutex = NdbMutex_Create(); - - _running = false; - _stop = false; -} - -NewtonBatchProcess::~NewtonBatchProcess(){ - doStop(true); - - if(theThread != 0) - NdbThread_Destroy(&theThread); - - if(startStopMutex != 0) - NdbMutex_Destroy(startStopMutex); - startStopMutex = 0; -} - -extern "C" -void* -runNDB_C(void * _nbp){ - NewtonBatchProcess * nbp = (NewtonBatchProcess*)_nbp; - nbp->_running = true; - nbp->run(); - nbp->_running = false; - - /** - * This sleep is to make sure that the transporter - * send thread will come in and send any - * signal buffers that this thread may have allocated. - * If that doesn't happen an error will occur in OSE - * when trying to restore a signal buffer allocated by a thread - * that have been killed. - */ - NdbSleep_MilliSleep(50); - NdbThread_Exit(0); - return 0; -} - -void -NewtonBatchProcess::doStart(){ - NdbMutex_Lock(startStopMutex); - if(_running && !_stop){ - NdbMutex_Unlock(startStopMutex); - return ; - } - - while(_running){ - NdbMutex_Unlock(startStopMutex); - NdbSleep_MilliSleep(200); - NdbMutex_Lock(startStopMutex); - } - - require(!_running); - _stop = false; - - if(theThread != 0) - NdbThread_Destroy(&theThread); - - theThread = NdbThread_Create(runNDB_C, - (void**)this, - 65535, - "Newton_BP", - NDB_THREAD_PRIO_LOWEST); - - NdbMutex_Unlock(startStopMutex); -} - -void -NewtonBatchProcess::doStop(bool wait){ - NdbMutex_Lock(startStopMutex); - _stop = true; - - if(wait){ - while(_running){ - NdbSleep_MilliSleep(200); - } - } - NdbMutex_Unlock(startStopMutex); -} - -bool -NewtonBatchProcess::isRunning() const { - return _running; -} - -bool -NewtonBatchProcess::isStopping() const { - return _stop; -} - -void -NewtonBatchProcess::run(){ - while(!_stop){ - NdbMutex_Lock(&theMutex); - theNdb.sendPollNdb(0, 1, DBA__NBP_Force); - NdbMutex_Unlock(&theMutex); - NdbSleep_MilliSleep(DBA__NBP_Intervall); - } -} diff --git a/ndb/src/old_files/newtonapi/dba_process.hpp b/ndb/src/old_files/newtonapi/dba_process.hpp deleted file mode 100644 index ef24fbd9142..00000000000 --- a/ndb/src/old_files/newtonapi/dba_process.hpp +++ /dev/null @@ -1,56 +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 NEWTON_BP_HPP -#define NEWTON_BP_HPP - -#include "dba_internal.hpp" - -#include -#include -#include - -extern "C" void* runNDB_C(void * nbp); - -/** - * This class implements the NewtonBatchProcess - */ -class NewtonBatchProcess { - friend void* runNDB_C(void * nbp); -public: - NewtonBatchProcess(Ndb &, NdbMutex &); - ~NewtonBatchProcess(); - - void doStart(); - void doStop(bool wait); - - bool isRunning() const ; - bool isStopping() const ; - -private: - void run(); - - bool _running; - bool _stop; - - Ndb & theNdb; - NdbMutex & theMutex; - - NdbThread * theThread; - NdbMutex * startStopMutex; -}; - -#endif diff --git a/ndb/src/old_files/newtonapi/dba_schema.cpp b/ndb/src/old_files/newtonapi/dba_schema.cpp deleted file mode 100644 index 1bf21f1fe80..00000000000 --- a/ndb/src/old_files/newtonapi/dba_schema.cpp +++ /dev/null @@ -1,150 +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 */ - -#include "dba_internal.hpp" -#include "NdbSchemaCon.hpp" - -static bool getNdbAttr(DBA_DataTypes_t, - Size_t, - int * attrSize, - int * arraySize, - AttrType * attrType); - -extern "C" -DBA_Error_t -DBA_CreateTable(const char* TableName, - int NbColumns, - const DBA_ColumnDesc_t Columns[] ){ - - if(DBA_TableExists(TableName)) - return DBA_NO_ERROR; - - NdbSchemaCon * schemaCon = NdbSchemaCon::startSchemaTrans(DBA__TheNdb); - if(schemaCon == 0){ - DBA__SetLatestError(DBA_NDB_ERROR, 0, - "Internal NDB error: No schema transaction"); - return DBA_NDB_ERROR; - } - - NdbSchemaOp * schemaOp = schemaCon->getNdbSchemaOp(); - if(schemaOp == 0){ - NdbSchemaCon::closeSchemaTrans(schemaCon); - DBA__SetLatestError(DBA_NDB_ERROR, 0, - "Internal NDB error: No schema op"); - return DBA_NDB_ERROR; - } - - if(schemaOp->createTable( TableName, - 8, // Data Size - TupleKey, - 2, // Index size - All, - 6, - 78, - 80, - 1, - false) == -1){ - NdbSchemaCon::closeSchemaTrans(schemaCon); - DBA__SetLatestError(DBA_NDB_ERROR, 0, - "Internal NDB error: Create table failed"); - return DBA_NDB_ERROR; - } - - for (int i = 0; i < NbColumns; i++){ - int attrSize; - int arraySize; - AttrType attrType; - - if(!getNdbAttr(Columns[i].DataType, Columns[i].Size, - &attrSize, - &arraySize, - &attrType)){ - NdbSchemaCon::closeSchemaTrans(schemaCon); - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, - "Invalid datatype/size combination"); - return DBA_APPLICATION_ERROR; - } - - if(schemaOp->createAttribute( Columns[i].Name, - Columns[i].IsKey ? TupleKey : NoKey, - attrSize, - arraySize, - attrType) == -1){ - NdbSchemaCon::closeSchemaTrans(schemaCon); - DBA__SetLatestError(DBA_NDB_ERROR, 0, - "Internal NDB error: Create attribute failed"); - return DBA_NDB_ERROR; - } - } - - if(schemaCon->execute() == -1){ - NdbSchemaCon::closeSchemaTrans(schemaCon); - DBA__SetLatestError(DBA_NDB_ERROR, 0, - "Internal NDB error: Execute schema failed"); - return DBA_NDB_ERROR; - } - - NdbSchemaCon::closeSchemaTrans(schemaCon); - - return DBA_NO_ERROR; -} - -DBA_Error_t -DBA_DropTable( char* TableName ){ - return DBA_NOT_IMPLEMENTED; -} - -Boolean_t -DBA_TableExists( const char* TableName ){ - NdbDictionary::Dictionary * dict = DBA__TheNdb->getDictionary(); - if(dict == 0){ - return 0; - } - - const NdbDictionary::Table * tab = dict->getTable(TableName); - if(tab == 0){ - return 0; - } - return 1; -} - -static -bool -getNdbAttr(DBA_DataTypes_t type, - Size_t size, - int * attrSize, - int * arraySize, - AttrType * attrType) { - - if(type == DBA_CHAR){ - * attrType = String; - * attrSize = 8; - * arraySize = size; - return true; - } - - * attrType = Signed; - if((size % 4) == 0){ - * attrSize = 32; - * arraySize = size / 4; - return true; - } - - * attrSize = 8; - * arraySize = size; - - return true; -} diff --git a/ndb/src/old_files/rep/ExtSender.cpp b/ndb/src/old_files/rep/ExtSender.cpp deleted file mode 100644 index cf31001a85f..00000000000 --- a/ndb/src/old_files/rep/ExtSender.cpp +++ /dev/null @@ -1,149 +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 */ - -#include "ExtSender.hpp" - -/***************************************************************************** - * Constructor / Destructor / Init / Get / Set - *****************************************************************************/ - -/** - * @todo: signalErrorHandler is not finished. Just infrastructure. - */ - -ExtSender::ExtSender() { - m_tf = NULL; - m_nodeId = 0; - m_ownRef = 0; -} - -ExtSender::~ExtSender() { - if (m_tf) delete m_tf; -} - -void -ExtSender::setNodeId(Uint32 nodeId) -{ -#if 0 - ndbout_c("ExtSender: Set nodeid to %d", nodeId); -#endif - - m_nodeId = nodeId; -} - -Uint32 -ExtSender::getOwnRef() const -{ - if(!m_ownRef) REPABORT("No m_ownRef set"); - - return m_ownRef; -} - -void -ExtSender::setOwnRef(Uint32 ref) -{ - // Can only be set once - if (m_ownRef != 0) REPABORT("Trying to change m_ownRef"); - - m_ownRef = ref; -} - -/***************************************************************************** - * Usage - *****************************************************************************/ - -int -ExtSender::sendSignal(class NdbApiSignal * s) { -#if 0 - ndbout_c("ExtSender: Sending signal %d to %d", - s->readSignalNumber(), m_nodeId); -#endif - - if (m_tf == NULL || m_nodeId == 0 || s==0) abort(); - m_tf->lock_mutex(); - int retvalue = m_tf->sendSignal(s, m_nodeId); - if (retvalue) { - RLOG(("sendSignal returned %d for send to node %d", retvalue, m_nodeId)); - } -#if 0 - ndbout_c("ExtSender: Sent signal to %d", m_nodeId); -#endif - m_tf->unlock_mutex(); - return retvalue; -} - -int -ExtSender::sendFragmentedSignal(NdbApiSignal * s, - LinearSectionPtr ptr[3], - Uint32 sections) { - if (m_tf == NULL || m_nodeId == 0) abort(); - m_tf->lock_mutex(); - int retvalue = m_tf->sendFragmentedSignal(s, m_nodeId, ptr, sections); - if (retvalue) { - RLOG(("sendFragmentedSignal returned %d for send to node %d", - retvalue, m_nodeId)); - } - m_tf->unlock_mutex(); - return retvalue; -} - -/** - * Check that TransporterFacade is connected to at least one DB node - */ -bool -ExtSender::connected(Uint32 timeOutMillis){ -#if 0 - ndbout_c("ExtSender: Waiting for remote component to be ready!"); -#endif - - NDB_TICKS start = NdbTick_CurrentMillisecond(); - NDB_TICKS now = start; - // while(m_tf->theClusterMgr->getNoOfConnectedNodes() == 0 && - while((m_tf->get_an_alive_node() == 0) && - (timeOutMillis == 0 || (now - start) < timeOutMillis)){ - NdbSleep_MilliSleep(100); - now = NdbTick_CurrentMillisecond(); - } - return m_tf->theClusterMgr->getNoOfConnectedNodes() > 0; -} - -bool -ExtSender::connected(Uint32 timeOutMillis, Uint32 nodeId){ - NDB_TICKS start = NdbTick_CurrentMillisecond(); - NDB_TICKS now = start; - - // while(m_tf->theClusterMgr->getNoOfConnectedNodes() == 0 && - while((m_tf->get_node_alive(nodeId) != 0) && - (timeOutMillis == 0 || (now - start) < timeOutMillis)){ - NdbSleep_MilliSleep(100); - now = NdbTick_CurrentMillisecond(); - } - return m_tf->theClusterMgr->getNoOfConnectedNodes() > 0; -} - -NdbApiSignal * -ExtSender::getSignal() -{ - /** - * @todo This should use some kind of list of NdbApiSignals, - * similar to the NDBAPI and the MGRSRVR. - * The best thing would be to have set of code - * shared between the programs. - * Thus the NDBAPI and MGMSRVR should be refactored. - * /Lars - */ - return new NdbApiSignal(getOwnRef()); -} diff --git a/ndb/src/old_files/rep/ExtSender.hpp b/ndb/src/old_files/rep/ExtSender.hpp deleted file mode 100644 index 0bdabd68f37..00000000000 --- a/ndb/src/old_files/rep/ExtSender.hpp +++ /dev/null @@ -1,76 +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 EXT_SENDER_HPP -#define EXT_SENDER_HPP - -#include -#include -#include -#include - -/** - * @todo Johan comment: - * - * ext->sendSignal should return something if send failed. - * I.e., i think all methods sending a signal should return int - * so that we can take care of errors. ALternatively take care of - * the error like this: - * if(ext->sendSignal(..) < 0 ) - * handleSignalError(...) - * - * or a combination.... - * - * Should go through all places that sends signals and check that - * they do correct error handling. - */ - -/** - * @class ExtSender - * @brief Manages connection to a transporter facade - */ -class ExtSender { -public: - /*************************************************************************** - * Constructor / Destructor / Init / Get / Set (Only set once!) - ***************************************************************************/ - ExtSender(); - ~ExtSender(); - - void setTransporterFacade(TransporterFacade * tf) { m_tf = tf; } - void setNodeId(Uint32 nodeId); - Uint32 getOwnRef() const; - void setOwnRef(Uint32 ref); - - /*************************************************************************** - * Usage - ***************************************************************************/ - int sendSignal(NdbApiSignal * s); - int sendFragmentedSignal(NdbApiSignal * s, LinearSectionPtr ptr[3], - Uint32 sections); - - bool connected(Uint32 TimeOutInMilliSeconds); - bool connected(Uint32 TimeOutInMilliSeconds, Uint32 nodeId); - - NdbApiSignal * getSignal(); - -private: - TransporterFacade * m_tf; - Uint32 m_nodeId; - Uint32 m_ownRef; -}; - -#endif diff --git a/ndb/src/old_files/rep/Makefile b/ndb/src/old_files/rep/Makefile deleted file mode 100644 index 9688a68ec74..00000000000 --- a/ndb/src/old_files/rep/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include .defs.mk - -# -# This "kernel" type should be removed (only need types) -# -TYPE := repserver kernel - -DIRS := adapters storage state transfer repapi - -BIN_TARGET := ndb_rep - -BIN_TARGET_LIBS := -BIN_TARGET_ARCHIVES += editline repstorage repadapters reprequestor reptransfer mgmapi NDB_API mgmsrvcommon - -SOURCES = \ - RepMain.cpp \ - Requestor.cpp \ - RequestorSubscriptions.cpp \ - \ - RepComponents.cpp \ - RepCommandInterpreter.cpp \ - RepApiService.cpp \ - RepApiInterpreter.cpp \ - SignalQueue.cpp \ - ExtSender.cpp \ - dbug_hack.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/NodeConnectInfo.hpp b/ndb/src/old_files/rep/NodeConnectInfo.hpp deleted file mode 100644 index 403f92a5999..00000000000 --- a/ndb/src/old_files/rep/NodeConnectInfo.hpp +++ /dev/null @@ -1,29 +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 NODE_CONNECTINFO_HPP -#define NODE_CONNECTINFO_HPP - -#include - -struct NodeConnectInfo { - NodeConnectInfo(Uint16 n, bool c): nodeId(n), connected(c) {}; - Uint32 nodeId; - bool connected; -}; - - -#endif diff --git a/ndb/src/old_files/rep/README b/ndb/src/old_files/rep/README deleted file mode 100644 index 7be5e230eb3..00000000000 --- a/ndb/src/old_files/rep/README +++ /dev/null @@ -1,147 +0,0 @@ - =========================================== - MySQL Replication Servers - Lars Thalmann and Johan Andersson - 2003 MySQL AB - =========================================== - -------------------------------------------------------------------------------- - - PRIMARY SYSTEM STANDBY SYSTEM - REPLICATION SERVER REPLICATION SERVER - (PS or SOURCE SYSTEM) (SS or DESTINATION SYSTEM) - +------------------+ +-------------------------+ - | RepMain | | RepMain [Requests] | - | | +-------------------------+ - | | | Requestor [Executes] | - +------------------+ +-------------------------+ - PS --- | ExtNDB | TransPS | --- | TransSS | AppNDB | --- SS - +------------------+ +-------------------------+ - (GCIContainer) (GCIContainer) - (RepState) - - Figure 1: Replication Server Threads - -Component List --------------- -RepMain - Main thread that runs command-line interpreter [Requests] - -Requestor - Thread that runs RepState::execute [Executes] - -ExtNDB - Extracts transaction epochs from NDB Cluster - -TransPS, TransSS - Transfers information (control and epoch buffers) between - Replication Servers. - -AppNDB - Applies transaction epochs to NDB Cluster - -------------------------------------------------------------------------------- - - RepState Control - Object - +------------------+ - | RepState | - | [Requests] | - | [Executes] | - +------------------+ - | RepStateRequest | --- ExtSender - +------------------+ - - Figure 2: RepState Object - - -The RepState object is shared by all components. - - -------------------------------------------------------------------------------- - -Dependent Directories ---------------------- -rep/adapters Appliers and Extractors - All code dependent on the database system - -rep/transfer - Depends on NDB transporters - -rep/state - Shared resources for all components - -Independent Directories ------------------------ -rep/storage Storage of epochs - Should not depend on any transporters/NDB specific - -rep/repstate - Should only have a reference to an ExtSender for the external PS REP node - - -------------------------------------------------------------------------------- - -Replication Teminology ----------------------- -GLOBAL CHECKPOINT -A global checkpoint is a point in time when all database server -are synchronized. - -NODE -A database server with information. - -NODE GROUP -A set of database servers, all storing the same information. - -SUBSCRIPTION . -A "subscription" is a collection of services that a source system -provides. The main to services belonging to a subscription are -"log" and "scan". Log provides the replication servers with -log entries (epochs) and scan provides the replication servers -with scanned data (also stored in epochs). - -EPOCH -An "epoch" is a log of all database changes between two time points. -(An epoch can have redundant log entries.) An epoch is named by the -number of the time slice between the two time points. - -EPOCH BUFFER -An "epoch buffer" is a part of the log belonging to an epoch. An -epoch buffer does not contain any redundancy. - -Two epoch buffers with the same subscription id and gci can be -"complements" or "duplicates" to each other. If they are complements, -they store different information, if they are duplicates then they -store equivalent information (the information need not be identical, -but it is equivalent for the purpose of restoring the original -information). If they are duplicates then they have the same name, -i.e. same subscription id, gci, and node group id. - -CHANNEL -A "channel" is a collection of epoch buffers belonging to -a specific subscription. (The channel can exist before it is -assigned to a subscription.) - -SUBSCRIPTION CONSISTENT -A database is "subscription consistent" or "consistent with respect -to a subscription" if ... - -Architectural Terminology -------------------------- -ADAPTER -An "adapter" is either an applier or an extractor. - -APPLIER -An "applier" is a a collection of threads in the replication server -that applies epochs to a destination database system. - -EXTRACTOR -An "extractor" is a collection of theads in the replication server -that receives epochs from a source database system. - -TRANSFER COMPONENT -A "transfer component" is a thread in the replication server that is -responsible for the connection with another replication server. - -REQUESTOR -A thread in the replication server that controls replication. diff --git a/ndb/src/old_files/rep/RepApiInterpreter.cpp b/ndb/src/old_files/rep/RepApiInterpreter.cpp deleted file mode 100644 index 6e6f150713a..00000000000 --- a/ndb/src/old_files/rep/RepApiInterpreter.cpp +++ /dev/null @@ -1,80 +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 */ - -#include "RepApiInterpreter.hpp" -#include - -RepApiInterpreter::RepApiInterpreter(RepComponents * comps, int port) -{ - m_repComponents = comps; - m_repState = comps->getRepState(); - m_port = port; - ss = new SocketServer(); - serv = new RepApiService(*this); -} - - -RepApiInterpreter::~RepApiInterpreter() -{ -} - -void -RepApiInterpreter::startInterpreter() -{ - if(!ss->setup(serv, m_port)){ - sleep(1); - delete ss; - delete serv; - } - ss->startServer(); -} - - -void -RepApiInterpreter::stopInterpreter() -{ - delete ss; -} - - -Properties * -RepApiInterpreter::execCommand(const Properties & props) -{ - Properties * result = new Properties(); - Uint32 req = 0; - Uint32 epoch = 0; - props.get("request", &req); - props.get("epoch", &epoch); - GrepError::Code err = m_repState->protectedRequest((GrepReq::Request)req, - epoch); - result->put("err", err); - return result; -} - -Properties * -RepApiInterpreter::getStatus() -{ - - return m_repState->getStatus(); -} - - -Properties * -RepApiInterpreter::query(Uint32 counter, Uint32 replicationId) -{ - return m_repState->query((QueryCounter)counter, replicationId); -} - diff --git a/ndb/src/old_files/rep/RepApiInterpreter.hpp b/ndb/src/old_files/rep/RepApiInterpreter.hpp deleted file mode 100644 index 78f190156b3..00000000000 --- a/ndb/src/old_files/rep/RepApiInterpreter.hpp +++ /dev/null @@ -1,54 +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 REP_API_INTERPRETER_HPP -#define REP_API_INTERPRETER_HPP - -#include - -#include -#include -#include -#include -#include - -/** - * @class RepCommandInterpreter - * @brief - */ - -class RepApiInterpreter { -public: - RepApiInterpreter(class RepComponents * comps, int port); - ~RepApiInterpreter(); - void startInterpreter(); - void stopInterpreter(); - Properties * execCommand(const Properties & props); - Properties * getStatus(); - Properties * query(Uint32 counter, Uint32 replicationId); - bool readAndExecute(); - -private: - char * readline_gets() const; - void request(Uint32 request); - int m_port; - class RepComponents * m_repComponents; - class RepState * m_repState; - SocketServer * ss; - RepApiService * serv; -}; - -#endif diff --git a/ndb/src/old_files/rep/RepApiService.cpp b/ndb/src/old_files/rep/RepApiService.cpp deleted file mode 100644 index d07f7a59375..00000000000 --- a/ndb/src/old_files/rep/RepApiService.cpp +++ /dev/null @@ -1,318 +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 */ - - -#include -#include -#include -#include -#include "RepApiService.hpp" -#include "RepApiInterpreter.hpp" -#include "repapi/repapi.h" -#include -#include - -/** - const char * name; - const char * realName; - const Type type; - const ArgType argType; - const ArgRequired argRequired; - const ArgMinMax argMinMax; - const int minVal; - const int maxVal; - void (T::* function)(const class Properties & args); - const char * description; -*/ - -#define REP_CMD(name, fun, desc) \ - { name, \ - 0, \ - ParserRow::Cmd, \ - ParserRow::String, \ - ParserRow::Optional, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - fun, \ - desc } - -#define REP_ARG(name, type, opt, desc) \ - { name, \ - 0, \ - ParserRow::Arg, \ - ParserRow::type, \ - ParserRow::opt, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - 0, \ - desc } - -#define REP_ARG2(name, type, opt, min, max, desc) \ - { name, \ - 0, \ - ParserRow::Arg, \ - ParserRow::type, \ - ParserRow::opt, \ - ParserRow::IgnoreMinMax, \ - min, max, \ - 0, \ - desc } - -#define REP_END() \ - { 0, \ - 0, \ - ParserRow::Arg, \ - ParserRow::Int, \ - ParserRow::Optional, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0 } - -#define REP_CMD_ALIAS(name, realName, fun) \ - { name, \ - realName, \ - ParserRow::CmdAlias, \ - ParserRow::Int, \ - ParserRow::Optional, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0 } - -#define REP_ARG_ALIAS(name, realName, fun) \ - { name, \ - realName, \ - ParserRow::ArgAlias, \ - ParserRow::Int, \ - ParserRow::Optional, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0 } - - -const -ParserRow commands[] = -{ - - REP_CMD("rep" , &RepApiSession::execCommand, ""), - REP_ARG("request", Int, Mandatory, "Grep::Request."), - REP_ARG("id", Int, Mandatory, "Replication id "), - REP_ARG("epoch", Int, Optional, "Epoch. Used by stop epoch ..."), - - REP_CMD("rep status" , &RepApiSession::getStatus, ""), - REP_ARG("request", Int, Optional, "Grep::Request."), - - REP_CMD("rep query" , &RepApiSession::query, ""), - REP_ARG("id", Int, Mandatory, "Replication Id"), - REP_ARG("counter", Int, Mandatory, "QueryCounter."), - REP_ARG("request", Int, Mandatory, "Grep::Request."), - - REP_END() -}; -RepApiSession::RepApiSession(NDB_SOCKET_TYPE sock, - class RepApiInterpreter & rep) - : SocketServer::Session(sock) - , m_rep(rep) -{ - m_input = new SocketInputStream(sock); - m_output = new SocketOutputStream(sock); - m_parser = new Parser(commands, *m_input, true, true, true); -} - -RepApiSession::RepApiSession(FILE * f, class RepApiInterpreter & rep) - : SocketServer::Session(1) - , m_rep(rep) -{ - m_input = new FileInputStream(f); - m_parser = new Parser(commands, *m_input, true, true, true); -} - -RepApiSession::~RepApiSession() -{ - delete m_input; - delete m_parser; -} - -void -RepApiSession::runSession() -{ - Parser_t::Context ctx; - while(!m_stop){ - m_parser->run(ctx, * this); - if(ctx.m_currentToken == 0) - break; - - switch(ctx.m_status){ - case Parser_t::Ok: - for(size_t i = 0; i %s", - ctx.m_aliasUsed[i]->name, ctx.m_aliasUsed[i]->realName); - break; - case Parser_t::NoLine: - case Parser_t::EmptyLine: - break; - default: - break; - } - } - NDB_CLOSE_SOCKET(m_socket); -} - -void -RepApiSession::execCommand(Parser_t::Context & /* unused */, - const class Properties & args) -{ - Uint32 err; - Uint32 replicationId; - args.get("id", &replicationId); - Properties * result = m_rep.execCommand(args); - if(result == NULL) { - m_output->println("global replication reply"); - m_output->println("result: %d", -1); - m_output->println("id: %d",replicationId); - m_output->println(""); - return; - } - result->get("err", &err); - m_output->println("global replication reply"); - m_output->println("result: %d", err); - m_output->println("id: %d", 0); - m_output->println(""); - delete result; -} - - -void -RepApiSession::getStatus(Parser_t::Context & /* unused */, - const class Properties & args) -{ - Uint32 err; - Properties * result = m_rep.getStatus(); - result->get("err", &err); - Uint32 subId; - result->get("subid", &subId); - Uint32 subKey; - result->get("subkey", &subKey); - Uint32 connected_rep; - result->get("connected_rep", &connected_rep); - Uint32 connected_db; - result->get("connected_db", &connected_db); - Uint32 state; - result->get("state", &state); - Uint32 state_sub; - result->get("state", &state_sub); - - m_output->println("global replication status reply"); - m_output->println("result: %d",0); - m_output->println("id: %d",0); - m_output->println("subid: %d", subId); - m_output->println("subkey: %d", subKey); - m_output->println("connected_rep: %d", connected_rep); - m_output->println("connected_db: %d", connected_db); - m_output->println("state_sub: %d", state_sub); - m_output->println("state: %d", state); - m_output->println(""); - delete result; -} - - -void -RepApiSession::query(Parser_t::Context & /* unused */, - const class Properties & args) -{ - Uint32 err; - Uint32 counter, replicationId; - args.get("counter", &counter); - args.get("id", &replicationId); - Properties * result = m_rep.query(counter, replicationId); - if(result == NULL) { - m_output->println("global replication query reply"); - m_output->println("result: %s","Failed"); - m_output->println("id: %d",replicationId); - m_output->println(""); - return; - } - - BaseString first; - BaseString last; - Uint32 subid = 0, subkey = 0, no_of_nodegroups = 0; - Uint32 connected_rep = 0, connected_db = 0; - Uint32 state = 0 , state_sub = 0; - result->get("err", &err); - result->get("no_of_nodegroups", &no_of_nodegroups); - result->get("subid", &subid); - result->get("subkey", &subkey); - result->get("connected_rep", &connected_rep); - result->get("connected_db", &connected_db); - result->get("first", first); - result->get("last", last); - result->get("state", &state); - result->get("state_sub", &state_sub); - m_output->println("global replication query reply"); - m_output->println("result: %s","Ok"); - m_output->println("id: %d",replicationId); - m_output->println("no_of_nodegroups: %d",no_of_nodegroups); - m_output->println("subid: %d", subid); - m_output->println("subkey: %d", subkey); - m_output->println("connected_rep: %d", connected_rep); - m_output->println("connected_db: %d", connected_db); - m_output->println("state_sub: %d", state_sub); - m_output->println("state: %d", state); - m_output->println("first: %s", first.c_str()); - m_output->println("last: %s", last.c_str()); - m_output->println(""); - delete result; -} - - - -static const char * -propToString(Properties *prop, const char *key) { - static char buf[32]; - const char *retval = NULL; - PropertiesType pt; - - prop->getTypeOf(key, &pt); - switch(pt) { - case PropertiesType_Uint32: - Uint32 val; - prop->get(key, &val); - snprintf(buf, sizeof buf, "%d", val); - retval = buf; - break; - case PropertiesType_char: - const char *str; - prop->get(key, &str); - retval = str; - break; - default: - snprintf(buf, sizeof buf, "(unknown)"); - retval = buf; - } - return retval; -} - -void -RepApiSession::printProperty(Properties *prop, const char *key) { - m_output->println("%s: %s", key, propToString(prop, key)); -} - -void -RepApiSession::stopSession(){ - -} diff --git a/ndb/src/old_files/rep/RepApiService.hpp b/ndb/src/old_files/rep/RepApiService.hpp deleted file mode 100644 index e1137e53258..00000000000 --- a/ndb/src/old_files/rep/RepApiService.hpp +++ /dev/null @@ -1,59 +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 REP_APISERVICE_HPP -#define REP_APISERVICE_HPP - -#include -#include -#include - -class RepApiInterpreter; - -class RepApiSession : public SocketServer::Session { - typedef Parser Parser_t; - - class RepApiInterpreter & m_rep; - InputStream *m_input; - OutputStream *m_output; - Parser_t *m_parser; - -void printProperty(Properties *prop, const char *key); -public: - RepApiSession(NDB_SOCKET_TYPE, class RepApiInterpreter &); - RepApiSession(FILE * f, class RepApiInterpreter & rep); - ~RepApiSession(); - - virtual void runSession(); - virtual void stopSession(); - - void execCommand(Parser_t::Context & ctx, const class Properties & args); - void getStatus(Parser_t::Context & ctx, const class Properties & args); - void query(Parser_t::Context & ctx, const class Properties & args); - -}; - -class RepApiService : public SocketServer::Service { - class RepApiInterpreter & m_rep; -public: - RepApiService(class RepApiInterpreter & rep) : m_rep(rep) {} - - RepApiSession * newSession(NDB_SOCKET_TYPE theSock){ - return new RepApiSession(theSock, m_rep); - } -}; - -#endif diff --git a/ndb/src/old_files/rep/RepCommandInterpreter.cpp b/ndb/src/old_files/rep/RepCommandInterpreter.cpp deleted file mode 100644 index a0daf9529ab..00000000000 --- a/ndb/src/old_files/rep/RepCommandInterpreter.cpp +++ /dev/null @@ -1,456 +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 */ - -#include "RepCommandInterpreter.hpp" - -static const char* -helpTextRep = -"+-------------------------------------------------------------------------+\n" -"| MySQL Replication Server |\n" -"| Commands should be executed on the standby Replication Server |\n" -"+-------------------------------------------------------------------------+\n" -"| Simple Commands |\n" -"+-------------------------------------------------------------------------+\n" -"| START Start replication |\n" -"| STATUS Show replication status |\n" -"+-------------------------------------------------------------------------+\n" -"| Advanced Commands |\n" -"+-------------------------------------------------------------------------+\n" -"| STOP Stop replication after epoch number |\n" -"| STOP IMMEDIATELY Stop replication after applying the current epoch |\n" -"| ADD TABLE // |\n" -"| Note: // is case sensitive! |\n" -"| Use 'STATUS' to see added tables. |\n" -"| REMOVE TABLE // |\n" -"| Note: // is case sensitive! |\n" -"| ENABLE Starts protocol |\n" -"| DISABLE Stops protocol |\n" -"| DEBUG Toggle logging of replication messages on console |\n" -"| |\n" -"| ::= REQUESTOR | TRANSFER | APPLY | DELETE |\n" -"+-------------------------------------------------------------------------+\n" -; - -/** - * @todo -"| ::= SUBID | SUBSCRIPTION |\n" -"| ::= METALOG | METASCAN | DATALOG | DATASCAN |\n" -"| ::= PRIMARY | STANDBY | TWOWAY |\n" -"| CONNECT Connects to NDB Cluster and other replication server |\n" -"| DELETE Removes all epochs stored in replication servers |\n" -"| DROP Drops table in standby system identified by table id |\n" -"| ::= Any integer (naming the last epoch to be applied) |\n" -*/ - -RepCommandInterpreter::RepCommandInterpreter(RepComponents * comps) -{ - m_repComponents = comps; - m_repState = comps->getRepState(); -} - -RepCommandInterpreter::~RepCommandInterpreter() -{ -} - -/** - * Read a string, and return a pointer to it. - * - * @return NULL on EOF. - */ -char * -RepCommandInterpreter::readline_gets() const -{ - static char *line_read = (char *)NULL; - - // Disable the default file-name completion action of TAB - // rl_bind_key ('\t', rl_insert); - - /* If the buffer has already been allocated, return the memory - to the free pool. */ - if (line_read) - { - NdbMem_Free(line_read); - line_read = (char *)NULL; - } - - /* Get a line from the user. */ - line_read = readline ("REP> "); - - /* If the line has any text in it, save it on the history. */ - if (line_read && *line_read) - add_history (line_read); - - return (line_read); -} - -bool emptyString(const char* s) -{ - if (s == NULL) { - return true; - } - - for (unsigned int i = 0; i < strlen(s); ++i) { - if (! isspace(s[i])) { - return false; - } - } - - return true; -} - -/** - * Converts a string to a Uint32 pointed value! - */ -bool convert(const char* s, Uint32 * val) -{ - if (s == NULL) { - return false; - } - - if (strlen(s) == 0) { - return false; - } - - errno = 0; - char* p; - long v = strtol(s, &p, 10); - if (errno != 0) { - return false; - } - if (p != &s[strlen(s)]) { - return false; - } - - *val = v; - return true; -} - -void -printError(GrepError::Code err) -{ - if (err == GrepError::NO_ERROR) { ndbout << "Ok" << endl; } - else { ndbout << GrepError::getErrorDesc(err) << endl; } -} - -bool -RepCommandInterpreter::readAndExecute() -{ - GrepError::Code err; - - char* _line = readline_gets(); - char * line; - if(_line == NULL) { - ndbout << endl; - return true; - } - - line = strdup(_line); - - if (emptyString(line)) { - return true; - } - - /* I have to uncomment this, since otherwise // - is converted to capitals, but it is case sensitive! - for (unsigned int i = 0; i < strlen(line); ++i) { - line[i] = toupper(line[i]); - } - */ - // if there is anything in the line proceed - char* firstToken = strtok(line, " "); - for (unsigned int i = 0; i < strlen(firstToken); ++i) { - firstToken[i] = toupper(firstToken[i]); - } - char* allAfterFirstToken = strtok(NULL, "\0"); - - /** - * Commands for REP Client only - */ - if (strcmp(firstToken, "ADD") == 0) { - if (m_repState->m_channel.getStateSub() != - Channel::NO_SUBSCRIPTION_EXISTS) { - ndbout_c("Subscription already exists"); - ndbout_c("Tables must be added before subscription exists"); - return true; - } - char * secondToken = strtok(allAfterFirstToken, " "); - char * fullTableName = strtok(NULL, "\0"); - if(fullTableName == NULL) { - ndbout_c("Table name not specified"); - return true; - } - for (unsigned int i = 0; i < strlen(secondToken); ++i) { - secondToken[i] = toupper(secondToken[i]); - } - - if (strcmp(secondToken, "TABLE") == 0) { - err = m_repState->protectedAddTable(fullTableName); - printError(err); - return true; - } - return true; - } - if (strcmp(firstToken, "REMOVE") == 0) { - if (m_repState->m_channel.getStateSub() != - Channel::NO_SUBSCRIPTION_EXISTS) { - ndbout_c("Subscription already exists"); - ndbout_c("Tables can not be removed after subscription is created"); - return true; - } - char * secondToken = strtok(allAfterFirstToken, " "); - char * fullTableName = strtok(NULL, "\0"); - if(fullTableName == NULL) { - ndbout_c("Table name not specified"); - return true; - } - for (unsigned int i = 0; i < strlen(secondToken); ++i) { - secondToken[i] = toupper(secondToken[i]); - } - - if (strcmp(secondToken, "TABLE") == 0) { - err = m_repState->protectedRemoveTable(fullTableName); - printError(err); - return true; - } - return true; - } - /** - * now, we can convert allAfterFirstToken to capitals - */ - if(allAfterFirstToken != 0) { - for (unsigned int i = 0; i < strlen(allAfterFirstToken); ++i) { - allAfterFirstToken[i] = toupper(allAfterFirstToken[i]); - } - } - if (strcmp(firstToken, "CONNECT") == 0) { - - if (strcmp(allAfterFirstToken, "PRIMARY") == 0) { - m_repComponents->connectPS(); - return true; - } - if (strcmp(allAfterFirstToken, "STANDBY") == 0) { - m_repComponents->connectPS(); - return true; - } - if (strcmp(allAfterFirstToken, "TWOWAY") == 0) { - m_repComponents->connectPS(); - return true; - } - ndbout_c("Unknown argument: %s to command: %s", - allAfterFirstToken, firstToken); - return true; - } - - if (strcmp(firstToken, "HELP") == 0) { - ndbout << helpTextRep; - return true; - } - - if (strcmp(firstToken, "QUIT") == 0 || - strcmp(firstToken, "BYE") == 0 || - strcmp(firstToken, "EXIT") == 0) { - return false; - } - - /** - * Commands for REP Server API - */ - if (strcmp(firstToken, "STATUS") == 0 || - strcmp(firstToken, "INFO") == 0 || - strcmp(firstToken, "I") == 0) { - m_repState->protectedRequest(GrepReq::STATUS, 0); - return true; - } - - if (strcmp(firstToken, "DEBUG") == 0) { - if (replogEnabled) - { - ndbout_c("Debugging disabled."); - replogEnabled = false; - } - else - { - ndbout_c("Debugging enabled."); - replogEnabled = true; - } - return true; - } - - if (strcmp(firstToken, "ENABLE") == 0) { - if (strcmp(allAfterFirstToken, "REQUESTOR") == 0) { - err = m_repState->protectedRequest(GrepReq::START_REQUESTOR, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "TRANSFER") == 0) { - err = m_repState->protectedRequest(GrepReq::START_TRANSFER, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "APPLY") == 0) { - err = m_repState->protectedRequest(GrepReq::START_APPLY, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "DELETE") == 0) { - err = m_repState->protectedRequest(GrepReq::START_DELETE, 0); - printError(err); - return true; - } - ndbout_c("Unknown argument: %s to command: %s", - allAfterFirstToken, firstToken); - return true; - } - - if (strcmp(firstToken, "DISABLE") == 0) { - if (strcmp(allAfterFirstToken, "REQUESTOR") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_REQUESTOR, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "TRANSFER") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_TRANSFER, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "APPLY") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_APPLY, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "DELETE") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_DELETE, 0); - printError(err); - return true; - } - ndbout_c("Unknown argument: %s to command: %s", - allAfterFirstToken, firstToken); - return true; - } - - if (strcmp(firstToken, "START") == 0) { - if (allAfterFirstToken == NULL) { - err = m_repState->protectedRequest(GrepReq::START, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "SUBID") == 0) { - err = m_repState->protectedRequest(GrepReq::CREATE_SUBSCR, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "SUBSCR") == 0 || - strcmp(allAfterFirstToken, "SUBSCRIPTION") == 0) { - err = m_repState->protectedRequest(GrepReq::START_SUBSCR, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "METALOG") == 0) { - err = m_repState->protectedRequest(GrepReq::START_METALOG, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "METASCAN") == 0) { - err = m_repState->protectedRequest(GrepReq::START_METASCAN, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "DATALOG") == 0) { - err = m_repState->protectedRequest(GrepReq::START_DATALOG, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "DATASCAN") == 0) { - err = m_repState->protectedRequest(GrepReq::START_DATASCAN, 0); - printError(err); - return true; - } - ndbout_c("Unknown argument: %s to command: %s", - allAfterFirstToken, firstToken); - return true; - } - - if (strcmp(firstToken, "STOP") == 0) { - if (allAfterFirstToken == NULL) { - ndbout_c("Please use either 'STOP IMMEDIATELY' or 'STOP ', " - "where\n is greater than or equal to " - "the last applied epoch."); - return true; - } - - char * secondToken = strtok(allAfterFirstToken, " "); - char * subscription = strtok(NULL, "\0"); - if (strcmp(secondToken, "SUBSCR") == 0 || - strcmp(secondToken, "SUBSCRIPTION") == 0) { - char * sSubId = strtok(subscription," "); - char * sSubKey = strtok(NULL, "\0"); - int subId = atoi(sSubId); - int subKey = atoi(sSubKey); - err = m_repState->protectedRequest(GrepReq::STOP_SUBSCR, subId, subKey ); - printError(err); - return true; - } - - if (strcmp(allAfterFirstToken, "SUBID") == 0) { - ndbout_c("Not implemented"); - return true; - } - - - if (strcmp(allAfterFirstToken, "METALOG") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_METALOG, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "METASCAN") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_METASCAN, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "DATALOG") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_DATALOG, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "DATASCAN") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP_DATASCAN, 0); - printError(err); - return true; - } - if (strcmp(allAfterFirstToken, "IM") == 0 || - strcmp(allAfterFirstToken, "IMM") == 0 || - strcmp(allAfterFirstToken, "IMMEDIATELY") == 0) { - err = m_repState->protectedRequest(GrepReq::STOP, 0); - printError(err); - return true; - } - Uint32 stopEpoch; - if (convert(allAfterFirstToken, &stopEpoch)) { - err = m_repState->protectedRequest(GrepReq::STOP, stopEpoch); - printError(err); - return true; - } - - ndbout_c("Unknown argument: %s to command: %s", - allAfterFirstToken, firstToken); - return true; - } - - ndbout_c("Unknown Command: %s", firstToken); - ndbout_c("Type HELP for help."); - ndbout << endl; - return true; -} diff --git a/ndb/src/old_files/rep/RepCommandInterpreter.hpp b/ndb/src/old_files/rep/RepCommandInterpreter.hpp deleted file mode 100644 index 398a7c0318c..00000000000 --- a/ndb/src/old_files/rep/RepCommandInterpreter.hpp +++ /dev/null @@ -1,45 +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 REP_COMMAND_INTERPRETER_HPP -#define REP_COMMAND_INTERPRETER_HPP - -#include - -#include -#include - -/** - * @class RepCommandInterpreter - * @brief - */ - -class RepCommandInterpreter { -public: - RepCommandInterpreter(class RepComponents * comps); - ~RepCommandInterpreter(); - - bool readAndExecute(); - -private: - char * readline_gets() const; - void request(Uint32 request); - - class RepComponents * m_repComponents; - class RepState * m_repState; -}; - -#endif diff --git a/ndb/src/old_files/rep/RepComponents.cpp b/ndb/src/old_files/rep/RepComponents.cpp deleted file mode 100644 index 04b2e0e5fa5..00000000000 --- a/ndb/src/old_files/rep/RepComponents.cpp +++ /dev/null @@ -1,138 +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 */ - -#include "RepComponents.hpp" - -RepComponents::RepComponents() -{ - /** - * @todo Fix proper reporting of errors - */ - m_connectStringPS = NULL; - m_connectStringSS = NULL; - - /** - * Phase 1: Containers, RepState - */ - m_gciContainer = new GCIContainer(MAX_NODE_GROUPS); - if (!m_gciContainer) REPABORT("Could not allocate object"); - m_gciContainerPS = new GCIContainerPS(MAX_NODE_GROUPS); - if (!m_gciContainerPS) REPABORT("Could not allocate object"); - m_repState = new RepState(); - if (!m_repState) REPABORT("Could not allocate object"); - - /** - * Phase 2: PS - */ - m_transPS = new TransPS(m_gciContainerPS); - if (!m_transPS) REPABORT("Could not allocate object"); - - - m_extAPI = new ExtAPI(); - if (!m_extAPI) REPABORT("Could not allocate object"); - - m_extNDB = new ExtNDB(m_gciContainerPS, m_extAPI); - if (!m_extNDB) REPABORT("Could not allocate object"); - - /** - * Phase 3: SS - */ - m_transSS = new TransSS(m_gciContainer, m_repState); - if (!m_transSS) REPABORT("Could not allocate object"); - m_appNDB = new AppNDB(m_gciContainer, m_repState); - if (!m_appNDB) REPABORT("Could not allocate object"); - - /** - * Phase 4: Requestor - */ - m_requestor = new Requestor(m_gciContainer, m_appNDB, m_repState); - if (!m_requestor) REPABORT("Could not allocate object"); - - /** - * Phase 5 - */ - m_repState->init(m_transSS->getRepSender()); - m_repState->setApplier(m_appNDB); - m_repState->setGCIContainer(m_gciContainer); - - m_requestor->setRepSender(m_transSS->getRepSender()); - - m_extNDB->setRepSender(m_transPS->getRepSender()); - - m_transPS->setGrepSender(m_extNDB->getGrepSender()); -} - -RepComponents::~RepComponents() -{ - if (m_requestor) delete m_requestor; - - if (m_appNDB) delete m_appNDB; - if (m_extNDB) delete m_extNDB; - if (m_extAPI) delete m_extAPI; - - if (m_repState) delete m_repState; - - if (m_transPS) delete m_transPS; - if (m_transSS) delete m_transSS; - - if (m_gciContainer) delete m_gciContainer; - if (m_gciContainerPS) delete m_gciContainerPS; -} - -int -RepComponents::connectPS() -{ - /** - * @todo Fix return values of this function - */ - - /** - * Phase 1: TransporterFacade 1, Block number: 2 (PS) - */ - if (!m_extNDB->init(m_connectStringPS)) return -1; - - /** - * Phase 2: TransporterFacade 2, Block number: 2 (PS) - */ - m_transPS->init(m_transSS->getTransporterFacade(), m_connectStringPS); - - return 0; -} - -int -RepComponents::connectSS() -{ - /** - * @todo Fix return values of this function - */ - - /** - * Phase 1: TransporterFacade 1, Block number: 1 (SS) - */ - m_appNDB->init(m_connectStringSS); - - /** - * Phase 2: TransporterFacade 2, Block number: 1 (SS) - */ - m_transSS->init(m_connectStringSS); - - /** - * Phase 3: Has no TransporterFacade, just starts thread - */ - m_requestor->init(); - - return 0; -} diff --git a/ndb/src/old_files/rep/RepComponents.hpp b/ndb/src/old_files/rep/RepComponents.hpp deleted file mode 100644 index ff0f29e2128..00000000000 --- a/ndb/src/old_files/rep/RepComponents.hpp +++ /dev/null @@ -1,60 +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 REPCOMPONENTS_HPP -#define REPCOMPONENTS_HPP - -#include -#include -#include -#include -#include -#include - -#include - -/** - * Connection data - */ -class RepComponents { -public: - RepComponents(); - ~RepComponents(); - - int connectPS(); - int connectSS(); - - ExtNDB * m_extNDB; - ExtAPI * m_extAPI; - TransPS * m_transPS; - - TransSS * m_transSS; - AppNDB * m_appNDB; - - Requestor * m_requestor; - - GCIContainer * m_gciContainer; - GCIContainerPS * m_gciContainerPS; - - char * m_connectStringPS; - char * m_connectStringSS; - - RepState * getRepState() { return m_repState; } -private: - RepState * m_repState; -}; - -#endif diff --git a/ndb/src/old_files/rep/RepMain.cpp b/ndb/src/old_files/rep/RepMain.cpp deleted file mode 100644 index d9f057be9a1..00000000000 --- a/ndb/src/old_files/rep/RepMain.cpp +++ /dev/null @@ -1,97 +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 */ - -#include - -#include -#include - -#include - -#include "rep_version.hpp" -#include -#include - - -int -main(int argc, const char **argv) -{ - RepComponents comps; - RepCommandInterpreter cmd(&comps); - - - int helpFlag = false; - int noConnectFlag = false; - int onlyPrimaryFlag = false; - int onlyStandbyFlag = false; - int port = 18000; - replogEnabled = false; - - struct getargs args[] = { - { "psc", '1', arg_string, &comps.m_connectStringPS, - "Connect string", "connectstring" }, - { "ssc", '2', arg_string, &comps.m_connectStringSS, - "Connect string", "connectstring" }, - { "port", 'p', arg_integer, &port, - "port for rep api. Default 18000", "" }, - { "usage", '?', arg_flag, &helpFlag, - "Print help", "" }, -/* @todo - { "noConnect", 'n', arg_flag, &noConnectFlag, - "Do not connect adapters", "" }, -*/ - { "debug", 'd', arg_flag, &replogEnabled, - "Enable debug printouts on console", "" }, - { "onlyStandby", 's', arg_flag, &onlyStandbyFlag, - "Let Replication Server view DBMS as standby (destination) system only", - "" } - }; - int num_args = sizeof(args) / sizeof(args[0]); - int optind = 0; - char desc[] = - "\nWhen working as a primary system node, this program receives\n"\ - "records from the primary NDB Cluster and forwards them to\n"\ - "the standby system.\n\n"\ - "When working as a standby system node, this program receives\n"\ - "records from another replication node and inserts them into\n"\ - "the standby NDB Cluster.\n\n"\ - "Example: ndb_rep --psc=\"nodeid=3;host=localhost:10000\"\n"; - - if(getarg(args, num_args, argc, argv, &optind) || - //argv[optind] == NULL || - helpFlag) - { - arg_printusage(args, num_args, argv[0], desc); - return -1; //NDBT_ProgramExit(NDBT_WRONGARGS); - } - - RepApiInterpreter api(&comps,port); - api.startInterpreter(); - - /************************** - * Command-line interface * - **************************/ - if (!noConnectFlag && !onlyPrimaryFlag) comps.connectSS(); - if (!noConnectFlag && !onlyStandbyFlag) comps.connectPS(); - - - while (true) { - if(!cmd.readAndExecute()) { - api.stopInterpreter(); - exit(1); - } - } -} diff --git a/ndb/src/old_files/rep/Requestor.cpp b/ndb/src/old_files/rep/Requestor.cpp deleted file mode 100644 index 3c93a6394a4..00000000000 --- a/ndb/src/old_files/rep/Requestor.cpp +++ /dev/null @@ -1,224 +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 */ - -#include "Requestor.hpp" -#include "ConfigRetriever.hpp" - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#define TIME_BETWEEN_EXECUTES_MS 250 - -/* - * @todo The requestor still has a TF, but this is not used... - * (We will need a (set of) TF(s) for REP-REP - * on the same system though....) - */ - - -/***************************************************************************** - * Constructor / Destructor / Init - *****************************************************************************/ -Requestor::Requestor(GCIContainer * gciContainer, - AppNDB * appNDB, - RepState * repState) -{ - m_gciContainer = gciContainer; - m_applier = appNDB; - m_repState = repState; - - //m_grepSender = new ExtSender(); - //if (!m_grepSender) REPABORT(""); - - m_repState->setSubscriptionRequests(&requestCreateSubscriptionId, - &requestCreateSubscription, - &requestRemoveSubscription); - m_repState->setIntervalRequests(&requestTransfer, - &requestApply, - &requestDeleteSS, - &requestDeletePS); - m_repState->setStartRequests(&requestStartMetaLog, - &requestStartDataLog, - &requestStartMetaScan, - &requestStartDataScan, - &requestEpochInfo); -} - -Requestor::~Requestor() { - //delete m_grepSender; -} - -bool -Requestor::init(const char * connectString) -{ - m_signalExecThread = NdbThread_Create(signalExecThread_C, - (void **)this, - 32768, - "Requestor_Service", - NDB_THREAD_PRIO_LOW); - - if (m_signalExecThread == NULL) - return false; - - return true; -} - -/***************************************************************************** - * Signal Queue Executor - *****************************************************************************/ - -void * -Requestor::signalExecThread_C(void *g) { - - Requestor *requestor = (Requestor*)g; - requestor->signalExecThreadRun(); - NdbThread_Exit(0); - - /* NOTREACHED */ - return 0; -} - -class SigMatch -{ -public: - int gsn; - void (Requestor::* function)(NdbApiSignal *signal); - - SigMatch() { gsn = 0; function = NULL; }; - - SigMatch(int _gsn, void (Requestor::* _function)(NdbApiSignal *signal)) { - gsn = _gsn; - function = _function; - }; - - bool check(NdbApiSignal *signal) { - if(signal->readSignalNumber() == gsn) - return true; - return false; - }; -}; - -void -Requestor::signalExecThreadRun() -{ - while(1) - { - /** - * @todo Here we would like to measure the usage size of the - * receive buffer of TransSS. If the buffer contains - * more than X signals (maybe 1k or 10k), then we should - * not do a protectedExecute. - * By having the usage size measure thingy, - * we avoid having the Requestor requesting more - * things than the TransSS can handle. - * /Lars - * - * @todo A different implementation of this functionality - * would be to send a signal to myself when the protected - * execute is finished. This solution could be - * discussed. - * /Lars - */ - m_repState->protectedExecute(); - NdbSleep_MilliSleep(TIME_BETWEEN_EXECUTES_MS); - } -} - -void -Requestor::sendSignalRep(NdbApiSignal * s) { - m_repSender->sendSignal(s); -} - -void -Requestor::execSignal(void* executorObj, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]){ - - Requestor * executor = (Requestor*)executorObj; - - const Uint32 gsn = signal->readSignalNumber(); - const Uint32 len = signal->getLength(); - - NdbApiSignal * s = new NdbApiSignal(executor->m_ownRef); - switch (gsn) { - case GSN_REP_GET_GCI_CONF: - case GSN_REP_GET_GCI_REQ: - case GSN_REP_GET_GCIBUFFER_REQ: - case GSN_REP_INSERT_GCIBUFFER_REQ: - case GSN_REP_CLEAR_SS_GCIBUFFER_REQ: - case GSN_REP_CLEAR_PS_GCIBUFFER_REQ: - case GSN_REP_DROP_TABLE_REQ: - case GSN_GREP_SUB_CREATE_REQ: - case GSN_GREP_SUB_START_REQ: - case GSN_GREP_SUB_SYNC_REQ: - case GSN_GREP_SUB_REMOVE_REQ: - case GSN_GREP_CREATE_SUBID_REQ: - s->set(0, PSREPBLOCKNO, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - break; - default: - REPABORT1("Illegal signal received in execSignal", gsn); - } -#if 0 - ndbout_c("Requestor: Inserted signal into queue (GSN: %d, Len: %d)", - signal->readSignalNumber(), len); -#endif -} - -void -Requestor::execNodeStatus(void* obj, Uint16 nodeId, - bool alive, bool nfCompleted) -{ - //Requestor * thisObj = (Requestor*)obj; - - RLOG(("Node changed status (NodeId %d, Alive %d, nfCompleted %d)", - nodeId, alive, nfCompleted)); - - if(alive) { - /** - * Connected - set node as connected - * - * @todo Make it possible to have multiple External REP nodes - */ -#if 0 - for(Uint32 i=0; im_nodeConnectList.size(); i++) { - if(thisObj->m_nodeConnectList[i]->nodeId == nodeId) - thisObj->m_nodeConnectList[i]->connected = true; - } - thisObj->m_grepSender->setNodeId(thisObj->m_nodeConnectList[0]->nodeId); -#endif - } - - if(!alive && !nfCompleted){ - /** - * ??? - */ - } - - if(!alive && nfCompleted){ - /** - * Re-connect - */ - } -} diff --git a/ndb/src/old_files/rep/Requestor.hpp b/ndb/src/old_files/rep/Requestor.hpp deleted file mode 100644 index 735d2094bde..00000000000 --- a/ndb/src/old_files/rep/Requestor.hpp +++ /dev/null @@ -1,154 +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 REQUESTOR_HPP -#define REQUESTOR_HPP - -#include - -#include -#include -#include -#include -#include -#include - -#include - -/** - * @todo Remove this dependency - */ -#include - -#include -#include - - -/** - * @class Requestor - * @brief Connects to GREP Coordinator on the standby system - */ -class Requestor { -public: - /*************************************************************************** - * Constructor / Destructor / Init - ***************************************************************************/ - Requestor(GCIContainer * gciContainer, AppNDB * applier, RepState * repSt); - ~Requestor(); - bool init(const char * connectString = NULL); - - /*************************************************************************** - * Public Methods - ***************************************************************************/ - void setRepSender(ExtSender * es) { m_repSender = es; }; - -private: - static void * signalExecThread_C(void *); ///< SignalQueue executor thread - void signalExecThreadRun(); - - static void execSignal(void* executorObj, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); - static void execNodeStatus(void* executorObj, NodeId, bool alive, - bool nfCompleted); - - void sendSignalRep(NdbApiSignal *); - void sendSignalGrep(NdbApiSignal *); - - void connectToNdb(); - - /*************************************************************************** - * Signal Executors - ***************************************************************************/ - void execREP_GET_GCIBUFFER_CONF(NdbApiSignal*); - void execREP_CLEAR_GCIBUFFER_REP(NdbApiSignal*); - void execREP_INSERT_GCIBUFFER_REQ(NdbApiSignal*); - void execREP_CLEAR_SS_GCIBUFFER_REQ(NdbApiSignal*); - void execREP_DROP_TABLE_REQ(NdbApiSignal*); - - /*************************************************************************** - * Signal Executors 2 - ***************************************************************************/ - void execGREP_CREATE_SUBID_CONF(NdbApiSignal*); - void execGREP_CREATE_SUBID_REF(NdbApiSignal*); - void createSubscription(NdbApiSignal*); - void createSubscriptionId(NdbApiSignal*); - void execGREP_SUB_CREATE_CONF(NdbApiSignal*); - void execGREP_SUB_CREATE_REF(NdbApiSignal*); - void execGREP_SUB_START_CONF(NdbApiSignal*); - void execGREP_SUB_START_REF(NdbApiSignal*); - void removeSubscription(NdbApiSignal*); - void execGREP_SUB_REMOVE_REF(NdbApiSignal*); - void execGREP_SUB_SYNC_CONF(NdbApiSignal*); - void execGREP_SUB_SYNC_REF(NdbApiSignal*); - void execREP_CLEAR_SS_GCIBUFFER_CONF(NdbApiSignal*); - void execREP_CLEAR_SS_GCIBUFFER_REF(NdbApiSignal*); - void execREP_GET_GCIBUFFER_REF(NdbApiSignal*); - void execREP_DISCONNECT_REP(NdbApiSignal*); - - /*************************************************************************** - * Ref signal senders - ***************************************************************************/ - void sendREP_INSERT_GCIBUFFER_REF(NdbApiSignal * signal, - Uint32 gci, - Uint32 nodeGrp, - GrepError::Code err); - - void sendREP_CLEAR_SS_GCIBUFFER_REF(NdbApiSignal* signal, - Uint32 firstGCI, - Uint32 lastGCI, - Uint32 currentGCI, - Uint32 nodeGrp, - GrepError::Code err); - - /*************************************************************************** - * Private Variables - ***************************************************************************/ - class SignalQueue m_signalRecvQueue; - struct NdbThread * m_signalExecThread; - - RepState * m_repState; - - Uint32 m_ownNodeId; ///< NodeId of this node - Uint32 m_ownBlockNo; ///< BlockNo of this "block" - BlockReference m_ownRef; ///< Reference to this - - TransporterFacade * m_transporterFacade; - - GCIContainer * m_gciContainer; - - AppNDB * m_applier; - ExtSender * m_repSender; - - friend void startSubscription(void * cbObj, NdbApiSignal* signal, int type); - friend void scanSubscription(void * cbObj, NdbApiSignal* signal, int type); - - friend RepState::FuncRequestCreateSubscriptionId requestCreateSubscriptionId; - friend RepState::FuncRequestCreateSubscription requestCreateSubscription; - friend RepState::FuncRequestRemoveSubscription requestRemoveSubscription; - - friend RepState::FuncRequestTransfer requestTransfer; - friend RepState::FuncRequestApply requestApply; - friend RepState::FuncRequestDeleteSS requestDeleteSS; - friend RepState::FuncRequestDeletePS requestDeletePS; - - friend RepState::FuncRequestStartMetaLog requestStartMetaLog; - friend RepState::FuncRequestStartDataLog requestStartDataLog; - friend RepState::FuncRequestStartMetaScan requestStartMetaScan; - friend RepState::FuncRequestStartDataScan requestStartDataScan; - friend RepState::FuncRequestEpochInfo requestEpochInfo; -}; - -#endif diff --git a/ndb/src/old_files/rep/RequestorSubscriptions.cpp b/ndb/src/old_files/rep/RequestorSubscriptions.cpp deleted file mode 100644 index 75b41fae037..00000000000 --- a/ndb/src/old_files/rep/RequestorSubscriptions.cpp +++ /dev/null @@ -1,60 +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 */ - -#include "Requestor.hpp" - -#include -#include - -#include - -/***************************************************************************** - * Create Subscription Id - *****************************************************************************/ - - -/***************************************************************************** - * Create Subscription - *****************************************************************************/ - - -/***************************************************************************** - * Start Subscription - *****************************************************************************/ - -/***************************************************************************** - * Remove Subscription - *****************************************************************************/ - -void -Requestor::execGREP_SUB_REMOVE_REF(NdbApiSignal* signal) -{ -#if 0 - GrepSubRemoveRef * const ref = (GrepSubRemoveRef *)signal->getDataPtr(); - Uint32 subId = ref->subscriptionId; - Uint32 subKey = ref->subscriptionKey; - Uint32 err = ref->err; - - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_SubRemoveRef; - signal->theData[2] = subId; - signal->theData[3] = subKey; - signal->theData[4] = (Uint32)err; - sendSignal(CMVMI_REF,GSN_EVENT_REP,signal, 5, JBB); -#endif -} - - diff --git a/ndb/src/old_files/rep/SignalQueue.cpp b/ndb/src/old_files/rep/SignalQueue.cpp deleted file mode 100644 index 9b356a14b7d..00000000000 --- a/ndb/src/old_files/rep/SignalQueue.cpp +++ /dev/null @@ -1,106 +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 */ - -#include - -#include "SignalQueue.hpp" - -SignalQueue::SignalQueue() { - m_mutex = NdbMutex_Create(); - m_cond = NdbCondition_Create(); - m_signalQueueHead = NULL; - m_queueSize = 0; -} - -SignalQueue::~SignalQueue() { - { - Guard g(m_mutex); - while(m_signalQueueHead != NULL) - delete pop(); - } - NdbMutex_Destroy(m_mutex); - m_mutex = NULL; - NdbCondition_Destroy(m_cond); - m_cond = NULL; -} - -NdbApiSignal * -SignalQueue::pop() { - NdbApiSignal *ret; - - if(m_signalQueueHead == NULL) - return NULL; - - ret = m_signalQueueHead->signal; - - QueueEntry *old = m_signalQueueHead; - m_signalQueueHead = m_signalQueueHead->next; - - delete old; - m_queueSize--; - return ret; -} - -void -SignalQueue::receive(void *me, NdbApiSignal *signal) { - SignalQueue *q = (SignalQueue *)me; - q->receive(signal); -} - -void -SignalQueue::receive(NdbApiSignal *signal) { - QueueEntry *n = new QueueEntry(); - n->signal = signal; - n->next = NULL; - - Guard guard(m_mutex); - - if(m_signalQueueHead == NULL) { - m_signalQueueHead = n; - m_queueSize++; - NdbCondition_Broadcast(m_cond); - return; - } - - QueueEntry *cur = m_signalQueueHead; - - while(cur->next != NULL) - cur = cur->next; - - cur->next = n; - m_queueSize++; - NdbCondition_Broadcast(m_cond); -} - -NdbApiSignal * -SignalQueue::waitFor(int gsn, NodeId nodeid, Uint32 timeout) { - Guard g(m_mutex); - - if(m_signalQueueHead == NULL) - NdbCondition_WaitTimeout(m_cond, m_mutex, timeout); - - if(m_signalQueueHead == NULL) - return NULL; - - if(gsn != 0 && m_signalQueueHead->signal->readSignalNumber() != gsn) - return NULL; - - if(nodeid != 0 && - refToNode(m_signalQueueHead->signal->theSendersBlockRef) != nodeid) - return NULL; - - return pop(); -} diff --git a/ndb/src/old_files/rep/SignalQueue.hpp b/ndb/src/old_files/rep/SignalQueue.hpp deleted file mode 100644 index 697bca85893..00000000000 --- a/ndb/src/old_files/rep/SignalQueue.hpp +++ /dev/null @@ -1,117 +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 __SIGNALQUEUE_HPP_INCLUDED__ -#define __SIGNALQUEUE_HPP_INCLUDED__ - -#include -#include -#include -#include - -/* XXX Look for an already existing definition */ -#define DEFAULT_TIMEOUT 10000 - -/** - * @class SignalQueue - * @brief - */ -class SignalQueue { -public: - typedef void (* SignalHandler)(void *obj, int gsn, NdbApiSignal *signal); - - SignalQueue(); - ~SignalQueue(); - - /** - * Static wrapper making it possible to call receive without knowing the - * type of the receiver - */ - static void receive(void *me, NdbApiSignal *signal); - - /** - * Enqueues a signal, and notifies any thread waiting for signals. - */ - void receive(NdbApiSignal *signal); - - NdbApiSignal *waitFor(int gsn, - NodeId nodeid = 0, - Uint32 timeout = DEFAULT_TIMEOUT); - template bool waitFor(Vector &t, - T *&handler, - NdbApiSignal *&signal, - Uint32 timeout); - - /** - * size() - */ - - Uint32 size() {return m_queueSize;}; - -private: - NdbMutex *m_mutex; /* Locks all data in SignalQueue */ - NdbCondition *m_cond; /* Notifies about new signal in the queue */ - - /** - * Returns the last recently received signal. - * Must be called with m_mutex locked. - * - * The caller takes responsibility for deleting the returned object. - * - * @returns NULL if failed, or a received signal - */ - NdbApiSignal *pop(); - - class QueueEntry { - public: - NdbApiSignal *signal; - QueueEntry *next; - }; - QueueEntry *m_signalQueueHead; /** Head of the queue. - * New entries added on the tail - */ - Uint32 m_queueSize; -}; - -template bool -SignalQueue::waitFor(Vector &t, - T *&handler, - NdbApiSignal *&signal, - Uint32 timeout) { - Guard g(m_mutex); - - if(m_signalQueueHead == NULL) - NdbCondition_WaitTimeout(m_cond, m_mutex, timeout); - - if(m_signalQueueHead == NULL) - return false; - - for(size_t i = 0; i < t.size(); i++) { - if(t[i].check(m_signalQueueHead->signal)) { - handler = &t[i]; - signal = pop(); - return true; - } - } - - ndbout_c("SignalQueue: Queued signal without true check function (GSN: %d)", - m_signalQueueHead->signal->theVerId_signalNumber); - abort(); - - return false; -} - -#endif /* !__SIGNALQUEUE_HPP_INCLUDED__ */ diff --git a/ndb/src/old_files/rep/TODO b/ndb/src/old_files/rep/TODO deleted file mode 100644 index a2462fae6cd..00000000000 --- a/ndb/src/old_files/rep/TODO +++ /dev/null @@ -1,119 +0,0 @@ -REQUIREMENTS ------------- -- It should be possible to run two systems with replication using the - same configuration file on both systems. - -FEATURES TO IMPLEMENT ---------------------- -- Fix so that execute and command uses ExtSender. - None of them should have their own signals, this should - instead by abstacted to the RepStateRequest layer. -- Delete signals - GSN_REP_INSERT_GCIBUFFER_CONF - GSN_REP_INSERT_GCIBUFFER_REF -- Fix so that all ExtSenders are set at one point in the code only. -- Verify the following signals: - GSN_REP_INSERT_GCIBUFFER_REQ - GSN_REP_CLEAR_SS_GCIBUFFER_REQ - GSN_REP_DROP_TABLE_REQ -- Fix all @todo's in the code -- Remove all #if 1, #if 0 etc. -- Fix correct usage of dbug package used in MySQL source code. -- System table storing all info about channels -- Think about how channels, subscriptions etc map to SUMA Subscriptions -- TableInfoPS must be secured if SS REP is restarted and PS REP still - has all log records needed to sync. (This could be saved in a system - table instead of using the struct.) - -KNOWN BUGS AND LIMITATIONS --------------------------- -- REP#1: Non-consistency due to non-logging stop [LIMITATION] - Problem: - - Stopping replication in state other than "Logging" can - lead to a non-consistent state of the destination database - Suggested solution: - - Implement a cleanData flag (= false) that indicates that - this has happend. - -- REP#2: PS REP uses epochs from old subscription [BUG] - The following scenario can lead to a non-correct replication: - - Start replication X - - Wait until replication is in "Logging" state - - Kill SS REP - - Let PS REP be alive - - Start new replication Y - - Replication Y can use old PS REP epochs from replication X. - Suggested solution: - - Mark PS buffers with channel ids - - Make sure that all epoch requests use channel number in the requests. - -- REP#3: When having two node groups, there is sometimes 626 [FIXED] - Problem: - - Sometimes (when doing updated) there is 626 error code when - using 2 node groups. - - 626 = Tuple does not exists. - - Current code in RepState.cpp is: - if(s == Channel::App && - m_channel.getState() == Channel::DATASCAN_COMPLETED && - i.last() >= m_channel.getDataScanEpochs().last() && - i.last() >= m_channel.getMetaScanEpochs().last()) - { - m_channel.setState(Channel::LOG); - disableAutoStart(); - } - When the system gets into LOG state, force flag is turned off - Suggested solution: - - During DATASCAN, force=true (i.e. updates are treated as writes, - deletes error due to non-existing tuple are ignored) - - The code above must take ALL node groups into account. - -- REP#4: User requests sometime vanish when DB node is down [LIMITATION] - Problem: - - PS REP node does not always REF when no connection to GREP exists - Suggested solution: - - All REP->GREP signalsends should be checked. If they return <0, - then a REF signal should be returned. - -- REP#5: User requests sometime vanish when PS REP is down [BUG] - Scenario: - - Execute "Start" with PS REP node down - Solution: - - When start is executed, the connect flag should be checked - -- REP#6: No warning if table exists [Lars, BUG!] - Problem: - - There is no warning if a replicated table already exists in the - database. - Suggested solution: - - Print warning - - Set cleanData = false - -- REP#7: Starting 2nd subscription crashes DB node (Grep.cpp:994) [FIXED] - Scenario: - - Start replication - - Wait until replication is in "Logging" state - - Kill SS REP - - Let PS REP be alive - - Start new replication - - Now GREP crashes in Grep.cpp:994. - Suggested fix: - - If a new subscription is requested with same subscriberData - as already exists, then SUMA (or GREP) sends a REF signal - indicating that SUMA does not allow a new subscription to be - created. [Now no senderData is sent from REP.] - -- REP#8: Dangling subscriptions in GREP/SUMA [Johan,LIMITATION] - Problem: - - If both REP nodes die, then there is no possibility to remove - subscriptions from GREP/SUMA - Suggested solution 1: - - Fix so that GREP/SUMA can receive a subscription removal - signal with subid 0. This means that ALL subscriptions are - removed. This meaning should be documented in the - signaldata class. - - A new user command "STOP ALL" is implemented that sends - a request to delete all subscriptions. - Suggested solution 2: - - When GREP detects that ALL PS REP nodes associated with a s - subscription are killed, then that subscription should be - deleted. diff --git a/ndb/src/old_files/rep/adapters/AppNDB.cpp b/ndb/src/old_files/rep/adapters/AppNDB.cpp deleted file mode 100644 index 05f6d52807f..00000000000 --- a/ndb/src/old_files/rep/adapters/AppNDB.cpp +++ /dev/null @@ -1,583 +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 */ - -#include "AppNDB.hpp" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/***************************************************************************** - * Constructor / Destructor / Init - *****************************************************************************/ - -AppNDB::~AppNDB() -{ - delete m_tableInfoPs; - delete m_ndb; - m_tableInfoPs = 0; -} - -AppNDB::AppNDB(GCIContainer * gciContainer, RepState * repState) -{ - m_gciContainer = gciContainer; - m_repState = repState; - m_cond = NdbCondition_Create(); - m_started = true; -} - -void -AppNDB::init(const char* connectString) { - - // NdbThread_SetConcurrencyLevel(1+ 2); - m_ndb = new Ndb(""); - - m_ndb->useFullyQualifiedNames(false); - - m_ndb->setConnectString(connectString); - /** - * @todo Set proper max no of transactions?? needed?? Default 12?? - */ - m_ndb->init(2048); - m_dict = m_ndb->getDictionary(); - - m_ownNodeId = m_ndb->getNodeId(); - - ndbout << "-- NDB Cluster -- REP node " << m_ownNodeId << " -- Version " - << REP_VERSION_ID << " --" << endl; - ndbout_c("Connecting to NDB Cluster..."); - if (m_ndb->waitUntilReady() != 0){ - REPABORT("NDB Cluster not ready for connections"); - } - ndbout_c("Phase 1 (AppNDB): Connection 1 to NDB Cluster opened (Applier)"); - - m_tableInfoPs = new TableInfoPs(); - - m_applierThread = NdbThread_Create(runAppNDB_C, - (void**)this, - 32768, - "AppNDBThread", - NDB_THREAD_PRIO_LOW); -} - - -/***************************************************************************** - * Threads - *****************************************************************************/ - -extern "C" -void* -runAppNDB_C(void * me) -{ - ((AppNDB *) me)->threadMainAppNDB(); - NdbThread_Exit(0); - return me; -} - -void -AppNDB::threadMainAppNDB() { - MetaRecord * mr; - LogRecord * lr; - GCIBuffer::iterator * itBuffer; - GCIPage::iterator * itPage; - GCIBuffer * buffer; - GCIPage * page; - Uint32 gci=0; - - bool force; - while(true){ - - m_gciBufferList.lock(); - if(m_gciBufferList.size()==0) - NdbCondition_Wait(m_cond, m_gciBufferList.getMutex()); - m_gciBufferList.unlock(); - - /** - * Do nothing if we are not started! - */ - if(!m_started) - continue; - - if(m_gciBufferList.size()>0) { - m_gciBufferList.lock(); - buffer = m_gciBufferList[0]; - assert(buffer!=0); - if(buffer==0) { - m_gciBufferList.unlock(); -// stopApplier(GrepError::REP_APPLY_NULL_GCIBUFFER); - return; - } - m_gciBufferList.unlock(); - - RLOG(("Applying %d:[%d]", buffer->getId(), buffer->getGCI())); - gci = buffer->getGCI(); - /** - * Do stuff with buffer - */ - - force = buffer->m_force; - itBuffer = new GCIBuffer::iterator(buffer); - page = itBuffer->first(); - - Record * record; - while(page!=0 && m_started) { - - itPage = new GCIPage::iterator(page); - record = itPage->first(); - - while(record!=0 && m_started) { - switch(Record::RecordType(record->recordType)) { - case Record::META: - mr = (MetaRecord*)record; - if(applyMetaRecord(mr, gci) < 0){ - /** - * If we fail with a meta record then - * we should fail the replication! - */ - //stopApplier(GrepError::REP_APPLY_METARECORD_FAILED); - } - break; - case Record::LOG: - lr = (LogRecord*)record; - if(applyLogRecord(lr, force, gci) < 0) { - /** - * If we fail to apply a log record AND - * we have sent a ref to repstate event, - * then we should not try to apply another one! - */ -// stopApplier(GrepError::REP_APPLY_LOGRECORD_FAILED); - } - break; - default: - REPABORT("Illegal record type"); - }; - record = itPage->next(); - } - delete itPage; - itPage = 0; - page = itBuffer->next(); - } - - m_gciBufferList.erase(0, true); - /** - * "callback" to RepState to send REP_INSERT_GCIBUFFER_CONF - */ - m_repState->eventInsertConf(buffer->getGCI(), buffer->getId()); - delete itBuffer; - itBuffer = 0; - mr = 0; - lr = 0; - page = 0; - buffer = 0; - } - } - - -} - -void AppNDB::startApplier(){ - m_started = true; -} - - -void AppNDB::stopApplier(GrepError::Code err){ - m_started = false; - m_repState->eventInsertRef(0,0,0, err); -} - - -GrepError::Code -AppNDB::applyBuffer(Uint32 nodeGrp, Uint32 epoch, Uint32 force) -{ - m_gciBufferList.lock(); - - GCIBuffer * buffer = m_gciContainer->getGCIBuffer(epoch, nodeGrp); - if (buffer == NULL) { - RLOG(("WARNING! Request to apply NULL buffer %d[%d]. Force %d", - nodeGrp, epoch, force)); - return GrepError::NO_ERROR; - } - if (!buffer->isComplete()) { - RLOG(("WARNING! Request to apply non-complete buffer %d[%d]. Force %d", - nodeGrp, epoch, force)); - return GrepError::REP_APPLY_NONCOMPLETE_GCIBUFFER; - } - buffer->m_force = force; - - assert(buffer!=0); - m_gciBufferList.push_back(buffer, false); - NdbCondition_Broadcast(m_cond); - m_gciBufferList.unlock(); - return GrepError::NO_ERROR; -} - -int -AppNDB::applyLogRecord(LogRecord* lr, bool force, Uint32 gci) -{ -#if 0 - RLOG(("Applying log record (force %d, Op %d, GCI %d)", - force, lr->operation, gci)); -#endif - - int retries =0; - retry: - if(retries == 10) { - m_repState->eventInsertRef(gci, 0, lr->tableId, - GrepError::REP_APPLIER_EXECUTE_TRANSACTION); - return -1; - } - NdbConnection * trans = m_ndb->startTransaction(); - if (trans == NULL) { - /** - * Transaction could not be started - * @todo Handle the error by: - * 1. Return error code - * 2. Print log message - * 3. On higher level indicate that DB has been tainted - */ - ndbout_c("AppNDB: Send the following error msg to NDB Cluster support"); - reportNdbError("Cannot start transaction!", trans->getNdbError()); - m_repState->eventInsertRef(gci, 0, 0, - GrepError::REP_APPLIER_START_TRANSACTION); - REPABORT("Can not start transaction"); - } - - /** - * Resolve table name based on table id - */ - const Uint32 tableId = lr->tableId; - const char * tableName = m_tableInfoPs->getTableName(tableId); - - /** - * Close trans and return if it is systab_0. - */ - if (tableId == 0) { - RLOG(("WARNING! System table log record received")); - m_ndb->closeTransaction(trans); - return -1; - } - - if (tableName==0) { - /** - * Table probably does not exist - * (Under normal operation this should not happen - * since log records should not appear unless the - * table has been created.) - * - * @todo Perhaps the table is not cached due to a restart, - * so let's check in the dictionary if it exists. - */ - m_ndb->closeTransaction(trans); - m_repState->eventInsertRef(gci, 0, tableId, - GrepError::REP_APPLIER_NO_TABLE); - return -1; - } - - const NdbDictionary::Table * table = m_dict->getTable(tableName); - - NdbOperation * op = trans->getNdbOperation(tableName); - if (op == NULL) { - ndbout_c("AppNDB: Send the following error msg to NDB Cluster support"); - reportNdbError("Cannot get NdbOperation record", - trans->getNdbError()); - m_repState->eventInsertRef(gci,0,tableId, - GrepError::REP_APPLIER_NO_OPERATION); - REPABORT("Can not get NdbOperation record"); - } - - int check=0; - switch(lr->operation) { - case TriggerEvent::TE_INSERT: // INSERT - check = op->insertTuple(); - break; - case TriggerEvent::TE_DELETE: // DELETE - check = op->deleteTuple(); - break; - case TriggerEvent::TE_UPDATE: // UPDATE - if (force) { - check = op->writeTuple(); - } else { - check = op->updateTuple(); - } - break; - case TriggerEvent::TE_CUSTOM: //SCAN - check = op->writeTuple(); - break; - default: - m_ndb->closeTransaction(trans); - return -1; - }; - - if (check<0) { - ndbout_c("AppNDB: Something is weird"); - } - - /** - * @todo index inside LogRecord struct somewhat prettier - * Now it 4 (sizeof(Uint32)), and 9 the position inside the struct - * where the data starts. - */ - AttributeHeader * ah=(AttributeHeader *)((char *)lr + sizeof(Uint32) * 9); - AttributeHeader *end = (AttributeHeader *)(ah + lr->attributeHeaderWSize); - Uint32 * dataPtr = (Uint32 *)(end); - - /** - * @note attributeheader for operaration insert includes a duplicate - * p.k. The quick fix for this problem/bug is to skip the first set of - * of p.k, and start from the other set of P.Ks. Data is duplicated for - * the p.k. - */ - if (lr->operation == 0) { - for(int i = 0; i< table->getNoOfPrimaryKeys(); i++) { - ah+=ah->getHeaderSize(); - dataPtr = dataPtr + ah->getDataSize(); - } - } - - while (ah < end) { - const NdbDictionary::Column * column = - table->getColumn(ah->getAttributeId()); - /** - * @todo: Here is a limitation. I don't care if it is a tuplekey - * that is autogenerated or an ordinary pk. I just whack it in. - * However, this must be examined. - */ - if(column->getPrimaryKey()) { - if(op->equal(ah->getAttributeId(), (const char *)dataPtr) < 0) { - ndbout_c("AppNDB: Equal failed id %d op %d name %s, gci %d force %d", - ah->getAttributeId(), - lr->operation, - column->getName(), gci, force); - reportNdbError("Equal!", trans->getNdbError()); - } - - } else { - if(op->setValue(ah->getAttributeId(), (const char *)dataPtr) < 0) - ndbout_c("AppNDB: setvalue failed id %d op %d name %s, gci %d force %d", - ah->getAttributeId(), - lr->operation, - column->getName(), gci, force); - } - - dataPtr = dataPtr + ah->getDataSize(); - ah = ah + ah->getHeaderSize() ; - } - - if(trans->execute(Commit) != 0) { - /** - * Transaction commit failure - */ - const NdbError err = trans->getNdbError(); - m_ndb->closeTransaction(trans); - switch(err.status){ - case NdbError::Success: - { - m_repState->eventInsertRef(gci, 0, tableId, - GrepError::REP_APPLIER_EXECUTE_TRANSACTION); - return -1; - } - break; - case NdbError::TemporaryError: - { - NdbSleep_MilliSleep(50); - retries++; - goto retry; - } - break; - case NdbError::UnknownResult: - { - ndbout_c("AppNDB: Send the following error msg to NDB Cluster support"); - reportNdbError("Execute transaction failed!", - trans->getNdbError()); - m_repState->eventInsertRef(gci, 0, tableId, - GrepError::REP_APPLIER_EXECUTE_TRANSACTION); - return -1; - } - break; - case NdbError::PermanentError: - { - if(err.code == 626) { - if(force && lr->operation == TriggerEvent::TE_DELETE) /**delete*/ { - /**tuple was not found. Ignore this, since - * we are trying to apply a "delete a tuple"-log record before - * having applied the scan data. - */ - return -1; - } - } - - ndbout_c("AppNDB: Send the following error msg to NDB Cluster support"); reportNdbError("Execute transaction failed!", - trans->getNdbError()); - ndbout_c("\n\nAppNDB: RepNode will now crash."); - m_ndb->closeTransaction(trans); - m_repState->eventInsertRef(gci, 0, tableId, - GrepError::REP_APPLIER_EXECUTE_TRANSACTION); - return -1; - } - break; - } - } - - /** - * No errors. Close transaction and continue in applierThread. - */ - m_ndb->closeTransaction(trans); - return 1; -} - - -int -AppNDB::applyMetaRecord(MetaRecord* mr, Uint32 gci) -{ - /** - * Validate table id - */ - Uint32 tableId = mr->tableId; - if (tableId==0) { - RLOG(("WARNING! Meta record contained record with tableId 0")); - return 0; - } - - /** - * Prepare meta record - */ - NdbDictionary::Table * table = prepareMetaRecord(mr); - if(table == 0) { - RLOG(("WARNING! Prepare table meta record failed for table %d", tableId)); - m_dict->getNdbError(); - m_repState->eventInsertRef(gci,0,tableId, - GrepError::REP_APPLIER_PREPARE_TABLE); - return -1; - } - - /** - * Table does not exist in TableInfoPs -> add it - */ - if(m_tableInfoPs->getTableName(tableId)==0) { - RLOG(("Table %d:%s added to m_tableInfoPs", tableId, table->getName())); - m_tableInfoPs->insert(tableId,table->getName()); - } - - /** - * Validate that table does not exist in Dict - */ - - const NdbDictionary::Table * tmpTable = m_dict->getTable(table->getName()); - if(tmpTable !=0) { - /** - * Oops, a table with the same name exists - */ - if(tmpTable->getObjectVersion()!=table->getObjectVersion()) { - char buf[100]; - sprintf(buf,"WARNING! Another version of table %d:%s already exists." - "Currently, we dont support versions, so will abort now!", - tableId, table->getName()); - - REPABORT(buf); - - } - RLOG(("WARNING! An identical table %d:%s already exists.", - tableId, table->getName())); - return -1; - } - - - /** - * @todo WARNING! Should scan table MR for columns that are not supported - */ - /* - NdbDictionary::Column * column; - - for(int i=0; igetNoOfColumns(); i++) { - column = table->getColumn(i); - if(column->getAutoIncrement()) { - reportWarning(table->getName(), column->getName(), - "Uses AUTOINCREMENT of PK"); - } - } - */ - - - /** - * Create table - */ - if(m_dict->createTable(*table)<0) { - ndbout_c("AppNDB: Send the following error msg to NDB Cluster support"); - reportNdbError("Create table failed!", m_dict->getNdbError()); - m_repState->eventCreateTableRef(gci, - tableId, - table->getName(), - GrepError::REP_APPLIER_CREATE_TABLE); - return -1; - } - - RLOG(("Table %d:%s created", tableId, table->getName())); - return 0; -} - -NdbDictionary::Table* -AppNDB::prepareMetaRecord(MetaRecord* mr) { - NdbTableImpl * tmp = 0; - NdbDictionary::Table * table =0; - Uint32 * data =(Uint32*)( ((char*)mr + sizeof(Uint32)*6)); - int res = NdbDictInterface::parseTableInfo(&tmp, data, mr->dataLen, - m_ndb->usingFullyQualifiedNames()); - if(res == 0) { - table = tmp; - return table; - } else{ - return 0; - } -} - -void -AppNDB::reportNdbError(const char * msg, const NdbError & err) { - ndbout_c("%s : Error code %d , error message %s", - msg, err.code, - (err.message ? err.message : "")); -} - -void -AppNDB::reportWarning(const char * tableName, const char * message) { - ndbout_c("WARNING: Table %s, %s", tableName, message); -} - -void -AppNDB::reportWarning(const char * tableName, const char * columnName, - const char * message) { - ndbout_c("WARNING: Table %s, column %s, %s", tableName, columnName,message); -} - -int -AppNDB::dropTable(Uint32 tableId) -{ - char * tableName = m_tableInfoPs->getTableName(tableId); - if(tableName == 0) return -1; - ndbout_c("AppNDB: Dropping table "); - if(m_dict->dropTable(tableName) != 0) { - reportNdbError("Failed dropping table",m_dict->getNdbError()); - return -1; - } - m_tableInfoPs->del(tableId); - return 1; -} diff --git a/ndb/src/old_files/rep/adapters/AppNDB.hpp b/ndb/src/old_files/rep/adapters/AppNDB.hpp deleted file mode 100644 index 9563a1e41ab..00000000000 --- a/ndb/src/old_files/rep/adapters/AppNDB.hpp +++ /dev/null @@ -1,141 +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 APPNDB_HPP -#define APPNDB_HPP -#include "NdbApi.hpp" - -#include -#include -#include -#include - -#include -#include - -#include "TableInfoPs.hpp" -#include -#include - -#include - -extern "C" { - void * runAppNDB_C(void *); -} - -/** - * @class AppNDB - * @brief Connects to NDB and appliers log records into standby system - */ -class AppNDB { -public: - /*************************************************************************** - * Constructor / Destructor / Init - ***************************************************************************/ - AppNDB(class GCIContainer * gciContainer, class RepState * repState); - ~AppNDB(); - - void init(const char * connectString); - - GrepError::Code - applyBuffer(Uint32 nodeGrp, Uint32 first, Uint32 force); - - /** - * Takes a table id and drops it. - * @param tableId Name of table to be dropped - * @return Returns 1 = ok, -1 failed - * - * @todo Fix: 0 usually means ok... - */ - int dropTable(Uint32 tableId); - void startApplier(); - void stopApplier(GrepError::Code err); -private: - /*************************************************************************** - * Methods - ***************************************************************************/ - friend void* runAppNDB_C(void*); - - void threadMainAppNDB(void); - - /** - * Takes a log records and does the operation specified in the log record - * on NDB. - * @param - lr (LogRecord) - * @param - force true if GREP:SSCoord is in phase STARTING. - * Ignore "Execute" errors if true. - */ - int applyLogRecord(LogRecord * lr, bool force, Uint32 gci); - - /** - * Applies a table based on a meta record and creates the table - * in NDB. - * @param - meta record - * @return - 0 on success, -1 if something went wrong - */ - int applyMetaRecord(MetaRecord * mr, Uint32 gci); - - /** - * Takes a meta record and uses NdbDictionaryXXX::parseInfoTable - * and returns a table - * @param mr - MetaRecord - * @return - a table based on the meta record - */ - NdbDictionary::Table* prepareMetaRecord(MetaRecord * mr); - - /** - * Prints out an NDB error message if a ndb operation went wrong. - * @param msg - text explaining the error - * @param err - NDB error type - */ - void reportNdbError(const char * msg, const NdbError & err); - - /** - * Prints out a warning message. Used if support for something - * is not implemented. - * @param tableName - the name of the table this warning occured on - * @param message - warning message - */ - void reportWarning(const char * tableName, const char * message); - - /** - * Prints out a warning message. Used if support for something - * is not implemented. - * @param tableName - the name of the table this warning occured on - * @param columnName - the name of the column this warning occured on - * @param message - warning message - */ - void reportWarning(const char * tableName, const char * columnName, - const char * message); - - - /*************************************************************************** - * Variables - ***************************************************************************/ - GCIContainer * m_gciContainer; - RepState * m_repState; - - Ndb* m_ndb; - NdbDictionary::Dictionary * m_dict; - NodeId m_ownNodeId; - bool m_started; - TableInfoPs * m_tableInfoPs; - NdbThread* m_applierThread; - NdbCondition * m_cond; - MutexVector m_gciBufferList; -}; - -#endif diff --git a/ndb/src/old_files/rep/adapters/ExtAPI.cpp b/ndb/src/old_files/rep/adapters/ExtAPI.cpp deleted file mode 100644 index 0dcd1e85465..00000000000 --- a/ndb/src/old_files/rep/adapters/ExtAPI.cpp +++ /dev/null @@ -1,31 +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 */ - -#include "ExtAPI.hpp" - -GrepError::Code -ExtAPI::eventSubscriptionIdCreated(Uint32 subId, Uint32 subKey) -{ - NdbApiSignal* signal = m_repSender->getSignal(); - CreateSubscriptionIdConf * conf = - (CreateSubscriptionIdConf *)signal->getDataPtrSend(); - conf->subscriptionId = subId; - conf->subscriptionKey = subKey; - signal->set(0, SSREPBLOCKNO, GSN_GREP_CREATE_SUBID_CONF, - CreateSubscriptionIdConf::SignalLength); - m_repSender->sendSignal(signal); - return GrepError::NO_ERROR; -} diff --git a/ndb/src/old_files/rep/adapters/ExtAPI.hpp b/ndb/src/old_files/rep/adapters/ExtAPI.hpp deleted file mode 100644 index f10b6c7d682..00000000000 --- a/ndb/src/old_files/rep/adapters/ExtAPI.hpp +++ /dev/null @@ -1,107 +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 EXTAPI_HPP -#define EXTAPI_HPP - -#include -#include -#include - -#include - -/** - * The abstract class for all extractors - */ -class ExtAPI -{ -public: - /*************************************************************************** - * Constructor / Destructor - ***************************************************************************/ -#if 0 - bool init(const char * connectString = NULL); - - GrepError::Code dataLogStarted(Uint32 epoch, - Uint32 subId, Uint32 subKey) = 0; - GrepError::Code metaLogStarted(Uint32 epoch, - Uint32 subId, Uint32 subKey) = 0; - GrepError::Code epochComleted() = 0; - GrepError::Code subscriptionCreated() = 0; - GrepError::Code subscriptionRemoved() = 0; - GrepError::Code metaScanCompleted() = 0; - GrepError::Code dataScanCompleted() = 0; - GrepError::Code subscriptionRemoveFailed() = 0; - GrepError::Code metaScanFailed() = 0; - GrepError::Code dataScanFailed() = 0; - GrepError::Code subscriptiodIdCreateFailed() = 0; - GrepError::Code dataLogFailed() = 0; - GrepError::Code metaLogFailed() = 0; - GrepError::Code subscriptionCreateFailed() = 0; - - /**Above to be deleted*/ -#endif - - virtual GrepError::Code - eventSubscriptionIdCreated(Uint32 subId, Uint32 subKey) ; - -#if 0 - GrepError::Code - eventSubscriptionDeleted(Uint32 subId, Uint32 subKey); - - GrepError::Code - eventMetaLogStarted(NdbApiSignal*, Uint32 subId, Uint32 subKey); - - GrepError::Code - eventDataLogStarted(NdbApiSignal*, Uint32 subId, Uint32 subKey); - - GrepError::Code - eventMetaScanCompleted(NdbApiSignal*, Uint32 subId, Uint32 subKey, - Interval epochs); - - GrepError::Code - eventDataScanCompleted(NdbApiSignal*, Uint32 subId, Uint32 subKey, - Interval epochs); - - GrepError::Code - eventMetaScanFailed(Uint32 subId, Uint32 subKey, GrepError::Code error); - - GrepError::Code - eventDataScanFailed(Uint32 subId, Uint32 subKey, GrepError::Code error); -#endif - - /*************************************************************************** - * Public Methods - ***************************************************************************/ - void setRepSender(ExtSender * es) { m_repSender = es; }; - //void signalErrorHandler(NdbApiSignal * s, Uint32 nodeId); - -protected: - ExtSender * m_repSender; -}; - - -#if 0 -class TestExtAPI : public ExtAPI -{ - GrepError::Code - eventSubscriptionIdCreated(Uint32 subId, Uint32 subKey) { - ndbout_c("Received subscription:%d-%d"); - }; -}; -#endif - -#endif // EXTAPI_HPP diff --git a/ndb/src/old_files/rep/adapters/ExtNDB.cpp b/ndb/src/old_files/rep/adapters/ExtNDB.cpp deleted file mode 100644 index 6642b750b57..00000000000 --- a/ndb/src/old_files/rep/adapters/ExtNDB.cpp +++ /dev/null @@ -1,559 +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 */ - -#include "ExtNDB.hpp" -#include "ConfigRetriever.hpp" -#include - -#include - -#include -#include -#include -#include -#include -#include - -/***************************************************************************** - * Constructor / Destructor / Init - *****************************************************************************/ -ExtNDB::ExtNDB(GCIContainerPS * gciContainer, ExtAPI * extAPI) -{ - m_grepSender = new ExtSender(); - if (!m_grepSender) REPABORT("Could not allocate object"); - m_gciContainerPS = gciContainer; - - m_nodeGroupInfo = new NodeGroupInfo(); - m_gciContainerPS->setNodeGroupInfo(m_nodeGroupInfo); - - m_doneSetGrepSender = false; - m_subId = 0; - m_subKey = 0; - m_firstGCI = 0; - m_dataLogStarted = false; - - m_extAPI = extAPI; - if (!m_extAPI) REPABORT("Could not allocate object"); -} - -ExtNDB::~ExtNDB() -{ - delete m_grepSender; - delete m_nodeGroupInfo; -} - -void -ExtNDB::signalErrorHandler(NdbApiSignal * signal, Uint32 nodeId) -{ - //const Uint32 gsn = signal->readSignalNumber(); - //const Uint32 len = signal->getLength(); - RLOG(("Send signal failed. Signal %p", signal)); -} - -bool -ExtNDB::init(const char * connectString) -{ - m_signalExecThread = NdbThread_Create(signalExecThread_C, - (void **)this, - 32768, - "ExtNDB_Service", - NDB_THREAD_PRIO_LOW); - -#if 0 - /** - * I don't see that this does anything - * - * Jonas 13/2-04 - */ - ConfigRetriever cr; cr.setConnectString(connectString); - - ndb_mgm_configuration * config = cr.getConfig(NDB_VERSION, NODE_TYPE_REP); - if (config == 0) { - ndbout << "ExtNDB: Configuration error: "; - const char* erString = cr.getErrorString(); - if (erString == 0) { - erString = "No error specified!"; - } - ndbout << erString << endl; - return false; - } - NdbAutoPtr autoPtr(config); - m_ownNodeId = r.getOwnNodeId(); - - /** - * Check which GREPs to connect to (in configuration) - * - * @note SYSTEM LIMITATION: Only connects to one GREP - */ - Uint32 noOfConnections=0; - NodeId grepNodeId=0; - const Properties * connection; - - config->get("NoOfConnections", &noOfConnections); - for (Uint32 i=0; iget("Connection", i, &connection); - connection->get("NodeId1", &nodeId1); - connection->get("NodeId2", &nodeId2); - if (!connection->contains("System1") && - !connection->contains("System2") && - (nodeId1 == m_ownNodeId || nodeId2 == m_ownNodeId)) { - /** - * Found connection - */ - if (nodeId1 == m_ownNodeId) { - grepNodeId = nodeId2; - } else { - grepNodeId = nodeId1; - } - } - } -#endif - - m_transporterFacade = TransporterFacade::instance(); - - assert(m_transporterFacade != 0); - - m_ownBlockNo = m_transporterFacade->open(this, execSignal, execNodeStatus); - assert(m_ownBlockNo > 0); - m_ownRef = numberToRef(m_ownBlockNo, m_ownNodeId); - ndbout_c("EXTNDB blockno %d ownref %d ", m_ownBlockNo, m_ownRef); - assert(m_ownNodeId == m_transporterFacade->ownId()); - - m_grepSender->setOwnRef(m_ownRef); - m_grepSender->setTransporterFacade(m_transporterFacade); - - if(!m_grepSender->connected(50000)){ - ndbout_c("ExtNDB: Failed to connect to DB nodes!"); - ndbout_c("ExtNDB: Tried to create transporter as (node %d, block %d).", - m_ownNodeId, m_ownBlockNo); - ndbout_c("ExtNDB: Check that DB nodes are started."); - return false; - } - ndbout_c("Phase 3 (ExtNDB): Connection %d to NDB Cluster opened (Extractor)", - m_ownBlockNo); - - for (Uint32 i=1; igetIsDbNode(i) && - m_transporterFacade->getIsNodeSendable(i)) - { - Uint32 nodeGrp = m_transporterFacade->getNodeGrp(i); - m_nodeGroupInfo->addNodeToNodeGrp(i, true, nodeGrp); - Uint32 nodeId = m_nodeGroupInfo->getFirstConnectedNode(nodeGrp); - m_grepSender->setNodeId(nodeId); - if(m_nodeGroupInfo->getPrimaryNode(nodeGrp) == 0) { - m_nodeGroupInfo->setPrimaryNode(nodeGrp, nodeId); - } - m_doneSetGrepSender = true; -#if 0 - RLOG(("Added node %d to node group %d", i, nodeGrp)); -#endif - } - } - - return true; -} - -/***************************************************************************** - * Signal Queue Executor - *****************************************************************************/ - -class SigMatch -{ -public: - int gsn; - void (ExtNDB::* function)(NdbApiSignal *signal); - - SigMatch() { gsn = 0; function = NULL; }; - - SigMatch(int _gsn, void (ExtNDB::* _function)(NdbApiSignal *signal)) { - gsn = _gsn; - function = _function; - }; - - bool check(NdbApiSignal *signal) { - if(signal->readSignalNumber() == gsn) - return true; - return false; - }; -}; - -extern "C" -void *signalExecThread_C(void *r) -{ - ExtNDB *grepps = (ExtNDB*)r; - - grepps->signalExecThreadRun(); - - NdbThread_Exit(0); - /* NOTREACHED */ - return 0; -} - - -void -ExtNDB::signalExecThreadRun() -{ - Vector sl; - - /** - * Signals to be executed - */ - sl.push_back(SigMatch(GSN_SUB_GCP_COMPLETE_REP, - &ExtNDB::execSUB_GCP_COMPLETE_REP)); - - /** - * Is also forwarded to SSCoord - */ - sl.push_back(SigMatch(GSN_GREP_SUB_START_CONF, - &ExtNDB::execGREP_SUB_START_CONF)); - sl.push_back(SigMatch(GSN_GREP_SUB_CREATE_CONF, - &ExtNDB::execGREP_SUB_CREATE_CONF)); - sl.push_back(SigMatch(GSN_GREP_SUB_REMOVE_CONF, - &ExtNDB::execGREP_SUB_REMOVE_CONF)); - /** - * Signals to be forwarded - */ - sl.push_back(SigMatch(GSN_GREP_CREATE_SUBID_CONF, - &ExtNDB::execGREP_CREATE_SUBID_CONF)); - - sl.push_back(SigMatch(GSN_GREP_SUB_SYNC_CONF, &ExtNDB::sendSignalRep)); - - sl.push_back(SigMatch(GSN_GREP_SUB_REMOVE_REF, &ExtNDB::sendSignalRep)); - sl.push_back(SigMatch(GSN_GREP_SUB_SYNC_REF, &ExtNDB::sendSignalRep)); - sl.push_back(SigMatch(GSN_GREP_CREATE_SUBID_REF, &ExtNDB::sendSignalRep)); - - sl.push_back(SigMatch(GSN_GREP_SUB_START_REF, &ExtNDB::sendSignalRep)); - sl.push_back(SigMatch(GSN_GREP_SUB_CREATE_REF, &ExtNDB::sendSignalRep)); - - - while(1) { - SigMatch *handler = NULL; - NdbApiSignal *signal = NULL; - - if(m_signalRecvQueue.waitFor(sl, handler, signal, DEFAULT_TIMEOUT)) { -#if 0 - RLOG(("Removed signal from queue (GSN: %d, QSize: %d)", - signal->readSignalNumber(), m_signalRecvQueue.size())); -#endif - if(handler->function != 0) { - (this->*handler->function)(signal); - delete signal; signal = 0; - } else { - REPABORT("Illegal handler for signal"); - } - } - } -} - -void -ExtNDB::sendSignalRep(NdbApiSignal * s) -{ - if(m_repSender->sendSignal(s) == -1) - { - signalErrorHandler(s, 0); - } -} - -void -ExtNDB::execSignal(void* executorObj, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]) -{ - ExtNDB * executor = (ExtNDB*)executorObj; - - const Uint32 gsn = signal->readSignalNumber(); - const Uint32 len = signal->getLength(); - - NdbApiSignal * s = new NdbApiSignal(executor->m_ownRef); - switch(gsn){ - case GSN_SUB_GCP_COMPLETE_REP: - case GSN_GREP_CREATE_SUBID_CONF: - case GSN_GREP_SUB_CREATE_CONF: - case GSN_GREP_SUB_START_CONF: - case GSN_GREP_SUB_SYNC_CONF: - case GSN_GREP_SUB_REMOVE_CONF: - case GSN_GREP_CREATE_SUBID_REF: - case GSN_GREP_SUB_CREATE_REF: - case GSN_GREP_SUB_START_REF: - case GSN_GREP_SUB_SYNC_REF: - case GSN_GREP_SUB_REMOVE_REF: - s->set(0, SSREPBLOCKNO, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - break; - case GSN_SUB_TABLE_DATA: - executor->execSUB_TABLE_DATA(signal, ptr); - delete s; s=0; - break; - case GSN_SUB_META_DATA: - executor->execSUB_META_DATA(signal, ptr); - delete s; s=0; - break; - default: - REPABORT1("Illegal signal received in execSignal", gsn); - } - s=0; -#if 0 - ndbout_c("ExtNDB: Inserted signal into queue (GSN: %d, Len: %d)", - signal->readSignalNumber(), len); -#endif -} - -void -ExtNDB::execNodeStatus(void* obj, Uint16 nodeId, bool alive, bool nfCompleted) -{ - ExtNDB * thisObj = (ExtNDB*)obj; - - RLOG(("Changed node status (Id %d, Alive %d, nfCompleted %d)", - nodeId, alive, nfCompleted)); - - if(alive) { - /** - * Connected - */ - Uint32 nodeGrp = thisObj->m_transporterFacade->getNodeGrp(nodeId); - RLOG(("DB node %d of node group %d connected", nodeId, nodeGrp)); - - thisObj->m_nodeGroupInfo->addNodeToNodeGrp(nodeId, true, nodeGrp); - Uint32 firstNode = thisObj->m_nodeGroupInfo->getPrimaryNode(nodeGrp); - - if(firstNode == 0) - thisObj->m_nodeGroupInfo->setPrimaryNode(nodeGrp, nodeId); - - if (!thisObj->m_doneSetGrepSender) { - thisObj->m_grepSender->setNodeId(firstNode); - thisObj->m_doneSetGrepSender = true; - } - - RLOG(("Connect: First connected node in nodegroup: %d", - thisObj->m_nodeGroupInfo->getPrimaryNode(nodeGrp))); - - } else if (!nfCompleted) { - - /** - * Set node as "disconnected" in m_nodeGroupInfo until - * node comes up again. - */ - Uint32 nodeGrp = thisObj->m_transporterFacade->getNodeGrp(nodeId); - RLOG(("DB node %d of node group %d disconnected", - nodeId, nodeGrp)); - thisObj->m_nodeGroupInfo->setConnectStatus(nodeId, false); - /** - * The node that crashed was also the primary node, the we must change - * primary node - */ - if(nodeId == thisObj->m_nodeGroupInfo->getPrimaryNode(nodeGrp)) { - Uint32 node = thisObj->m_nodeGroupInfo->getFirstConnectedNode(nodeGrp); - if(node > 0) { - thisObj->m_grepSender->setNodeId(node); - thisObj->m_nodeGroupInfo->setPrimaryNode(nodeGrp, node); - } - else { - thisObj->sendDisconnectRep(nodeGrp); - } - } - RLOG(("Disconnect: First connected node in nodegroup: %d", - thisObj->m_nodeGroupInfo->getPrimaryNode(nodeGrp))); - - } else if(nfCompleted) { - } else { - REPABORT("Function execNodeStatus with wrong parameters"); - } -} - -/***************************************************************************** - * Signal Receivers for LOG and SCAN - *****************************************************************************/ - -/** - * Receive datalog/datascan from GREP/SUMA - */ -void -ExtNDB::execSUB_TABLE_DATA(NdbApiSignal * signal, LinearSectionPtr ptr[3]) -{ - SubTableData * const data = (SubTableData*)signal->getDataPtr(); - Uint32 tableId = data->tableId; - Uint32 operation = data->operation; - Uint32 gci = data->gci; - Uint32 nodeId = refToNode(signal->theSendersBlockRef); - - if((SubTableData::LogType)data->logType == SubTableData::SCAN) - { - Uint32 nodeGrp = m_nodeGroupInfo->findNodeGroup(nodeId); - - NodeGroupInfo::iterator * it; - it = new NodeGroupInfo::iterator(nodeGrp, m_nodeGroupInfo); - for(NodeConnectInfo * nci=it->first(); it->exists();nci=it->next()) { - m_gciContainerPS->insertLogRecord(nci->nodeId, tableId, - operation, ptr, gci); - } - delete it; it = 0; - } else { - m_gciContainerPS->insertLogRecord(nodeId, tableId, operation, ptr, gci); - } -} - -/** - * Receive metalog/metascan from GREP/SUMA - */ -void -ExtNDB::execSUB_META_DATA(NdbApiSignal * signal, LinearSectionPtr ptr[3]) -{ - Uint32 nodeId = refToNode(signal->theSendersBlockRef); - SubMetaData * const data = (SubMetaData*)signal->getDataPtr(); - Uint32 tableId = data->tableId; - Uint32 gci = data->gci; - - Uint32 nodeGrp = m_nodeGroupInfo->findNodeGroup(nodeId); - - NodeGroupInfo::iterator * it; - it = new NodeGroupInfo::iterator(nodeGrp, m_nodeGroupInfo); - for(NodeConnectInfo * nci=it->first(); it->exists();nci=it->next()) { - m_gciContainerPS->insertMetaRecord(nci->nodeId, tableId, ptr, gci); - RLOG(("Received meta record in %d[%d]", nci->nodeId, gci)); - } - - delete it; it = 0; -} - - -/***************************************************************************** - * Signal Receivers (Signals that are actually just forwarded to SS REP) - *****************************************************************************/ - -void -ExtNDB::execGREP_CREATE_SUBID_CONF(NdbApiSignal * signal) -{ - CreateSubscriptionIdConf const * conf = - (CreateSubscriptionIdConf *)signal->getDataPtr(); - Uint32 subId = conf->subscriptionId; - Uint32 subKey = conf->subscriptionKey; - ndbout_c("GREP_CREATE_SUBID_CONF m_extAPI=%p\n", m_extAPI); - m_extAPI->eventSubscriptionIdCreated(subId, subKey); -} - -/***************************************************************************** - * Signal Receivers - *****************************************************************************/ - -/** - * Receive information about completed GCI from GREP/SUMA - * - * GCI completed, i.e. no more unsent log records exists in SUMA - * @todo use node id to identify buffers? - */ -void -ExtNDB::execSUB_GCP_COMPLETE_REP(NdbApiSignal * signal) -{ - SubGcpCompleteRep * const rep = (SubGcpCompleteRep*)signal->getDataPtr(); - const Uint32 gci = rep->gci; - Uint32 nodeId = refToNode(rep->senderRef); - - RLOG(("Epoch %d completed at node %d", gci, nodeId)); - m_gciContainerPS->setCompleted(gci, nodeId); - - if(m_firstGCI == gci && !m_dataLogStarted) { - sendGREP_SUB_START_CONF(signal, m_firstGCI); - m_dataLogStarted = true; - } -} - -/** - * Send info that scan is competed to SS REP - * - * @todo Use node id to identify buffers? - */ -void -ExtNDB::sendGREP_SUB_START_CONF(NdbApiSignal * signal, Uint32 gci) -{ - RLOG(("Datalog started (Epoch %d)", gci)); - GrepSubStartConf * conf = (GrepSubStartConf *)signal->getDataPtrSend(); - conf->firstGCI = gci; - conf->subscriptionId = m_subId; - conf->subscriptionKey = m_subKey; - conf->part = SubscriptionData::TableData; - signal->m_noOfSections = 0; - signal->set(0, SSREPBLOCKNO, GSN_GREP_SUB_START_CONF, - GrepSubStartConf::SignalLength); - sendSignalRep(signal); -} - -/** - * Scan is completed... says SUMA/GREP - * - * @todo Use node id to identify buffers? - */ -void -ExtNDB::execGREP_SUB_START_CONF(NdbApiSignal * signal) -{ - GrepSubStartConf * const conf = (GrepSubStartConf *)signal->getDataPtr(); - Uint32 part = conf->part; - //Uint32 nodeId = refToNode(conf->senderRef); - m_firstGCI = conf->firstGCI; - - if (part == SubscriptionData::TableData) { - RLOG(("Datalog started (Epoch %d)", m_firstGCI)); - return; - } - RLOG(("Metalog started (Epoch %d)", m_firstGCI)); - - signal->set(0, SSREPBLOCKNO, GSN_GREP_SUB_START_CONF, - GrepSubStartConf::SignalLength); - sendSignalRep(signal); -} - -/** - * Receive no of node groups that PS has and pass signal on to SS - */ -void -ExtNDB::execGREP_SUB_CREATE_CONF(NdbApiSignal * signal) -{ - GrepSubCreateConf * conf = (GrepSubCreateConf *)signal->getDataPtrSend(); - m_subId = conf->subscriptionId; - m_subKey = conf->subscriptionKey; - - conf->noOfNodeGroups = m_nodeGroupInfo->getNoOfNodeGroups(); - sendSignalRep(signal); -} - -/** - * Receive conf that subscription has been remove in GREP/SUMA - * - * Pass signal on to TransPS - */ -void -ExtNDB::execGREP_SUB_REMOVE_CONF(NdbApiSignal * signal) -{ - m_gciContainerPS->reset(); - sendSignalRep(signal); -} - -/** - * If all PS nodes has disconnected, then remove all epochs - * for this subscription. - */ -void -ExtNDB::sendDisconnectRep(Uint32 nodeId) -{ - NdbApiSignal * signal = new NdbApiSignal(m_ownRef); - signal->set(0, SSREPBLOCKNO, GSN_REP_DISCONNECT_REP, - RepDisconnectRep::SignalLength); - RepDisconnectRep * rep = (RepDisconnectRep*) signal->getDataPtrSend(); - rep->nodeId = nodeId; - rep->subId = m_subId; - rep->subKey = m_subKey; - sendSignalRep(signal); -} diff --git a/ndb/src/old_files/rep/adapters/ExtNDB.hpp b/ndb/src/old_files/rep/adapters/ExtNDB.hpp deleted file mode 100644 index 228c980fd06..00000000000 --- a/ndb/src/old_files/rep/adapters/ExtNDB.hpp +++ /dev/null @@ -1,118 +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 EXTNDB_HPP -#define EXTNDB_HPP - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include "ExtAPI.hpp" - -extern "C" { -static void * signalExecThread_C(void *); -} - -/** - * @class ExtNDB - * @brief Class responsible for connection to primary system GREP - */ -class ExtNDB -{ -public: - /*************************************************************************** - * Constructor / Destructor - ***************************************************************************/ - ExtNDB(GCIContainerPS * gciContainer, ExtAPI * extAPI); - ~ExtNDB(); - bool init(const char * connectString = NULL); - - /*************************************************************************** - * Public Methods - ***************************************************************************/ - void setGrepSender(ExtSender * es) { m_grepSender = es; }; - ExtSender * getGrepSender() { return m_grepSender; }; - void setRepSender(ExtSender * es) { - m_extAPI->setRepSender(es); m_repSender = es; }; - void signalErrorHandler(NdbApiSignal * s, Uint32 nodeId); - -private: - friend void * signalExecThread_C(void *); - void signalExecThreadRun(); - - static void execSignal(void* signalSender, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); - - static void execNodeStatus(void* signalSender, NodeId, - bool alive, bool nfCompleted); - - void sendSignalRep(NdbApiSignal *); - void sendDisconnectRep(Uint32 nodeId); - - /*************************************************************************** - * Signal Executors - ***************************************************************************/ - void execSUB_GCP_COMPLETE_REP(NdbApiSignal*); - void execGREP_SUB_CREATE_CONF(NdbApiSignal * signal); - void execGREP_SUB_REMOVE_CONF(NdbApiSignal * signal); - void execGREP_SUB_START_CONF(NdbApiSignal * signal); - void sendGREP_SUB_START_CONF(NdbApiSignal * signal, Uint32 gci); - void execSUB_TABLE_DATA(NdbApiSignal * signal,LinearSectionPtr ptr[3]); - void execSUB_META_DATA(NdbApiSignal * signal,LinearSectionPtr ptr[3]); - - // Signals that are actually just fowarded to REP - void execGREP_CREATE_SUBID_CONF(NdbApiSignal *); - - /*************************************************************************** - * Private Variables - ***************************************************************************/ - struct NdbThread * m_signalExecThread; - class SignalQueue m_signalRecvQueue; - - Uint32 m_ownNodeId; ///< NodeId of this node - Uint32 m_ownBlockNo; ///< BlockNo of this "block" - BlockReference m_ownRef; ///< Reference to this - - ExtSender * m_grepSender; ///< Responsible send to GREP - ExtSender * m_repSender; ///< Responsible send to SS REP - - NodeGroupInfo * m_nodeGroupInfo; - GCIContainerPS * m_gciContainerPS; ///< Interface to GCICotainer - ///< seen by PS - TransporterFacade * m_transporterFacade; - - bool m_doneSetGrepSender; ///< Only done once - bool m_dataLogStarted; - Uint32 m_subId; - Uint32 m_subKey; - Uint32 m_firstGCI; - - ExtAPI * m_extAPI; -}; - -#endif diff --git a/ndb/src/old_files/rep/adapters/Makefile b/ndb/src/old_files/rep/adapters/Makefile deleted file mode 100644 index bdd711510c3..00000000000 --- a/ndb/src/old_files/rep/adapters/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapi repserver kernel - -ARCHIVE_TARGET := repadapters - -SOURCES = ExtNDB.cpp \ - AppNDB.cpp \ - ExtAPI.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/adapters/TableInfoPs.hpp b/ndb/src/old_files/rep/adapters/TableInfoPs.hpp deleted file mode 100644 index 3fa25979255..00000000000 --- a/ndb/src/old_files/rep/adapters/TableInfoPs.hpp +++ /dev/null @@ -1,118 +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 TABLEINFO_PS_HPP -#define TABLEINFO_PS_HPP - -#include -#include -#include -#include - -struct TableInfo { - Uint32 tableId; - char* tableName; -}; - -/** - * @class TableInfoPS - * @brief Meta information about tables stored on PS - */ -class TableInfoPs { -public: - inline void insert(const Uint32 tableId, const char * tableName); - - inline bool del(const Uint32 tableId); - - inline char * getTableName(const Uint32 tableId) const; - -private: - Vector tableInfo; - - inline TableInfo * lookup(const Uint32 tableId) const; - inline TableInfo * lookup(const Uint32 tableId , Uint32 * pos) const; -}; - -inline -TableInfo * -TableInfoPs::lookup(const Uint32 tableId) const{ - TableInfo * table; - Uint32 i=0; - - while(itableId == tableId) - return table; - i++; - } - return 0; -} - -inline -TableInfo * -TableInfoPs::lookup(const Uint32 tableId, Uint32 * pos ) const{ - TableInfo * table; - Uint32 i=0; - while(itableId == tableId) { - *pos=i; - return table; - } - i++; - } - return 0; -} - - -inline -char * -TableInfoPs::getTableName(const Uint32 tableId) const{ - TableInfo * table; - table=lookup(tableId); - if(table!=0) - return table->tableName; - return 0; -} - - -inline -void -TableInfoPs::insert(const Uint32 tableId, const char * tableName) { - TableInfo * table = new TableInfo; - table->tableId=tableId; - table->tableName=strdup(tableName); - tableInfo.push_back(table); -} - -inline -bool -TableInfoPs::del(const Uint32 tableId) { - - TableInfo * table; - Uint32 i=0; - table = lookup(tableId, &i); - - if(table!=0) { - NdbMem_Free(table->tableName); - delete table; - tableInfo.erase(i); - return true; - } - return false; -} - -#endif diff --git a/ndb/src/old_files/rep/dbug_hack.cpp b/ndb/src/old_files/rep/dbug_hack.cpp deleted file mode 100644 index 74e5f080777..00000000000 --- a/ndb/src/old_files/rep/dbug_hack.cpp +++ /dev/null @@ -1,75 +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 */ - -#include - -#include -#include "NdbOut.hpp" -#include "rep_version.hpp" - -int replogEnabled; - -/** - * @todo This should be implemented using MySQLs dbug library - */ -#if 0 -extern "C" -void -DBUG_PRINT(const char * fmt, ...) -{ -#ifdef DBUG - va_list ap; - char buf[1000]; - - va_start(ap, fmt); - if (fmt != 0) - vsnprintf(buf, sizeof(buf)-1, fmt, ap); - ndbout << buf << endl; - va_end(ap); -#endif -} -#endif - -extern "C" -void -replog(const char * fmt, ...) -{ - if (replogEnabled) - { - va_list ap; - char buf[1000]; - - va_start(ap, fmt); - if (fmt != 0) - vsnprintf(buf, sizeof(buf)-1, fmt, ap); - ndbout << buf << endl; - va_end(ap); - } -} - -extern "C" -void -rlog(const char * fmt, ...) -{ - va_list ap; - char buf[1000]; - - va_start(ap, fmt); - if (fmt != 0) - vsnprintf(buf, sizeof(buf)-1, fmt, ap); - ndbout << buf; - va_end(ap); -} diff --git a/ndb/src/old_files/rep/rep_version.hpp b/ndb/src/old_files/rep/rep_version.hpp deleted file mode 100644 index 3830f9c351c..00000000000 --- a/ndb/src/old_files/rep/rep_version.hpp +++ /dev/null @@ -1,88 +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 REP_VERSION_HPP -#define REP_VERSION_HPP - -/** - * Block number for REP - */ -#define SSREPBLOCKNO 1 -#define PSREPBLOCKNO 2 - -#define DBUG - -#include - -extern "C" -void -DBUG_PRINT__(const char * fmt, ...); - -extern "C" -void -replog(const char * fmt, ...); - -extern "C" -void -rlog(const char * fmt, ...); - -#define RLOG(ARGS) \ - do { if (replogEnabled) { \ - rlog ARGS; \ - ndbout << " (" << __FILE__ << ":" << __LINE__ << ")" << endl; \ - } \ - } while (0) - -/** - * Replication logging on or off - */ -extern int replogEnabled; - -/** - * Used for config id - */ -#define REP_VERSION_ID NDB_VERSION - -#define MAX_NODE_GROUPS 6 - -#define REPABORT(string) \ - { \ - ndbout_c("\nInternal error in %s:%d: %s", __FILE__, __LINE__, string); \ - abort(); \ - } -#define REPABORT1(string, data1) \ - { \ - ndbout_c("\nInternal error in %s:%d: %s" \ - "\n (data1: %d)", \ - __FILE__, __LINE__, string, data1); \ - abort(); \ - } -#define REPABORT2(string, data1, data2) \ - { \ - ndbout_c("\nInternal error in %s:%d: %s" \ - "\n (data1: %d, data2: %d)", \ - __FILE__, __LINE__, string, data1, data2); \ - abort(); \ - } -#define REPABORT3(string, data1, data2, data3) \ - { \ - ndbout_c("\nInternal error in %s:%d: %s" \ - "\n (data1: %d, data2: %d data3: %d)", \ - __FILE__, __LINE__, string, data1, data2, data3); \ - abort(); \ - } - -#endif diff --git a/ndb/src/old_files/rep/repapi/Makefile b/ndb/src/old_files/rep/repapi/Makefile deleted file mode 100644 index fdd153f1060..00000000000 --- a/ndb/src/old_files/rep/repapi/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include .defs.mk - -TYPE := util - -PIC_ARCHIVE := Y -ARCHIVE_TARGET := repapi - -A_LIB := Y -SO_LIB := Y -PIC_LIB := Y - -#DIRS := test - -LIB_TARGET := REP_API -LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) general portlib - -# Source files of non-templated classes (.C files) -SOURCES = repapi.cpp - -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \ - -I$(call fixpath,$(NDB_TOP)/src/common/mgmcommon) - -CCFLAGS += -DNO_DEBUG_MESSAGES - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/repapi/repapi.cpp b/ndb/src/old_files/rep/repapi/repapi.cpp deleted file mode 100644 index d34ab098c9c..00000000000 --- a/ndb/src/old_files/rep/repapi/repapi.cpp +++ /dev/null @@ -1,598 +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 */ - -#include -#include -#include "repapi.h" -//#include "mgmapi_debug.h" -#include - -#include -#include -#include -#include -#include - -#if defined VM_TRACE && !defined NO_DEBUG_MESSAGES -#define DEBUG(x) ndbout << x << endl; -#elif defined NO_DEBUG_MESSAGES -#define DEBUG(x) -#endif - -#ifdef NDB_WIN32 -#define EBADMSG EFAULT -#endif - - - -class ParserDummy2 : SocketServer::Session { -public: - ParserDummy2(NDB_SOCKET_TYPE sock); -}; - -ParserDummy2::ParserDummy2(NDB_SOCKET_TYPE sock) : SocketServer::Session(sock) { - -} - -typedef Parser Parser_t; - - -#define REP_CMD(name, fun, desc) \ - { name, \ - 0, \ - ParserRow::Cmd, \ - ParserRow::String, \ - ParserRow::Optional, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - fun, \ - desc, 0 } - -#define REP_ARG(name, type, opt, desc) \ - { name, \ - 0, \ - ParserRow::Arg, \ - ParserRow::type, \ - ParserRow::opt, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - 0, \ - desc, 0 } - -#define REP_END() \ - { 0, \ - 0, \ - ParserRow::Arg, \ - ParserRow::Int, \ - ParserRow::Optional, \ - ParserRow::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0, 0 } - -struct ndb_rep_handle { - char * hostname; - unsigned short port; - - int connected; - int last_error; - int last_error_line; - int read_timeout; - int write_timeout; - - NDB_SOCKET_TYPE socket; - -#ifdef REPAPI_LOG - FILE* logfile; -#endif -}; - -#define SET_ERROR(h, e) \ - h->last_error = e; \ - h->last_error_line = __LINE__; - -extern "C" -NdbRepHandle -ndb_rep_create_handle(){ - NdbRepHandle h = (NdbRepHandle)malloc(sizeof(ndb_rep_handle)); - h->connected = 0; - h->last_error = 0; - h->last_error_line = 0; - h->hostname = 0; - h->socket = -1; - h->read_timeout = 50000; - h->write_timeout = 100; - -#ifdef REPAPI_LOG - h->logfile = 0; -#endif - - return h; -} - -/** - * Destroy a handle - */ -extern "C" -void -ndb_rep_destroy_handle(NdbRepHandle * handle){ - if(!handle) - return; - if((* handle)->connected){ - ndb_rep_disconnect(* handle); - } - if((* handle)->hostname != 0){ - free((* handle)->hostname); - } -#ifdef REPAPI_LOG - if ((* handle)->logfile != 0){ - fclose((* handle)->logfile); - (* handle)->logfile = 0; - } -#endif - free(* handle); - * handle = 0; -} - -/** - * Get latest error associated with a handle - */ -extern "C" -int -ndb_rep_get_latest_error(const NdbRepHandle h){ - return h->last_error; -} - -/** - * Get latest error line associated with a handle - */ -extern "C" -int -ndb_rep_get_latest_error_line(const NdbRepHandle h){ - return h->last_error_line; -} - -static -int -parse_connect_string(const char * connect_string, - NdbRepHandle handle){ - - if(connect_string == 0){ - DEBUG("connect_string == 0"); - SET_ERROR(handle, EINVAL); - return -1; - } - - char * line = strdup(connect_string); - if(line == 0){ - DEBUG("line == 0"); - SET_ERROR(handle, ENOMEM); - return -1; - } - - char * tmp = strchr(line, ':'); - if(tmp == 0){ - DEBUG("tmp == 0"); - free(line); - SET_ERROR(handle, EINVAL); - return -1; - } - * tmp = 0; tmp++; - - int port = 0; - if(sscanf(tmp, "%d", &port) != 1){ - DEBUG("sscanf() != 1"); - free(line); - SET_ERROR(handle, EINVAL); - return -1; - } - - if(handle->hostname != 0) - free(handle->hostname); - - handle->hostname = strdup(line); - handle->port = port; - free(line); - return 0; -} - -/* - * Call an operation, and return the reply - */ -static const Properties * -ndb_rep_call(NdbRepHandle handle, - const ParserRow *command_reply, - const char *cmd, - const Properties *cmd_args) { - SocketOutputStream out(handle->socket); - SocketInputStream in(handle->socket, handle->read_timeout); - - out.println(cmd); -#ifdef REPAPI_LOG - /** - * Print command to log file - */ - FileOutputStream f(handle->logfile); - f.println("OUT: %s", cmd); -#endif - - if(cmd_args != NULL) { - Properties::Iterator iter(cmd_args); - const char *name; - while((name = iter.next()) != NULL) { - PropertiesType t; - Uint32 val_i; - BaseString val_s; - - cmd_args->getTypeOf(name, &t); - switch(t) { - case PropertiesType_Uint32: - cmd_args->get(name, &val_i); - out.println("%s: %d", name, val_i); - break; - case PropertiesType_char: - cmd_args->get(name, val_s); - out.println("%s: %s", name, val_s.c_str()); - break; - default: - /* Ignore */ - break; - } - } -#ifdef REPAPI_LOG - /** - * Print arguments to log file - */ - cmd_args->print(handle->logfile, "OUT: "); -#endif - } - out.println(""); - - Parser_t::Context ctx; - ParserDummy2 session(handle->socket); - Parser_t parser(command_reply, in, true, true, true); - -#if 1 - const Properties* p = parser.parse(ctx, session); - if (p == NULL){ - /** - * Print some info about why the parser returns NULL - */ - ndbout << " status=" << ctx.m_status << ", curr="<print(handle->logfile, "IN: "); - } -#endif - return p; -#else - return parser.parse(ctx, session); -#endif -} - -/** - * Connect to a rep server - * - * Returns 0 if OK, sets ndb_rep_handle->last_error otherwise - */ -extern "C" -int -ndb_rep_connect(NdbRepHandle handle, const char * repsrv){ - - if(handle == 0) - return -1; - - if(parse_connect_string(repsrv, handle) != 0) - return -1; - - -#ifdef REPAPI_LOG - /** - * Open the log file - */ - char logname[64]; - snprintf(logname, 64, "repapi.log"); - handle->logfile = fopen(logname, "w"); -#endif - - /** - * Do connect - */ - const NDB_SOCKET_TYPE sockfd = socket(AF_INET, SOCK_STREAM, 0); - if (sockfd == NDB_INVALID_SOCKET) { - DEBUG("socket() == INVALID_SOCKET"); - return -1; - } - - struct sockaddr_in servaddr; - memset(&servaddr, 0, sizeof(servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons(handle->port); - // Convert ip address presentation format to numeric format - const int res1 = Ndb_getInAddr(&servaddr.sin_addr, handle->hostname); - if (res1 != 0) { - DEBUG("Ndb_getInAddr(...) == -1"); - return -1; - } - - const int res2 = connect(sockfd, (struct sockaddr*) &servaddr, - sizeof(servaddr)); - if (res2 == -1) { - DEBUG("connect() == -1"); - NDB_CLOSE_SOCKET(sockfd); - return -1; - } - - handle->socket = sockfd; - handle->connected = 1; - - return 0; -} - -/** - * Disconnect from a rep server - */ -extern "C" -void -ndb_rep_disconnect(NdbRepHandle handle){ - if(handle == 0) - return; - - if(handle->connected != 1){ - return; - } - - NDB_CLOSE_SOCKET(handle->socket); - handle->socket = -1; - handle->connected = 0; - - return; -} - - - -/****************************************************************************** - * Global Replication - ******************************************************************************/ -extern "C" -int ndb_rep_command(NdbRepHandle handle, - unsigned int request, - unsigned int* replication_id, - struct ndb_rep_reply* /*reply*/, - unsigned int epoch) { - - *replication_id = 0; - - const ParserRow replication_reply[] = { - REP_CMD("global replication reply", NULL, ""), - REP_ARG("result", Int, Mandatory, "Error message"), - REP_ARG("id", Int, Optional, "Id of global replication"), - REP_END() - }; - - if (handle == 0) { - return -1; - } - - if (handle->connected != 1) { - handle->last_error = EINVAL; - return -1; - } - - Properties args; - args.put("request", request); - args.put("id", *replication_id); - if(epoch > 0) - args.put("epoch",epoch); - else - args.put("epoch",(unsigned int)0); - - const Properties *reply; - reply = ndb_rep_call(handle, replication_reply, "rep", &args); - - if(reply == NULL) { - handle->last_error = EIO; - return -1; - } - - reply->get("id", replication_id); - Uint32 result; - reply->get("result", &result); - delete reply; - return result; -} - -extern "C" -int convert2int(char * first, char * last, unsigned int f[], unsigned int l[]) -{ - char * ftok = strtok(first, ","); - char * ltok = strtok(last, ","); - Uint32 i=0; - while(ftok!=NULL && ltok!=NULL) - { - f[i] = atoi(ftok); - l[i] = atoi(ltok); - ftok = strtok(NULL, ","); - ltok = strtok(NULL, ","); - i++; - } - - return 0; -} - - -int ndb_rep_query(NdbRepHandle handle, - QueryCounter counter, - unsigned int* replicationId, - struct ndb_rep_reply* /*reply*/, - struct rep_state * state) -{ - *replicationId = 0; // not used currently. - - if(state == 0) - return -1; - - const ParserRow replication_reply[] = { - REP_CMD("global replication query reply", NULL, ""), - REP_ARG("result", String, Mandatory, "Error message"), - REP_ARG("id", Int, Mandatory, "replicationId"), - REP_ARG("no_of_nodegroups", Int, Optional, "number of nodegroups"), - REP_ARG("subid", Int, Optional, "Id of subscription"), - REP_ARG("subkey", Int, Optional, "Key of subscription"), - REP_ARG("connected_rep", Int, Optional, "connected to rep"), - REP_ARG("connected_db", Int, Optional, "connected to db"), - REP_ARG("first", String, Optional, ""), - REP_ARG("last", String, Optional, ""), - REP_ARG("state_sub", Int, Optional, "state of subsription"), - REP_ARG("state", Int, Optional, "state"), - REP_END() - }; - - if (handle == 0) { - return -1; - } - - if (handle->connected != 1) { - handle->last_error = EINVAL; - return -1; - } - - const Properties *props; - Properties args; - Uint32 request = 0; - args.put("request", request); - args.put("id", *replicationId); - args.put("counter" , (Uint32)counter); - props = ndb_rep_call(handle, replication_reply, "rep query", &args); - - BaseString result; - props->get("result", result); - if(strcmp(result.c_str(), "Ok") != 0) - { - delete props; - return 1; - } - state->queryCounter = counter; - unsigned int no_of_nodegroups; - props->get("no_of_nodegroups", &no_of_nodegroups); - state->no_of_nodegroups = no_of_nodegroups; - - if(counter >= 0) - { - BaseString first, last; - props->get("first", first); - props->get("last", last); - convert2int((char*)first.c_str(), (char*)last.c_str(), - state->first , state->last ); - } else - { - for(Uint32 i = 0; ifirst[i] = 0; - state->last[i] = 0; - } - } - - unsigned int connected_rep = 0; - props->get("connected_rep", &connected_rep); - state->connected_rep = connected_rep; - - unsigned int connected_db = 0; - props->get("connected_rep", &connected_db); - state->connected_db = connected_db; - - unsigned int subid; - props->get("subid", &subid); - state->subid = subid; - - unsigned int subkey; - props->get("subkey", &subkey); - state->subkey = subkey; - - unsigned int _state; - props->get("state", &_state); - state->state = _state; - - unsigned int state_sub; - props->get("state_sub", &state_sub); - state->state_sub = state_sub; - - if(props == NULL) { - handle->last_error = EIO; - return -1; - } - delete props; - - return 0; -} - - -extern "C" -int -ndb_rep_get_status(NdbRepHandle handle, - unsigned int* replication_id, - struct ndb_rep_reply* /*reply*/, - struct rep_state * repstate) { - - const ParserRow replication_reply[] = { - REP_CMD("global replication status reply", NULL, ""), - REP_ARG("result", String, Mandatory, "Error message"), - REP_ARG("id", Int, Optional, "Error message"), - REP_ARG("subid", Int, Optional, "Id of subscription"), - REP_ARG("subkey", Int, Optional, "Key of subscription"), - REP_ARG("connected_rep", Int, Optional, "connected to rep"), - REP_ARG("connected_db", Int, Optional, "connected to db"), - REP_ARG("state_sub", Int, Optional, "state of subsription"), - REP_ARG("state", Int, Optional, "state"), - REP_END() - }; - - if (handle == 0) { - return -1; - } - - if (handle->connected != 1) { - handle->last_error = EINVAL; - return -1; - } - - const Properties *reply; - Properties args; - Uint32 request = 0; - args.put("request", request); - reply = ndb_rep_call(handle, replication_reply, "rep status", &args); - - if(reply == NULL) { - handle->last_error = EIO; - return -1; - } - - Uint32 result; - reply->get("result", &result); - reply->get("id", replication_id); - reply->get("subid", (Uint32*)&repstate->subid); - reply->get("subkey", (Uint32*)&repstate->subkey); - reply->get("connected_rep", (Uint32*)&repstate->connected_rep); - reply->get("connected_db", (Uint32*)&repstate->connected_db); - reply->get("state", (Uint32*)&repstate->state); - reply->get("state_sub", (Uint32*)&repstate->state_sub); - - delete reply; - return result; -} diff --git a/ndb/src/old_files/rep/repapi/repapi.h b/ndb/src/old_files/rep/repapi/repapi.h deleted file mode 100644 index 170e493cd86..00000000000 --- a/ndb/src/old_files/rep/repapi/repapi.h +++ /dev/null @@ -1,216 +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 REPAPI_H -#define REPAPI_H - -/** - * @mainpage NDB Cluster REP API - * - * The NDB Cluster Replication API (REP API) consists of a C API - * which is used to: - * - Start and stop replication - * - Other administrative tasks - * - * The functions use simple ASCII based - * commands to interact with thw Replication Server. - * - * - * @section General Concepts - * - * Each REP API function call needs an rep_C_Api::NdbRepHandle - * which initally is created by - * calling the function ndb_rep_create_handle(). - * - * A function can return: - * -# An integer value. If it returns 0 then this indicates success. - * -# A pointer value. If it returns NULL then check the latest error. - * If it didn't return NULL, then "something" is returned. - * This "something" has to be free:ed by the user of the REP API. - */ - -/** @addtogroup REP_C_API - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define REPAPI_MAX_NODE_GROUPS 4 - /** - * The NdbRepHandle. - */ - typedef struct ndb_rep_handle * NdbRepHandle; - - - /** - * Default reply from the server - */ - struct ndb_rep_reply { - int return_code; ///< 0 if successful, - ///< otherwise error code - char message[256]; ///< Error or reply message. - }; - - enum QueryCounter { - PS = 0, ///< Stored on Primary System REP - SSReq = 1, ///< Requested for transfer to Standby System - SS = 2, ///< Stored on Standby System REP - AppReq = 3, ///< Requested to be applied to Standby System - App = 4, ///< Has been applied to Standby System - DelReq = 5, ///< Has been requested to be deleted on PS REP & SS REP - Subscription = 6, - ConnectionRep = 7, - ConnectionDb = 8 - }; - - - struct rep_state { - QueryCounter queryCounter; - unsigned int no_of_nodegroups; - unsigned int connected_rep; - unsigned int connected_db; - unsigned int subid; - unsigned int subkey; - unsigned int state; - unsigned int state_sub; - unsigned int first[REPAPI_MAX_NODE_GROUPS]; //4 = max no of nodegroups - unsigned int last[REPAPI_MAX_NODE_GROUPS]; //4 = max no of nodegroups - }; - - - - - - - /*************************************************************************** - * FUNCTIONS - ***************************************************************************/ - /** - * Create a handle - * - * @return A handle != 0 - * or 0 if failed to create one. (Check errno then). - */ - NdbRepHandle ndb_rep_create_handle(); - - /** - * Destroy a handle - * - * @param handle Rep server handle - */ - void ndb_rep_destroy_handle(NdbRepHandle * handle); - - /** - * Get latest error associated with a handle - * - * @param handle Rep server handle - * @return Latest error. - */ - int ndb_rep_get_latest_error(const NdbRepHandle handle); - - /** - * Get latest error line associated with a handle - * - * @param handle Rep server handle. - * @return Latest error line. - */ - int ndb_rep_get_latest_error_line(const NdbRepHandle handle); - - /** - * Connect to a REP server - * - * @param handle Rep server handle. - * @param repsrv Hostname and port of the REP server, - * "hostname:port". - * @return 0 if OK, sets ndb_rep_handle->last_error otherwise. - */ - int ndb_rep_connect(NdbRepHandle handle, const char * repsrv); - - /** - * Disconnect from a REP server - * - * @param handle Rep server handle. - */ - void ndb_rep_disconnect(NdbRepHandle handle); - - - /** - * Global Replication Command - * - * @param handle NDB REP handle. - * @param request Type of request - * @param replicationId Replication id is returned from function. - * @param reply Reply message. - * @param epoch Currenty used to STOP at a certain EPOCH - * @return 0 if successful, error code otherwise. - */ - int ndb_rep_command(NdbRepHandle handle, - unsigned int request, - unsigned int* replicationId, - struct ndb_rep_reply* reply, - unsigned int epoch = 0); - - - /** - * Global Replication Command - * - * @param handle NDB REP handle. - * @param counter Type of request. If <0, then - "first" and "last" in repstate - is set to 0;x - * @param replicationId Replication id is returned from function. - * @param reply Reply message. - * @param repstate Struct containing queried data. (Note! - * All values are set in the struct, regardless - which QueryCounter that has been set - * @return 0 if successful, error code otherwise. - */ - int ndb_rep_query(NdbRepHandle handle, - QueryCounter counter, - unsigned int* replicationId, - struct ndb_rep_reply* reply, - struct rep_state * repstate); - - -/** - * @deprecated (will probably be). Can use ndb_rep_query instead. - */ - int ndb_rep_get_status(NdbRepHandle handle, - unsigned int* replication_id, - struct ndb_rep_reply* /*reply*/, - struct rep_state * repstate); - - - - enum RequestStatusCode { - OK = 0, ///< Everything OK - Error = 1, ///< Generic error - AlreadyExists = 2, ///< Entry already exists in list - NotExists = 3, ///< Entry does not exist in list - AlreadyStopped = 4 - }; - - - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif diff --git a/ndb/src/old_files/rep/state/Channel.cpp b/ndb/src/old_files/rep/state/Channel.cpp deleted file mode 100644 index a7f7b90d3fe..00000000000 --- a/ndb/src/old_files/rep/state/Channel.cpp +++ /dev/null @@ -1,487 +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 */ - -#include "Channel.hpp" - -Channel::Channel() -{ - reset(); -} - -Channel::~Channel() -{ - /** - * Destroy list of selected tables - */ - for(Uint32 i=0; i < m_selectedTables.size(); i++) { - delete m_selectedTables[i]; - m_selectedTables[i] = 0; - } - m_selectedTables=0; -} - -void -Channel::reset() -{ - for (Uint32 i=0; ionlyLeft(GREP_SYSTEM_TABLE_MAX_RANGE); - i->onlyUpToValue(m_stopEpochId); - if (i->isEmpty()) return false; - - add(SSReq, nodeGrp, *i); - invariant(); - return true; -} - -bool -Channel::requestApply(Uint32 nodeGrp, Uint32 * epoch) -{ - invariant(); - Interval tmp1, tmp2; - - // tmp2 = SS - AppReq - App - intervalLeftMinus(state[nodeGrp][SS], state[nodeGrp][AppReq], &tmp1); - intervalLeftMinus(tmp1, state[nodeGrp][App], &tmp2); - - tmp2.onlyUpToValue(m_stopEpochId); - if (tmp2.isEmpty()) return false; - tmp2.onlyLeft(1); - - // Check that all GCI Buffers for epoch exists in SS - for (Uint32 i=0; iisEmpty()) return false; - i->onlyLeft(GREP_SYSTEM_TABLE_MAX_RANGE); - - invariant(); - add(DelReq, nodeGrp, *i); - invariant(); - return true; -} - -void -Channel::add(Position pos, Uint32 nodeGrp, const Interval i) -{ - Interval r; - intervalAdd(state[nodeGrp][pos], i, &r); - state[nodeGrp][pos].set(r); -} - -void -Channel::clear(Position p, Uint32 nodeGrp, const Interval i) -{ - Interval r; - intervalLeftMinus(state[nodeGrp][p], i, &r); - state[nodeGrp][p].set(r); -} - -bool -Channel::isSynchable(Uint32 nodeGrp) -{ - return true; - /* - @todo This should be implemented... - - Interval tmp1, tmp2; - intervalAdd(state[nodeGrp][PS], state[nodeGrp][SSReq], &tmp1); - intervalAdd(tmp1, state[nodeGrp][SSReq], &tmp2); - intervalAdd(tmp2, state[nodeGrp][SS], &tmp1); - intervalAdd(tmp1, state[nodeGrp][AppReq], &tmp2); - intervalAdd(tmp2, state[nodeGrp][App], &tmp1); - if (intervalInclude(state[nodeGrp][PS], tmp1.right())) - return true; - else - return false; - */ -} - -/** - * Return the cut of all App:s. - */ -void -Channel::getFullyAppliedEpochs(Interval * interval) -{ - if (m_noOfNodeGroups < 1) { - *interval = emptyInterval; - return; - } - - *interval = universeInterval; - for (Uint32 i=0; ifirst() < state[i][App].first()) { - interval->setFirst(state[i][App].first()); - } - if (state[i][App].last() < interval->last()) { - interval->setLast(state[i][App].last()); - } - } - interval->normalize(); - return; -} - -/** - * Return true if it is ok to remove the subscription and then stop channel - */ -bool -Channel::isStoppable() -{ - /** - * Check that AppReq are empty for all nodegrps - */ - for (Uint32 i=0; i interval.last()) { - RLOG(("Stop disallowed. AppReq empty. Stop %d, LastApplied %d", - m_stopEpochId, interval.last())); - return false; - } - - return true; -} - -GrepError::Code -Channel::setStopEpochId(Uint32 n) -{ - /** - * If n equal to zero, use next possible epoch (max(App, AppReq)) - */ - if (n == 0) { - for (Uint32 i=0; i n) ? state[i][App].last() : n; - n = (state[i][AppReq].last() > n) ? state[i][AppReq].last() : n; - } - } - - /** - * If n >= max(App, AppReq) then set value, else return error code - */ - for (Uint32 i=0; iMAX_TAB_NAME_SIZE) - return GrepError::REP_NOT_PROPER_TABLE; - /** - * No of separators are the number of table_name_separator found in tableName - * since a table is defined as //tablename. - * if noOfSeparators is not equal to 2, then it is not a valid - * table name. - */ - Uint32 noOfSeps = 0; - if(strlen(tableName) < 5) - return GrepError::REP_NOT_PROPER_TABLE; - for(Uint32 i =0; i < strlen(tableName); i++) - if(tableName[i]==table_name_separator) - noOfSeps++; - if(noOfSeps!=2) - return GrepError::REP_NOT_PROPER_TABLE; - table * t= new table(tableName); - for(Uint32 i=0; itableName)==0) - return GrepError::REP_TABLE_ALREADY_SELECTED; - } - m_selectedTables.push_back(t); - return GrepError::NO_ERROR; -} - -GrepError::Code -Channel::removeTable(const char * tableName) -{ - if(strlen(tableName)>MAX_TAB_NAME_SIZE) - return GrepError::REP_NOT_PROPER_TABLE; - /** - * No of separators are the number of table_name_separator found in tableName - * since a table is defined as //tablename. - * If noOfSeparators is not equal to 2, - * then it is not a valid table name. - */ - Uint32 noOfSeps = 0; - if(strlen(tableName) < 5) - return GrepError::REP_NOT_PROPER_TABLE; - for(Uint32 i =0; i < strlen(tableName); i++) - if(tableName[i]==table_name_separator) - noOfSeps++; - if(noOfSeps!=2) - return GrepError::REP_NOT_PROPER_TABLE; - for(Uint32 i=0; itableName)==0) { - delete m_selectedTables[i]; - m_selectedTables.erase(i); - return GrepError::NO_ERROR; - } - } - return GrepError::REP_TABLE_NOT_FOUND; -} - -void -Channel::printTables() -{ - if(m_selectedTables.size() == 0) - ndbout_c("| ALL TABLES " - " |"); - else { - for(Uint32 i=0; itableName); - } -} - -Vector * -Channel::getSelectedTables() -{ - if(m_selectedTables.size() == 0) return 0; - return &m_selectedTables; -} - -/***************************************************************************** - * PRINT - *****************************************************************************/ - -void -Channel::print(Position pos) -{ - switch(pos){ - case PS: ndbout << "PS Rep"; break; - case SSReq: ndbout << "Tra-Req"; break; - case SS: ndbout << "SS Rep"; break; - case AppReq: ndbout << "App-Req"; break; - case App: ndbout << "Applied"; break; - case DelReq: ndbout << "Del-Req"; break; - default: REPABORT("Unknown replication position"); - } -} - -void -Channel::print() -{ - for (Uint32 i=0; i -#include -#include -#include - - -/** - * Max number of requested epochs from PS - */ -#define GREP_SYSTEM_TABLE_MAX_RANGE 20 - -#define MAX_NO_OF_NODE_GROUPS 32 - -/** - * This table struct is used in m_selectedTables - */ -struct table{ - table(const char * n) {strncpy(tableName, n, MAX_TAB_NAME_SIZE);} - char tableName[MAX_TAB_NAME_SIZE]; -}; - -/** - * @class Channel - * @brief Represents location of various epochs belonging to a subscription - */ -class Channel { -public: - enum StateSub - { - NO_SUBSCRIPTION_EXISTS, - - CREATING_SUBSCRIPTION_ID, - SUBSCRIPTION_ID_CREATED, - - STARTING_SUBSCRIPTION, - SUBSCRIPTION_STARTED - }; - - enum StateRep - { - CONSISTENT, ///< Consistent database. Grep not running. - METALOG_STARTING, ///< Starting. Starting METALOG subscription - METALOG_STARTED, - METASCAN_STARTING, ///< Starting. Starting METASCAN subscription - METASCAN_COMPLETED, - DATALOG_STARTING, ///< Starting. Starting DATALOG subscription - DATALOG_STARTED, - DATASCAN_STARTING, ///< Starting. Starting DATASCAN subscription - DATASCAN_COMPLETED, - LOG, ///< Started. Cons/Inconsistent. Grep running. - ///< All scan records have been applied. - STOPPING ///< Channel is stopping - }; - - /** - * Storage "positions" of Epochs - */ - enum Position { - PS = 0, ///< Stored on Primary System REP - SSReq = 1, ///< Requested for transfer to Standby System - SS = 2, ///< Stored on Standby System REP - AppReq = 3, ///< Requested to be applied to Standby System - App = 4, ///< Has been applied to Standby System - DelReq = 5, ///< Has been requested to be deleted on PS REP & SS REP - NO_OF_POSITIONS = 6 - }; //DONT FORGET TO ADD STUFF in position2Name if u add somehting here, - - /*************************************************************************** - * CONSTRUCTOR / DESTRUCTOR - ***************************************************************************/ - Channel(); - ~Channel(); - - /** - * Get and set no of nodegroups that actually exists on PS - */ - void setNoOfNodeGroups(Uint32 n) { m_noOfNodeGroups = n; }; - Uint32 getNoOfNodeGroups() { return m_noOfNodeGroups; }; - void getEpochState(Position p, - Uint32 nodeGrp, - Uint32 * first, - Uint32 * last); - Uint32 getEpochState(Position p, Uint32 nodegroup); - bool m_requestorEnabled; - bool m_transferEnabled; - bool m_applyEnabled; - bool m_deleteEnabled; - bool m_autoStartEnabled; - - /*************************************************************************** - * GETTERS and SETTERS - ***************************************************************************/ - bool requestTransfer(Uint32 nodeGrp, Interval * i); - bool requestApply(Uint32 nodeGrp, Uint32 * epoch); - bool requestDelete(Uint32 nodeGrp, Interval * i); - - void add(Position pos, Uint32 nodeGrp, const Interval i); - void clear(Position pos, Uint32 nodeGrp, const Interval i); - - void setSubId(Uint32 subId) { m_subId=subId; }; - Uint32 getSubId() { return m_subId; }; - - Uint32 getSubKey() { return m_subKey; }; - void setSubKey(Uint32 subKey) { m_subKey=subKey; }; - - bool isSynchable(Uint32 nodeGrp); - GrepError::Code addTable(const char * tableName); - GrepError::Code removeTable(const char * tableName); - void printTables(); - bool isSelective() {return m_selectedTables.size()>0;}; - Vector * getSelectedTables(); - - void reset(); - - StateRep getState() { return m_stateRep; } - void setState(StateRep sr) { m_stateRep = sr; } - - StateSub getStateSub() { return m_stateSub; } - void setStateSub(StateSub ss) { m_stateSub = ss; } - - Interval getMetaScanEpochs() { return m_metaScanEpochs; } - void setMetaScanEpochs(Interval i) { m_metaScanEpochs = i; } - Interval getDataScanEpochs() { return m_dataScanEpochs; } - void setDataScanEpochs(Interval i) { m_dataScanEpochs = i; } - - GrepError::Code setStopEpochId(Uint32 n); - Uint32 getStopEpochId() { return m_stopEpochId; }; - - bool isStoppable(); - bool shouldStop(); - - bool subscriptionExists() { return (m_subId != 0 && m_subKey != 0); } - - /*************************************************************************** - * GETTERS - ***************************************************************************/ - Uint32 getFirst(Position pos, Uint32 nodeGrp) { - return state[nodeGrp][pos].first(); - } - - Uint32 getLast(Position pos, Uint32 nodeGrp) { - return state[nodeGrp][pos].last(); - } - - void getFullyAppliedEpochs(Interval * i); - - /*************************************************************************** - * PRINT METHODS - ***************************************************************************/ - void print(); - void print(Position pos); - void print(Position pos, Uint32 nodeGrp); - void print(Uint32 nodeGrp); - - /*************************************************************************** - * PUBLIC ATTRIBUTES - ***************************************************************************/ - -private: - /*************************************************************************** - * PRIVATE ATTRIBUTES - ***************************************************************************/ - StateRep m_stateRep; // Replication state - StateSub m_stateSub; // Subscription state - - Uint32 m_subId; - Uint32 m_subKey; - - Uint32 m_noOfNodeGroups; // Number of node grps in this channel - Uint32 m_stopEpochId; // Epoch id to stop subscription - - Interval state[MAX_NO_OF_NODE_GROUPS][NO_OF_POSITIONS]; - - Interval m_metaScanEpochs; - Interval m_dataScanEpochs; - - - Vector m_selectedTables; - void invariant(); // Abort if channel metadata is inconsistent - char * position2Name(Position p); -public: - bool copy(Position from, Position to, Uint32 range, - Uint32 * f, Uint32 * l, Uint32 nodeGrp); -}; - -#endif diff --git a/ndb/src/old_files/rep/state/Interval.cpp b/ndb/src/old_files/rep/state/Interval.cpp deleted file mode 100644 index 8266f19c58d..00000000000 --- a/ndb/src/old_files/rep/state/Interval.cpp +++ /dev/null @@ -1,171 +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 */ - -#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; } - -Interval::Interval() -{ - set(1, 0); // EmptyInterval -} - -Interval::Interval(Uint32 f, Uint32 l) -{ - set(f, l); -} - -bool -Interval::isEmpty() const -{ - return (m_first > m_last) ? true : false; -} - -bool -Interval::isEqual(Uint32 a, Uint32 b) const -{ - return (a==m_first && b==m_last); -} - -bool -Interval::inInterval(Uint32 a) const -{ - return (m_first <= a && a <= m_last); -} - -void -Interval::set(Uint32 first, Uint32 last) -{ - m_first = first; - m_last = last; - normalize(); -} - -void -Interval::set(const Interval i) -{ - m_first = i.first(); - m_last = i.last(); - normalize(); -} - -void -Interval::setFirst(Uint32 first) -{ - m_first = first; -} - -void -Interval::setLast(Uint32 last) -{ - m_last = last; -} - -void -Interval::onlyLeft(Uint32 n) -{ - if (size() > n) m_last = m_first + n - 1; -} - -void -Interval::onlyUpToValue(Uint32 n) -{ - m_last = min(n, m_last); - normalize(); -} - -/*****************************************************************************/ - -void -Interval::normalize() -{ - if (isEmpty()) { - m_first = 1; - m_last = 0; - } -} - - -/*****************************************************************************/ - -bool -intervalAdd(const Interval a, const Interval b, Interval * r) -{ - /** - * Non-empty disjoint intervals - */ - if (!a.isEmpty() && - !b.isEmpty() && - (a.last() + 1 < b.first() || - b.last() + 1 < a.first()) ) { - return false; // Illegal add - } - - /** - * Interval A empty -> return B - */ - if (a.isEmpty()) { - r->set(b); - return true; - } - - /** - * Interval B empty -> return A - */ - if (b.isEmpty()) { - r->set(a); - return true; - } - - r->set(min(a.first(), b.first()), - max(a.last(), b.last())); - return true; -} - -/** - * Subtract the left part of interval 'a' up to last of 'b'. - * - * @note This is NOT ordinary arithmetic interval minus. - * In ordinary arithmetic, [11-25] - [12-15] would be undefined, - * but here it is [11-25] - [12-15] = [16-25]. - */ -void -intervalLeftMinus(const Interval a, const Interval b, Interval * r) -{ - if(b.last() != intervalMax) - r->set(max(a.first(), b.last()+1), a.last()); - else - r->set(max(a.first(), intervalMax), a.last()); -} - -void -intervalCut(const Interval a, const Interval b, Interval * r) -{ - r->set(max(a.first(), b.first()), min(a.last(), b.last())); - r->normalize(); -} - -bool -intervalDisjoint(const Interval a, const Interval b) -{ - return (a.isEmpty() || - b.isEmpty() || - a.last() < b.first() || - b.last() < a.first()); -} diff --git a/ndb/src/old_files/rep/state/Interval.hpp b/ndb/src/old_files/rep/state/Interval.hpp deleted file mode 100644 index 935adaf26b1..00000000000 --- a/ndb/src/old_files/rep/state/Interval.hpp +++ /dev/null @@ -1,107 +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 INTERVAL_HPP -#define INTERVAL_HPP - -#include -#include - -/** - * @class Interval - * @brief Represents an interval - */ -class Interval { -public: - Interval(); - Interval(Uint32, Uint32); - - /** - * Getters of first and last - */ - inline Uint32 first() const { return m_first; } - inline Uint32 last() const { return m_last; } - - /** - * Check if interval is empty - */ - bool isEmpty() const; - bool isEqual(Uint32 a, Uint32 b) const; - bool inInterval(Uint32 a) const; - - /** - * Size of interval - */ - Uint32 size() const { - return (!isEmpty()) ? m_last - m_first + 1 : 0; - } - - /** - * Set interval - */ - void set(Uint32 first, Uint32 last); - void set(const Interval i); - - void setFirst(Uint32 first); - void setLast(Uint32 last); - - /** - * Reduce the interval to only the n left elements of the - * interval. If the interval is shorter than n, then - * interval is not changed. - */ - void onlyLeft(Uint32 n); - - /** - * Reduce the interval to have at most the value n - * as the last value. - * This method can make the interval empty. - */ - void onlyUpToValue(Uint32 n); - - /** - * Print - */ - void print() { - ndbout << "[" << m_first << "," << m_last << "]"; - } - - void normalize(); -private: - Uint32 m_first; - Uint32 m_last; -}; - -const Uint32 intervalMin = 0; -const Uint32 intervalMax = 0xffffffff; -const Interval emptyInterval(1, 0); -const Interval universeInterval(intervalMin, intervalMax); - -/** - * @return true if intervals could be added - */ -bool intervalAdd(const Interval a, const Interval b, Interval * c); - -void intervalLeftMinus(const Interval a, const Interval b, Interval * c); - -void intervalCut(const Interval a, const Interval b, Interval * c); - -/** - * @return true if intervals are disjoint - */ -bool intervalDisjoint(const Interval a, const Interval b); - -#endif diff --git a/ndb/src/old_files/rep/state/Makefile b/ndb/src/old_files/rep/state/Makefile deleted file mode 100644 index 3eed69a97dd..00000000000 --- a/ndb/src/old_files/rep/state/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include .defs.mk - -TYPE := repserver kernel - -ARCHIVE_TARGET := reprequestor - -DIR := testRepState \ - testInterval - -SOURCES = RepState.cpp \ - RepStateEvent.cpp \ - RepStateRequests.cpp \ - \ - Channel.cpp \ - Interval.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/state/RepState.cpp b/ndb/src/old_files/rep/state/RepState.cpp deleted file mode 100644 index d8a50961a3c..00000000000 --- a/ndb/src/old_files/rep/state/RepState.cpp +++ /dev/null @@ -1,869 +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 */ - -#include "RepState.hpp" - -#include -#include -#include -//#define DBUG_REQUESTOR - -#ifdef DBUG_REQUESTOR -#define DBUG_REQUESTOR_PRINT(X) ndbout_c(X); -#else -#define DBUG_REQUESTOR_PRINT(X) -#endif - -/**************************************************************************** - * Constructor / Destructor / Init - ****************************************************************************/ -RepState::RepState() -{ - m_connected = UNKNOWN; - m_repConnected = UNKNOWN; - m_mutex = NdbMutex_Create(); - m_stopEpoch = 0; - m_subIdToRemove = 0; - m_subKeyToRemove = 0; -} - -RepState::~RepState() -{ - NdbMutex_Destroy(m_mutex); -} - -void -RepState::setSubscriptionRequests(FuncRequestCreateSubscriptionId f1, - FuncRequestCreateSubscription f2, - FuncRequestRemoveSubscription f3) -{ - m_funcRequestCreateSubscriptionId = f1; - m_funcRequestCreateSubscription = f2; - m_funcRequestRemoveSubscription = f3; -} - -void -RepState::setIntervalRequests(FuncRequestTransfer f1, - FuncRequestApply f2, - FuncRequestDeleteSS f3, - FuncRequestDeletePS f4) -{ - m_funcRequestTransfer = f1; - m_funcRequestApply = f2; - m_funcRequestDeleteSS = f3; - m_funcRequestDeletePS = f4; -} - -void -RepState::setStartRequests(FuncRequestStartMetaLog * f5, - FuncRequestStartDataLog * f6, - FuncRequestStartMetaScan * f7, - FuncRequestStartDataScan * f8, - FuncRequestEpochInfo * f9) -{ - m_funcRequestStartMetaLog = f5; - m_funcRequestStartDataLog = f6; - m_funcRequestStartMetaScan = f7; - m_funcRequestStartDataScan = f8; - m_funcRequestEpochInfo = f9; -} - - -/**************************************************************************** - * Private Helper functions - ****************************************************************************/ - -void -RepState::requestTransfer(NdbApiSignal * signal) -{ - DBUG_REQUESTOR_PRINT("RepState: Transfer calculations started"); - for(Uint32 nodeGrp=0; nodeGrp= m_channel.getDataScanEpochs().last() && - fullEpochs.last() >= m_channel.getMetaScanEpochs().last()) - { - RLOG(("[%d-%d] fully applied. Channel state changed to LOG", - fullEpochs.first(), fullEpochs.last())); - m_channel.setState(Channel::LOG); - disableAutoStart(); - } - - return GrepError::NO_ERROR; -} - -GrepError::Code -RepState::clear(Channel::Position s, Uint32 nodeGrp, const Interval i) -{ - m_channel.clear(s, nodeGrp, i); - return GrepError::NO_ERROR; -} - -/**************************************************************************** - * Execute - * - * This method should only be called from Requestor! - ****************************************************************************/ - -GrepError::Code -RepState::protectedExecute() -{ - GrepError::Code err; - - NdbMutex_Lock(m_mutex); - - NdbApiSignal* signal = m_extSender->getSignal(); - if (signal == NULL) { - err = GrepError::COULD_NOT_ALLOCATE_MEM_FOR_SIGNAL; - } else { - err = execute(signal); - } - NdbMutex_Unlock(m_mutex); - return err; -} - -GrepError::Code -RepState::execute(NdbApiSignal* signal) -{ - Uint32 subId = m_channel.getSubId(); - Uint32 subKey = m_channel.getSubKey(); - - if (!m_channel.m_requestorEnabled) - return GrepError::NO_ERROR; - - /** - * @todo Should have subscriptions in here - */ - requestEpochInfo(signal); - - /** - * Update connected counter (Silence time) - */ - m_connected_counter++; - if (m_connected_counter > REQUESTOR_EXECUTES_NEEDED_FOR_UNKNOWN_CONNECTION) { - m_connected = UNKNOWN; - } - - switch (m_channel.getState()) - { - case Channel::CONSISTENT: - if (isAutoStartEnabled()) { - switch (m_channel.getStateSub()) - { - case Channel::NO_SUBSCRIPTION_EXISTS: - m_funcRequestCreateSubscriptionId(m_extSender, signal); - m_channel.setStateSub(Channel::CREATING_SUBSCRIPTION_ID); - break; - - case Channel::CREATING_SUBSCRIPTION_ID: - break; - - case Channel::SUBSCRIPTION_ID_CREATED: - if(m_channel.isSelective()) - m_funcRequestCreateSubscription(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey(), - m_channel.getSelectedTables()); - else - m_funcRequestCreateSubscription(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey(), - 0); - m_channel.setStateSub(Channel::STARTING_SUBSCRIPTION); - break; - - case Channel::STARTING_SUBSCRIPTION: - break; - - case Channel::SUBSCRIPTION_STARTED: - m_funcRequestStartMetaLog(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey()); - m_channel.setState(Channel::METALOG_STARTING); - break; - } - } - break; - - case Channel::METALOG_STARTING: - break; - - case Channel::METALOG_STARTED: - if (isAutoStartEnabled()) { - m_funcRequestStartMetaScan(m_extSender, signal, subId, subKey); - m_channel.setState(Channel::METASCAN_STARTING); - } - break; - - case Channel::METASCAN_STARTING: - break; - - case Channel::METASCAN_COMPLETED: - if (isAutoStartEnabled()) { - m_funcRequestStartDataLog(m_extSender, signal, subId, subKey); - m_channel.setState(Channel::DATALOG_STARTING); - } - break; - - case Channel::DATALOG_STARTING: - break; - - case Channel::DATALOG_STARTED: - if (isAutoStartEnabled()) { - m_funcRequestStartDataScan(m_extSender, signal, subId, subKey); - m_channel.setState(Channel::DATASCAN_STARTING); - } - break; - - case Channel::DATASCAN_STARTING: - break; - - case Channel::DATASCAN_COMPLETED: - break; - - case Channel::LOG: - if (m_channel.shouldStop()) { - disableTransfer(); - m_channel.setState(Channel::STOPPING); - } - break; - - case Channel::STOPPING: - if (m_channel.m_transferEnabled) - { - REPABORT("Illegal stopping state while transfer is still enabled"); - } - /** - * check if channel has a subscription, if not, - * check if we have marked a subscription that we want to remove - * and remove it. This is used to clean up "dangling subscriptions" - * after various crashes - */ - if(!m_channel.subscriptionExists()) - { - if(m_subIdToRemove && m_subKeyToRemove) - { - m_funcRequestRemoveSubscription(m_extSender, signal, - m_subIdToRemove, - m_subKeyToRemove); - eventSubscriptionDeleted( m_subIdToRemove, - m_subKeyToRemove); - return GrepError::NO_ERROR; - } - else { - return GrepError::SUBSCRIPTION_ID_NOT_FOUND; - } - } else { - if (m_channel.isStoppable()) - { - - m_funcRequestRemoveSubscription(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey()); - eventSubscriptionDeleted(m_channel.getSubId(), - m_channel.getSubKey()); - } - else - return GrepError::CHANNEL_NOT_STOPPABLE; - - } - break; - - default: - REPABORT("Illegal replication state"); - } - if (m_channel.m_transferEnabled) requestTransfer(signal); - if (m_channel.m_applyEnabled) requestApply(signal); - if (m_channel.m_deleteEnabled) requestDelete(signal); - return GrepError::NO_ERROR; -} - -/**************************************************************************** - * Request - * - * This method should only be called from Main Thread! - ****************************************************************************/ - -GrepError::Code -RepState::protectedRequest(GrepReq::Request req, Uint32 arg) -{ - return protectedRequest(req, arg, 0); -} - -GrepError::Code -RepState::protectedRequest(GrepReq::Request req, Uint32 arg1, Uint32 arg2) -{ - GrepError::Code code; - NdbMutex_Lock(m_mutex); - - NdbApiSignal* signal = m_extSender->getSignal(); - if (signal == NULL) { - code = GrepError::COULD_NOT_ALLOCATE_MEM_FOR_SIGNAL; - } else { - code = request(req, arg1, arg2, signal); - } - - NdbMutex_Unlock(m_mutex); - return code; -} - -GrepError::Code -RepState::protectedAddTable(const char * fullTableName) -{ - GrepError::Code code; - NdbMutex_Lock(m_mutex); - code = m_channel.addTable(fullTableName); - NdbMutex_Unlock(m_mutex); - return code; -} - -GrepError::Code -RepState::protectedRemoveTable(const char * fullTableName) -{ - GrepError::Code code; - if(m_channel.getStateSub() != Channel::NO_SUBSCRIPTION_EXISTS) - return GrepError::START_ALREADY_IN_PROGRESS; - NdbMutex_Lock(m_mutex); - code = m_channel.removeTable(fullTableName); - NdbMutex_Unlock(m_mutex); - return code; -} - -GrepError::Code -RepState::request(GrepReq::Request request, Uint32 arg1, Uint32 arg2, - NdbApiSignal* signal) -{ - switch (request) - { - /************************************************************************* - * STATUS etc - *************************************************************************/ - - case GrepReq::STATUS: - printStatus(); - break; - - case GrepReq::REMOVE_BUFFERS: - return GrepError::NOT_YET_IMPLEMENTED; - - /************************************************************************* - * START - *************************************************************************/ - - case GrepReq::CREATE_SUBSCR: - if (m_channel.getStateSub() != Channel::NO_SUBSCRIPTION_EXISTS) - return GrepError::SUBSCRIPTION_ID_ALREADY_EXIST; - - m_funcRequestCreateSubscriptionId(m_extSender, signal); - m_channel.setStateSub(Channel::CREATING_SUBSCRIPTION_ID); - return GrepError::NO_ERROR; - - case GrepReq::START_SUBSCR: - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - if (m_channel.getStateSub() != Channel::SUBSCRIPTION_ID_CREATED) - return GrepError::SUBSCRIPTION_ID_NOT_FOUND; - if(m_channel.isSelective()) - m_funcRequestCreateSubscription(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey(), - m_channel.getSelectedTables()); - else - m_funcRequestCreateSubscription(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey(), - 0); - m_channel.setStateSub(Channel::STARTING_SUBSCRIPTION); - return GrepError::NO_ERROR; - - case GrepReq::START_METALOG: - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - if (m_channel.getStateSub() != Channel::SUBSCRIPTION_STARTED) - return GrepError::SUBSCRIPTION_NOT_STARTED; - if (m_channel.getState() != Channel::CONSISTENT) - return GrepError::START_OF_COMPONENT_IN_WRONG_STATE; - - m_funcRequestStartMetaLog(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey()); - m_channel.setState(Channel::METALOG_STARTING); - return GrepError::NO_ERROR; - - case GrepReq::START_METASCAN: - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - if (m_channel.getStateSub() != Channel::SUBSCRIPTION_STARTED) - return GrepError::SUBSCRIPTION_NOT_STARTED; - if (m_channel.getState() != Channel::METALOG_STARTED) - return GrepError::START_OF_COMPONENT_IN_WRONG_STATE; - - m_funcRequestStartMetaScan(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey()); - m_channel.setState(Channel::METASCAN_STARTING); - return GrepError::NO_ERROR; - - case GrepReq::START_DATALOG: - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - if (m_channel.getStateSub() != Channel::SUBSCRIPTION_STARTED) - return GrepError::SUBSCRIPTION_NOT_STARTED; - if (m_channel.getState() != Channel::METASCAN_COMPLETED) - return GrepError::START_OF_COMPONENT_IN_WRONG_STATE; - - m_funcRequestStartDataLog(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey()); - m_channel.setState(Channel::DATALOG_STARTING); - return GrepError::NO_ERROR; - - case GrepReq::START_DATASCAN: - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - if (m_channel.getStateSub() != Channel::SUBSCRIPTION_STARTED) - return GrepError::SUBSCRIPTION_NOT_STARTED; - if (m_channel.getState() != Channel::DATALOG_STARTED) - return GrepError::START_OF_COMPONENT_IN_WRONG_STATE; - - m_funcRequestStartDataScan(m_extSender, signal, - m_channel.getSubId(), - m_channel.getSubKey()); - m_channel.setState(Channel::DATASCAN_STARTING); - return GrepError::NO_ERROR; - - case GrepReq::START_REQUESTOR: - enable(); - return GrepError::NO_ERROR; - - case GrepReq::START_TRANSFER: - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - enableTransfer(); - return GrepError::NO_ERROR; - - case GrepReq::START_APPLY: - enableApply(); - return GrepError::NO_ERROR; - - case GrepReq::START_DELETE: - enableDelete(); - return GrepError::NO_ERROR; - - case GrepReq::START: - if (isAutoStartEnabled()) - return GrepError::START_ALREADY_IN_PROGRESS; - - enableAutoStart(); - return GrepError::NO_ERROR; - - /************************************************************************* - * STOP - *************************************************************************/ - - case GrepReq::STOP: - if (m_channel.getStateSub() == Channel::NO_SUBSCRIPTION_EXISTS) - return GrepError::SUBSCRIPTION_NOT_STARTED; - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - - if (arg1 == 0) { - /** - * Stop immediately - */ - disableTransfer(); - m_channel.setState(Channel::STOPPING); - m_channel.setStopEpochId(0); - return GrepError::NO_ERROR; - } else { - /** - * Set future stop epoch - */ - return m_channel.setStopEpochId(arg1); - } - - case GrepReq::STOP_SUBSCR: - { - if(m_subIdToRemove == 0 && m_subKeyToRemove == 0) { - m_subIdToRemove = arg1; - m_subKeyToRemove = arg2; - } else { - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - } - - if(m_channel.getSubId() != 0 && m_channel.getSubKey() != 0) - return GrepError::ILLEGAL_USE_OF_COMMAND; - if (m_channel.getState() == Channel::STOPPING) - return GrepError::ILLEGAL_ACTION_WHEN_STOPPING; - disableTransfer(); - m_channel.setState(Channel::STOPPING); - return GrepError::NO_ERROR; - } - case GrepReq::STOP_METALOG: - case GrepReq::STOP_METASCAN: - case GrepReq::STOP_DATALOG: - case GrepReq::STOP_DATASCAN: - return GrepError::NOT_YET_IMPLEMENTED; - - case GrepReq::STOP_REQUESTOR: - disable(); - return GrepError::NO_ERROR; - - case GrepReq::STOP_TRANSFER: - disableTransfer(); - return GrepError::NO_ERROR; - - case GrepReq::STOP_APPLY: - disableApply(); - return GrepError::NO_ERROR; - - case GrepReq::STOP_DELETE: - disableDelete(); - return GrepError::NO_ERROR; - - default: - ndbout_c("RepCommandInterpreter: Illegal request received"); - return GrepError::NOT_YET_IMPLEMENTED; - } - return GrepError::NOT_YET_IMPLEMENTED; -} - -/**************************************************************************** - * - ****************************************************************************/ - -/* -GrepError::Code -RepState::slowStop() -{ - switch(m_channel.getState()) - { - case Channel::LOG: - m_channel.setState(Channel::LOG_SLOW_STOP); - return GrepError::NO_ERROR; - default: - return GrepError::REQUESTOR_ILLEGAL_STATE_FOR_SLOWSTOP; - } -} - -GrepError::Code -RepState::fastStop() -{ - switch(m_channel.getState()) - { - case Channel::LOG: - m_channel.setState(Channel::LOG_FAST_STOP); - return GrepError::NO_ERROR; - default: - return GrepError::REQUESTOR_ILLEGAL_STATE_FOR_FASTSTOP; - } -} -*/ - -/**************************************************************************** - * Print Status - ****************************************************************************/ - -static const char* -headerText = -"+-------------------------------------------------------------------------+\n" -"| MySQL Replication Server |\n" -"+-------------------------------------------------------------------------+\n" -; - -static const char* -channelHeaderText = -"+-------------------------------------------------------------------------+\n" -"| Applier Channel 1 Replication Status |\n" -"+-------------------------------------------------------------------------+\n" -; - -static const char* -line = -"+-------------------------------------------------------------------------+\n" -; - - -Properties * -RepState::getStatus() -{ - Properties * prop = new Properties(); - if(prop == NULL) - return NULL; - NdbMutex_Lock(m_mutex); - - prop->put("nodegroups", (int)m_channel.getNoOfNodeGroups()); -// prop->put("epoch_state", m_channel.getEpochState()); - NdbMutex_Unlock(m_mutex); - return prop; -} - - -Properties * RepState::query(QueryCounter counter, Uint32 replicationId) -{ - Properties * prop = new Properties(); - if(prop == NULL) - return NULL; - NdbMutex_Lock(m_mutex); - if(counter != ~(Uint32)0) - getEpochState((Channel::Position)counter, prop ); - prop->put("no_of_nodegroups", m_channel.getNoOfNodeGroups()); - prop->put("subid", m_channel.getNoOfNodeGroups()); - prop->put("subkey", m_channel.getSubKey()); - prop->put("connected_db", m_connected); - prop->put("connected_rep", m_repConnected); - prop->put("state_sub", (int)m_channel.getStateSub()); - prop->put("state", (int)m_channel.getState()); - - NdbMutex_Unlock(m_mutex); - return prop; - -} - -void -RepState::getEpochState(Channel::Position pos, Properties * p) -{ - char first_buf[20]; - char last_buf[20]; - int pos_first = 0, pos_last = 0; - Uint32 first = 0, last = 0; - for(Uint32 i = 0; i < m_channel.getNoOfNodeGroups() ; i++) - { - m_channel.getEpochState(pos, i, &first, &last); - pos_first += sprintf(first_buf+pos_first,"%d%s",first,","); - pos_last += sprintf(last_buf+pos_last,"%d%s",last,","); - } -/** - * remove trailing comma - */ - 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); - -} - - -void -RepState::printStatus() -{ - /*************************************************************************** - * Global Status - ***************************************************************************/ - ndbout << headerText; - switch (m_connected) - { - case CONNECTED: - ndbout << "| Source: Connected "; break; - case DISCONNECTED: - ndbout << "| Source: Disconnected "; break; - case CONNECTABLE: - ndbout << "| Source: Disconnected "; break; - default: - ndbout << "| Source: Unknown "; break; - } - switch (m_repConnected) - { - case CONNECTED: - ndbout << "(Rep: Connected) "; break; - case DISCONNECTED: - ndbout << "(Rep: Disconnected) "; break; - case CONNECTABLE: - ndbout << "(Rep: Disconnected) "; break; - default: - ndbout << "(Rep: Unknown) "; break; - } - ndbout << " |" << endl; - ndbout << "| Autostart: " << (isAutoStartEnabled() ? "On " : "Off") - << " "; - ndbout_c(" Silence time: %10u |", m_connected_counter); - - /*************************************************************************** - * Channel Status - ***************************************************************************/ - ndbout << channelHeaderText; - switch(m_channel.getStateSub()) { - case Channel::NO_SUBSCRIPTION_EXISTS: - ndbout_c("| Subscription: Non-existing " - " |"); - break; - case Channel::CREATING_SUBSCRIPTION_ID: - ndbout_c("| Subscription: Non-existing (Id is being created)" - " |"); - break; - case Channel::SUBSCRIPTION_ID_CREATED: - ndbout_c("| Subscription: %-3d-%-6d in state: Not yet started " - " |", - m_channel.getSubId(), m_channel.getSubKey()); - break; - case Channel::STARTING_SUBSCRIPTION: - ndbout_c("| Subscription: %-3d-%-6d in state: Being started " - " |", - m_channel.getSubId(), m_channel.getSubKey()); - break; - case Channel::SUBSCRIPTION_STARTED: - ndbout_c("| Subscription: %-3d-%-6d in state: Started " - " |", - m_channel.getSubId(), m_channel.getSubKey()); - break; - default: - REPABORT("Illegal subscription state"); - } - ndbout << "| Stop epoch: "; - if (m_channel.getStopEpochId() == intervalMax) { - ndbout << "No stop defined "; - } else { - ndbout.print("%-10d ", - m_channel.getStopEpochId()); - } - ndbout << " |" << endl; - - ndbout << "| State: "; - switch(m_channel.getState()) - { - case Channel::CONSISTENT: - ndbout << "Local database is subscription consistent "; - break; - case Channel::METALOG_STARTING: - ndbout << "Starting (Phase 1: Metalog starting) "; - break; - case Channel::METALOG_STARTED: - ndbout << "Starting (Phase 2: Metalog started) "; - break; - case Channel::METASCAN_STARTING: - ndbout << "Starting (Phase 3: Metascan starting) "; - break; - case Channel::METASCAN_COMPLETED: - ndbout << "Starting (Phase 4: Metascan completed) "; - break; - case Channel::DATALOG_STARTING: - ndbout << "Starting (Phase 5: Datalog starting) "; - break; - case Channel::DATALOG_STARTED: - ndbout << "Starting (Phase 6: Datalog started) "; - break; - case Channel::DATASCAN_STARTING: - ndbout << "Starting (Phase 7: Datascan completed) "; - break; - case Channel::DATASCAN_COMPLETED: - ndbout << "Starting (Phase 8: Datascan completed) "; - break; - case Channel::LOG: - ndbout << "Logging "; - break; - case Channel::STOPPING: - ndbout << "Stopping (Stopped when all epochs applied) "; - break; - } - ndbout << " |" << endl; - -/* @todo - ndbout_c("| Syncable: Yes/Scan/No/Unknown (Not implemented)" - " |"); -*/ - ndbout << "| Requestor: " << (isEnabled() ? "On " : "Off") - << " (Transfer: " << (isTransferEnabled() ? "On, " : "Off, ") - << "Apply: " << (isApplyEnabled() ? "On, " : "Off, ") - << "Delete: " << (isDeleteEnabled() ? "On) " : "Off)") - << " |" << endl; - ndbout_c("| Tables being replicated using this channel: " - " |"); - m_channel.printTables(); - - /** - * Print node groups - */ - if (getNoOfNodeGroups() == 0) - { - ndbout_c("| No node groups are known. " - " |"); - } - else - { - m_channel.print(); - } - ndbout << line; -} diff --git a/ndb/src/old_files/rep/state/RepState.hpp b/ndb/src/old_files/rep/state/RepState.hpp deleted file mode 100644 index 06bbca19f7e..00000000000 --- a/ndb/src/old_files/rep/state/RepState.hpp +++ /dev/null @@ -1,276 +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 REP_STATE_HPP -#define REP_STATE_HPP - -#include -#include -#include -#include -#include -#include - -#include "Channel.hpp" -#include "Interval.hpp" - -#define REQUESTOR_EXECUTES_NEEDED_FOR_UNKNOWN_CONNECTION 5 - -class NdbApiSignal; - - -/** - * @class RepState - * @brief The main information about the replication - */ -class RepState -{ -public: - RepState(); - ~RepState(); - void init(ExtSender * extSender) { m_extSender = extSender; } - - /*************************************************************************** - * Callback functions - * - * These are used when RepState wants to do something - ***************************************************************************/ - - typedef void (FuncRequestCreateSubscriptionId) - (void * cbObj, NdbApiSignal* signal); - - typedef void (FuncRequestCreateSubscription) - (void * cbObj, NdbApiSignal* signal, Uint32 subId, - Uint32 subKey , - Vector * selectedTables); - - typedef void (FuncRequestRemoveSubscription) - (void * cbObj, NdbApiSignal* signal, Uint32 subId, Uint32 subKey); - - typedef void (FuncRequestTransfer) - (void * cbObj, NdbApiSignal* signal, - Uint32 nodeGrp, Uint32 first, Uint32 last); - - typedef void (FuncRequestApply) - (void * cbObj, NdbApiSignal* signal, - Uint32 nodeGrp, Uint32 first, Uint32 last, Uint32 force); - - typedef void (FuncRequestDeleteSS) - (void * cbObj, NdbApiSignal* signal, - Uint32 nodeGrp, Uint32 first, Uint32 last); - - typedef void (FuncRequestDeletePS) - (void * cbObj, NdbApiSignal* signal, - Uint32 nodeGrp, Uint32 first, Uint32 last); - - typedef void (FuncRequestStartMetaLog) - (void * cbObj, NdbApiSignal * signal, Uint32 subId, Uint32 subKey); - - typedef void (FuncRequestStartDataLog) - (void * cbObj, NdbApiSignal * signal, Uint32 subId, Uint32 subKey); - - typedef void (FuncRequestStartMetaScan) - (void * cbObj, NdbApiSignal * signal, Uint32 subId, Uint32 subKey); - - typedef void (FuncRequestStartDataScan) - (void * cbObj, NdbApiSignal * signal, Uint32 subId, Uint32 subKey); - - typedef void (FuncRequestEpochInfo) - (void * cbObj, NdbApiSignal * signal, Uint32 nodeGrp); - - /*************************************************************************** - * - ***************************************************************************/ - void setSubscriptionRequests(FuncRequestCreateSubscriptionId f1, - FuncRequestCreateSubscription f2, - FuncRequestRemoveSubscription f3); - void setIntervalRequests(FuncRequestTransfer * f1, - FuncRequestApply * f2, - FuncRequestDeleteSS * f3, - FuncRequestDeletePS * f4); - void setStartRequests(FuncRequestStartMetaLog * f5, - FuncRequestStartDataLog * f6, - FuncRequestStartMetaScan * f7, - FuncRequestStartDataScan * f8, - FuncRequestEpochInfo * f9); - - /*************************************************************************** - * Enablings - ***************************************************************************/ - bool isEnabled() { return m_channel.m_requestorEnabled; } - bool isTransferEnabled() { return m_channel.m_transferEnabled; } - bool isApplyEnabled() { return m_channel.m_applyEnabled; } - bool isDeleteEnabled() { return m_channel.m_deleteEnabled; } - bool isAutoStartEnabled() { return m_channel.m_autoStartEnabled; } - - void enable() { m_channel.m_requestorEnabled = true; } - void enableTransfer() { m_channel.m_transferEnabled = true; } - void enableApply() { m_channel.m_applyEnabled = true; } - void enableDelete() { m_channel.m_deleteEnabled = true; } - void enableAutoStart() { m_channel.m_autoStartEnabled = true; } - - void disable() { m_channel.m_requestorEnabled = false; } - void disableTransfer() { m_channel.m_transferEnabled = false; } - void disableApply() { m_channel.m_applyEnabled = false;} - void disableDelete() { m_channel.m_deleteEnabled = false; } - void disableAutoStart() { m_channel.m_autoStartEnabled = false; } - - /*************************************************************************** - * Node groups - ***************************************************************************/ - void setNoOfNodeGroups(Uint32 n) { m_channel.setNoOfNodeGroups(n); } - Uint32 getNoOfNodeGroups() { return m_channel.getNoOfNodeGroups(); } - - /*************************************************************************** - * Event reporting to RepState - * - * These are used to update the state of the Requestor when something - * has happend. - ***************************************************************************/ - void request(GrepReq::Request request); - - //GrepError::Code createSubscription(Uint32 subId, Uint32 subKey); - GrepError::Code protectedExecute(); - GrepError::Code protectedRequest(GrepReq::Request request, Uint32 arg); - GrepError::Code protectedRequest(GrepReq::Request request, - Uint32 arg1, - Uint32 arg2); - GrepError::Code protectedAddTable(const char * fullTableName); - GrepError::Code protectedRemoveTable(const char * fullTableName); - GrepError::Code add(Channel::Position s, Uint32 nodeGrp, const Interval i); - GrepError::Code clear(Channel::Position s, Uint32 nodeGrp, const Interval i); - - void eventSubscriptionDeleted(Uint32 subId, Uint32 subKey); - - void eventMetaLogStarted(NdbApiSignal*, Uint32 subId, Uint32 subKey); - void eventDataLogStarted(NdbApiSignal*, Uint32 subId, Uint32 subKey); - void eventMetaScanCompleted(NdbApiSignal*, Uint32 subId, Uint32 subKey, - Interval epochs); - void eventDataScanCompleted(NdbApiSignal*, Uint32 subId, Uint32 subKey, - Interval epochs); - void eventMetaScanFailed(Uint32 subId, Uint32 subKey, GrepError::Code error); - void eventDataScanFailed(Uint32 subId, Uint32 subKey, GrepError::Code error); - - /** - * @fn sendInsertConf - * @param gci - the gci of the applied GCIBuffer. - * @param nodeGrp - the nodeGrp of the applied GCIBuffer. - */ - void eventInsertConf(Uint32 gci, Uint32 nodeGrp); - - /** - * @fn sendInsertRef - * @param gci - the gci of the applied GCIBuffer. - * @param nodeGrp - the nodeGrp of the applied GCIBuffer. - * @param tableId - the table of the applied GCIBuffer. - */ - void eventInsertRef(Uint32 gci, Uint32 nodeGrp, Uint32 tableId, - GrepError::Code err); - void eventCreateTableRef(Uint32 gci, - Uint32 tableId, - const char * tableName, - GrepError::Code err) ; - - void eventSubscriptionIdCreated(Uint32 subId, Uint32 subKey); - void eventSubscriptionIdCreateFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error); - - void eventSubscriptionCreated(Uint32 subId, Uint32 subKey); - void eventSubscriptionCreateFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error); - - void eventMetaLogStartFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error); - void eventDataLogStartFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error); - - void eventNodeConnected(Uint32 nodeId); - void eventNodeDisconnected(Uint32 nodeId); - void eventNodeConnectable(Uint32 nodeId); - - void printStatus(); - Properties * getStatus(); - Properties * query(QueryCounter counter, Uint32 replicationId); - Uint32 getSubId() { return m_channel.getSubId(); } - Uint32 getSubKey () { return m_channel.getSubKey(); } - - void setApplier(class AppNDB * app) { m_applier = app; } - void setGCIContainer(class GCIContainer * c) { m_gciContainer = c; } - - /* @todo should be private */ - Channel m_channel; - -private: - /*************************************************************************** - * PRIVATE ATTRIBUTES - ***************************************************************************/ - ExtSender * m_extSender; - AppNDB * m_applier; - GCIContainer * m_gciContainer; - - Uint32 m_subIdToRemove; - Uint32 m_subKeyToRemove; - - - enum Connected - { - UNKNOWN, ///< - CONNECTED, ///< Recently received info from (all needed) PS REP - DISCONNECTED, ///< Received disconnect info from (some needed) PS REP - CONNECTABLE ///< Received disconnect info from (some needed) PS REP - }; - Connected m_connected; - Connected m_repConnected; - Uint32 m_connected_counter; - - NdbMutex * m_mutex; - - /** @todo Should be channel-specific */ - Uint32 m_stopEpoch; - - /*************************************************************************** - * PRIVATE METHODS - ***************************************************************************/ - GrepError::Code execute(NdbApiSignal*); - GrepError::Code request(GrepReq::Request req, - Uint32 arg1, - Uint32 arg2, - NdbApiSignal*); - - FuncRequestCreateSubscriptionId * m_funcRequestCreateSubscriptionId; - FuncRequestCreateSubscription * m_funcRequestCreateSubscription; - FuncRequestRemoveSubscription * m_funcRequestRemoveSubscription; - - FuncRequestTransfer * m_funcRequestTransfer; - FuncRequestApply * m_funcRequestApply; - FuncRequestDeleteSS * m_funcRequestDeleteSS; - FuncRequestDeletePS * m_funcRequestDeletePS; - - FuncRequestStartMetaLog * m_funcRequestStartMetaLog; - FuncRequestStartDataLog * m_funcRequestStartDataLog; - FuncRequestStartMetaScan * m_funcRequestStartMetaScan; - FuncRequestStartDataScan * m_funcRequestStartDataScan; - FuncRequestEpochInfo * m_funcRequestEpochInfo; - - void requestTransfer(NdbApiSignal * signal); - void requestApply(NdbApiSignal * signal); - void requestDelete(NdbApiSignal * signal); - void requestEpochInfo(NdbApiSignal * signal); - void getEpochState(Channel::Position pos, Properties * p); - friend void testRepState(); -}; - -#endif diff --git a/ndb/src/old_files/rep/state/RepStateEvent.cpp b/ndb/src/old_files/rep/state/RepStateEvent.cpp deleted file mode 100644 index 9be304c8bfa..00000000000 --- a/ndb/src/old_files/rep/state/RepStateEvent.cpp +++ /dev/null @@ -1,284 +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 */ - -#include "RepState.hpp" - -/**************************************************************************** - * Public Event Handlers : CREATE SUBSCRIPTION ID - ****************************************************************************/ - -void -RepState::eventSubscriptionIdCreated(Uint32 subId, Uint32 subKey) -{ - if (m_channel.getStateSub() == Channel::CREATING_SUBSCRIPTION_ID) - { - m_channel.setSubId(subId); - m_channel.setSubKey(subKey); - m_channel.setStateSub(Channel::SUBSCRIPTION_ID_CREATED); - } - else - { - REPABORT("Illegal state for create subscription id conf"); - } -} - -void -RepState::eventSubscriptionIdCreateFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error) -{ - ndbout_c("\nSubscription id creation failed"); - ndbout_c("Error %d: %s", error, GrepError::getErrorDesc(error)); - ndbout_c("Subscription Id: %d, Key: %d", subId, subKey); -} - -/**************************************************************************** - * Public Event Handlers : CREATE SUBSCRIPTION - ****************************************************************************/ - -void -RepState::eventSubscriptionCreated(Uint32 subId, Uint32 subKey) -{ - if (m_channel.getStateSub() == Channel::STARTING_SUBSCRIPTION) - { - m_channel.setStateSub(Channel::SUBSCRIPTION_STARTED); - } - else - { - REPABORT("Illegal state for create subscription conf"); - } -} - -void -RepState::eventSubscriptionCreateFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error) -{ - ndbout_c("\nSubscription creation failed"); - ndbout_c("Error %d: %s", error, GrepError::getErrorDesc(error)); - ndbout_c("Subscription Id: %d, Key: %d", subId, subKey); -} - - -/**************************************************************************** - * Public Event Handlers : META LOG - ****************************************************************************/ - -void -RepState::eventMetaLogStarted(NdbApiSignal* signal, - Uint32 subId, Uint32 subKey) -{ - if (m_channel.getState() != Channel::METALOG_STARTING) - { - RLOG(("WARNING! Metalog started in state %d, should be %d", - m_channel.getState(), Channel::METALOG_STARTING)); - } - - if (!isAutoStartEnabled()) - { - m_channel.setState(Channel::METALOG_STARTED); - } - else - { - m_channel.setState(Channel::METALOG_STARTED); - m_channel.setState(Channel::METASCAN_STARTING); - m_funcRequestStartMetaScan(m_extSender, signal, subId, subKey); - } -} - -void -RepState::eventMetaLogStartFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error) -{ - ndbout_c("\nMetalog start failed"); - ndbout_c("Error %d: %s", error, GrepError::getErrorDesc(error)); - ndbout_c("Subscription Id: %d, Key: %d", subId, subKey); -} - -/**************************************************************************** - * Public Event Handlers : META SCAN - ****************************************************************************/ - -void -RepState::eventMetaScanCompleted(NdbApiSignal* signal, - Uint32 subId, Uint32 subKey, Interval epochs) -{ - if (m_channel.getState() != Channel::METASCAN_STARTING) - { - RLOG(("WARNING! Metascan completed in state %d, should be %d", - m_channel.getState(), Channel::METASCAN_STARTING)); - } - RLOG(("Metascan completed. Subscription %d-%d, Epochs [%d-%d]", - subId, subKey, epochs.first(), epochs.last())); - - m_channel.setState(Channel::METASCAN_COMPLETED); - - if (isAutoStartEnabled()) - { - m_channel.setState(Channel::DATALOG_STARTING); - m_funcRequestStartDataLog(m_extSender, signal, subId, subKey); - } - m_channel.setMetaScanEpochs(epochs); -} - -/**************************************************************************** - * Public Event Handlers : DATA LOG - ****************************************************************************/ - -void -RepState::eventDataLogStarted(NdbApiSignal* signal, - Uint32 subId, Uint32 subKey) -{ - if (m_channel.getState() != Channel::DATALOG_STARTING) - { - RLOG(("WARNING! Datalog started in state %d, should be %d", - m_channel.getState(), Channel::DATALOG_STARTING)); - } - - m_channel.setState(Channel::DATALOG_STARTED); - - if (isAutoStartEnabled()) - { - m_channel.setState(Channel::DATASCAN_STARTING); - m_funcRequestStartDataScan(m_extSender, signal, subId, subKey); - } -} - -void -RepState::eventDataLogStartFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error) -{ - ndbout_c("\nDatalog start failed"); - ndbout_c("Error %d: %s", error, GrepError::getErrorDesc(error)); - ndbout_c("Subscription Id: %d, Key: %d", subId, subKey); -} - -/**************************************************************************** - * Public Event Handlers : DATA SCAN - ****************************************************************************/ - -void -RepState::eventDataScanCompleted(NdbApiSignal* signal, - Uint32 subId, Uint32 subKey, - Interval epochs) -{ - if (m_channel.getState() != Channel::DATASCAN_STARTING) - { - RLOG(("WARNING! Datascan completed in state %d, should be %d", - m_channel.getState(), Channel::DATASCAN_STARTING)); - } - RLOG(("Datascan completed. Subscription %d-%d, Epochs [%d-%d]", - subId, subKey, epochs.first(), epochs.last())); - - m_channel.setState(Channel::DATASCAN_COMPLETED); - m_channel.setDataScanEpochs(epochs); -} - -/**************************************************************************** - * Public Event Handlers : FAILURES - ****************************************************************************/ - -void -RepState::eventMetaScanFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error) -{ - ndbout_c("\nMetascan failed"); - ndbout_c("Error %d: %s", error, GrepError::getErrorDesc(error)); - ndbout_c("Subscription Id: %d, Key: %d", subId, subKey); -} - -void -RepState::eventDataScanFailed(Uint32 subId, Uint32 subKey, - GrepError::Code error) -{ - ndbout_c("\nDatascan failed"); - ndbout_c("Error %d: %s", error, GrepError::getErrorDesc(error)); - ndbout_c("Subscription Id: %d, Key: %d", subId, subKey); -} - -/**************************************************************************** - * Public Event Handlers : APPLY - ****************************************************************************/ - -void -RepState::eventInsertConf(Uint32 gci, Uint32 nodeGrp) -{ - Interval app(gci, gci); - add(Channel::App, nodeGrp, app); - clear(Channel::AppReq, nodeGrp, app); - -#ifdef DEBUG_GREP - ndbout_c("RepState: GCI Buffer %d:[%d] applied", nodeGrp, gci); -#endif -} - -void -RepState::eventInsertRef(Uint32 gci, Uint32 nodeGrp, Uint32 tableId, - GrepError::Code err) -{ - ndbout_c("\nTable %d, used in replication, did not exist"); - RLOG(("ERROR %d:%s. Apply failed (%d[%d] in table %d)", - err, GrepError::getErrorDesc(err), nodeGrp, gci, tableId)); -} - - -void -RepState::eventCreateTableRef(Uint32 gci, - Uint32 tableId, - const char * tableName, - GrepError::Code err) -{ - ndbout_c("\nFailed to create table %s with source site table id %d", - tableName, - tableId); - - RLOG(("ERROR %d:%s. Failed to create table %s with source site table id %d!", - err, GrepError::getErrorDesc(err), tableName, tableId)); -} - -/**************************************************************************** - * Public Event Handlers : Connected/Disconnected - ****************************************************************************/ - -void -RepState::eventNodeConnected(Uint32 nodeId) -{ - m_repConnected = CONNECTED; -} - -void -RepState::eventNodeDisconnected(Uint32 nodeId) -{ - m_repConnected = DISCONNECTED; -} - -void -RepState::eventNodeConnectable(Uint32 nodeId) -{ - m_repConnected = CONNECTABLE; -} - -/**************************************************************************** - * Public Event Handlers : Connected/Disconnected - ****************************************************************************/ - -void -RepState::eventSubscriptionDeleted(Uint32 subId, Uint32 subKey) -{ - m_gciContainer->reset(); - m_channel.setState(Channel::CONSISTENT); - m_channel.reset(); - m_subIdToRemove = 0; - m_subKeyToRemove = 0; -} diff --git a/ndb/src/old_files/rep/state/RepStateRequests.cpp b/ndb/src/old_files/rep/state/RepStateRequests.cpp deleted file mode 100644 index 02677e141f6..00000000000 --- a/ndb/src/old_files/rep/state/RepStateRequests.cpp +++ /dev/null @@ -1,294 +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 */ - -#include "RepState.hpp" - -#include -#include -#include - -#include -#include -#include - -#include -#include "Channel.hpp" - -/***************************************************************************** - * Helper functions - *****************************************************************************/ - -void -startSubscription(void * cbObj, NdbApiSignal* signal, - SubscriptionData::Part part, - Uint32 subId, Uint32 subKey) -{ - ExtSender * ext = (ExtSender *) cbObj; - - GrepSubStartReq * req = (GrepSubStartReq *)signal->getDataPtrSend(); - req->subscriptionId = subId; - req->subscriptionKey = subKey; - req->part = (Uint32) part; - signal->set(0, PSREPBLOCKNO, GSN_GREP_SUB_START_REQ, - GrepSubStartReq::SignalLength); - ext->sendSignal(signal); -} - -void -scanSubscription(void * cbObj, NdbApiSignal* signal, - SubscriptionData::Part part, - Uint32 subId, Uint32 subKey) -{ - ExtSender * ext = (ExtSender *) cbObj; - - GrepSubSyncReq * req = (GrepSubSyncReq *)signal->getDataPtrSend(); - req->subscriptionId = subId; - req->subscriptionKey = subKey; - req->part = part; - signal->set(0, PSREPBLOCKNO, GSN_GREP_SUB_SYNC_REQ, - GrepSubSyncReq::SignalLength); - ext->sendSignal(signal); -} - -/***************************************************************************** - * RepState registered functions - * - * These registered functions are executed by RepState when - * RepState needs to have stuff done. - *****************************************************************************/ - -void -requestCreateSubscriptionId(void * cbObj, NdbApiSignal* signal) -{ - ExtSender * ext = (ExtSender *) cbObj; - - CreateSubscriptionIdReq * req = - (CreateSubscriptionIdReq *)signal->getDataPtrSend(); - req->senderData = ext->getOwnRef(); - signal->set(0, PSREPBLOCKNO, GSN_GREP_CREATE_SUBID_REQ, - CreateSubscriptionIdReq::SignalLength); - ext->sendSignal(signal); - -#ifdef DEBUG_GREP_SUBSCRIPTION - ndbout_c("Sent request for creation of subscription id to PS"); -#endif -} - -void -requestCreateSubscription(void * cbObj, - NdbApiSignal* signal, - Uint32 subId, - Uint32 subKey, - Vector * selectedTables) -{ - ExtSender * ext = (ExtSender *) cbObj; - - GrepSubCreateReq * req = (GrepSubCreateReq *)signal->getDataPtrSend(); - req->senderRef = ext->getOwnRef(); - req->subscriptionId = subId; - req->subscriptionKey = subKey; - if(selectedTables!=0) { - UtilBuffer m_buffer; - UtilBufferWriter w(m_buffer); - LinearSectionPtr tablePtr[3]; - req->subscriptionType = SubCreateReq::SelectiveTableSnapshot; - - for(Uint32 i=0; i< selectedTables->size(); i++) { - w.add(SimpleProperties::StringValue, (*selectedTables)[i]->tableName); - } - - tablePtr[0].p = (Uint32*)m_buffer.get_data(); - tablePtr[0].sz = m_buffer.length() >> 2; - - signal->set(0, PSREPBLOCKNO, GSN_GREP_SUB_CREATE_REQ, - GrepSubCreateReq::SignalLength); - ext->sendFragmentedSignal(signal, tablePtr, 1); - } - else { - req->subscriptionType = SubCreateReq::DatabaseSnapshot; - signal->set(0, PSREPBLOCKNO, GSN_GREP_SUB_CREATE_REQ, - GrepSubCreateReq::SignalLength); - ext->sendFragmentedSignal(signal, 0, 0); - } - - - -#ifdef DEBUG_GREP_SUBSCRIPTION - ndbout_c("Requestor: Sent request for creation of subscription"); -#endif -} - -void -requestRemoveSubscription(void * cbObj, NdbApiSignal* signal, - Uint32 subId, Uint32 subKey) -{ - ExtSender * ext = (ExtSender *) cbObj; - - GrepSubRemoveReq * req = (GrepSubRemoveReq *)signal->getDataPtrSend(); - req->subscriptionId = subId; - req->subscriptionKey = subKey; - signal->set(0, PSREPBLOCKNO, GSN_GREP_SUB_REMOVE_REQ, - GrepSubRemoveReq::SignalLength); - ext->sendSignal(signal); -} - -void -requestTransfer(void * cbObj, NdbApiSignal * signal, - Uint32 nodeGrp, Uint32 first, Uint32 last) -{ - ExtSender * ext = (ExtSender *) cbObj; - - RepGetGciBufferReq * req = (RepGetGciBufferReq*)signal->getDataPtrSend(); - req->firstGCI = first; - req->lastGCI = last; - req->nodeGrp = nodeGrp; - req->senderRef = ext->getOwnRef(); - signal->set(0, PSREPBLOCKNO, GSN_REP_GET_GCIBUFFER_REQ, - RepGetGciBufferReq::SignalLength); - ext->sendSignal(signal); - -#ifdef DEBUG_GREP_TRANSFER - ndbout_c("Requestor: Requested PS GCI buffers %d:[%d-%d]", - nodeGrp, first, last); -#endif -} - -void -requestApply(void * applyObj, NdbApiSignal * signal, - Uint32 nodeGrp, Uint32 first, Uint32 last, Uint32 force) -{ - AppNDB * applier = (AppNDB *) applyObj; - - if (first != last) { - RLOG(("WARNING! Trying to apply range [%d-%d]. This is not implemeted", - first, last)); - } - /** - * Apply GCIBuffer even if it is empty. - */ - applier->applyBuffer(nodeGrp, first, force); - /** - * @todo Handle return value from the method above - */ -} - -void -requestDeleteSS(void * cbObj, NdbApiSignal * signal, - Uint32 nodeGrp, Uint32 firstGCI, Uint32 lastGCI) -{ - GCIContainer * container = (GCIContainer *) cbObj; - - RLOG(("Deleting SS:%d:[%d-%d]", nodeGrp, firstGCI, lastGCI)); - - if(firstGCI < 0 || lastGCI<=0 || nodeGrp < 0) { - REPABORT("Illegal interval or wrong node group"); - //return GrepError::REP_DELETE_NEGATIVE_EPOCH; - } - - /********************************************* - * All buffers : Modify to the available ones - *********************************************/ - if(firstGCI==0 && lastGCI==(Uint32)0xFFFF) { - container->getAvailableGCIBuffers(nodeGrp, &firstGCI, &lastGCI); - } - - if(firstGCI == 0) { - Uint32 f, l; - container->getAvailableGCIBuffers(nodeGrp, &f, &l); - RLOG(("Deleting SS:[%d-%d]", f, l)); - if(f > firstGCI) firstGCI = f; - } - - /** - * Delete buffers - */ - for(Uint32 i=firstGCI; i<=lastGCI; i++) { - if(!container->destroyGCIBuffer(i, nodeGrp)) { - RLOG(("WARNING! Delete non-existing epoch SS:%d:[%d]", nodeGrp, i)); - } - //RLOG(("RepStateRequests: Deleting buffer SS:%d:[%d]", nodeGrp, i)); - } -} - -void -requestDeletePS(void * cbObj, NdbApiSignal * signal, - Uint32 nodeGrp, Uint32 firstGCI, Uint32 lastGCI) -{ - ExtSender * ext = (ExtSender *) cbObj; - - RepClearPSGciBufferReq * psReq = - (RepClearPSGciBufferReq*)signal->getDataPtrSend(); - /** - * @todo Should have better senderData /Lars - */ - psReq->senderData = 4711; - psReq->senderRef = ext->getOwnRef(); - psReq->firstGCI = firstGCI; - psReq->lastGCI = lastGCI; - psReq->nodeGrp = nodeGrp; - signal->set(0, PSREPBLOCKNO, GSN_REP_CLEAR_PS_GCIBUFFER_REQ, - RepClearPSGciBufferReq::SignalLength); - ext->sendSignal(signal); - - RLOG(("Requesting deletion of PS:%d:[%d-%d]", nodeGrp, firstGCI, lastGCI)); -} - -/** - * Function that requests information from REP PS about stored GCI Buffers - */ -void -requestEpochInfo(void * cbObj, NdbApiSignal* signal, Uint32 nodeGrp) -{ - ExtSender * ext = (ExtSender *) cbObj; - - RepGetGciReq * req = (RepGetGciReq *) signal->getDataPtrSend(); - req->nodeGrp = nodeGrp; - signal->set(0, PSREPBLOCKNO, GSN_REP_GET_GCI_REQ, - RepGetGciReq::SignalLength); - ext->sendSignal(signal); -} - -void -requestStartMetaLog(void * cbObj, NdbApiSignal * signal, - Uint32 subId, Uint32 subKey) -{ - RLOG(("Metalog starting. Subscription %d-%d", subId, subKey)); - startSubscription(cbObj, signal, SubscriptionData::MetaData, subId, subKey); -} - -void -requestStartDataLog(void * cbObj, NdbApiSignal * signal, - Uint32 subId, Uint32 subKey) -{ - RLOG(("Datalog starting. Subscription %d-%d", subId, subKey)); - startSubscription(cbObj, signal, SubscriptionData::TableData, subId, subKey); -} - -void -requestStartMetaScan(void * cbObj, NdbApiSignal* signal, - Uint32 subId, Uint32 subKey) -{ - RLOG(("Metascan starting. Subscription %d-%d", subId, subKey)); - scanSubscription(cbObj, signal, SubscriptionData::MetaData, subId, subKey); -} - -void -requestStartDataScan(void * cbObj, NdbApiSignal* signal, - Uint32 subId, Uint32 subKey) -{ - RLOG(("Datascan starting. Subscription %d-%d", subId, subKey)); - scanSubscription(cbObj, signal, SubscriptionData::TableData, subId, subKey); -} diff --git a/ndb/src/old_files/rep/state/testInterval/Makefile b/ndb/src/old_files/rep/state/testInterval/Makefile deleted file mode 100644 index fbb0b48c280..00000000000 --- a/ndb/src/old_files/rep/state/testInterval/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include .defs.mk - -TYPE := kernel ndbapitest - -BIN_TARGET := testInterval -BIN_TARGET_ARCHIVES := portlib general - -CCFLAGS_LOC += -I.. - -SOURCES = testInterval.cpp ../Interval.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/state/testInterval/testInterval.cpp b/ndb/src/old_files/rep/state/testInterval/testInterval.cpp deleted file mode 100644 index 463e4adffb7..00000000000 --- a/ndb/src/old_files/rep/state/testInterval/testInterval.cpp +++ /dev/null @@ -1,127 +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 */ - -#include "../Interval.hpp" - -#define TEST_REQUIRE(X); if (!(X)) { \ - ndbout_c("Test failed in line %d", __LINE__); testPassed = false; } - - -int -main () { - bool testPassed = true; - - Interval a, b, c; - - /** - * isEmpty - */ - TEST_REQUIRE(a.isEmpty()); - - a.set(3,1); - TEST_REQUIRE(a.isEmpty()); - - /** - * isEqual - */ - a.set(1,2); - TEST_REQUIRE(a.isEqual(1,2)); - - a.set(3,1); - TEST_REQUIRE(a.isEqual(1,0)); // The result should be normalized - - /** - * intervalAdd -- non-disjoint - */ - a.set(1,3); - b.set(3,10); - TEST_REQUIRE(intervalAdd(a, b, &c)); - TEST_REQUIRE(c.isEqual(1,10)); - - a.set(3,10); - b.set(1,3); - TEST_REQUIRE(intervalAdd(a, b, &c)); - TEST_REQUIRE(c.isEqual(1,10)); - - /** - * intervalAdd -- consequtive - */ - a.set(1,3); - b.set(4,10); - TEST_REQUIRE(intervalAdd(a, b, &c)); - TEST_REQUIRE(c.isEqual(1,10)); - - a.set(4,10); - b.set(1,3); - TEST_REQUIRE(intervalAdd(a, b, &c)); - TEST_REQUIRE(c.isEqual(1,10)); - - /** - * intervalAdd -- disjoint - */ - a.set(1,3); - b.set(5,10); - c.set(4711,4711); - TEST_REQUIRE(!intervalAdd(a, b, &c)); // This should not work - TEST_REQUIRE(c.isEqual(4711,4711)); - - a.set(5,10); - b.set(1,3); - c.set(4711,4711); - TEST_REQUIRE(!intervalAdd(a, b, &c)); // This should not work - TEST_REQUIRE(c.isEqual(4711,4711)); - - /** - * intervalLeftMinus -- non-disjoint - */ - a.set(1,3); - b.set(5,10); - intervalLeftMinus(a, b, &c); - TEST_REQUIRE(c.isEmpty()); - - a.set(5,10); - b.set(1,3); - intervalLeftMinus(a, b, &c); - TEST_REQUIRE(c.isEqual(5,10)); - - /** - * intervalLeftMinus -- consequtive - */ - a.set(1,3); - b.set(4,10); - intervalLeftMinus(a, b, &c); - TEST_REQUIRE(c.isEmpty()); - - a.set(4,10); - b.set(1,3); - intervalLeftMinus(a, b, &c); - TEST_REQUIRE(c.isEqual(4,10)); - - /** - * intervalLeftMinus -- disjoint - */ - a.set(1,3); - b.set(5,10); - intervalLeftMinus(a, b, &c); - TEST_REQUIRE(c.isEmpty()); - - a.set(5,10); - b.set(1,3); - intervalLeftMinus(a, b, &c); - TEST_REQUIRE(c.isEqual(5,10)); - - ndbout << "Test " << (testPassed ? "passed" : "failed") << "." << endl; -} diff --git a/ndb/src/old_files/rep/state/testRepState/Makefile b/ndb/src/old_files/rep/state/testRepState/Makefile deleted file mode 100644 index 33c6076eff3..00000000000 --- a/ndb/src/old_files/rep/state/testRepState/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include .defs.mk - -TYPE := kernel - -BIN_TARGET := testRequestor -BIN_TARGET_ARCHIVES := portlib general - -CCFLAGS_LOC += -I.. - -SOURCES = testRequestor.cpp \ - ../Requestor.cpp \ - ../RepState.cpp \ - ../Interval.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp b/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp deleted file mode 100644 index 8989f7098b8..00000000000 --- a/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp +++ /dev/null @@ -1,166 +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 */ - -#include "testRequestor.hpp" - -#define TEST_REQUIRE(X); if (!(X)) { \ - ndbout_c("Test failed in line %d", __LINE__); testPassed = false; } - - -struct Result { - Uint32 nodeGrp; - Uint32 first; - Uint32 last; - Uint32 force; -}; -Result result; - -/** Callbacks ****************************************************************/ - -void -f_transfer(void *, Signal* signal, Uint32 nodeGrp, Uint32 first, Uint32 last) -{ - result.nodeGrp = nodeGrp; - result.first = first; - result.last = last; - result.force = 0; - ndbout_c("Transfer: %d:[%d-%d] ", nodeGrp, first, last); -} - -void -f_apply(void *, Signal* signal, Uint32 nodeGrp, - Uint32 first, Uint32 last, Uint32 force) -{ - result.nodeGrp = nodeGrp; - result.first = first; - result.last = last; - result.force = force; - ndbout_c("Apply: %d:[%d-%d] (Force:%d)", nodeGrp, first, last, force); -} - -void -f_deletePS(void *, Signal* signal, Uint32 nodeGrp, Uint32 first, Uint32 last) -{ - result.nodeGrp = nodeGrp; - result.first = first; - result.last = last; - result.force = 0; - ndbout_c("DeletePS: %d:[%d-%d] ", nodeGrp, first, last); -} - -void -f_deleteSS(void *, Signal* signal, Uint32 nodeGrp, Uint32 first, Uint32 last) -{ - result.nodeGrp = nodeGrp; - result.first = first; - result.last = last; - result.force = 0; - ndbout_c("DeleteSS: %d:[%d-%d] ", nodeGrp, first, last); -} - -void -requestStartMetaLog(void * cbObj, Signal * signal) -{ - ndbout_c("StartMetaLog:"); -} - -void -requestStartDataLog(void * cbObj, Signal * signal) -{ - ndbout_c("StartDataLog:"); -} - -void -requestStartMetaScan(void * cbObj, Signal* signal) -{ - ndbout_c("StartMetaScan:"); -} - -void -requestStartDataScan(void * cbObj, Signal* signal) -{ - ndbout_c("StartDataScan:"); -} - - -/** Compare ****************************************************************/ - -bool compare(Uint32 nodeGrp, Uint32 first, Uint32 last, Uint32 force) -{ - return (result.nodeGrp == nodeGrp && result.first == first && - result.last == last && result.force == force); -} - - -/** Main *******************************************************************/ - -void -testRequestor() -{ - Signal * signal; - bool testPassed = true; - - Requestor requestor; - requestor.setObject(0); - requestor.setIntervalRequests(&f_transfer, - &f_apply, - &f_deletePS, - &f_deleteSS); - requestor.setStartRequests(&requestStartMetaLog, - &requestStartDataLog, - &requestStartMetaScan, - &requestStartDataScan); - requestor.setNoOfNodeGroups(1); - requestor.enable(); - requestor.enableTransfer(); - requestor.enableDelete(); - requestor.enableApply(); - requestor.m_state = Requestor::LOG; - - requestor.printStatus(); - - /** - * First transfer - */ - Interval i(12,13); - requestor.add(RepState::PS, 0, i); - requestor.execute(signal); - TEST_REQUIRE(compare(0, 12, 13, 0)); - - requestor.printStatus(); - - /** - * State transtion test - */ - - /** - * First apply - */ - - /** - * Test end - */ - if (testPassed) { - ndbout << "Test passed!" << endl; - } else { - ndbout << "Test FAILED!" << endl; - } -} - -int -main () { - testRequestor(); -} diff --git a/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp b/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp deleted file mode 100644 index 726b289114d..00000000000 --- a/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp +++ /dev/null @@ -1,24 +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 TEST_REQUESTOR_HPP -#define TEST_REQUESTOR_HPP - -#include "../Requestor.hpp" - -void testRequestor(); - -#endif diff --git a/ndb/src/old_files/rep/storage/GCIBuffer.cpp b/ndb/src/old_files/rep/storage/GCIBuffer.cpp deleted file mode 100644 index 013600b30a5..00000000000 --- a/ndb/src/old_files/rep/storage/GCIBuffer.cpp +++ /dev/null @@ -1,173 +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 */ - -#include -#include "GCIBuffer.hpp" - -/***************************************************************************** - * Constructor / Destructor - *****************************************************************************/ - -GCIBuffer::GCIBuffer(Uint32 gci, Uint32 id) -{ - m_gci = gci; - m_id = id; - m_complete = false; - m_receivedBytes = 0; -} - -GCIBuffer::~GCIBuffer() -{ - /** - * Loop through all pages and delete them - */ - for(Uint32 i=0; iinsertLogRecord(tableId, operation, ptr)) { - /** - * GCIPage is full. - */ - GCIPage * newPage = new GCIPage(m_gci); - assert(newPage != NULL); - m_pageList.push_back(newPage); - bool res = newPage->insertLogRecord(tableId, operation, ptr); - - if(!res) { - ndbout << "GCIBuffer: gci : " << m_gci << endl; - assert(res); - } - } -} - -/** - * @todo: We must be able to distinguish between Scan meta - * data and log meta data. - * Currently only scan meta data is considered. - */ -void -GCIBuffer::insertMetaRecord(Uint32 tableId, class LinearSectionPtr ptr[3]) -{ - GCIPage * p; - if(m_pageList.size()==0) { - p = new GCIPage(m_gci); - assert(p != NULL); - m_pageList.push_back(p); - } - - p = m_pageList.back(); - - if (!p->insertMetaRecord(tableId, ptr)) { - /** - * Page is full. - */ - GCIPage * newPage = new GCIPage(m_gci); - assert(newPage != NULL); - m_pageList.push_back(newPage); - - bool res = newPage->insertMetaRecord(tableId, ptr); - assert(res); - } -} - -void -GCIBuffer::insertPage(Uint32 gci, char * dataPtr, Uint32 dataBLen) -{ - /** - * allocate a new GCIPage - */ - GCIPage * page = new GCIPage(gci); - assert(page != 0); - - /** - * copy data into page - */ - page->copyDataToPage(dataPtr, dataBLen); - - /** - * put page on pagelist. - */ - m_pageList.push_back(page); - - /** - * Update GCI Buffer received bytes - */ - m_receivedBytes += dataBLen; -} - - -/***************************************************************************** - * Iterator - *****************************************************************************/ - -GCIBuffer::iterator::iterator(const GCIBuffer* gciBuffer) -{ - m_gciBuffer = gciBuffer; - m_iterator=0; - -} - -GCIPage * -GCIBuffer::iterator::first() -{ - m_iterator = 0; - if(m_gciBuffer->m_pageList.size() == 0) return NULL; - return (m_gciBuffer->m_pageList)[m_iterator]; -} - - -GCIPage * -GCIBuffer::iterator::next() -{ - m_iterator++; - if(m_gciBuffer->m_pageList.size() == 0) return NULL; - - if((m_iteratorm_pageList.size())) - return (m_gciBuffer->m_pageList)[m_iterator]; - else - return NULL; -} - - -bool -GCIBuffer::iterator::exists() -{ - return (m_iterator < m_gciBuffer->m_pageList.size()); -} - - - diff --git a/ndb/src/old_files/rep/storage/GCIBuffer.hpp b/ndb/src/old_files/rep/storage/GCIBuffer.hpp deleted file mode 100644 index 8a8473d1d49..00000000000 --- a/ndb/src/old_files/rep/storage/GCIBuffer.hpp +++ /dev/null @@ -1,112 +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 GCI_BUFFER_HPP -#define GCI_BUFFER_HPP - -#include "GCIPage.hpp" -#include -#include - -#include - -/** - * @class GCIBuffer - * @brief A GCIBuffer contains pages containing log records for ONE gci. - * - * @todo Load and save to disk - */ - -class GCIBuffer -{ -public: - GCIBuffer(Uint32 gci, Uint32 id); - ~GCIBuffer(); - - /** - * @fn insertLogRecord - * @param tableId Table this will be LogRecord applies to. - * @param operation Operation this LogRecord represents - * @param ptr Ptr of type LinearSectionPtr that contains the data. - * @return A full page or 0, if the insert didn't generate a full page. - */ - void insertLogRecord(Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3]); - - void insertMetaRecord(Uint32 tableId, class LinearSectionPtr ptr[3]); - - /** - * @fn inserts a page, containing Records into a GCI Buffer. - * @param gci - the gci of the page. - * @param dataPtr - Pointer originating from Page::m_page. - * @param dataBLen - length of dataptr in bytes - * @note Page must NOT be deallocated after being inserted! - */ - void insertPage(Uint32 gci, char * dataPtr, Uint32 dataBLen); - - /** - * @fn isComplete - * @return True if this GCI Buffer is done (gci is completed). - */ - bool isComplete() { return m_complete; }; - void setComplete() { m_complete = true; }; - - /** - * @fn getReceivedBytes - * @returns the total number of bytes that this buffer has received. - */ - Uint32 getReceivedBytes() const { return m_receivedBytes;} ; - - /** - * Iterator for pages - */ - class iterator { - public: - iterator(const GCIBuffer* gciBuffer); - GCIPage * first(); ///< @return First page (or NULL if no page exists) - GCIPage * next(); ///< @return Next page (or NULL if no more page exists) - bool exists(); ///< @return true if another page exists (for next()) - private: - Uint32 m_iterator; - const GCIBuffer * m_gciBuffer; - }; - friend class GCIBuffer::iterator; - - /*************************************************************************** - * GCI Buffer meta information - ***************************************************************************/ - void setGCI(Uint32 gci) { m_gci = gci; }; - Uint32 getGCI() { return m_gci; }; - - void setId(Uint32 id) { m_id = id; }; - Uint32 getId() { return m_id; }; - - bool m_force; // if true, ignore "execute" errors when - // restoring buffer (PUBLIC) during phase - // starting. -private: - /*************************************************************************** - * Private Variables - ***************************************************************************/ - Uint32 m_gci; ///< GCI of this buffer - Uint32 m_id; ///< names GCIBuffer - bool m_complete; ///< GCI complete; buffer contains - ///< everything - Vector m_pageList; ///< Storage for data/log record pages. - Uint32 m_receivedBytes; ///< Received bytes in this buffer -}; - -#endif diff --git a/ndb/src/old_files/rep/storage/GCIContainer.cpp b/ndb/src/old_files/rep/storage/GCIContainer.cpp deleted file mode 100644 index c161db0769b..00000000000 --- a/ndb/src/old_files/rep/storage/GCIContainer.cpp +++ /dev/null @@ -1,272 +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 */ - -#include "GCIContainer.hpp" -#include -#include -#include - -#include - -//#define GCICONTAINER_DEBUG - -/***************************************************************************** - * Constructors / Destructors - *****************************************************************************/ - -GCIContainer::GCIContainer(Uint32 maxNoOfIds) -{ - m_maxNoOfIds = maxNoOfIds; - - gciRange = new GCIRange[maxNoOfIds * sizeof(GCIRange)]; - - for(Uint32 i = 0; i < maxNoOfIds; i++) { - gciRange[i].m_firstGCI = 1; // The empty interval = [1,0] - gciRange[i].m_lastGCI = 0; - } - theMutexPtr = NdbMutex_Create(); -} - -GCIContainer::~GCIContainer() -{ - for(Uint32 i=0; i < m_bufferList.size(); i++) { - delete m_bufferList[i]; - m_bufferList[i] = 0; - } - - m_bufferList=0; - delete [] gciRange; - NdbMutex_Destroy(theMutexPtr); -} - -/***************************************************************************** - * GCIBuffer Create / Destroy - *****************************************************************************/ - -GCIBuffer * -GCIContainer::createGCIBuffer(Uint32 gci, Uint32 id) -{ - GCIBuffer * buf = new GCIBuffer(gci, id); - if (buf == NULL) REPABORT("Could not allocate new buffer"); - - m_bufferList.push_back(buf, true); - -#ifdef GCICONTAINER_DEBUG - ndbout_c("GCIContainer: New buffer created (GCI: %d, Id: %d)", gci, id); -#endif - return buf; -} - -/** - * Delete all GCI buffers strictly less than "gci" - */ -void -GCIContainer::destroyGCIBuffersBeforeGCI(Uint32 gci, Uint32 id) -{ - for(Uint32 i = 0 ; i < m_bufferList.size(); i++) { - if(m_bufferList[i]->getGCI() < gci) { -#ifdef GCICONTAINER_DEBUG - ndbout_c("GCIContainer: Destroying buffer (GCI: %d, id: %d)", - m_bufferList[i]->getGCI(), id); -#endif - destroyGCIBuffer(i, id); - } - } -} - -/** - * Delete one GCI Buffer - */ -bool -GCIContainer::destroyGCIBuffer(Uint32 gci, Uint32 id) -{ - m_bufferList.lock(); - for(Uint32 i = 0 ; i < m_bufferList.size(); i++) { - if((m_bufferList[i]->getGCI() == gci) && - (m_bufferList[i]->getId() == id)) { - - /** - * Delete the GCI Buffer - */ - delete m_bufferList[i]; - m_bufferList[i] = 0; - - /** - * Remove from the list of buffers stored in GCIContainer - */ - m_bufferList.erase(i,false); - m_bufferList.unlock(); - - /** - * Set info - */ - NdbMutex_Lock(theMutexPtr); - if(gciRange[id].m_firstGCI != gci) - RLOG(("WARNING! Buffer %d deleted from [%d-%d]", - gci, gciRange[id].m_firstGCI, gciRange[id].m_lastGCI)); - - gciRange[id].m_firstGCI++; - - /** - * Normalize empty interval to [1,0] - */ - if (gciRange[id].m_firstGCI > gciRange[id].m_lastGCI){ - gciRange[id].m_firstGCI = 1; - gciRange[id].m_lastGCI = 0; - } - NdbMutex_Unlock(theMutexPtr); - return true; - } - } - m_bufferList.unlock(); - return false; -} - -/***************************************************************************** - * GCIBuffer interface - *****************************************************************************/ - -GCIBuffer * -GCIContainer::getGCIBuffer(Uint32 gci, Uint32 id) -{ - GCIBuffer * gciBuffer = 0; - - m_bufferList.lock(); - for(Uint32 i=0; i < m_bufferList.size(); i++) { - gciBuffer = m_bufferList[i]; - if((gciBuffer->getGCI() == gci) && (gciBuffer->getId() == id)) { - m_bufferList.unlock(); - return gciBuffer; - } - } - m_bufferList.unlock(); - return 0; -} - -void -GCIContainer::setCompleted(Uint32 gci, Uint32 id) -{ - GCIBuffer * gciBuffer = getGCIBuffer(gci, id); - if(gciBuffer == 0) gciBuffer = createGCIBuffer(gci, id); - - gciBuffer->setComplete(); - -#ifdef GCICONTAINER_DEBUG - ndbout_c("GCIContainer: Buffer completely stored in GCIContainer (GCI: %d)", - gci); -#endif - - NdbMutex_Lock(theMutexPtr); - - /** - * If this is the first GCI Buffer to be completed - * then both first and last must be updated. - * Subsequently, only the last value must be updated. - */ - if(gciRange[id].m_firstGCI == 1 && gciRange[id].m_lastGCI == 0) { - gciRange[id].m_firstGCI = gci; - gciRange[id].m_lastGCI = gci; - } else { - if (gci != gciRange[id].m_lastGCI + 1) { - RLOG(("WARNING! Non-consequtive buffer %u completed [%u-%u])", - gci, gciRange[id].m_firstGCI, gciRange[id].m_lastGCI)); - } - gciRange[id].m_lastGCI = gci; - } - NdbMutex_Unlock(theMutexPtr); -} - -void -GCIContainer::getAvailableGCIBuffers(Uint32 id, Uint32 * first, Uint32 * last) -{ - NdbMutex_Lock(theMutexPtr); - *first = gciRange[id].m_firstGCI; - *last = gciRange[id].m_lastGCI; - NdbMutex_Unlock(theMutexPtr); -} - -/***************************************************************************** - * Inserts - *****************************************************************************/ -void -GCIContainer::insertMetaRecord(Uint32 id, Uint32 tableId, - class LinearSectionPtr ptr[3], Uint32 gci) -{ - /********************************************************** - * 1. Find correct GCI Buffer (Doesn't exist? Create one) - **********************************************************/ - GCIBuffer * gciBuffer = getGCIBuffer(gci, id); - if(gciBuffer == 0) gciBuffer = createGCIBuffer(gci, id); - - /********************************** - * 2. Insert record into GCIBuffer - **********************************/ - gciBuffer->insertMetaRecord(tableId, ptr); -} - -void -GCIContainer::insertLogRecord(Uint32 id, Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3], Uint32 gci) -{ - /********************************************************* - * 1. Find correct GCI Buffer (doesn't exist? create one) - *********************************************************/ - GCIBuffer * gciBuffer = getGCIBuffer(gci, id); - if(gciBuffer == 0) gciBuffer = createGCIBuffer(gci, id); - /********************************** - * 2. Insert record into GCIBuffer - **********************************/ - gciBuffer->insertLogRecord(tableId, operation, ptr); -} - -void -GCIContainer::insertPage(Uint32 gci, Uint32 id, - char * dataPtr, Uint32 dataBLen) -{ - /********************************************************* - * 1. Find correct GCI Buffer (doesn't exist? create one) - *********************************************************/ - GCIBuffer * gciBuffer = getGCIBuffer(gci, id); - if(gciBuffer == 0) gciBuffer = createGCIBuffer(gci, id); - - /******************************** - * 2. Insert page into GCIBuffer - ********************************/ - gciBuffer->insertPage(gci, dataPtr, dataBLen); -} - -bool -GCIContainer::reset() -{ - /** - * Clear the intervals - */ - for(Uint32 i = 0; i < m_maxNoOfIds; i++) { - gciRange[i].m_firstGCI = 1; // The empty interval = [1,0] - gciRange[i].m_lastGCI = 0; - } - - /** - * Destroy ALL gci buffers for ALL ids - */ - for(Uint32 i=0; i < m_bufferList.size(); i++) { - delete m_bufferList[i]; - m_bufferList[i] = 0; - } - m_bufferList.clear(); - - return true; -} diff --git a/ndb/src/old_files/rep/storage/GCIContainer.hpp b/ndb/src/old_files/rep/storage/GCIContainer.hpp deleted file mode 100644 index 48cbc66bfbd..00000000000 --- a/ndb/src/old_files/rep/storage/GCIContainer.hpp +++ /dev/null @@ -1,121 +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 GCI_CONTAINER_HPP -#define GCI_CONTAINER_HPP - -#include - -#include "LogRecord.hpp" -#include "GCIBuffer.hpp" - -#undef swap -#include -#include - -/** - * @class GCIContainer - * @brief Responsible for storing LogRecord:s in GCIBuffer:s - * - * Each GCIBuffer stored in the GCIContainer is named by a pair . - * (On PS REP the id is the nodeId, on SS REP the id is the node group). - */ -class GCIContainer { -public: - GCIContainer(Uint32 maxNoOfIds); - ~GCIContainer(); - - /*************************************************************************** - * GCIBuffer interface - ***************************************************************************/ - /** - * @return GCIBuffer if success, NULL otherwise - */ - GCIBuffer * createGCIBuffer(Uint32 gci, Uint32 id); - - /** - * Destroy all buffers with GCI strictly less than gci. - */ - void destroyGCIBuffersBeforeGCI(Uint32 gci, Uint32 id); - - /** - * Destroy all buffers with GCI gci. - * @return true if buffer was deleted, false if no buffer exists - */ - bool destroyGCIBuffer(Uint32 gci, Uint32 id); - - /** - * Fetch buffer - * @return GCIBuffer for gci, or NULL if no buffer found - */ - GCIBuffer * getGCIBuffer(Uint32 gci, Uint32 id); - - /** - * Set that buffer is completed, i.e. no more records are to be inserted - */ - void setCompleted(Uint32 gci, Uint32 id); - - - /** - * @fn insertPage - * @param gci GCI this page belongs to. - * @param id Id this page belongs to. - * @param dataPtr Pointer originating from Page::m_page - * @param dataBLen Length in bytes of data following dataptr. - */ - void insertPage(Uint32 gci, Uint32 id, char * dataPtr, Uint32 dataBLen); - - - /*************************************************************************** - * Record interface - ***************************************************************************/ - void insertLogRecord(Uint32 id, Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3], Uint32 gci); - - void insertMetaRecord(Uint32 id, Uint32 tableId, - class LinearSectionPtr ptr[3], Uint32 gci); - - /** - * Get available (complete) GCI Buffers that exists in the container. - * first == last means that there is one complete buffer - * @param id Id for which to as for available gci buffers. - * @param first First complete gci buffer - * @param last Last complete gci buffer - */ - void getAvailableGCIBuffers(Uint32 id, Uint32 * first, Uint32 * last); - - /** - * Resets the gcicontainer to its original state (initial state and empty) - * I.e., same state as when the object was first constructed. - * @return true if reset was ok - */ - bool reset(); - -private: - NdbMutex* theMutexPtr; - MutexVector m_bufferList; ///< All GCIBuffers stored - - typedef struct GCIRange { - Uint32 m_firstGCI; - Uint32 m_lastGCI; - }; - - Uint32 m_maxNoOfIds; - - GCIRange * gciRange; ///< Array of GCI ranges for each id -}; - -#endif diff --git a/ndb/src/old_files/rep/storage/GCIContainerPS.cpp b/ndb/src/old_files/rep/storage/GCIContainerPS.cpp deleted file mode 100644 index 5adb53f965c..00000000000 --- a/ndb/src/old_files/rep/storage/GCIContainerPS.cpp +++ /dev/null @@ -1,128 +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 */ - -#include "GCIContainerPS.hpp" -#include -#include -#include - -GCIContainerPS::GCIContainerPS(Uint32 maxNoOfNodeGrps) -{ - m_container = new GCIContainer(maxNoOfNodeGrps); - if (!m_container) REPABORT("Could not allocate new GCIContainer"); -} - -GCIContainerPS::~GCIContainerPS() -{ - delete m_container; -} - -void -GCIContainerPS::setNodeGroupInfo(NodeGroupInfo * info) -{ - m_nodeGroupInfo=info; -}; - -void -GCIContainerPS::createGCIBuffer(Uint32 gci, Uint32 id) -{ - m_container->createGCIBuffer(gci, id); -} - -void -GCIContainerPS::getAvailableGCIBuffers(Uint32 id /*nodegrp */, - Uint32 * first, Uint32 * last) { - - Uint32 nodeId = m_nodeGroupInfo->getPrimaryNode(id); - if(!nodeId) { - *first = 1; - *last = 0; - return; - } - - /** - *@todo do smart stuff with this! - */ - m_container->getAvailableGCIBuffers(nodeId, first, last); - -} - -void -GCIContainerPS::destroyGCIBuffersBeforeGCI(Uint32 gci) -{ - //for each node in every nodeGrp do: - NodeGroupInfo::iterator * it; - for(Uint32 i=0; igetNoOfNodeGroups(); i++) { - it = new NodeGroupInfo::iterator(i, m_nodeGroupInfo); - for(NodeConnectInfo * nci=it->first(); it->exists();nci=it->next()) { - m_container->destroyGCIBuffersBeforeGCI(gci, nci->nodeId); - } - delete it; - } -} - -void -GCIContainerPS::insertLogRecord(Uint32 id, Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3], Uint32 gci) -{ - m_container->insertLogRecord(id, tableId, operation, ptr, gci); -} - -void -GCIContainerPS::insertMetaRecord(Uint32 id, Uint32 tableId, - class LinearSectionPtr ptr[3], Uint32 gci) -{ - m_container->insertMetaRecord(id, tableId, ptr, gci); -} - -void -GCIContainerPS::setCompleted(Uint32 gci, Uint32 id) -{ - m_container->setCompleted(gci, id); -} - -GCIBuffer * -GCIContainerPS::getGCIBuffer(Uint32 gci, Uint32 id) -{ - return m_container->getGCIBuffer(gci, id); -} - -/** - * @todo: fix return value - */ -bool -GCIContainerPS::destroyGCIBuffer(Uint32 gci, Uint32 id) -{ - //for each node in nodeGrp id do: - NodeGroupInfo::iterator * it; - it = new NodeGroupInfo::iterator(id, m_nodeGroupInfo); - for(NodeConnectInfo * nci=it->first(); it->exists();nci=it->next()) - { - if(!m_container->destroyGCIBuffer(gci, nci->nodeId)) - { - delete it; - return false; - } - } - delete it; - return true; -} - -bool -GCIContainerPS::reset() -{ - return m_container->reset(); -} diff --git a/ndb/src/old_files/rep/storage/GCIContainerPS.hpp b/ndb/src/old_files/rep/storage/GCIContainerPS.hpp deleted file mode 100644 index 7f5aaac4840..00000000000 --- a/ndb/src/old_files/rep/storage/GCIContainerPS.hpp +++ /dev/null @@ -1,90 +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 GCI_CONTAINER_PS_HPP -#define GCI_CONTAINER_PS_HPP - -#include -#include - -#include "NodeGroupInfo.hpp" -#include - -#include -#include - -/** - * @class GCIContainerPS - * @brief Interface to GCIContainer that takes node groups into account - */ -class GCIContainerPS -{ -public: - GCIContainerPS(Uint32 maxNoOfNodeGrps); - ~GCIContainerPS(); - - void setNodeGroupInfo(NodeGroupInfo * info); - NodeGroupInfo * getNodeGroupInfo() {return m_nodeGroupInfo;}; - - void createGCIBuffer(Uint32 gci, Uint32 id); - void getAvailableGCIBuffers(Uint32 id /*nodegrp */, - Uint32 * first, Uint32 * last); - - /*************************************************************************** - * Record interface - ***************************************************************************/ - void insertLogRecord(Uint32 grpId, Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3], Uint32 gci); - - void insertMetaRecord(Uint32 grpId, Uint32 tableId, - class LinearSectionPtr ptr[3], Uint32 gci); - - /** - * Destroy all buffers with GCI strictly less than gci. - */ - void destroyGCIBuffersBeforeGCI(Uint32 gci); - - /** - * Set that buffer is completed, i.e. no more records are to be inserted - */ - void setCompleted(Uint32 gci, Uint32 id); - - /** - * Fetch buffer - * @return GCIBuffer for gci, or NULL if no buffer found - */ - GCIBuffer * getGCIBuffer(Uint32 gci, Uint32 id); - - /** - * Destroy all buffers with GCI gci. - * @return true if buffer was deleted, false if no buffer exists - */ - bool destroyGCIBuffer(Uint32 gci, Uint32 id); - - - /** - * Resets the gcicontainer to its original state (initial state and empty) - * @return true if reset was ok - */ - bool reset(); - -private: - GCIContainer * m_container; - NodeGroupInfo * m_nodeGroupInfo; -}; - - -#endif diff --git a/ndb/src/old_files/rep/storage/GCIPage.cpp b/ndb/src/old_files/rep/storage/GCIPage.cpp deleted file mode 100644 index 05ecde2fee1..00000000000 --- a/ndb/src/old_files/rep/storage/GCIPage.cpp +++ /dev/null @@ -1,165 +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 */ - -#include "GCIPage.hpp" -#include "assert.h" -#include - -GCIPage::GCIPage(Uint32 gci) -{ - m_first = NULL; - m_last = NULL; - m_gci = gci; - m_full = false; - m_currentPagePos=m_page; - m_usedBytes = 0; -} - -/***************************************************************************** - * Insert - *****************************************************************************/ - -/** - * Store a new log record on this page. - * @return True if success, false otherwise - */ -bool -GCIPage::insertLogRecord(Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3]) -{ - /** - * Calculate size of new logrecord in bytes - */ - assert(m_page!=NULL); - Uint32 size = 4*ptr[0].sz + 4*ptr[1].sz + sizeof(LogRecord); - - if(!((m_currentPagePos + size ) < (m_page + m_pageBSize))) { - m_full = true; - return false; // No free space. GCIBuffer must allocate a new page - } - LogRecord * lr = new(m_currentPagePos) LogRecord(); - if (lr==0) REPABORT("Could not allocate new log record"); - - lr->recordType = Record::LOG; - lr->recordLen = size; - lr->operation = operation; - lr->tableId = tableId; - lr->attributeHeaderWSize = ptr[0].sz; - lr->attributeDataWSize = ptr[1].sz; - - m_currentPagePos += sizeof(LogRecord); - - lr->attributeHeader = (Uint32*)m_currentPagePos; - memcpy(lr->attributeHeader, ptr[0].p, lr->attributeHeaderWSize * 4); - - m_currentPagePos += lr->attributeHeaderWSize * 4; - - lr->attributeData = (Uint32*)m_currentPagePos; - memcpy(lr->attributeData, ptr[1].p, lr->attributeDataWSize * 4); - - m_currentPagePos += lr->attributeDataWSize * 4; - - m_usedBytes+=size; - return true; -} - -/** - * Store a new log record on this page. - * @return True if sucessful, false otherwise. - */ -bool -GCIPage::insertMetaRecord(Uint32 tableId, class LinearSectionPtr ptr[3]) -{ - /** - * Calculate size of new logrecord in bytes - */ - Uint32 size = 4*ptr[0].sz + sizeof(MetaRecord); - - if(!((m_currentPagePos + size ) < (m_page + m_pageBSize))) { - m_full = true; - return false; // No free space. GCIBuffer must allocate a new page - } - MetaRecord * mr = new(m_currentPagePos) MetaRecord(); - if (mr==0) REPABORT("Could not allocate new meta record"); - - // mr->operation = operation; - mr->recordType = Record::META; - mr->recordLen = size; - - mr->tableId = tableId; - mr->dataLen = ptr[0].sz; - - - m_currentPagePos += sizeof(MetaRecord); - - mr->data = (Uint32*)m_currentPagePos; - memcpy(mr->data, ptr[0].p, mr->dataLen * 4); - - m_currentPagePos += mr->dataLen * 4; - - m_usedBytes+=size; - return true; -} - -/** - * copy function - */ -void -GCIPage::copyDataToPage(char * dataPtr, Uint32 dataBLen) -{ - assert (dataBLen < m_pageBSize); - memcpy(m_page, dataPtr, dataBLen); - m_currentPagePos=m_page + dataBLen; - m_usedBytes = dataBLen; - m_full = true; - m_first = (Record * )m_page; - dataPtr = 0; -} - -/***************************************************************************** - * Iterator - *****************************************************************************/ - -GCIPage::iterator::iterator(const GCIPage* page) -{ - m_gciPage = page; - m_data = m_gciPage->m_page; - m_currentRecord = (Record*)m_data; -} - -Record * -GCIPage::iterator::first() -{ - return m_currentRecord; -} - -Record * -GCIPage::iterator::next() -{ - m_currentRecord = (Record*) - ((char*)(m_currentRecord)+ m_currentRecord->recordLen); - if((char*)m_currentRecord < (char*)(m_data + m_gciPage->m_usedBytes)) - return m_currentRecord; - else { - return 0; - } -} - -bool -GCIPage::iterator::exists() -{ - return ((char*)m_currentRecord < (m_data + m_gciPage->m_usedBytes)); -} diff --git a/ndb/src/old_files/rep/storage/GCIPage.hpp b/ndb/src/old_files/rep/storage/GCIPage.hpp deleted file mode 100644 index 50c5ab0cfba..00000000000 --- a/ndb/src/old_files/rep/storage/GCIPage.hpp +++ /dev/null @@ -1,114 +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 GCI_PAGE_HPP -#define GCI_PAGE_HPP - -#include "LogRecord.hpp" -#include - -#include - -/** - * @class GCIPage - * @brief A GCIPage contains a number of LogRecords for a certain GCI. - */ -class GCIPage -{ -public: - GCIPage(Uint32 gci); - GCIPage(Uint32 gci, char * dataPtr, Uint32 szBytes); - - /** - * @fn insertLogRecord - * @param tableId the table this will be LogRecord applies to. - * @param operation the operation this LogRecord represents - * @param ptr A LinearSectionPtr p'tr that contains the data. - * @return PAGE_FULL if the page is full, otherwise "true" - */ - bool insertLogRecord(Uint32 tableId, Uint32 operation, - class LinearSectionPtr ptr[3]); - - /** - * @fn insertMetaRecord - */ - bool insertMetaRecord(Uint32 tableId, class LinearSectionPtr ptr[3]); - - /** - * @fn getFirstRecord - * @return First record (or NULL if no record is stored on page) - */ - Record * getFirstRecord() { return m_first; }; - - /** - * @fn getStorage - */ - Uint32 * getStoragePtr() const {return (Uint32*)m_page;} ; - Uint32 getStorageByteSize() const {return m_usedBytes;} ; - Uint32 getStorageWordSize() const {return m_usedBytes >> 2;}; - - /** - * @fn copyDataToPage - * @info copy dataPtr to Page - * @param dataPtr - data to copy - * @param dataBLen - size in bytes to copy. - */ - void copyDataToPage(char * dataPtr, Uint32 szBytes); - - /** - * Iterator for records (Not yet used! Maybe should not be used.) - */ - class iterator { - public: - iterator(const GCIPage* page); - Record * first(); ///< @return First record (or NULL if no page exists) - Record * next(); ///< @return Next record (or NULL if no more records) - bool exists(); ///< @return true if another record exists-for next() - private: - Record * m_currentRecord; - const char * m_data; - const GCIPage * m_gciPage; - }; - friend class GCIPage::iterator; - - /** - * @fn getGCI - * Get the GCI of all log records stored on this page. - */ - Uint32 getGCI() { return m_gci; }; - - /** - * @fn isFull - * @return true if page is full, i.e. is one attempt to add a record - * has failed, false otherwise. - */ - bool isFull() { return m_full; }; - -private: - Uint32 m_gci; ///< GCI for this page - - Record * m_first; ///< Pointer to first log record - Record * m_last; ///< Pointer to last log record - - bool m_full; - - static const Uint32 m_pageBSize = 8192; ///< Page size in bytes - char m_page[m_pageBSize]; ///< Storage for pages - char * m_currentPagePos; - Uint32 m_usedBytes; -}; - -#endif diff --git a/ndb/src/old_files/rep/storage/LogRecord.hpp b/ndb/src/old_files/rep/storage/LogRecord.hpp deleted file mode 100644 index a0bf3d52372..00000000000 --- a/ndb/src/old_files/rep/storage/LogRecord.hpp +++ /dev/null @@ -1,81 +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 LOG_RECORD_HPP -#define LOG_RECORD_HPP - -#include -#include - -/** - * @class Record - * @brief - */ -class Record { -public: - enum RecordType { META = 1, LOG = 2 }; - RecordType recordType; - Uint32 recordLen; ///< Size in bytes of entire log record, incl payload -}; - - -/** - * @class LogRecord - * @brief - */ -class LogRecord : public Record { -public: - ~LogRecord() { - NdbMem_Free(attributeHeader); - NdbMem_Free(attributeData); - } - -public: - Uint32 gci; //0 - Uint32 operation; //4 - Uint32 tableId; //8 - - Uint32 attributeHeaderWSize; //12 - Uint32 attributeDataWSize; //16 - Uint32 * attributeHeader; //20 - Uint32 * attributeData; //24 - - /** - * Next pointer - */ -}; - - -/** - * @class MetaRecord - * @brief - */ -class MetaRecord : public Record { -public: - ~MetaRecord() { - NdbMem_Free(data); - } - -public: - Uint32 gci; - Uint32 tableId; - Uint32 dataLen; //in words of the data (below) - Uint32 *data; -}; - - -#endif - diff --git a/ndb/src/old_files/rep/storage/Makefile b/ndb/src/old_files/rep/storage/Makefile deleted file mode 100644 index 89b3af455e8..00000000000 --- a/ndb/src/old_files/rep/storage/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include .defs.mk - -TYPE := repserver - -ARCHIVE_TARGET := repstorage - -SOURCES = GCIContainer.cpp \ - GCIContainerPS.cpp \ - GCIBuffer.cpp \ - GCIPage.cpp \ - NodeGroupInfo.cpp \ - NodeGroup.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp b/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp deleted file mode 100644 index 403f92a5999..00000000000 --- a/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp +++ /dev/null @@ -1,29 +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 NODE_CONNECTINFO_HPP -#define NODE_CONNECTINFO_HPP - -#include - -struct NodeConnectInfo { - NodeConnectInfo(Uint16 n, bool c): nodeId(n), connected(c) {}; - Uint32 nodeId; - bool connected; -}; - - -#endif diff --git a/ndb/src/old_files/rep/storage/NodeGroup.cpp b/ndb/src/old_files/rep/storage/NodeGroup.cpp deleted file mode 100644 index 33451efb104..00000000000 --- a/ndb/src/old_files/rep/storage/NodeGroup.cpp +++ /dev/null @@ -1,149 +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 */ - -#include "NodeGroup.hpp" -#include - -//#define NODE_GROUP_DEBUG - -NodeGroup::NodeGroup(Uint32 nodeGrp) { - m_nodeGrp = nodeGrp; - m_primaryNode = 0; -} - -NodeGroup::~NodeGroup() { - for(Uint32 i=0; inodeId == nodeId) { - m_nodeConnectList[i]->connected = connected; - return; - } - - /** - * If node not already in node group, then add node - */ - m_nodeConnectList.push_back(new NodeConnectInfo(nodeId, connected)); - sort(); - -#ifdef NODE_GROUP_DEBUG - for(Uint32 i=0; i < m_nodeConnectList.size(); i++) - ndbout_c("NodeGroup: NodeId=%d", m_nodeConnectList[i]->nodeId); -#endif -} - -/** - * crappy sort - */ -void NodeGroup::sort() { - NodeConnectInfo * tmp; - if(m_nodeConnectList.size()<2) - return; - for(Uint32 i=0; i < m_nodeConnectList.size()-1; i++) { - for(Uint32 j=m_nodeConnectList.size()-1;j>i+1; j--) { - if(m_nodeConnectList[j]->nodeId < m_nodeConnectList[j-1]->nodeId) { - tmp=m_nodeConnectList[j]; - m_nodeConnectList[j]=m_nodeConnectList[j-1]; - m_nodeConnectList[j-1]=tmp; - } - } - } -} - -Uint32 -NodeGroup::getFirstConnectedNode() { - for(Uint32 i=0; iconnected) - return m_nodeConnectList[i]->nodeId; - } - return 0; -} - -Uint32 -NodeGroup::getNodeGrp() { - return m_nodeGrp; -} - -Vector * -NodeGroup::getNodeConnectList(){ - return &m_nodeConnectList; -} - -void -NodeGroup::setNodeConnectStatus(Uint32 nodeId, bool connected) { - for(Uint32 i=0; inodeId==nodeId) { - m_nodeConnectList[i]->connected=connected; - break; - } - } -} - -bool -NodeGroup::isConnected(Uint32 nodeId) { - for(Uint32 i=0; inodeId == nodeId) { - return m_nodeConnectList[i]->connected; - } - } - REPABORT1("Check for non-existing node to be connected", nodeId); -} - - -bool -NodeGroup::fullyConnected() { - for(Uint32 i=0; iconnected)) - return false; - } - return true; -} - -bool -NodeGroup::connectedNodeGrp() { - for(Uint32 i=0; iconnected) { - return true; - } - } - return false; -} - - -bool -NodeGroup::exists(Uint32 nodeId) { - for(Uint32 i=0;inodeId==nodeId) - return true; - } - return false; -} diff --git a/ndb/src/old_files/rep/storage/NodeGroup.hpp b/ndb/src/old_files/rep/storage/NodeGroup.hpp deleted file mode 100644 index 1f515e02a23..00000000000 --- a/ndb/src/old_files/rep/storage/NodeGroup.hpp +++ /dev/null @@ -1,109 +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 NODE_GROUP_HPP -#define NODE_GROUP_HPP - -#include "NodeConnectInfo.hpp" -#include -#include - -#include - -/** - * @class NodeGroup - * @brief Contains info about all nodes belonging to one node group - */ -class NodeGroup { -public: - NodeGroup(Uint32 nodeGrp); - ~NodeGroup(); - /** - * Add node to node group - * @param nodeId Node id of node to add - * @param connected Status of this node (true==connected) - */ - void addNode(Uint32 nodeId, bool connected); - - /** - * get first connected node in this node group - * @returns nodeId, 0 if there is no connected node... - */ - Uint32 getFirstConnectedNode(); - - /** - * get the primary node id - * @returns nodeId, the primary node id - */ - Uint32 getPrimaryNode() {return m_primaryNode;}; - - - /** - * sets a node in this nodegroup as the primary node - */ - void setPrimaryNode(Uint32 nodeId) {m_primaryNode=nodeId;}; - - - /** - * get the node group - * @returns the nodegroup number (m_nodeGrp) - */ - Uint32 getNodeGrp(); - - /** - * set the connection status for a particular node - * @param nodeId - the nodeId to set the connect status on - * @param connected - the status of this node (true==connected) - */ - void setNodeConnectStatus(Uint32 nodeId, bool connected); - - /** - * Get the connection status for a particular node - * @param nodeId - the nodeId to check the connect status on - * @returns true if node is connected, otherwise false - */ - bool isConnected(Uint32 nodeId); - - /** - * gives the status of this nodegroup. - * @returns true if atleast one node in the node group is connected - */ - bool connectedNodeGrp(); - - /** - * @returns true if ALL nodes are connected - */ - bool fullyConnected(); - - /** - * - * @returns true if node exists in nodegroup - */ - bool exists(Uint32 nodeId); - - Vector * getNodeConnectList(); - -private: - /** - * Sort list (bubble sort) - */ - void sort(); - Uint32 m_primaryNode; - Uint32 m_nodeGrp; - Vector m_nodeConnectList; -}; - -#endif diff --git a/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp b/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp deleted file mode 100644 index 8c250268997..00000000000 --- a/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp +++ /dev/null @@ -1,218 +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 */ - -#include "NodeGroupInfo.hpp" - -NodeGroupInfo::NodeGroupInfo() -{ -} - -NodeGroupInfo::~NodeGroupInfo() -{ - for(Uint32 i=0; isetPrimaryNode(nodeId); - } else { - /** - * could not find node group - */ - RLOG(("Node group not found")); - REPABORT("Node group not found"); - } -} - -Uint32 -NodeGroupInfo::getPrimaryNode(Uint32 nodeGrp) { - Uint32 pos; - /** - * Validation check to find out that the nodegroup really exists. - * The list is not sorted, so the index of the nodegroup is returned - * in pos. - */ - if(existsNodeGroup(nodeGrp, &pos)) { - return m_nodeGroupList[pos]->getPrimaryNode(); - } else { - /** - * could not find node group - */ - RLOG(("Node group not found")); - REPABORT("Node group not found"); - } -} - -void -NodeGroupInfo::addNodeToNodeGrp(Uint32 nodeId, bool connected, Uint32 nodeGrp) -{ - Uint32 pos; - if(existsNodeGroup(nodeGrp, &pos)) { - /** - * NG exists -> just add the node - */ - m_nodeGroupList[pos]->addNode(nodeId, connected); - - } else { - /** - * NG do not exist -> create a new nodeGrp and add the node - */ - m_nodeGroupList.push_back(new NodeGroup(nodeGrp)); - - /** - * paranoia - */ - if(existsNodeGroup(nodeGrp, &pos)) { - m_nodeGroupList[pos]->addNode(nodeId, connected); - } else { - REPABORT(""); - } - } -} - -Uint32 -NodeGroupInfo::findNodeGroup(Uint32 nodeId) -{ - /** - * Check for existance in each nodegroup - */ - for(Uint32 i=0; iexists(nodeId)) return i; - } - - REPABORT1("No node group known for node", nodeId); -} - -Uint32 -NodeGroupInfo::getFirstConnectedNode(Uint32 nodeGrp) -{ - Uint32 pos; - /** - * Validation check to find out that the nodegroup really exists. - * The list is not sorted, so the index of the nodegroup is returned - * in pos. - */ - if(existsNodeGroup(nodeGrp, &pos)) { - return m_nodeGroupList[pos]->getFirstConnectedNode(); - } else { - /** - * could not find node group - */ - REPABORT(""); - } -} - -bool -NodeGroupInfo::connectedNodeGrp(Uint32 nodeGrp) -{ - return m_nodeGroupList[nodeGrp]->connectedNodeGrp(); -} - -bool -NodeGroupInfo::isConnected(Uint32 nodeId) -{ - Uint32 nodeGrp = findNodeGroup(nodeId); - return m_nodeGroupList[nodeGrp]->isConnected(nodeId); - -} - -bool -NodeGroupInfo::fullyConnected() -{ - for(Uint32 i=0; ifullyConnected())) - return false; - } - return true; -} - - -void -NodeGroupInfo::setConnectStatus(Uint32 nodeId, bool connected) -{ - Uint32 nodeGrp = findNodeGroup(nodeId); - m_nodeGroupList[nodeGrp]->setNodeConnectStatus(nodeId,connected); -} - - -bool -NodeGroupInfo::existsNodeGroup(Uint32 nodeGrp, Uint32 * pos) -{ - for(Uint32 i=0; igetNodeGrp()==nodeGrp) { - *pos=i; - return true; - } - } - return false; -} - - -/***************************************************************************** - * Iterator - *****************************************************************************/ - -NodeGroupInfo::iterator::iterator(Uint32 nodeGrp, NodeGroupInfo * ngi) -{ - m_iterator = 0; - for(Uint32 i=0; i < ngi->m_nodeGroupList.size(); i++) { - if(ngi->m_nodeGroupList[i]->getNodeGrp()==nodeGrp) { - m_nodeList = ngi->m_nodeGroupList[i]->getNodeConnectList(); - return; - } - } - m_nodeList=0; -} - -bool -NodeGroupInfo::iterator::exists() -{ - if(m_nodeList==0) return 0; - return (m_iterator < m_nodeList->size()); -} - -NodeConnectInfo * -NodeGroupInfo::iterator::first() -{ - m_iterator=0; - if(m_nodeList==0) return 0; - if(m_nodeList->size() == 0) return 0; - return (*m_nodeList)[m_iterator]; -} - -NodeConnectInfo * -NodeGroupInfo::iterator::next() -{ - m_iterator++; - if(m_nodeList==0) return 0; - if(m_nodeList->size() == 0) return 0; - if(m_iteratorsize()) - return (*m_nodeList)[m_iterator]; - else - return 0; -} - diff --git a/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp b/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp deleted file mode 100644 index 3d0499d4425..00000000000 --- a/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp +++ /dev/null @@ -1,145 +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 NODE_GROUPINFO_HPP -#define NODE_GROUPINFO_HPP - -#include -#include -#include -#include -//#include - -#include "NodeGroup.hpp" -#include - -/** - * @class NodeGroupInfo - * @brief Contains info about all node groups and their connectivity status - */ -class NodeGroupInfo { -public: - NodeGroupInfo(); - ~NodeGroupInfo(); - - /** - * Add a node to a nodegroup together with the status of the node - * @param nodeId - the nodeId to add - * @param connected - true/false - * @param nodeGrp - the nodegroup to add this node to - */ - void addNodeToNodeGrp(Uint32 nodeId, bool connected, Uint32 nodeGrp); - - /** - * Get the nodegroup that a node belongs to. - * @param nodeId - the nodeId to check wich nodegroup it belongs to - * @return the nodegroup - */ - Uint32 findNodeGroup(Uint32 nodeId); - - /** - * Get the first connected node in a node group - * @param nodegroup - the node group to get the node in. - * @return nodeId, 0 if there is no connected node in the nodegroup - */ - Uint32 getFirstConnectedNode(Uint32 nodeGrp); - - - /** - * sets a nodeId in a nodeGroup as the primary node. If the - * primary node fails, then a new node in the node group is chosen - * @param nodegroup - the node group to get the node in. - * @param nodeId, 0 if there is no connected node in the nodegroup - */ - void setPrimaryNode(Uint32 nodeGrp, Uint32 nodeId); - - /** - * gets the nodeId in the nodegroup of the primary node. - * @param nodegroup - the node group to get the node in. - * @return nodeId, 0 if there is no connected node in the nodegroup - */ - Uint32 getPrimaryNode(Uint32 nodeGrp); - - - /** - * Checks if at least one node in the nodegroup is connected. - * @param nodeGrp - the nodegrp to check - * @return true if >0 nodes are connected in the nodegroup - */ - bool connectedNodeGrp(Uint32 nodeGrp); - - /** - * Checks if a node is connected or not - * @param nodeId - the nodeId to check connectivity - * @return true if node is connected - */ - bool isConnected(Uint32 nodeId); - - /** - * Set if a node is connected or not - * @param nodeId - the nodeId to set the connect flag fory - * @param connected - true if connect false if disconnect - */ - void setConnectStatus(Uint32 nodeId, bool connected); - - /** - * Check if all nodes are connected in all nodegroups - * @return return true if ALL nodes are connected in ALL nodeGroups - */ - bool fullyConnected(); - - /** - * Get the number of nodegroups - * @return the number of nodegroups. - */ - Uint32 getNoOfNodeGroups() { return m_nodeGroupList.size();}; - - /** - * @class iterator - * The iterator class iterates over a nodegroup, returning nodeIds - * in that node group. - * - * @code - * NodeGroupInfo::iterator * it; - * for(Uint32 i=0;i < m_nodeGroupInfo->getNoOfNodeGroups();i++) { - * it = new NodeGroupInfo::iterator(i,m_nodeGroupInfo); - * for(NodeConnectInfo * nci=it->first(); it->exists();nci=it->next()) - * ndbout_c("Iterating: %d", nci->nodeId); - * - * } - * @end code - */ - class iterator { - public: - iterator(Uint32 nodeGrp, NodeGroupInfo * ngi); - NodeConnectInfo * first(); ///< @return nodeConnectInfo* if exists. - ///< (NULL if no more nodes exists) - NodeConnectInfo * next(); ///< @return nodeConnectInfo* if exists. - ///< (NULL if no more nodes exists) - bool exists(); ///< @return true if another nodeId exists (for next()) - private: - Uint32 m_iterator; - const Vector * m_nodeList; - }; - friend class NodeGroupInfo::iterator; - -private: - bool existsNodeGroup(Uint32 nodeGrp, Uint32 * pos); - - Vector m_nodeGroupList; -}; - -#endif diff --git a/ndb/src/old_files/rep/transfer/Makefile b/ndb/src/old_files/rep/transfer/Makefile deleted file mode 100644 index 0d8851e287a..00000000000 --- a/ndb/src/old_files/rep/transfer/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapi repserver kernel - -ARCHIVE_TARGET := reptransfer - -SOURCES = TransPS.cpp \ - TransSS.cpp \ - TransSSSubscriptions.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/old_files/rep/transfer/TransPS.cpp b/ndb/src/old_files/rep/transfer/TransPS.cpp deleted file mode 100644 index 11fb0203cbc..00000000000 --- a/ndb/src/old_files/rep/transfer/TransPS.cpp +++ /dev/null @@ -1,553 +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 */ - - -#include "ConfigRetriever.hpp" -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include "TransPS.hpp" -#include - -/***************************************************************************** - * Constructor / Destructor / Init - *****************************************************************************/ -TransPS::TransPS(GCIContainerPS* gciContainer) -{ - m_repSender = new ExtSender(); - m_gciContainerPS = gciContainer; -} - -TransPS::~TransPS() -{ - delete m_repSender; -} - -void -TransPS::init(TransporterFacade * tf, const char * connectString) -{ - abort(); -#ifdef NOT_FUNCTIONAL - m_signalExecThread = NdbThread_Create(signalExecThread_C, - (void **)this, - 32768, - "TransPS_Service", - NDB_THREAD_PRIO_LOW); - - ConfigRetriever configRetriever; - // configRetriever.setConnectString(connectString); - Properties* config = configRetriever.getConfig("REP", REP_VERSION_ID); - if (config == 0) { - ndbout << "TransPS: Configuration error: "; - const char* erString = configRetriever.getErrorString(); - if (erString == 0) { - erString = "No error specified!"; - } - ndbout << erString << endl; - exit(-1); - } - - Properties * extConfig; - /** - * @todo Hardcoded primary system name - */ - if (!config->getCopy("EXTERNAL SYSTEM_External", &extConfig)) { - ndbout << "External System \"External\" not found in configuration. " - << "Check config.ini." << endl; - config->print(); - exit(-1); - } - - m_ownNodeId = configRetriever.getOwnNodeId(); - extConfig->put("LocalNodeId", m_ownNodeId); - extConfig->put("LocalNodeType", "REP"); - Uint32 noOfConnections; - extConfig->get("NoOfConnections", &noOfConnections); - /* if (noOfConnections != 1) { - ndbout << "TransPS: There are " << noOfConnections << " connections " - << "defined in configuration" - << endl - << " There should be exactly one!" << endl; - exit(-1); - } - */ - /****************************** - * Set node id of external REP - ******************************/ - const Properties * connection; - const char * extSystem; - Uint32 extRepNodeId, tmpOwnNodeId; - - for(Uint32 i=0; i < noOfConnections; i++) { - extConfig->get("Connection", i, &connection); - if(connection == 0) REPABORT("No connection found"); - - if(connection->get("System1", &extSystem)) { - connection->get("NodeId1", &extRepNodeId); - connection->get("NodeId2", &tmpOwnNodeId); - } else { - connection->get("System2", &extSystem); - connection->get("NodeId1", &tmpOwnNodeId); - connection->get("NodeId2", &extRepNodeId); - } - if(m_ownNodeId == tmpOwnNodeId) - break; - } - - if(extRepNodeId==0) REPABORT("External replication server not found"); - if(extSystem==0) REPABORT("External system not found"); - - m_ownBlockNo = tf->open(this, execSignal, execNodeStatus); - assert(m_ownBlockNo > 0); - - m_ownRef = numberToRef(m_ownBlockNo, m_ownNodeId); - assert(m_ownNodeId == tf->ownId()); - - ndbout_c("Phase 4 (TransPS): Connection %d to external REP node %d opened", - m_ownBlockNo, extRepNodeId); - - m_repSender->setNodeId(extRepNodeId); - m_repSender->setOwnRef(m_ownRef); - m_repSender->setTransporterFacade(tf); -#endif -} - -/***************************************************************************** - * Signal Queue Executor - *****************************************************************************/ - -class SigMatch -{ -public: - int gsn; - void (TransPS::* function)(NdbApiSignal *signal); - - SigMatch() { gsn = 0; function = NULL; }; - - SigMatch(int _gsn, void (TransPS::* _function)(NdbApiSignal *signal)) { - gsn = _gsn; - function = _function; - }; - - bool check(NdbApiSignal *signal) { - if(signal->readSignalNumber() == gsn) return true; - return false; - }; -}; - -extern "C" -void * -signalExecThread_C(void *r) -{ - TransPS *repps = (TransPS*)r; - - repps->signalExecThreadRun(); - - NdbThread_Exit(0); - /* NOTREACHED */ - return 0; -} - -void -TransPS::signalExecThreadRun() -{ - Vector sl; - - /** - * Signals executed here - */ - sl.push_back(SigMatch(GSN_REP_GET_GCI_REQ, - &TransPS::execREP_GET_GCI_REQ)); - sl.push_back(SigMatch(GSN_REP_GET_GCIBUFFER_REQ, - &TransPS::execREP_GET_GCIBUFFER_REQ)); - sl.push_back(SigMatch(GSN_REP_CLEAR_PS_GCIBUFFER_REQ, - &TransPS::execREP_CLEAR_PS_GCIBUFFER_REQ)); - - /** - * Signals to be forwarded to GREP::PSCoord - */ - sl.push_back(SigMatch(GSN_GREP_SUB_CREATE_REQ, &TransPS::sendSignalGrep)); - - /** - * Signals to be forwarded to GREP::PSCoord - */ - sl.push_back(SigMatch(GSN_GREP_CREATE_SUBID_REQ, &TransPS::sendSignalGrep)); - sl.push_back(SigMatch(GSN_GREP_SUB_START_REQ, &TransPS::sendSignalGrep)); - sl.push_back(SigMatch(GSN_GREP_SUB_SYNC_REQ, &TransPS::sendSignalGrep)); - sl.push_back(SigMatch(GSN_GREP_SUB_REMOVE_REQ, &TransPS::sendSignalGrep)); - - while(1) { - SigMatch *handler = NULL; - NdbApiSignal *signal = NULL; - if(m_signalRecvQueue.waitFor(sl, handler, signal, DEFAULT_TIMEOUT)) { -#if 0 - ndbout_c("TransPS: Removed signal from queue (GSN: %d, QSize: %d)", - signal->readSignalNumber(), m_signalRecvQueue.size()); -#endif - if(handler->function != 0) { - (this->*handler->function)(signal); - delete signal; - signal = 0; - } else { - REPABORT("Illegal handler for signal"); - } - } - } -} - -void -TransPS::sendSignalRep(NdbApiSignal * s) -{ - m_repSender->sendSignal(s); -} - -void -TransPS::sendSignalGrep(NdbApiSignal * s) -{ - m_grepSender->sendSignal(s); -} - -void -TransPS::sendFragmentedSignalRep(NdbApiSignal * s, - LinearSectionPtr ptr[3], - Uint32 sections) -{ - m_repSender->sendFragmentedSignal(s, ptr, sections); -} - -void -TransPS::sendFragmentedSignalGrep(NdbApiSignal * s, - LinearSectionPtr ptr[3], - Uint32 sections) -{ - m_grepSender->sendFragmentedSignal(s, ptr, sections); -} - - -void -TransPS::execNodeStatus(void* obj, Uint16 nodeId, bool alive, bool nfCompleted) -{ -// TransPS * thisObj = (TransPS*)obj; - - RLOG(("Node changed state (NodeId %d, Alive %d, nfCompleted %d)", - nodeId, alive, nfCompleted)); - - if(!alive && !nfCompleted) { } - - if(!alive && nfCompleted) { } -} - -void -TransPS::execSignal(void* executeObj, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]){ - - TransPS * executor = (TransPS *) executeObj; - - const Uint32 gsn = signal->readSignalNumber(); - const Uint32 len = signal->getLength(); - - NdbApiSignal * s = new NdbApiSignal(executor->m_ownRef); - switch(gsn){ - case GSN_REP_GET_GCI_REQ: - case GSN_REP_GET_GCIBUFFER_REQ: - case GSN_REP_CLEAR_PS_GCIBUFFER_REQ: - s->set(0, SSREPBLOCKNO, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - break; - case GSN_GREP_SUB_CREATE_REQ: - { - if(signal->m_noOfSections > 0) { - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - s->set(0, GREP, gsn, - len); - executor->sendFragmentedSignalGrep(s,ptr,1); - delete s; - } else { - s->set(0, GREP, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - } - } - break; - case GSN_GREP_SUB_START_REQ: - case GSN_GREP_SUB_SYNC_REQ: - case GSN_GREP_SUB_REMOVE_REQ: - case GSN_GREP_CREATE_SUBID_REQ: - s->set(0, GREP, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - break; - default: - REPABORT1("Illegal signal received in execSignal", gsn); - } -#if 0 - ndbout_c("TransPS: Inserted signal into queue (GSN: %d, Len: %d)", - signal->readSignalNumber(), len); -#endif -} - -/***************************************************************************** - * Signal Receivers - *****************************************************************************/ - -void -TransPS::execREP_GET_GCIBUFFER_REQ(NdbApiSignal* signal) -{ - RepGetGciBufferReq * req = (RepGetGciBufferReq*)signal->getDataPtr(); - Uint32 firstGCI = req->firstGCI; - Uint32 lastGCI = req->lastGCI; - Uint32 nodeGrp = req->nodeGrp; - - RLOG(("Received request for %d:[%d-%d]", nodeGrp, firstGCI, lastGCI)); - - NodeGroupInfo * tmp = m_gciContainerPS->getNodeGroupInfo(); - Uint32 nodeId = tmp->getPrimaryNode(nodeGrp); - /** - * If there is no connected node in the nodegroup -> abort. - * @todo: Handle error when a nodegroup is "dead" - */ - if(!nodeId) { - RLOG(("There are no connected nodes in node group %d", nodeGrp)); - sendREP_GET_GCIBUFFER_REF(signal, firstGCI, lastGCI, nodeGrp, - GrepError::REP_NO_CONNECTED_NODES); - return; - } - - transferPages(firstGCI, lastGCI, nodeId, nodeGrp, signal); - - /** - * Done tfxing pages, sending GCIBuffer conf. - */ - Uint32 first, last; - m_gciContainerPS->getAvailableGCIBuffers(nodeGrp, &first, &last); - - RepGetGciBufferConf * conf = (RepGetGciBufferConf*)req; - conf->senderRef = m_ownRef; - conf->firstPSGCI = first; // Buffers found on REP PS (piggy-back info) - conf->lastPSGCI = last; - conf->firstSSGCI = firstGCI; // Now been transferred to REP SS - conf->lastSSGCI = lastGCI; - conf->nodeGrp = nodeGrp; - signal->set(0, SSREPBLOCKNO, GSN_REP_GET_GCIBUFFER_CONF, - RepGetGciBufferConf::SignalLength); - sendSignalRep(signal); - - RLOG(("Sent %d:[%d-%d] (Stored PS:%d:[%d-%d])", - nodeGrp, firstGCI, lastGCI, nodeGrp, first, last)); -} - -void -TransPS::transferPages(Uint32 firstGCI, Uint32 lastGCI, - Uint32 nodeId, Uint32 nodeGrp, - NdbApiSignal * signal) -{ - /** - * Transfer pages in GCI Buffer to SS - * When buffer is sent, send accounting information. - */ - RepDataPage * pageData = (RepDataPage*)signal->getDataPtr(); - LinearSectionPtr ptr[1]; - GCIPage * page; - for(Uint32 i=firstGCI; i<=lastGCI; i++) { - Uint32 totalSizeSent = 0; - GCIBuffer * buffer = m_gciContainerPS->getGCIBuffer(i, nodeId); - - if(buffer != 0) { - GCIBuffer::iterator it(buffer); - /** - * Send all pages to SS - */ - for (page = it.first(); page != 0; page = it.next()) { - ptr[0].p = page->getStoragePtr(); - ptr[0].sz = page->getStorageWordSize(); - totalSizeSent += ptr[0].sz; - pageData->gci = i; - pageData->nodeGrp = nodeGrp; - signal->set(0, SSREPBLOCKNO, GSN_REP_DATA_PAGE, - RepDataPage::SignalLength); - sendFragmentedSignalRep(signal, ptr, 1); - } - - /** - * Send accounting information to SS - */ - RepGciBufferAccRep * rep = (RepGciBufferAccRep *)pageData; - rep->gci = i; - rep->nodeGrp = nodeGrp; - rep->totalSentBytes = (4 * totalSizeSent); //words to bytes - signal->set(0, SSREPBLOCKNO, GSN_REP_GCIBUFFER_ACC_REP, - RepGciBufferAccRep::SignalLength); - sendSignalRep(signal); - - RLOG(("Sending %d:[%d] (%d bytes) to external REP (nodeId %d)", - nodeGrp, i, 4*totalSizeSent, nodeId)); - } - } - page = 0; -} - -void -TransPS::execREP_GET_GCI_REQ(NdbApiSignal* signal) -{ - RepGetGciReq * req = (RepGetGciReq*)signal->getDataPtr(); - Uint32 nodeGrp = req->nodeGrp; - - Uint32 first, last; - m_gciContainerPS->getAvailableGCIBuffers(nodeGrp, &first, &last); - - RepGetGciConf * conf = (RepGetGciConf*) req; - conf->firstPSGCI = first; - conf->lastPSGCI = last; - conf->senderRef = m_ownRef; - conf->nodeGrp = nodeGrp; - signal->set(0, SSREPBLOCKNO, GSN_REP_GET_GCI_CONF, - RepGetGciConf::SignalLength); - sendSignalRep(signal); -} - -/** - * REP_CLEAR_PS_GCIBUFFER_REQ - * destroy the GCI buffer in the GCI Container - * and send a CONF to Grep::SSCoord - */ -void -TransPS::execREP_CLEAR_PS_GCIBUFFER_REQ(NdbApiSignal * signal) -{ - RepClearPSGciBufferReq * const req = - (RepClearPSGciBufferReq*)signal->getDataPtr(); - Uint32 firstGCI = req->firstGCI; - Uint32 lastGCI = req->lastGCI; - Uint32 nodeGrp = req->nodeGrp; - - assert(firstGCI >= 0 && lastGCI > 0); - if(firstGCI<0 && lastGCI <= 0) - { - RLOG(("WARNING! Illegal delete request ignored")); - sendREP_CLEAR_PS_GCIBUFFER_REF(signal, firstGCI, lastGCI, - 0, nodeGrp, - GrepError::REP_DELETE_NEGATIVE_EPOCH); - } - - if(firstGCI==0 && lastGCI==(Uint32)0xFFFF) { - m_gciContainerPS->getAvailableGCIBuffers(nodeGrp, &firstGCI, &lastGCI); - RLOG(("Deleting PS:[%d-%d]", firstGCI, lastGCI)); - } - - if(firstGCI == 0) { - Uint32 f, l; - m_gciContainerPS->getAvailableGCIBuffers(nodeGrp, &f, &l); - - RLOG(("Deleting PS:[%d-%d]", f, l)); - - if(f>firstGCI) - firstGCI = f; - } - - /** - * Delete buffer - * Abort if we try to destroy a buffer that does not exist - * Deleting buffer from every node in the nodegroup - */ - for(Uint32 i=firstGCI; i<=lastGCI; i++) { - if(!m_gciContainerPS->destroyGCIBuffer(i, nodeGrp)) { - sendREP_CLEAR_PS_GCIBUFFER_REF(signal, firstGCI, lastGCI, i, nodeGrp, - GrepError::REP_DELETE_NONEXISTING_EPOCH); - return; - } - - RLOG(("Deleted PS:%d:[%d]", nodeGrp, i)); - } - - /** - * Send reply to Grep::SSCoord - */ - RepClearPSGciBufferConf * conf = (RepClearPSGciBufferConf*)req; - conf->firstGCI = firstGCI; - conf->lastGCI = lastGCI; - conf->nodeGrp = nodeGrp; - signal->set(0, SSREPBLOCKNO, GSN_REP_CLEAR_PS_GCIBUFFER_CONF, - RepClearPSGciBufferConf::SignalLength); - sendSignalRep(signal); -} - -/***************************************************************************** - * Signal Senders - *****************************************************************************/ - -void -TransPS::sendREP_GET_GCI_REF(NdbApiSignal* signal, - Uint32 nodeGrp, - Uint32 firstPSGCI, Uint32 lastPSGCI, - GrepError::Code err) -{ - RepGetGciRef * ref = (RepGetGciRef *)signal->getDataPtrSend(); - ref->firstPSGCI = firstPSGCI; - ref->lastPSGCI = lastPSGCI; - ref->firstSSGCI = 0; - ref->lastSSGCI = 0; - ref->nodeGrp = nodeGrp; - ref->err = err; - signal->set(0, SSREPBLOCKNO, GSN_REP_GET_GCI_REF, - RepGetGciRef::SignalLength); - sendSignalRep(signal); -} - -void -TransPS::sendREP_CLEAR_PS_GCIBUFFER_REF(NdbApiSignal* signal, - Uint32 firstGCI, Uint32 lastGCI, - Uint32 currentGCI, - Uint32 nodeGrp, - GrepError::Code err) -{ - RepClearPSGciBufferRef * ref = - (RepClearPSGciBufferRef *)signal->getDataPtrSend(); - ref->firstGCI = firstGCI; - ref->lastGCI = lastGCI; - ref->currentGCI = currentGCI; - ref->nodeGrp = nodeGrp; - ref->err = err; - signal->set(0, SSREPBLOCKNO, GSN_REP_CLEAR_PS_GCIBUFFER_REF, - RepClearPSGciBufferRef::SignalLength); - sendSignalRep(signal); -} - -void -TransPS::sendREP_GET_GCIBUFFER_REF(NdbApiSignal* signal, - Uint32 firstGCI, Uint32 lastGCI, - Uint32 nodeGrp, - GrepError::Code err) -{ - RepGetGciBufferRef * ref = - (RepGetGciBufferRef *)signal->getDataPtrSend(); - ref->firstPSGCI = firstGCI; - ref->lastPSGCI = lastGCI; - ref->firstSSGCI = 0; - ref->lastSSGCI = 0; - ref->nodeGrp = nodeGrp; - ref->err = err; - signal->set(0, SSREPBLOCKNO, GSN_REP_GET_GCIBUFFER_REF, - RepGetGciBufferRef::SignalLength); - sendSignalRep(signal); -} diff --git a/ndb/src/old_files/rep/transfer/TransPS.hpp b/ndb/src/old_files/rep/transfer/TransPS.hpp deleted file mode 100644 index 0464b9e47c0..00000000000 --- a/ndb/src/old_files/rep/transfer/TransPS.hpp +++ /dev/null @@ -1,136 +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 TransPS_HPP -#define TransPS_HPP - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include -#include - -#include - -extern "C" { -static void * signalExecThread_C(void *); -} - -/** - * @class TransPS - * @brief Responsible for REP-REP interface in Primary System role - */ -class TransPS { -public: - /*************************************************************************** - * Constructor / Destructor - ***************************************************************************/ - TransPS(GCIContainerPS * gciContainer); - ~TransPS(); - - void init(TransporterFacade * tf, const char * connectString = NULL); - - /*************************************************************************** - * Public Methods - ***************************************************************************/ - ExtSender * getRepSender() { return m_repSender; }; - void setGrepSender(ExtSender * es) { m_grepSender = es; }; - -private: - /*************************************************************************** - * Private Methods - ***************************************************************************/ - /** - * SignalQueue executor thread - */ - - friend void * signalExecThread_C(void *); - - void signalExecThreadRun(); - - static void execSignal(void* signalSender, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); - - static void execNodeStatus(void* signalSender, NodeId, - bool alive, bool nfCompleted); - - void sendSignalRep(NdbApiSignal * s); - void sendSignalGrep(NdbApiSignal * s); - - void sendFragmentedSignalRep(NdbApiSignal * s, LinearSectionPtr ptr[3], - Uint32 sections ); - void sendFragmentedSignalGrep(NdbApiSignal * s, LinearSectionPtr ptr[3], - Uint32 sections ); - - /*************************************************************************** - * Signal executors - ***************************************************************************/ - void execREP_CLEAR_PS_GCIBUFFER_REQ(NdbApiSignal*); - void execREP_GET_GCI_REQ(NdbApiSignal*); - void execREP_GET_GCIBUFFER_REQ(NdbApiSignal*); - - /*************************************************************************** - * Ref signal senders - ***************************************************************************/ - void sendREP_GET_GCI_REF(NdbApiSignal* signal, Uint32 nodeGrp, - Uint32 firstPSGCI, Uint32 lastPSGCI, - GrepError::Code err); - - void sendREP_CLEAR_PS_GCIBUFFER_REF(NdbApiSignal* signal, - Uint32 firstGCI, Uint32 lastGCI, - Uint32 currentGCI, Uint32 nodeGrp, - GrepError::Code err); - - void sendREP_GET_GCIBUFFER_REF(NdbApiSignal* signal, - Uint32 firstGCI, Uint32 lastGCI, - Uint32 nodeGrp, - GrepError::Code err); - - /*************************************************************************** - * Other Methods - ***************************************************************************/ - void transferPages(Uint32 firstGCI, Uint32 lastGCI, Uint32 id, - Uint32 nodeGrp, NdbApiSignal* signal); - - /************* - * Variables - *************/ - Uint32 m_ownNodeId; ///< NodeId of this node - Uint32 m_ownBlockNo; ///< BlockNo of this "block" - BlockReference m_ownRef; ///< Reference to this - - BlockReference m_extRepRef; ///< Node ref of REP at SS - - ExtSender * m_grepSender; ///< Responsible send to GREP - ExtSender * m_repSender; ///< Responsible send to REP - - struct NdbThread * m_signalExecThread; - class SignalQueue m_signalRecvQueue; - - GCIContainerPS * m_gciContainerPS; ///< Ref to gci container. -}; - -#endif diff --git a/ndb/src/old_files/rep/transfer/TransSS.cpp b/ndb/src/old_files/rep/transfer/TransSS.cpp deleted file mode 100644 index 376c6375bc4..00000000000 --- a/ndb/src/old_files/rep/transfer/TransSS.cpp +++ /dev/null @@ -1,653 +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 */ - - -#include "ConfigRetriever.hpp" - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include "TransSS.hpp" - -//#define DEBUG_REP_GET_GCI_CONF - -/***************************************************************************** - * Constructor / Destructor / Init - *****************************************************************************/ -TransSS::TransSS(GCIContainer * gciContainer, RepState * repState) -{ - m_repSender = new ExtSender(); - if (!m_repSender) REPABORT("Could not allocate new ExtSender"); - m_gciContainer = gciContainer; - m_repState = repState; -} - -TransSS::~TransSS() -{ - delete m_repSender; -} - -void -TransSS::init(const char * connectString) -{ - abort(); -#ifdef NOT_FUNCTIONAL - m_signalExecThread = NdbThread_Create(signalExecThread_C, - (void **)this, - 32768, - "TransSS_Service", - NDB_THREAD_PRIO_LOW); - ConfigRetriever configRetriever; - configRetriever.setConnectString(connectString); - - Properties* config = configRetriever.getConfig("REP", REP_VERSION_ID); - if (config == 0) { - ndbout << "Configuration error: "; - const char* erString = configRetriever.getErrorString(); - if (erString == 0) { - erString = "No error specified!"; - } - ndbout << erString << endl; - exit(-1); - } - Properties * extConfig; - - /** - * @todo Hardcoded standby system name - */ - if (!config->getCopy("EXTERNAL SYSTEM_External", &extConfig)) { - ndbout << "External System \"External\" not found in configuration. " - << "Check config.ini." << endl; - config->print(); - exit(-1); - } - m_ownNodeId = configRetriever.getOwnNodeId(); - extConfig->put("LocalNodeId", m_ownNodeId); - extConfig->put("LocalNodeType", "REP"); - Uint32 noOfConnections; - extConfig->get("NoOfConnections", &noOfConnections); - /* if (noOfConnections != 1) { - ndbout << "TransSS: There are " << noOfConnections << " connections " - << "defined in configuration" - << endl - << " There should be exactly one!" << endl; - exit(-1); - }*/ - - /****************************** - * Set node id of external REP - ******************************/ - const Properties * connection; - const char * extSystem; - - Uint32 extRepNodeId, tmpOwnNodeId; - - for(Uint32 i=0; i < noOfConnections; i++) { - extConfig->get("Connection", i, &connection); - if(connection == 0) REPABORT("Connection not found"); - - if(connection->get("System1", &extSystem)) { - connection->get("NodeId1", &extRepNodeId); - connection->get("NodeId2", &tmpOwnNodeId); - } else { - connection->get("System2", &extSystem); - connection->get("NodeId1", &tmpOwnNodeId); - connection->get("NodeId2", &extRepNodeId); - } - if(m_ownNodeId == tmpOwnNodeId) - break; - } - - if(extRepNodeId==0) REPABORT("External replication server not found"); - if(extSystem==0) REPABORT("External system not found"); - - m_transporterFacade = new TransporterFacade(); - if (!m_transporterFacade->init(extConfig)) - { - ndbout << "TransSS: Failed to initialize transporter facade" << endl; - exit(-1); - } - - m_ownBlockNo = m_transporterFacade->open(this, execSignal, execNodeStatus); - assert(m_ownBlockNo > 0); - m_ownRef = numberToRef(m_ownBlockNo, m_ownNodeId); - assert(m_ownNodeId == m_transporterFacade->ownId()); - - ndbout_c("Phase 2 (TransSS): Connection %d to external REP node %d opened", - m_ownBlockNo, extRepNodeId); - - m_repSender->setNodeId(extRepNodeId); - m_repSender->setOwnRef(m_ownRef); - m_repSender->setTransporterFacade(m_transporterFacade); -#endif -} - -/***************************************************************************** - * Signal Queue Executor - *****************************************************************************/ - -class SigMatch -{ -public: - int gsn; - void (TransSS::* function)(NdbApiSignal *signal); - - SigMatch() { gsn = 0; function = NULL; }; - - SigMatch(int _gsn, void (TransSS::* _function)(NdbApiSignal *signal)) { - gsn = _gsn; - function = _function; - }; - - bool check(NdbApiSignal *signal) { - if(signal->readSignalNumber() == gsn) - return true; - return false; - }; -}; - -extern "C" -void * -signalExecThread_C(void *r) -{ - TransSS *transss = (TransSS*)r; - - transss->signalExecThreadRun(); - NdbThread_Exit(0); - /* NOTREACHED */ - return 0; -} - -void -TransSS::signalExecThreadRun() -{ - Vector sl; - /** - * Signals to be forwarded to TransPS - */ - sl.push_back(SigMatch(GSN_REP_GET_GCI_REQ, - &TransSS::sendSignalRep)); - sl.push_back(SigMatch(GSN_REP_GET_GCIBUFFER_REQ, - &TransSS::sendSignalRep)); - /** - * Signals to be executed - */ - sl.push_back(SigMatch(GSN_REP_GCIBUFFER_ACC_REP, - &TransSS::execREP_GCIBUFFER_ACC_REP)); - sl.push_back(SigMatch(GSN_REP_DISCONNECT_REP, - &TransSS::execREP_DISCONNECT_REP)); - sl.push_back(SigMatch(GSN_GREP_SUB_REMOVE_CONF, - &TransSS::execGREP_SUB_REMOVE_CONF)); - sl.push_back(SigMatch(GSN_REP_GET_GCIBUFFER_CONF, - &TransSS::execREP_GET_GCIBUFFER_CONF)); - - sl.push_back(SigMatch(GSN_REP_CLEAR_PS_GCIBUFFER_CONF, - &TransSS::execREP_CLEAR_PS_GCIBUFFER_CONF)); - sl.push_back(SigMatch(GSN_GREP_SUB_SYNC_CONF, - &TransSS::execGREP_SUB_SYNC_CONF)); - sl.push_back(SigMatch(GSN_GREP_SUB_SYNC_REF, - &TransSS::execGREP_SUB_SYNC_REF)); - sl.push_back(SigMatch(GSN_REP_GET_GCIBUFFER_REF, - &TransSS::execREP_GET_GCIBUFFER_REF)); - - /** - * Signals to be executed : Subscriptions - */ - sl.push_back(SigMatch(GSN_GREP_CREATE_SUBID_CONF, - &TransSS::execGREP_CREATE_SUBID_CONF)); - sl.push_back(SigMatch(GSN_GREP_CREATE_SUBID_REF, - &TransSS::execGREP_CREATE_SUBID_REF)); - sl.push_back(SigMatch(GSN_GREP_SUB_CREATE_CONF, - &TransSS::execGREP_SUB_CREATE_CONF)); - sl.push_back(SigMatch(GSN_GREP_SUB_CREATE_REF, - &TransSS::execGREP_SUB_CREATE_REF)); - sl.push_back(SigMatch(GSN_GREP_SUB_START_CONF, - &TransSS::execGREP_SUB_START_CONF)); - sl.push_back(SigMatch(GSN_GREP_SUB_START_REF, - &TransSS::execGREP_SUB_START_REF)); - - /** - * Signals to be executed and forwarded - */ - sl.push_back(SigMatch(GSN_REP_GET_GCI_CONF, - &TransSS::execREP_GET_GCI_CONF)); - - /** - * Signals to be forwarded - */ - sl.push_back(SigMatch(GSN_GREP_SUB_REMOVE_REF, - &TransSS::execGREP_SUB_REMOVE_REF)); - sl.push_back(SigMatch(GSN_REP_CLEAR_PS_GCIBUFFER_REF, - &TransSS::execREP_CLEAR_PS_GCIBUFFER_REF)); - sl.push_back(SigMatch(GSN_REP_GET_GCI_REF, - &TransSS::execREP_GET_GCI_REF)); - - while(1) { - SigMatch *handler = NULL; - NdbApiSignal *signal = NULL; - if(m_signalRecvQueue.waitFor(sl, handler, signal, DEFAULT_TIMEOUT)) - { -#if 0 - ndbout_c("TransSS: Removed signal from queue (GSN: %d, QSize: %d)", - signal->readSignalNumber(), m_signalRecvQueue.size()); -#endif - if(handler->function != 0) - { - (this->*handler->function)(signal); - delete signal; - signal = 0; - } else { - REPABORT("Illegal handler for signal"); - } - } - } -} - -void -TransSS::sendSignalRep(NdbApiSignal * s) -{ - m_repSender->sendSignal(s); -} - -void -TransSS::execNodeStatus(void* obj, Uint16 nodeId, - bool alive, bool nfCompleted) -{ - TransSS * thisObj = (TransSS*)obj; - - if (alive) { - thisObj->m_repState->eventNodeConnected(nodeId); - - } else if (!nfCompleted) { - thisObj->m_repState->eventNodeDisconnected(nodeId); - - } else if (nfCompleted) { - thisObj->m_repState->eventNodeConnectable(nodeId); - - } else { - REPABORT("Illegal state for execNodeStatus"); - } -} - -void -TransSS::execSignal(void* executorObj, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]) -{ - TransSS * executor = (TransSS *) executorObj; - - const Uint32 gsn = signal->readSignalNumber(); - const Uint32 len = signal->getLength(); - - NdbApiSignal * s = new NdbApiSignal(executor->m_ownRef); - switch (gsn) { - case GSN_REP_GET_GCI_REQ: - case GSN_REP_GET_GCIBUFFER_REQ: - case GSN_REP_GET_GCIBUFFER_CONF: - case GSN_GREP_SUB_REMOVE_CONF: - case GSN_REP_DISCONNECT_REP: - case GSN_REP_GCIBUFFER_ACC_REP: - s->set(0, PSREPBLOCKNO, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - break; - case GSN_GREP_CREATE_SUBID_CONF: - case GSN_GREP_SUB_CREATE_CONF: - case GSN_GREP_SUB_START_CONF: - case GSN_GREP_SUB_SYNC_CONF: - case GSN_REP_GET_GCI_CONF: - case GSN_REP_CLEAR_PS_GCIBUFFER_CONF: - case GSN_GREP_CREATE_SUBID_REF: - case GSN_GREP_SUB_CREATE_REF: - case GSN_GREP_SUB_START_REF: - case GSN_GREP_SUB_SYNC_REF: - case GSN_GREP_SUB_REMOVE_REF: - case GSN_REP_GET_GCI_REF: - case GSN_REP_GET_GCIBUFFER_REF: - case GSN_REP_CLEAR_PS_GCIBUFFER_REF: - s->set(0, GREP, gsn, len); - memcpy(s->getDataPtrSend(), signal->getDataPtr(), 4 * len); - executor->m_signalRecvQueue.receive(s); - break; - case GSN_REP_DATA_PAGE: - executor->execREP_DATA_PAGE(signal, ptr); - delete s; s = 0; - break; - default: - REPABORT1("Illegal signal received in execSignal %d", gsn); - } - -#if 0 - ndbout_c("TransSS: Inserted signal into queue (GSN: %d, Len: %d)", - signal->readSignalNumber(), len); -#endif -} - -/***************************************************************************** - * Signal Executors - *****************************************************************************/ - -void -TransSS::execREP_DATA_PAGE(NdbApiSignal * signal, LinearSectionPtr ptr[3]) -{ - RepDataPage * const page = (RepDataPage*)signal->getDataPtr(); - m_gciContainer->insertPage(page->gci, page->nodeGrp, - (char*)(ptr[0].p), 4 * ptr[0].sz); -} - -/** - * Recd from TransPS - */ -void -TransSS::execREP_GCIBUFFER_ACC_REP(NdbApiSignal * signal) -{ - RepGciBufferAccRep * const rep = - (RepGciBufferAccRep * )signal->getDataPtr(); - - Uint32 gci = rep->gci; - Uint32 nodeGrp = rep->nodeGrp; - Uint32 totalSize = rep->totalSentBytes; - GCIBuffer * buffer = m_gciContainer->getGCIBuffer(gci, nodeGrp); - Uint32 getReceivedBytes = 0; - if (buffer != 0) - getReceivedBytes = buffer->getReceivedBytes(); - - RLOG(("TransSS: Received %d:[%d] (%d of %d bytes)", - nodeGrp, gci, getReceivedBytes, totalSize)); - - if(getReceivedBytes != totalSize) { - REPABORT("Did not receive correct number of bytes"); - } -} - -/** - * Received from primary system - */ -void -TransSS::execREP_GET_GCIBUFFER_CONF(NdbApiSignal * signal) -{ - RepGetGciBufferConf * conf = (RepGetGciBufferConf*)signal->getDataPtr(); - conf->senderRef = m_ownRef; - Uint32 first = conf->firstSSGCI; - Uint32 last = conf->lastSSGCI; - for(Uint32 i = first; i <= last; i++) { - m_gciContainer->setCompleted(i, conf->nodeGrp); - } - - /** - * Buffers @ PS - */ - Interval ps(conf->firstPSGCI, conf->lastPSGCI); - m_repState->add(Channel::PS, conf->nodeGrp, ps); - - /** - * Buffers @ SS - */ - Uint32 ssfirst, sslast; - m_gciContainer->getAvailableGCIBuffers(conf->nodeGrp, &ssfirst, &sslast); - Interval ss(ssfirst, sslast); - m_repState->clear(Channel::SS, conf->nodeGrp, universeInterval); - m_repState->add(Channel::SS, conf->nodeGrp, ss); - m_repState->clear(Channel::SSReq, conf->nodeGrp, ss); - - RLOG(("Transfered epochs (PS:%d[%d-%d], SS:%d[%d-%d])", - conf->nodeGrp, conf->firstPSGCI, conf->lastPSGCI, - conf->nodeGrp, conf->firstSSGCI, conf->lastSSGCI)); -} - -/** - * Received from primary system - */ -void -TransSS::execGREP_SUB_REMOVE_CONF(NdbApiSignal * signal) -{ - GrepSubRemoveConf * conf = (GrepSubRemoveConf* )signal->getDataPtr(); - Uint32 subId = conf->subscriptionId; - Uint32 subKey = conf->subscriptionKey; - - /** - * @todo Fix this sending - */ -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_SubRemoveConf; - signal->theData[2] = subId; - signal->theData[3] = subKey; - sendSignal(CMVMI_REF,GSN_EVENT_REP,signal, 4, JBB); -#endif - - m_repState->eventSubscriptionDeleted(subId, subKey); - RLOG(("Subscription deleted (SubId: %d, SubKey: %d)", subId, subKey)); -} - -void -TransSS::execGREP_SUB_REMOVE_REF(NdbApiSignal * signal) -{ - GrepSubRemoveRef * ref = (GrepSubRemoveRef* )signal->getDataPtr(); - Uint32 subId = ref->subscriptionId; - Uint32 subKey = ref->subscriptionKey; - - /** @todo: Add repevent for this */ - RLOG(("TransSS: Warning: Grep sub remove ref (SubId: %d, SubKey: %d)", - subId, subKey)); -} - -/** - * Received from primary system - */ -void -TransSS::execREP_GET_GCI_CONF(NdbApiSignal * signal) -{ - RepGetGciConf * conf = (RepGetGciConf*)signal->getDataPtr(); - Uint32 nodeGrp = conf->nodeGrp; - Interval i(conf->firstPSGCI, conf->lastPSGCI); - m_repState->add(Channel::PS, nodeGrp, i); - - Uint32 first, last; - m_gciContainer->getAvailableGCIBuffers(nodeGrp, &first, &last); - Interval j(first, last); - m_repState->clear(Channel::SS, nodeGrp, universeInterval); - m_repState->add(Channel::SS, nodeGrp, j); - -#ifdef DEBUG_REP_GET_GCI_CONF - RLOG(("TransSS: Requestor info received " - "(PS: %d:[%d-%d], SS: %d:[%d-%d])", - conf->nodeGrp, conf->firstPSGCI, conf->lastPSGCI, - conf->nodeGrp, conf->firstSSGCI, conf->lastSSGCI)); -#endif -} - -void -TransSS::execREP_GET_GCI_REF(NdbApiSignal * signal) -{ - RepGetGciRef * ref = (RepGetGciRef*)signal->getDataPtr(); - Uint32 nodeGrp = ref->nodeGrp; - - RLOG(("WARNING! Requestor info request failed (Nodegrp: %d)", nodeGrp)); -} - -/** - * Recd from GrepPS - * This signal means that a DB node has disconnected. - * @todo Do we need to know that a DB node disconnected? - * - * A node has disconnected (REP or PS DB) - * @todo let the requestor respond to this event - * in a proper way. - */ -void -TransSS::execREP_DISCONNECT_REP(NdbApiSignal * signal) -{ - RepDisconnectRep * const rep = - (RepDisconnectRep*)signal->getDataPtr(); - - //Uint32 nodeId = rep->nodeId; - Uint32 nodeType = rep->nodeType; - - if((RepDisconnectRep::NodeType)nodeType == RepDisconnectRep::REP) - { - m_repState->disable(); - } -} - -/** - * The buffer is now deleted on REP PS. We can now clear it from PS. - */ -void -TransSS::execREP_CLEAR_PS_GCIBUFFER_CONF(NdbApiSignal * signal) -{ - RepClearPSGciBufferConf * const conf = - (RepClearPSGciBufferConf*)signal->getDataPtr(); - Uint32 firstGCI = conf->firstGCI; - Uint32 lastGCI = conf->lastGCI; - Uint32 nodeGrp = conf->nodeGrp; - Interval i(firstGCI, lastGCI); - m_repState->clear(Channel::PS, nodeGrp, i); - m_repState->clear(Channel::DelReq, nodeGrp, i); - - RLOG(("Deleted PS:%d:[%d-%d]", nodeGrp, firstGCI, lastGCI)); -} - -/** - * Something went wrong when deleting buffer on REP PS - */ -void -TransSS::execREP_CLEAR_PS_GCIBUFFER_REF(NdbApiSignal * signal) -{ - RepClearPSGciBufferRef * const ref = - (RepClearPSGciBufferRef*)signal->getDataPtr(); - Uint32 firstGCI = ref->firstGCI; - Uint32 lastGCI = ref->lastGCI; - Uint32 nodeGrp = ref->nodeGrp; - - RLOG(("WARNING! Could not delete PS:%d:[%d-%d]", nodeGrp, firstGCI, lastGCI)); -} - -/***************************************************************************** - * Signal Executors : SCAN - *****************************************************************************/ - -/** - * Scan has started on PS side... (says PS REP) - */ -void -TransSS::execGREP_SUB_SYNC_CONF(NdbApiSignal* signal) -{ - GrepSubSyncConf * const conf = (GrepSubSyncConf * ) signal->getDataPtr(); - Uint32 subId = conf->subscriptionId; - Uint32 subKey = conf->subscriptionKey; - Interval epochs(conf->firstGCI, conf->lastGCI); - SubscriptionData::Part part = (SubscriptionData::Part) conf->part; - - switch(part) { - case SubscriptionData::MetaData: - RLOG(("Metascan completed. Subcription %d-%d, Epochs [%d-%d]", - subId, subKey, epochs.first(), epochs.last())); - m_repState->eventMetaScanCompleted(signal, subId, subKey, epochs); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_SubSyncMetaConf; - signal->theData[2] = subId; - signal->theData[3] = subKey; - signal->theData[4] = gci; - sendSignal(CMVMI_REF,GSN_EVENT_REP,signal, 5, JBB); -#endif - break; - case SubscriptionData::TableData: - RLOG(("Datascan completed. Subcription %d-%d, Epochs [%d-%d]", - subId, subKey, epochs.first(), epochs.last())); - m_repState->eventDataScanCompleted(signal, subId, subKey, epochs); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_SubSyncDataConf; - signal->theData[2] = subId; - signal->theData[3] = subKey; - signal->theData[4] = gci; - sendSignal(CMVMI_REF,GSN_EVENT_REP,signal, 5, JBB); -#endif - break; - default: - REPABORT3("Wrong subscription part", part, subId, subKey); - } -} - -void -TransSS::execGREP_SUB_SYNC_REF(NdbApiSignal* signal) -{ - GrepSubSyncRef * const ref = (GrepSubSyncRef * ) signal->getDataPtr(); - Uint32 subId = ref->subscriptionId; - Uint32 subKey = ref->subscriptionKey; - SubscriptionData::Part part = (SubscriptionData::Part) ref->part; - GrepError::Code error = (GrepError::Code) ref->err; - - switch(part) { - case SubscriptionData::MetaData: - m_repState->eventMetaScanFailed(subId, subKey, error); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_SubSyncMetaRef; - signal->theData[2] = subId; - signal->theData[3] = subKey; - // signal->theData[4] = gci; - sendSignal(CMVMI_REF,GSN_EVENT_REP,signal, 5, JBB); -#endif - break; - case SubscriptionData::TableData: - m_repState->eventDataScanFailed(subId, subKey, error); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_SubSyncDataRef; - signal->theData[2] = subId; - signal->theData[3] = subKey; - //signal->theData[4] = m_lastScanGCI; - sendSignal(CMVMI_REF,GSN_EVENT_REP,signal, 5, JBB); -#endif - break; - default: - REPABORT3("Wrong subscription part", part, subId, subKey); - } -} - -/** - * Something went wrong says REP PS - */ -void -TransSS::execREP_GET_GCIBUFFER_REF(NdbApiSignal* signal) -{ - RepGetGciBufferRef * const ref = (RepGetGciBufferRef*)signal->getDataPtr(); - /* - Uint32 senderData = ref->senderData; - Uint32 senderRef = ref->senderRef; - Uint32 firstPSGCI = ref->firstPSGCI; - Uint32 lastPSGCI = ref->lastPSGCI; - Uint32 firstSSGCI = ref->firstSSGCI; - Uint32 lastSSGCI = ref->lastSSGCI; - Uint32 currentGCIBuffer = ref->currentGCIBuffer; - Uint32 nodeGrp = ref->nodeGrp; - */ - GrepError::Code err = ref->err; - - RLOG(("WARNING! Request to get buffer failed. Error %d:%s", - err, GrepError::getErrorDesc(err))); -} diff --git a/ndb/src/old_files/rep/transfer/TransSS.hpp b/ndb/src/old_files/rep/transfer/TransSS.hpp deleted file mode 100644 index 3340038c8d1..00000000000 --- a/ndb/src/old_files/rep/transfer/TransSS.hpp +++ /dev/null @@ -1,145 +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 TransSS_HPP -#define TransSS_HPP - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include - -extern "C" { -static void * signalExecThread_C(void *); -} - -/** - * @class TransSS - * @brief Responsible for REP-REP interface in Standby System role - */ -class TransSS { -public: - /*************************************************************************** - * Constructor / Destructor / Init - ***************************************************************************/ - TransSS(GCIContainer * gciContainer, RepState * repState); - ~TransSS(); - void init(const char * connectString = NULL); - - /*************************************************************************** - * Public Methods - ***************************************************************************/ - ExtSender * getRepSender() { return m_repSender; }; - TransporterFacade * getTransporterFacade() { return m_transporterFacade; }; - -private: - /*************************************************************************** - * Private Methods - ***************************************************************************/ - friend void * signalExecThread_C(void *); - void signalExecThreadRun(); ///< SignalQueue executor thread - - static void execSignal(void* executorObj, NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); - static void execNodeStatus(void* executorObj, NodeId, bool alive, - bool nfCompleted); - - void sendSignalRep(NdbApiSignal * s); - - /*************************************************************************** - * Signal receivers - ***************************************************************************/ - void execREP_GET_GCI_REQ(NdbApiSignal*); - void execREP_GET_GCI_CONF(NdbApiSignal*); - void execREP_GET_GCI_REF(NdbApiSignal*); - - void execREP_GET_GCIBUFFER_REQ(NdbApiSignal*); - void execREP_GET_GCIBUFFER_CONF(NdbApiSignal*); - void execREP_GET_GCIBUFFER_REF(NdbApiSignal*); - - void execGREP_SUB_REMOVE_CONF(NdbApiSignal *); - void execGREP_SUB_REMOVE_REF(NdbApiSignal *); - - void execREP_INSERT_GCIBUFFER_REQ(NdbApiSignal*); - void execREP_INSERT_GCIBUFFER_CONF(NdbApiSignal*); - void execREP_INSERT_GCIBUFFER_REF(NdbApiSignal*); - - void execREP_DATA_PAGE(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - void execREP_GCIBUFFER_ACC_REP(NdbApiSignal*); - void execREP_DISCONNECT_REP(NdbApiSignal*); - - - void execREP_CLEAR_PS_GCIBUFFER_CONF(NdbApiSignal*); - void execREP_CLEAR_PS_GCIBUFFER_REF(NdbApiSignal*); - - void execGREP_SUB_SYNC_CONF(NdbApiSignal*); - void execGREP_SUB_SYNC_REF(NdbApiSignal*); - - /*************************************************************************** - * Signal receivers : Subscriptions - ***************************************************************************/ - void execGREP_CREATE_SUBID_CONF(NdbApiSignal*); - void execGREP_CREATE_SUBID_REF(NdbApiSignal*); - void execGREP_SUB_CREATE_CONF(NdbApiSignal*); - void execGREP_SUB_CREATE_REF(NdbApiSignal*); - void execGREP_SUB_START_CONF(NdbApiSignal*); - void execGREP_SUB_START_REF(NdbApiSignal*); - - /*************************************************************************** - * Ref signal senders - ***************************************************************************/ - - void sendREP_GET_GCI_REF(NdbApiSignal* signal, Uint32 nodeGrp, - Uint32 firstSSGCI, Uint32 lastSSGCI, - GrepError::Code err); - - void sendREP_GET_GCIBUFFER_REF(NdbApiSignal* signal, - Uint32 firstGCI, Uint32 lastGCI, - Uint32 nodeGrp, GrepError::Code err); - - /*************************************************************************** - * Private Variables - ***************************************************************************/ - RepState * m_repState; - - struct NdbThread * m_signalExecThread; ///< Signal Queue executor - class SignalQueue m_signalRecvQueue; - - ExtSender * m_repSender; ///< Obj responsible send to REP - - Uint32 m_ownNodeId; ///< NodeId of this node - Uint32 m_ownBlockNo; ///< BlockNo of this "block" - BlockReference m_ownRef; ///< Reference to this - - GCIContainer * m_gciContainer; ///< Ref to gci container. - - TransporterFacade * m_transporterFacade; -}; - -#endif diff --git a/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp b/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp deleted file mode 100644 index 582ba8040a6..00000000000 --- a/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp +++ /dev/null @@ -1,193 +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 */ - -#include "TransSS.hpp" - -#include -#include - -/***************************************************************************** - * CREATE SUBSCRIPTION ID - *****************************************************************************/ - -void -TransSS::execGREP_CREATE_SUBID_CONF(NdbApiSignal* signal) -{ - CreateSubscriptionIdConf const * conf = - (CreateSubscriptionIdConf *)signal->getDataPtr(); - Uint32 subId = conf->subscriptionId; - Uint32 subKey = conf->subscriptionKey; - - /** @todo Fix this */ -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_CreateSubIdConf; - signal->theData[2] = subId; - signal->theData[3] = subKey; - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4 ,JBB); -#endif - m_repState->eventSubscriptionIdCreated(subId, subKey); -} - -void -TransSS::execGREP_CREATE_SUBID_REF(NdbApiSignal* signal) -{ - CreateSubscriptionIdRef const * ref = - (CreateSubscriptionIdRef *)signal->getDataPtr(); - Uint32 subId = ref->subscriptionId; - Uint32 subKey = ref->subscriptionKey; - GrepError::Code err = (GrepError::Code) ref->err; - -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_CreateSubIdRef; - signal->theData[2] = subId; - signal->theData[3] = subKey; - signal->theData[4] = err; - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 5 ,JBB); -#endif - m_repState->eventSubscriptionIdCreateFailed(subId, subKey, err); -} - -/***************************************************************************** - * CREATE SUBSCRIPTION - *****************************************************************************/ - -void -TransSS::execGREP_SUB_CREATE_CONF(NdbApiSignal* signal) -{ - GrepSubCreateConf * const conf = (GrepSubCreateConf *)signal->getDataPtr(); - Uint32 noOfNodeGroups = conf->noOfNodeGroups; - Uint32 subId = conf->subscriptionId; - Uint32 subKey = conf->subscriptionKey; - - m_repState->setNoOfNodeGroups(noOfNodeGroups); - -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_SubCreateConf; - signal->theData[2] = subId; - signal->theData[3] = subKey; - signal->theData[4] = noOfNodeGroups; - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 5, JBB); -#endif - - m_repState->eventSubscriptionCreated(subId, subKey); -} - -void -TransSS::execGREP_SUB_CREATE_REF(NdbApiSignal* signal) -{ - GrepSubCreateRef * const ref = (GrepSubCreateRef *)signal->getDataPtr(); - Uint32 subId = ref->subscriptionId; - Uint32 subKey = ref->subscriptionKey; - GrepError::Code err = (GrepError::Code)ref->err; -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_SubCreateRef; - signal->theData[2] = subId; - signal->theData[3] = subKey; - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB); -#endif - - m_repState->eventSubscriptionCreateFailed(subId, subKey, err); -} - -/***************************************************************************** - * START SUBSCRIPTION - *****************************************************************************/ - -void -TransSS::execGREP_SUB_START_CONF(NdbApiSignal* signal) -{ - GrepSubStartConf * const conf = (GrepSubStartConf *)signal->getDataPtr(); - Uint32 subId = conf->subscriptionId; - Uint32 subKey = conf->subscriptionKey; - SubscriptionData::Part part = (SubscriptionData::Part) conf->part; - - switch(part) { - case SubscriptionData::MetaData: - RLOG(("Metalog started. Subscription %d-%d", subId, subKey)); - m_repState->eventMetaLogStarted(signal, subId, subKey); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_SubStartMetaConf; - signal->theData[2] = m_requestor.getSubId(); - signal->theData[3] = m_requestor.getSubKey(); - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB); -#endif - break; - case SubscriptionData::TableData: - RLOG(("Datalog started. Subscription %d-%d", subId, subKey)); - m_repState->eventDataLogStarted(signal, subId, subKey); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionInfo; - signal->theData[1] = GrepEvent::GrepSS_SubStartDataConf; - signal->theData[2] = m_requestor.getSubId(); - signal->theData[3] = m_requestor.getSubKey(); - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB); -#endif - break; - default: - REPABORT("Illegal type of subscription"); - } -} - -void -TransSS::execGREP_SUB_START_REF(NdbApiSignal* signal) -{ - GrepSubStartRef * const ref = (GrepSubStartRef *)signal->getDataPtr(); - Uint32 subId = ref->subscriptionId; - Uint32 subKey = ref->subscriptionKey; - GrepError::Code err = (GrepError::Code)ref->err; - SubscriptionData::Part part = (SubscriptionData::Part) ref->part; - - switch(part) { - case SubscriptionData::MetaData: - m_repState->eventMetaLogStartFailed(subId, subKey, err); -#if 1 - ndbout_c("Requestor: Subscription FAILED to start on Meta Data"); - ndbout_c("Error code : %d. Error message: %s", - err, GrepError::getErrorDesc(err)); -#endif -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_SubStartMetaRef; - signal->theData[2] = subId; //@todo. manage subscriptions. - signal->theData[3] = subKey; //@todo. manage subscriptions. - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB); -#endif - break; - case SubscriptionData::TableData: - m_repState->eventDataLogStartFailed(subId, subKey, err); -#if 0 - signal->theData[0] = EventReport::GrepSubscriptionAlert; - signal->theData[1] = GrepEvent::GrepSS_SubStartDataRef; - signal->theData[2] = subId; //@todo. manage subscriptions. - signal->theData[3] = subKey; //@todo. manage subscriptions. - sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 4, JBB); -#endif -#if 1 - ndbout_c("Requestor: Subscription FAILED to start on Table Data"); -#endif - ndbout_c("Error code : %d. Error message: %s", - err, GrepError::getErrorDesc(err)); - - break; - default: - REPABORT("Illegal type of subscription"); - } -} diff --git a/ndb/test/ndbapi/old_dirs/acid/Makefile b/ndb/test/ndbapi/old_dirs/acid/Makefile deleted file mode 100644 index 33dc49fcdea..00000000000 --- a/ndb/test/ndbapi/old_dirs/acid/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := acid - -# Source files of non-templated classes (.C files) -SOURCES = acid.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/acid2/Makefile b/ndb/test/ndbapi/old_dirs/acid2/Makefile deleted file mode 100644 index 69c9d409b9e..00000000000 --- a/ndb/test/ndbapi/old_dirs/acid2/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := acid2 - -# Source files of non-templated classes (.C files) -SOURCES = acid2.cpp TraceNdbApi.cpp VerifyNdbApi.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp b/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp deleted file mode 100644 index 16acd639f18..00000000000 --- a/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp +++ /dev/null @@ -1,131 +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; version 2 of the License. - - 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 TraceNdbApi_hpp -#define TraceNdbApi_hpp - - -class CTraceNdbSchemaOp : public NdbSchemaOp -{ -public: - int createTable(const char* aTableName); - int createAttribute(const char* aAttrName, KeyType aTupleyKey); -}; - - - -class CTraceNdbSchemaCon : public NdbSchemaCon -{ -public: - CTraceNdbSchemaOp* getNdbSchemaOp(); - int execute(); -}; - - - -class CTraceNdbRecAttr : public NdbRecAttr -{ -public: - Uint32 u_32_value(); -}; - - -class CTraceNdbOperation : public NdbOperation -{ -public: - int insertTuple(); - int updateTuple(); - int interpretedUpdateTuple(); - int readTuple(); - int readTupleExclusive(); - int deleteTuple(); - int equal(const char* anAttrName, Uint32 aValue); - int setValue(const char* anAttrName, Uint32 aValue); - int incValue(const char* anAttrName, Uint32 aValue); - CTraceNdbRecAttr* getValue(const char* anAttrName); - -}; - - -class CTraceNdbIndexOperation : public NdbIndexOperation -{ -public: - int insertTuple(); - int updateTuple(); - int interpretedUpdateTuple(); - int readTuple(); - int readTupleExclusive(); - int deleteTuple(); - int equal(const char* anAttrName, Uint32 aValue); - int setValue(const char* anAttrName, Uint32 aValue); - int incValue(const char* anAttrName, Uint32 aValue); - CTraceNdbRecAttr* getValue(const char* anAttrName); -}; - - - -class CTraceNdbConnection : public NdbConnection -{ -public: - CTraceNdbOperation* getNdbOperation(const char* aTableName); - CTraceNdbIndexOperation* getNdbIndexOperation(const char* anIndexName, const char* aTableName); - - int execute(ExecType aTypeOfExec); - - int execute_ok(ExecType aTypeOfExec) - { - return execute(aTypeOfExec); - }; - - const NdbError & getNdbError(void) const; -}; - - - -class CTraceNdbDictionary : public NdbDictionary -{ -public: - class CTraceTable : public Table - { - }; - - class CTraceIndex : public Index - { - }; - - class CTraceColumn : public Column - { - }; - - int createTable(const CTraceTable &); - int createIndex(const CTraceIndex &); -}; - - - -class CTraceNdb : public Ndb -{ -public: - CTraceNdb(const char* aDataBase); - CTraceNdbSchemaCon* startSchemaTransaction(); - void closeSchemaTransaction(CTraceNdbSchemaCon* aSchemaCon); - CTraceNdbConnection* startTransaction(); - void closeTransaction(CTraceNdbConnection* aConnection); -}; - - - -#endif // TraceNdbApi_hpp diff --git a/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp b/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp deleted file mode 100644 index f9d5dff698d..00000000000 --- a/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp +++ /dev/null @@ -1,465 +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; version 2 of the License. - - 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 VerifyNdbApi_hpp -#define VerifyNdbApi_hpp - - -class CVerifyNdbSchemaOp : public NdbSchemaOp -{ -public: - int createTable(const char* aTableName) - { - int i = NdbSchemaOp::createTable(aTableName); - VerifyInt(i, "createTable"); - return i; - }; - - int createAttribute(const char* aAttrName, KeyType aTupleyKey) - { - int i = NdbSchemaOp::createAttribute(aAttrName, aTupleyKey); - VerifyInt(i, "createAttribute"); - return i; - }; - -private: - void VerifyInt(const int i, const char* szMethod) - { - if(i) - { - VerifyIntError(i, szMethod); - } - } - - void VerifyIntError(const int i, const char* szMethod); -}; - - - -class CVerifyNdbSchemaCon : public NdbSchemaCon -{ -public: - CVerifyNdbSchemaOp* getNdbSchemaOp() - { - NdbSchemaOp* p = NdbSchemaCon::getNdbSchemaOp(); - VerifyPtr(p, "getNdbSchemaOp"); - return (CVerifyNdbSchemaOp*)p; - }; - - int execute() - { - int i = NdbSchemaCon::execute(); - VerifyInt(i, "execute"); - return i; - }; - -private: - void VerifyInt(const int i, const char* szMethod) - { - if(i) - { - VerifyIntError(i, szMethod); - } - } - - void VerifyPtr(void* p, const char* szMethod) - { - if(!p) - { - VerifyPtrError(p, szMethod); - } - } - - void VerifyIntError(const int i, const char* szMethod); - void VerifyPtrError(void* p, const char* szMethod); -}; - - - -class CVerifyNdbRecAttr : public NdbRecAttr -{ -public: - Uint32 u_32_value() - { - Uint32 n = NdbRecAttr::u_32_value(); - VerifyValue("u_32_value"); - return n; - }; - -private: - void VerifyValue(const char* szMethod) - { - int iNull = NdbRecAttr::isNULL(); - if(iNull) - { - VerifyValueError(iNull, szMethod); - } - }; - - void VerifyValueError(const int iNull, const char* szMethod); -}; - - -class CVerifyNdbOperation : public NdbOperation -{ -public: - int insertTuple() - { - int i = NdbOperation::insertTuple(); - VerifyInt(i, "insertTuple"); - return i; - }; - - int updateTuple() - { - int i = NdbOperation::updateTuple(); - VerifyInt(i, "updateTuple"); - return i; - }; - - int interpretedUpdateTuple() - { - int i = NdbOperation::interpretedUpdateTuple(); - VerifyInt(i, "interpretedUpdateTuple"); - return i; - } - - int readTuple() - { - int i = NdbOperation::readTuple(); - VerifyInt(i, "readTuple"); - return i; - } - - int readTupleExclusive() - { - int i = NdbOperation::readTupleExclusive(); - VerifyInt(i, "readTupleExclusive"); - return i; - } - - int deleteTuple() - { - int i = NdbOperation::deleteTuple(); - VerifyInt(i, "deleteTuple"); - return i; - } - - int equal(const char* anAttrName, Uint32 aValue) - { - int i = NdbOperation::equal(anAttrName, aValue); - VerifyInt(i, "equal"); - return i; - } - - int setValue(const char* anAttrName, Uint32 aValue) - { - int i = NdbOperation::setValue(anAttrName, aValue); - VerifyInt(i, "setValue"); - return i; - } - - int incValue(const char* anAttrName, Uint32 aValue) - { - int i = NdbOperation::incValue(anAttrName, aValue); - VerifyInt(i, "incValue"); - return i; - } - - CVerifyNdbRecAttr* getValue(const char* anAttrName) - { - NdbRecAttr* p = NdbOperation::getValue(anAttrName); - VerifyPtr(p, "getValue"); - return (CVerifyNdbRecAttr*)p; - } - - -private: - void VerifyInt(const int i, const char* szMethod) - { - if(i) - { - VerifyIntError(i, szMethod); - } - } - - void VerifyPtr(void* p, const char* szMethod) - { - if(!p) - { - VerifyPtrError(p, szMethod); - } - } - - void VerifyIntError(const int i, const char* szMethod); - void VerifyPtrError(void* p, const char* szMethod); -}; - - -class CVerifyNdbIndexOperation : public NdbIndexOperation -{ -public: - int insertTuple() - { - int i = NdbIndexOperation::insertTuple(); - VerifyInt(i, "insertTuple"); - return i; - }; - - int updateTuple() - { - int i = NdbIndexOperation::updateTuple(); - VerifyInt(i, "updateTuple"); - return i; - }; - - int interpretedUpdateTuple() - { - int i = NdbIndexOperation::interpretedUpdateTuple(); - VerifyInt(i, "interpretedUpdateTuple"); - return i; - } - - int readTuple() - { - int i = NdbIndexOperation::readTuple(); - VerifyInt(i, "readTuple"); - return i; - } - - int readTupleExclusive() - { - int i = NdbIndexOperation::readTupleExclusive(); - VerifyInt(i, "readTupleExclusive"); - return i; - } - - int deleteTuple() - { - int i = NdbIndexOperation::deleteTuple(); - VerifyInt(i, "deleteTuple"); - return i; - } - - int equal(const char* anAttrName, Uint32 aValue) - { - int i = NdbIndexOperation::equal(anAttrName, aValue); - VerifyInt(i, "equal"); - return i; - } - - int setValue(const char* anAttrName, Uint32 aValue) - { - int i = NdbIndexOperation::setValue(anAttrName, aValue); - VerifyInt(i, "setValue"); - return i; - } - - int incValue(const char* anAttrName, Uint32 aValue) - { - int i = NdbIndexOperation::incValue(anAttrName, aValue); - VerifyInt(i, "incValue"); - return i; - } - - CVerifyNdbRecAttr* getValue(const char* anAttrName) - { - NdbRecAttr* p = NdbIndexOperation::getValue(anAttrName); - VerifyPtr(p, "getValue"); - return (CVerifyNdbRecAttr*)p; - } - - -private: - void VerifyInt(const int i, const char* szMethod) - { - if(i) - { - VerifyIntError(i, szMethod); - } - } - - void VerifyPtr(void* p, const char* szMethod) - { - if(!p) - { - VerifyPtrError(p, szMethod); - } - } - - void VerifyIntError(const int i, const char* szMethod); - void VerifyPtrError(void* p, const char* szMethod); -}; - - -class CVerifyNdbConnection : public NdbConnection -{ -public: - CVerifyNdbOperation* getNdbOperation(const char* aTableName) - { - NdbOperation* p = NdbConnection::getNdbOperation(aTableName); - VerifyPtr(p, "getNdbOperation"); - return (CVerifyNdbOperation*)p; - } - - CVerifyNdbIndexOperation* getNdbIndexOperation(const char* anIndexName, const char* aTableName) - { - NdbIndexOperation* p = NdbConnection::getNdbIndexOperation(anIndexName, aTableName); - VerifyPtr(p, "getNdbIndexOperation"); - return (CVerifyNdbIndexOperation*)p; - } - - int execute(ExecType aTypeOfExec) - { - int i = NdbConnection::execute(aTypeOfExec); - VerifyInt(i, "execute"); - return i; - } - - int execute_ok(ExecType aTypeOfExec) - { - int iExec = NdbConnection::execute(aTypeOfExec); - NdbError err = NdbConnection::getNdbError(); - int iCode = err.code; - if(iExec - && ((aTypeOfExec==NoCommit && iCode!=0) - || (aTypeOfExec==Commit && iCode!=626 && iCode!=630))) - { - VerifyInt(iExec, "execute"); - } - return iExec; - } - - -private: - void VerifyInt(const int i, const char* szMethod) - { - if(i) - { - VerifyIntError(i, szMethod); - } - } - - void VerifyPtr(void* p, const char* szMethod) - { - if(!p) - { - VerifyPtrError(p, szMethod); - } - } - - void VerifyIntError(const int i, const char* szMethod); - void VerifyPtrError(void* p, const char* szMethod); -}; - - -//class CVerifyTable : public NdbDictionary::Table -//{ -//public: -//}; - - -class CVerifyNdbDictionary : public NdbDictionary -{ -public: - class CVerifyTable : public Table - { - public: - private: - }; - - class CVerifyIndex : public Index - { - public: - private: - }; - - class CVerifyColumn : public Column - { - public: - private: - }; - - int createTable(const CVerifyTable &); - int createIndex(const CVerifyIndex &); - - -private: -}; - - -class CVerifyNdb : public Ndb -{ -public: - CVerifyNdb(const char* aDataBase) - : Ndb(aDataBase) - { - VerifyVoid("Ndb"); - }; - - CVerifyNdbSchemaCon* startSchemaTransaction() - { - NdbSchemaCon* p = Ndb::startSchemaTransaction(); - VerifyPtr(p, "startSchemaTransaction"); - return (CVerifyNdbSchemaCon*)p; - }; - - void closeSchemaTransaction(CVerifyNdbSchemaCon* aSchemaCon) - { - Ndb::closeSchemaTransaction(aSchemaCon); - VerifyVoid("closeSchemaTransaction"); - }; - - CVerifyNdbConnection* startTransaction() - { - NdbConnection* p = Ndb::startTransaction(); - VerifyPtr(p, "startTransaction"); - return (CVerifyNdbConnection*)p; - }; - - void closeTransaction(CVerifyNdbConnection* aConnection) - { - Ndb::closeTransaction(aConnection); - VerifyVoid("closeTransaction"); - }; - - -private: - void VerifyPtr(void* p, const char* szMethod) - { - if(!p) - { - VerifyPtrError(p, szMethod); - } - } - - void VerifyVoid(const char* szMethod) - { - NdbError err = Ndb::getNdbError(); - int iCode = err.code; - if(iCode) - { - VerifyVoidError(iCode, szMethod); - } - } - - void VerifyPtrError(void* p, const char* szMethod); - void VerifyVoidError(const int iCode, const char* szMethod); -}; - - - -#endif // VerifyNdbApi_hpp diff --git a/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile b/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile deleted file mode 100755 index 802c5e5a2bd..00000000000 --- a/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := testBasicAsynch - -SOURCES := testBasicAsynch.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile b/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile deleted file mode 100644 index 22c05b138b7..00000000000 --- a/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := bulk_copy - -SOURCES := bulk_copy.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile b/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile deleted file mode 100644 index 58309807682..00000000000 --- a/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := create_all_tabs - -# Source files of non-templated classes (.C files) -SOURCES = create_all_tabs.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/create_tab/Makefile b/ndb/test/ndbapi/old_dirs/create_tab/Makefile deleted file mode 100644 index c2ea0b52b15..00000000000 --- a/ndb/test/ndbapi/old_dirs/create_tab/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := create_tab - -# Source files of non-templated classes (.C files) -SOURCES = create_tab.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile b/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile deleted file mode 100644 index 96db0781417..00000000000 --- a/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := drop_all_tabs - -# Source files of non-templated classes (.C files) -SOURCES = drop_all_tabs.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile b/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile deleted file mode 100644 index 2c77c8e21df..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := flexAsynch - -# Source files of non-templated classes (.C files) -SOURCES = flexAsynch.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am b/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am deleted file mode 100644 index d4de4b92b60..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ - -bin_PROGRAMS = flexBench - -flexBench_SOURCES = flexBench.cpp - -include $(top_srcdir)/ndb/config/common.mk.am -include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl b/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl deleted file mode 100755 index b16f6d5897d..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl +++ /dev/null @@ -1,305 +0,0 @@ -#! /usr/bin/perl - -use strict; -use Getopt::Long; -use Symbol; -use Socket; - -my $progname = $0; -$progname =~ s!^.*/|\.pl$!!g; -my $defaultport = 27127; -my $defaulttotal = 120; -my $defaultsample = 5; -my $defaultrange = 5000; - -sub printhelp { - print < \$helpflag, - 'debug' => \$debug, - 'port=i' => \$serverport, - 'total=i' => \$totaltime, - 'sample=i' => \$sampletime, - 'range=i' => \$range, - 'nopct' => \$nopct, - 'z=s' => \@zopts, -) or die "try: $progname -h\n"; -$helpflag && printhelp(); - -# calculate number of data points -my $samplecnt; -$samplecnt = int($totaltime / $sampletime) + 1; -$totaltime = ($samplecnt - 1) * $sampletime; -warn "total time = $totaltime sec, sample time = $sampletime sec\n"; - -# open gnuplot -my $plotfile; -sub openplot { - $plotfile = gensym(); - if (! open($plotfile, "| gnuplot @zopts")) { - die "open plot: $!\n"; - } - my $sav = select($plotfile); - $| = 1; - select($sav); - print $plotfile "clear\n"; -} - -# samples -my @sample; # samples 0..$samplecnt in time order -my $sampleready = 0; # samples 1..$samplecnt are ready (true/false) - -@sample = map({ start => 0 }, 0..$samplecnt); - -sub adddata { - my($node, $type, $value) = @_; - my $now = time; - my $s = $sample[0]; - if ($now - $s->{start} >= $sampletime) { - unshift(@sample, { - start => $now, - total => 0, - }); - $s = $sample[0]; - pop(@sample); # delete oldest - $sampleready = 1; - } - # if no type then this is just a time tick - if ($type) { - $s->{$type} += $value; - $s->{total} += $value; - } -} - -# data file name -my $datadir; -if ($ENV{NDB_BASE}) { - $datadir = "$ENV{NDB_BASE}/var/plot"; -} else { - $datadir = "/var/tmp"; -} -(-d $datadir || mkdir($datadir, 0777)) - or die "mkdir $datadir failed: $!\n"; -my $datafile = "$datadir/plot$$.dat"; -warn "writing plot data to $datafile\n"; - -# refresh the plot -sub plotsample { - my $fh = gensym(); - if (! open($fh, ">$datafile")) { - die "$datafile: $!\n"; - } - # sample 0 is never ready - my $currops = ""; - my $currpct = {}; - for (my $i = @sample; $i >= 1; $i--) { - my $s = $sample[$i]; - if (! $s->{start}) { # initial empty sample - next; - } - printf $fh "%d", -($i - 1) * $sampletime; - printf $fh " %.0f", 1.01 * $s->{"total"} / $sampletime; - for my $k (qw(insert update select delete)) { - printf $fh " %.0f", $s->{$k} / $sampletime; - } - printf $fh "\n"; - if ($i == 1) { - $currops = sprintf("%.0f", $s->{"total"} / $sampletime); - if (! $nopct && $currops > 0) { - $currpct->{"total"} = sprintf("%5s", ""); - for my $k (qw(insert update select delete)) { - $currpct->{$k} = sprintf(" %3.0f%%", - 100.0 * $s->{$k} / $s->{"total"}); - } - } - } - } - close($fh); - print $plotfile <{insert}" \\ - with lines lt 2, \\ - '$datafile' \\ - using 1:4 \\ - title "update$currpct->{update}" \\ - with lines lt 3, \\ - '$datafile' \\ - using 1:5 \\ - title "select$currpct->{select}" \\ - with lines lt 4, \\ - '$datafile' \\ - using 1:6 \\ - title "delete$currpct->{delete}" \\ - with lines lt 5, \\ - '$datafile' \\ - using 1:2 \\ - title "total$currpct->{total}" \\ - with lines lt 1 lw 2 -END -} - -# set up server socket -my $sock = gensym(); -if (! socket($sock, PF_INET, SOCK_STREAM, getprotobyname("tcp"))) { - die "socket: $!\n"; -} -if (! setsockopt($sock, SOL_SOCKET, SO_REUSEADDR, pack("l*", 1))) { - die "setsockopt: $!\n"; -} -if (! bind($sock, pack_sockaddr_in($serverport, INADDR_ANY))) { - die "bind: $!\n"; -} -if (! listen($sock, SOMAXCONN)) { - die "listen: $!\n"; -} - -# bit vectors for select on server socket and clients -my $readin = ''; -vec($readin, fileno($sock), 1) = 1; - -# clients -my @client = (); -my $clientid = 0; -sub addclient { - my($conn) = @_; - my $c = { - conn => $conn, - data => "", - name => "client " . ++$clientid, - }; - push(@client, $c); - vec($readin, fileno($c->{conn}), 1) = 1; - if (1 || $debug) { - warn "added $c->{name}\n"; - } -} -sub deleteclient { - my($c) = @_; - @client = grep($_ ne $c, @client); - vec($readin, fileno($c->{conn}), 1) = 0; - shutdown($c->{conn}, 2); - if (1 || $debug) { - warn "deleted $c->{name}\n"; - } -} -sub readclient { - my($c) = @_; - my $data; - my $n; - eval { - local $SIG{ALRM} = sub { die "timeout\n" }; - alarm(5); - $n = sysread($c->{conn}, $data, 512); - alarm(0); - }; - if ($@) { - chomp($@); - warn "$c->{name}: read: $@\n"; - return undef; - } - if (!defined($n)) { - warn "$c->{name}: read: $!\n"; - return undef; - } - $c->{data} .= $data; - if ($debug) { - warn "$c->{name}: read @{[ length($data) ]} bytes\n"; - } - return $n; -} -sub processclient { - my($c) = @_; - my $i; - while (($i = index($c->{data}, "\n")) >= 0) { - my $line = substr($c->{data}, 0, $i); - $c->{data} = substr($c->{data}, $i+1); - my($node, $type, $value) = split(' ', $line); - if ($node !~ /^\d+$/) { - warn "$c->{name}: $line: bad node id\n"; - next; - } - if ($type !~ /^(insert|update|read|delete|verify|verifydelete)$/) { - warn "$c->{name}: $line: bad type\n"; - next; - } - if ($value !~ /^\d+$/) { - warn "$c->{name}: $line: bad value\n"; - next; - } - if ($type eq "read") { - $type = "select"; - } - adddata($node, $type, $value); - } -} - -# main loop -openplot(); -while (1) { - my $readout = ''; - my $ret = select($readout = $readin, undef, undef, 1.0); - if (vec($readout, fileno($sock), 1)) { - my $conn = gensym(); - if (! accept($conn, $sock)) { - warn "accept failed: $!\n"; - } else { - addclient($conn); - } - } - for my $c (@client) { - if (vec($readout, fileno($c->{conn}), 1)) { - my $n = readclient($c); - if (! defined($n)) { - deleteclient($c); - } else { - processclient($c); - if ($n == 0) { # end of file - deleteclient($c); - } - } - } - } - adddata(); # keep clock ticking - if ($sampleready) { - if ($debug) { - warn "sample ready\n"; - } - plotsample(); - $sampleready = 0; - } -} -# vim: set sw=4: diff --git a/ndb/test/ndbapi/old_dirs/flexHammer/Makefile b/ndb/test/ndbapi/old_dirs/flexHammer/Makefile deleted file mode 100644 index c8e436fb7f5..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexHammer/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := flexHammer - -SOURCES := flexHammer.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/flexHammer/README b/ndb/test/ndbapi/old_dirs/flexHammer/README deleted file mode 100644 index 556582aab96..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexHammer/README +++ /dev/null @@ -1,67 +0,0 @@ - -Executing flexHammer-tests automatically -======================================== - - -It is possible to execute almost al the flexHammer-tests -automatically. The procedure contains three steps: -- increase the number of tabels (flexHammer -c number) -- increase the number of threads (flexHammer -t number) -- increase the number of records (flexHammer -r number) -- increase the number of tabels and threads alternately - -Each of these steps are performed by the scripts test1.sh, -test2.sh, test3.sh and test4.sh. Each test will start Ndb, -execute the test and close Ndb again in order to execute -each test in a 'clean' Ndb-environment. So make sure that -there is no Ndb running when you start the test. - - -1. Setup - -To perform the tests automatically, the following issues -have to be taken care of: - -- be sure that you have a directory bin in your home-directory. - In this directory, you need to have a link 'runndb' to the - ndb executable. You can do this by executing a shell-command like: - ln -s ndb/Emulator/Main/ndb runndb - The script is not yet so far that it performs checks, so if - you forget about this, things will get messy. -- In this directory you need a Ndb.cfg for a server-configuration. - - -2. Command - -I assume you have Ndb and the API compiled or you use the -'released' version. Compile flexHammer as usual with 'make'. -Now you can start the tests by typing 'make test'. The -execution of the test will take a while. - - -3. Results - -The scripts will write their results in the file report.txt. -The scripts will start with a short summary on the test. Then -it will add 1 line documenting each run of flexHammer that is -ececuted. Finally, it will print highest 'score'. The file -report.txt is probably good enough to check in directly as -testprotocol in ndb/test/docs/testprotocols. - - -4. Log files. - -To make it possible to investigate errors, the output from -the flexScan-run where the error occurred is stored in -test1.log, test2.log, test3.log or test4.log respectively. -They are overwritten each time you start 'make test'. - - -HINT - -The number of iterations in each test-script is not directly -limited by the number of attributes or the size of the -attributes but by the number of tables that you are allowed -to create. Probably this will be the error that occurs if -you execute the test. You migh adjust the begin-values and -the step-size in the individual scripts if you want. diff --git a/ndb/test/ndbapi/old_dirs/flexScan/Makefile b/ndb/test/ndbapi/old_dirs/flexScan/Makefile deleted file mode 100644 index 78f9d481063..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexScan/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := flexScan - -SOURCES := flexScan.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/flexScan/README b/ndb/test/ndbapi/old_dirs/flexScan/README deleted file mode 100644 index cddbdea5336..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexScan/README +++ /dev/null @@ -1,66 +0,0 @@ - -Executing flexScan-tests automatically -====================================== - - -It is possible to execute almost al the flexBench-tests -automatically. The procedure contains three steps: -- increase the number of attributes (flexScan -a number) -- increase the size of attributes (flexScan -s number) -- increase the number of threads (flexScan -t number) - -Each of these steps are performed by the scripts test1.sh -test2.sh and test3.sh. Each test will start Ndb, execute -the test and close Ndb again in order to execute each test -in a 'clean' Ndb-environment. So make sure that there is -no Ndb running when you start the test. - - -1. Setup - -To perform the tests automatically, the following issues -have to be taken care of: - -- be sure that you have a directory bin in your home-directory. - In this directory, you need to have a link 'runndb' to the - ndb executable. You can do this by executing a shell-command like: - ln -s ndb/Emulator/Main/ndb runndb - The script is not yet so far that it performs checks, so if - you forget about this, things will get messy. -- In this directory you need a Ndb.cfg for a server-configuration. - - -2. Command - -I assume you have Ndb and the API compiled or you use the -'released' version. Compile flexScan as usual with 'make'. -Now you can start the tests by typing 'make test'. The -execution of the test will take a while. - - -3. Results - -The scripts will write their results in the file report.txt. -The scripts will start with a short summary on the test. Then -it will add 1 line documenting each run of flexScan that is -ececuted. Finally, it will print highest 'score'. The file -report.txt is probably good enough to check in directly as -testprotocol in ndb/test/docs/testprotocols. - - -4. Log files. - -To make it possible to investigate errors, the output from -the flexScan-run where the error occurred is stored in -test1.log, test2.log or test3.log respectively. They are -overwritten each time you start 'make test'. - - -HINT - -The number of iterations in each test-script is not directly -limited by the number of attributes or the size of the -attributes but by the number of tables that you are allowed -to create. Probably this will be the error that occurs if -you execute the test. You migh adjust the begin-values and -the step-size in the individual scripts if you want. diff --git a/ndb/test/ndbapi/old_dirs/flexTT/Makefile b/ndb/test/ndbapi/old_dirs/flexTT/Makefile deleted file mode 100644 index a63bd803d95..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexTT/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := flexTT - -# Source files of non-templated classes (.C files) -SOURCES = flexTT.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile b/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile deleted file mode 100644 index e9995dbd16f..00000000000 --- a/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := flexTimedAsynch - -# Source files of non-templated classes (.C files) -SOURCES = flexTimedAsynch.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile b/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile deleted file mode 100644 index d2608526cae..00000000000 --- a/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := flex_bench_mysql - -# Source files of non-templated classes (.C files) -SOURCES = flex_bench_mysql.cpp - -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/../include) -BIN_TARGET_LIBS_DIRS += $(NDB_TOP)/../libmysql_r/.libs -BIN_TARGET_LIBS += z mysqlclient_r - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/indexTest/Makefile b/ndb/test/ndbapi/old_dirs/indexTest/Makefile deleted file mode 100644 index d842e487ee5..00000000000 --- a/ndb/test/ndbapi/old_dirs/indexTest/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := index - -SOURCES := index.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/indexTest2/Makefile b/ndb/test/ndbapi/old_dirs/indexTest2/Makefile deleted file mode 100644 index ad78fd51986..00000000000 --- a/ndb/test/ndbapi/old_dirs/indexTest2/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := index2 - -SOURCES := index2.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile b/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile deleted file mode 100644 index 074adbf674a..00000000000 --- a/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - - -BIN_TARGET := interpreterInTup - -SOURCES := interpreterInTup.cc - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile deleted file mode 100644 index af472b1589f..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include .defs.mk - -DIRS := src async-src script - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile deleted file mode 100644 index 744d6171139..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include .defs.mk - -DIRS = \ - user \ - generator - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile deleted file mode 100644 index c1f84a3ef70..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -SOURCES = mainAsyncGenerator.cpp asyncGenerator.cpp - -CCFLAGS_LOC := -I../include -I../../include - -BIN_TARGET := DbAsyncGenerator -BIN_TARGET_ARCHIVES := lmc_AsyncUser - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h deleted file mode 100644 index 3e1a3e6704a..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h +++ /dev/null @@ -1,62 +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; version 2 of the License. - - 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 DBGENERATOR_H -#define DBGENERATOR_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include "testData.h" -#include "userInterface.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -extern void asyncGenerator(ThreadData *d, int parallellism, - int millisSendPoll, - int minEventSendPoll, - int forceSendPoll); - -#ifdef __cplusplus -} -#endif - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - - -#endif /* DBGENERATOR_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h deleted file mode 100644 index 0327656de73..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h +++ /dev/null @@ -1,155 +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; version 2 of the License. - - 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 TESTDATA_H -#define TESTDATA_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ -#include -#include -#include -#include -#include "testDefinitions.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -#define NUM_TRANSACTION_TYPES 5 -#define SESSION_LIST_LENGTH 1000 - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -typedef struct { - SubscriberNumber subscriberNumber; - ServerId serverId; -} SessionElement; - -typedef struct { - SessionElement list[SESSION_LIST_LENGTH]; - unsigned int readIndex; - unsigned int writeIndex; - unsigned int numberInList; -} SessionList; - -typedef struct { - unsigned int count; - unsigned int branchExecuted; - unsigned int rollbackExecuted; - - /** - * Latency measures - */ - NDB_TICKS startTime; - NDBT_Stats latency; - unsigned int latencyCounter; - - inline void startLatency(){ - if((latencyCounter & 127) == 127) - startTime = NdbTick_CurrentMillisecond(); - } - - inline void stopLatency(){ - if((latencyCounter & 127) == 127){ - const NDB_TICKS tmp = NdbTick_CurrentMillisecond() - startTime; - latency.addObservation(tmp); - } - latencyCounter++; - } -} TransactionDefinition; - -typedef struct { - RandomSequence transactionSequence; - RandomSequence rollbackSequenceT4; - RandomSequence rollbackSequenceT5; - - TransactionDefinition transactions[NUM_TRANSACTION_TYPES]; - - unsigned int totalTransactions; - - double outerLoopTime; - double outerTps; - - SessionList activeSessions; - -} GeneratorStatistics; - -typedef enum{ - Runnable, - Running -} RunState ; - -typedef struct { - SubscriberNumber number; - SubscriberSuffix suffix; - SubscriberName name; - Location location; - ChangedBy changed_by; - ChangedTime changed_time; - ServerId server_id; - ServerBit server_bit; - SessionDetails session_details; - - GroupId group_id; - ActiveSessions sessions; - Permission permission; - - unsigned int do_rollback; - - unsigned int branchExecuted; - unsigned int sessionElement; -} TransactionData ; - -typedef struct { - struct NdbThread* pThread; - - unsigned long randomSeed; - unsigned long changedTime; - - unsigned int warmUpSeconds; - unsigned int testSeconds; - unsigned int coolDownSeconds; - - GeneratorStatistics generator; - - /** - * For async execution - */ - RunState runState; - double startTime; - TransactionData transactionData; - struct Ndb * pNDB; -} ThreadData; - -/*************************************************************** - * P U B L I C F U N C T I O N S * - ***************************************************************/ - -/*************************************************************** - * E X T E R N A L D A T A * - ***************************************************************/ - - - -#endif /* TESTDATA_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h deleted file mode 100644 index 61769904964..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h +++ /dev/null @@ -1,78 +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; version 2 of the License. - - 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 DBINTERFACE_H -#define DBINTERFACE_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include "testDefinitions.h" -#include "testData.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -/*-----------------------*/ -/* Default Database Name */ -/*-----------------------*/ -#define DEFAULTDB "TestDbClient" - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -typedef struct Ndb Ndb; - -#ifdef __cplusplus -extern "C" { -#endif - extern void showTime(); - extern double userGetTime(void); - extern Ndb *asyncDbConnect(int parallellism); - extern void asyncDbDisconnect(Ndb* pNDB); - - extern void start_T1(Ndb * uh, ThreadData * data, int async); - extern void start_T2(Ndb * uh, ThreadData * data, int async); - extern void start_T3(Ndb * uh, ThreadData * data, int async); - extern void start_T4(Ndb * uh, ThreadData * data, int async); - extern void start_T5(Ndb * uh, ThreadData * data, int async); - - extern void complete_T1(ThreadData * data); - extern void complete_T2(ThreadData * data); - extern void complete_T3(ThreadData * data); - extern void complete_T4(ThreadData * data); - extern void complete_T5(ThreadData * data); - -#ifdef __cplusplus -} -#endif - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - -#endif /* DBINTERFACE_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile deleted file mode 100644 index c0b532a8359..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -ARCHIVE_TARGET := lmc_AsyncUser - -SOURCES := userInterface.C ndb_async2.C - -CCFLAGS_LOC = -I../include -I../../include - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h deleted file mode 100644 index d50183d1749..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h +++ /dev/null @@ -1,50 +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; version 2 of the License. - - 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 MACROS_H -#define MACROS_H - -#include -#include - -#define ERROR(x) {ndbout_c((x));} -#define ERROR1(x,y) {ndbout_c((x), (y));} -#define ERROR2(x,y,z) {ndbout_c((x), (y), (z));} -#define ERROR3(x,y,z,u) {ndbout_c((x), (y), (z), (u));} -#define ERROR4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w));} - -#define INIT_RANDOM(x) srand48((x)) -#define UI_RANDOM(x) ((unsigned int)(lrand48()%(x))) - -#define ASSERT(cond, message) \ - { if(!(cond)) { ERROR(message); exit(-1); }} - -#ifdef DEBUG_ON -#define DEBUG(x) {ndbout_c((x));} -#define DEBUG1(x,y) {ndbout_c((x), (y));} -#define DEBUG2(x,y,z) {ndbout_c((x), (y), (z));} -#define DEBUG3(x,y,z,u) {ndbout_c((x), (y), (z), (u));} -#define DEBUG4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w));} -#define DEBUG5(x,y,z,u,w, v) {ndbout_c((x), (y), (z), (u), (w), (v));} -#else -#define DEBUG(x) -#define DEBUG1(x,y) -#define DEBUG2(x,y,z) -#define DEBUG3(x,y,z,u) -#define DEBUG4(x,y,z,u,w) -#define DEBUG5(x,y,z,u,w, v) -#endif - -#endif diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp deleted file mode 100644 index cb5cd062ae4..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp +++ /dev/null @@ -1,62 +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; version 2 of the License. - - 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_ERROR_H -#define NDB_ERROR_H - -#include -#include -#include "userInterface.h" -#include - -inline -void -CHECK_ALLOWED_ERROR(const char * str, - const ThreadData * td, - const struct NdbError & error){ - - char buf[100]; - snprintf(buf, sizeof(buf), "subscriber = %.*s ", - SUBSCRIBER_NUMBER_LENGTH, - td->transactionData.number); - ndbout << str << " " << error << endl - << buf; - showTime(); - - switch(error.classification) { - case NdbError::TimeoutExpired: - case NdbError::OverloadError: - case NdbError::TemporaryResourceError: - case NdbError::NodeRecoveryError: - break; - default: - if(error.status != NdbError::TemporaryError) - exit(-1); - } -} - -inline -void -CHECK_NULL(void * null, - const char * str, - const ThreadData * td, - const struct NdbError & err){ - if(null == 0){ - CHECK_ALLOWED_ERROR(str, td, err); - exit(-1); - } -} - -#endif diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty b/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp b/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp deleted file mode 100644 index ff7be1f8956..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp +++ /dev/null @@ -1,77 +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; version 2 of the License. - - 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_SCHEMA_H -#define NDB_SCHEMA_H - -#include "testDefinitions.h" - -#define SUBSCRIBER_TABLE "SUBSCRIBER" -#define SUBSCRIBER_NUMBER "NUMBER" -#define SUBSCRIBER_LOCATION "LOCATION" -#define SUBSCRIBER_NAME "NAME" -#define SUBSCRIBER_GROUP "GROUP_ID" -#define SUBSCRIBER_SESSIONS "SESSIONS" -#define SUBSCRIBER_CHANGED_BY "CHANGED_BY" -#define SUBSCRIBER_CHANGED_TIME "CHANGED_TIME" - -#define SERVER_TABLE "SERVER" -#define SERVER_ID "SERVER_ID" -#define SERVER_SUBSCRIBER_SUFFIX "SUFFIX" -#define SERVER_NAME "NAME" -#define SERVER_READS "NO_OF_READ" -#define SERVER_INSERTS "NO_OF_INSERT" -#define SERVER_DELETES "NO_OF_DELETE" - -#define GROUP_TABLE "GROUP" -#define GROUP_ID "GROUP_ID" -#define GROUP_NAME "GROUP_NAME" -#define GROUP_ALLOW_READ "ALLOW_READ" -#define GROUP_ALLOW_INSERT "ALLOW_INSERT" -#define GROUP_ALLOW_DELETE "ALLOW_DELETE" - -#define SESSION_TABLE "SESSION" -#define SESSION_SERVER "SERVER_ID" -#define SESSION_SUBSCRIBER "NUMBER" -#define SESSION_DATA "DATA" - -/** Numbers */ - -#define IND_SUBSCRIBER_NUMBER (unsigned)0 -#define IND_SUBSCRIBER_NAME (unsigned)1 -#define IND_SUBSCRIBER_GROUP (unsigned)2 -#define IND_SUBSCRIBER_LOCATION (unsigned)3 -#define IND_SUBSCRIBER_SESSIONS (unsigned)4 -#define IND_SUBSCRIBER_CHANGED_BY (unsigned)5 -#define IND_SUBSCRIBER_CHANGED_TIME (unsigned)6 - -#define IND_SERVER_SUBSCRIBER_SUFFIX (unsigned)0 -#define IND_SERVER_ID (unsigned)1 -#define IND_SERVER_NAME (unsigned)2 -#define IND_SERVER_READS (unsigned)3 -#define IND_SERVER_INSERTS (unsigned)4 -#define IND_SERVER_DELETES (unsigned)5 - -#define IND_GROUP_ID (unsigned)0 -#define IND_GROUP_NAME (unsigned)1 -#define IND_GROUP_ALLOW_READ (unsigned)2 -#define IND_GROUP_ALLOW_INSERT (unsigned)3 -#define IND_GROUP_ALLOW_DELETE (unsigned)4 - -#define IND_SESSION_SUBSCRIBER (unsigned)0 -#define IND_SESSION_SERVER (unsigned)1 -#define IND_SESSION_DATA (unsigned)2 - -#endif diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h b/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h deleted file mode 100644 index e2705b55a34..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h +++ /dev/null @@ -1,89 +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; version 2 of the License. - - 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 TESTDEFINITIONS_H -#define TESTDEFINITIONS_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -#define OP_PER_TRANS 200 -#define NO_OF_SUBSCRIBERS 500000 -#define NO_OF_GROUPS 100 -#define NO_OF_SERVERS 20 - -#define SUBSCRIBER_NUMBER_LENGTH 12 -#define SUBSCRIBER_NUMBER_SUFFIX_LENGTH 2 - -#define SUBSCRIBER_NAME_LENGTH 32 -#define CHANGED_BY_LENGTH 32 -#define CHANGED_TIME_LENGTH 32 -#define SESSION_DETAILS_LENGTH 2000 -#define SERVER_NAME_LENGTH 32 -#define GROUP_NAME_LENGTH 32 - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -#define PADDING 4 - -typedef char SubscriberNumber[SUBSCRIBER_NUMBER_LENGTH]; -typedef char SubscriberSuffix[SUBSCRIBER_NUMBER_SUFFIX_LENGTH + 2]; -typedef char SubscriberName[SUBSCRIBER_NAME_LENGTH]; -typedef char ServerName[SERVER_NAME_LENGTH]; -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 unsigned int BranchExecuted; -typedef unsigned int DoRollback; - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -} -#endif - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - - -#endif /* TESTDEFINITIONS_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty b/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile deleted file mode 100644 index 240b5957573..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include .defs.mk - -SOURCES.sh := async-lmc-bench.sh async-lmc-bench-l.sh async-lmc-bench-p10.sh async-lmc-bench-l-p10.sh - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh deleted file mode 100755 index 1ce3969f9fb..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -DbCreate -l -ret=$? -if [ $ret -ne 0 ] -then - echo "DbCreate failed" - exit $ret -fi - -DbAsyncGenerator -time 300 -p 10 $* -ret=$? -exit $ret - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh deleted file mode 100755 index a5de71395c4..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -DbCreate -l -ret=$? -if [ $ret -ne 0 ] -then - echo "DbCreate failed" - exit $ret -fi - -DbAsyncGenerator -time 300 $* -ret=$? -exit $ret - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh deleted file mode 100755 index 92c853cdd86..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -DbCreate -ret=$? -if [ $ret -ne 0 ] -then - echo "DbCreate failed" - exit $ret -fi - -DbAsyncGenerator -time 300 -p 10 $* -ret=$? -exit $ret - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh deleted file mode 100755 index da8e9d9bf42..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -DbCreate -ret=$? -if [ $ret -ne 0 ] -then - echo "DbCreate failed" - exit $ret -fi - -DbAsyncGenerator -time 300 $* -ret=$? -exit $ret - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile deleted file mode 100644 index ae7fac9c49b..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include .defs.mk - -DIRS = \ - user \ - populator \ - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/README b/ndb/test/ndbapi/old_dirs/lmc-bench/src/README deleted file mode 100644 index e81c8ba0051..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/README +++ /dev/null @@ -1,8 +0,0 @@ - -Note that you have to use gnumake to build - -On ndbs05: -use 'gmake' instead of 'make' - -On hfXXX: -do 'module add make' diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile deleted file mode 100644 index 143d9ba655e..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -SOURCES = mainGenerator.c dbGenerator.c - -CCFLAGS_LOC := -I../include -I../../include - -OBJECTS = \ - mainGenerator.o\ - dbGenerator.o - -BIN_TARGET := DbGenerator -BIN_TARGET_ARCHIVES := lmc_User - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c deleted file mode 100644 index a0df1e7c1d2..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c +++ /dev/null @@ -1,542 +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; version 2 of the License. - - 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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include -#include "dbGenerator.h" - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - -static void getRandomSubscriberNumber(SubscriberNumber number); -static void getRandomServerId(ServerId *serverId); -static void getRandomChangedBy(ChangedBy changedBy); -static void getRandomChangedTime(ChangedTime changedTime); - -static void clearTransaction(TransactionDefinition *trans); -static void initGeneratorStatistics(GeneratorStatistics *gen); - -static void doOneTransaction(UserHandle *uh, GeneratorStatistics *gen); -static void doTransaction_T1(UserHandle *uh, GeneratorStatistics *gen); -static void doTransaction_T2(UserHandle *uh, GeneratorStatistics *gen); -static void doTransaction_T3(UserHandle *uh, GeneratorStatistics *gen); -static void doTransaction_T4(UserHandle *uh, GeneratorStatistics *gen); -static void doTransaction_T5(UserHandle *uh, GeneratorStatistics *gen); - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -static SequenceValues transactionDefinition[] = { - {25, 1}, - {25, 2}, - {20, 3}, - {15, 4}, - {15, 5}, - {0, 0} -}; - -static SequenceValues rollbackDefinition[] = { - {98, 0}, - {2 , 1}, - {0, 0} -}; - -static int maxsize = 0; - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -static void getRandomSubscriberNumber(SubscriberNumber number) -{ - uint32 tmp; - char sbuf[SUBSCRIBER_NUMBER_LENGTH + 1]; - tmp = myRandom48(NO_OF_SUBSCRIBERS); - sprintf(sbuf, "%.*d", SUBSCRIBER_NUMBER_LENGTH, tmp); - memcpy(number, sbuf, SUBSCRIBER_NUMBER_LENGTH); -} - -static void getRandomServerId(ServerId *serverId) -{ - *serverId = myRandom48(NO_OF_SERVERS); -} - -static void getRandomChangedBy(ChangedBy changedBy) -{ - memset(changedBy, myRandom48(26)+'A', CHANGED_BY_LENGTH); - changedBy[CHANGED_BY_LENGTH] = 0; -} - -static void getRandomChangedTime(ChangedTime changedTime) -{ - memset(changedTime, myRandom48(26)+'A', CHANGED_TIME_LENGTH); - changedTime[CHANGED_TIME_LENGTH] = 0; -} - -static void clearTransaction(TransactionDefinition *trans) -{ - trans->benchTime = 0.0; - trans->count = 0; - trans->branchExecuted = 0; - trans->rollbackExecuted = 0; -} - -static int listFull(SessionList *list) -{ - return(list->numberInList == SESSION_LIST_LENGTH); -} - -static int listEmpty(SessionList *list) -{ - return(list->numberInList == 0); -} - -static void insertSession(SessionList *list, - SubscriberNumber number, - ServerId serverId) -{ - SessionElement *e; - if( listFull(list) ) return; - - e = &list->list[list->writeIndex]; - - strcpy(e->subscriberNumber, number); - e->serverId = serverId; - - list->writeIndex = (list->writeIndex + 1) % SESSION_LIST_LENGTH; - list->numberInList++; - -if( list->numberInList > maxsize ) -maxsize = list->numberInList; -} - -static SessionElement *getNextSession(SessionList *list) -{ - if( listEmpty(list) ) return(0); - - return(&list->list[list->readIndex]); -} - -static void deleteSession(SessionList *list) -{ - if( listEmpty(list) ) return; - - list->readIndex = (list->readIndex + 1) % SESSION_LIST_LENGTH; - list->numberInList--; -} - -static void initGeneratorStatistics(GeneratorStatistics *gen) -{ - int i; - - if( initSequence(&gen->transactionSequence, - transactionDefinition) != 0 ) { - printf("could not set the transaction types\n"); - exit(0); - } - - if( initSequence(&gen->rollbackSequenceT4, - rollbackDefinition) != 0 ) { - printf("could not set the rollback sequence\n"); - exit(0); - } - - if( initSequence(&gen->rollbackSequenceT5, - rollbackDefinition) != 0 ) { - printf("could not set the rollback sequence\n"); - exit(0); - } - - for(i = 0; i < NUM_TRANSACTION_TYPES; i++ ) - clearTransaction(&gen->transactions[i]); - - gen->totalTransactions = 0; - - gen->activeSessions.numberInList = 0; - gen->activeSessions.readIndex = 0; - gen->activeSessions.writeIndex = 0; -} - - -static void doOneTransaction(UserHandle *uh, GeneratorStatistics *gen) -{ - unsigned int transactionType; - - transactionType = getNextRandom(&gen->transactionSequence); - - switch(transactionType) { - case 1: - doTransaction_T1(uh, gen); - break; - case 2: - doTransaction_T2(uh, gen); - break; - case 3: - doTransaction_T3(uh, gen); - break; - case 4: - doTransaction_T4(uh, gen); - break; - case 5: - doTransaction_T5(uh, gen); - break; - default: - printf("Unknown transaction type: %d\n", transactionType); - } - - gen->totalTransactions++; -} - -static void doTransaction_T1(UserHandle *uh, GeneratorStatistics *gen) -{ - SubscriberNumber number; - Location new_location; - ChangedBy changed_by; - ChangedTime changed_time; - - double start_time; - double end_time; - double transaction_time; - - unsigned int tid = 0; - - /*----------------*/ - /* Init arguments */ - /*----------------*/ - getRandomSubscriberNumber(number); - getRandomChangedBy(changed_by); - getRandomChangedTime(changed_time); - new_location = changed_by[0]; - - /*-----------------*/ - /* Run transaction */ - /*-----------------*/ - start_time = userGetTimeSync(); - userTransaction_T1(uh, - number, - new_location, - changed_by, - changed_time); - end_time = userGetTimeSync(); - - /*-------------------*/ - /* Update Statistics */ - /*-------------------*/ - transaction_time = end_time - start_time; - gen->transactions[tid].benchTime += transaction_time; - gen->transactions[tid].count++; -} - -static void doTransaction_T2(UserHandle *uh, GeneratorStatistics *gen) -{ - SubscriberNumber number; - Location new_location; - ChangedBy changed_by; - ChangedTime changed_time; - SubscriberName subscriberName; - - double start_time; - double end_time; - double transaction_time; - - unsigned int tid = 1; - - /*----------------*/ - /* Init arguments */ - /*----------------*/ - getRandomSubscriberNumber(number); - - /*-----------------*/ - /* Run transaction */ - /*-----------------*/ - start_time = userGetTimeSync(); - userTransaction_T2(uh, - number, - &new_location, - changed_by, - changed_time, - subscriberName); - end_time = userGetTimeSync(); - - /*-------------------*/ - /* Update Statistics */ - /*-------------------*/ - transaction_time = end_time - start_time; - gen->transactions[tid].benchTime += transaction_time; - gen->transactions[tid].count++; -} - -static void doTransaction_T3(UserHandle *uh, GeneratorStatistics *gen) -{ - SubscriberNumber number; - ServerId serverId; - ServerBit serverBit; - SessionDetails sessionDetails; - unsigned int branchExecuted; - SessionElement *se; - - double start_time; - double end_time; - double transaction_time; - - unsigned int tid = 2; - - /*----------------*/ - /* Init arguments */ - /*----------------*/ - se = getNextSession(&gen->activeSessions); - if( se ) { - strcpy(number, se->subscriberNumber); - serverId = se->serverId; - } - else { - getRandomSubscriberNumber(number); - getRandomServerId(&serverId); - } - - serverBit = 1 << serverId; - - /*-----------------*/ - /* Run transaction */ - /*-----------------*/ - start_time = userGetTimeSync(); - userTransaction_T3(uh, - number, - serverId, - serverBit, - sessionDetails, - &branchExecuted); - end_time = userGetTimeSync(); - - /*-------------------*/ - /* Update Statistics */ - /*-------------------*/ - transaction_time = end_time - start_time; - gen->transactions[tid].benchTime += transaction_time; - gen->transactions[tid].count++; - - if(branchExecuted) - gen->transactions[tid].branchExecuted++; -} - -static void doTransaction_T4(UserHandle *uh, GeneratorStatistics *gen) -{ - SubscriberNumber number; - ServerId serverId; - ServerBit serverBit; - SessionDetails sessionDetails; - unsigned int branchExecuted; - unsigned int rollback; - - double start_time; - double end_time; - double transaction_time; - - unsigned int tid = 3; - - /*----------------*/ - /* Init arguments */ - /*----------------*/ - getRandomSubscriberNumber(number); - getRandomServerId(&serverId); - - serverBit = 1 << serverId; - rollback = getNextRandom(&gen->rollbackSequenceT4); - - memset(sessionDetails, myRandom48(26)+'A', SESSION_DETAILS_LENGTH); - sessionDetails[SESSION_DETAILS_LENGTH] = 0; - - /*-----------------*/ - /* Run transaction */ - /*-----------------*/ - start_time = userGetTimeSync(); - userTransaction_T4(uh, - number, - serverId, - serverBit, - sessionDetails, - rollback, - &branchExecuted); - end_time = userGetTimeSync(); - - /*-------------------*/ - /* Update Statistics */ - /*-------------------*/ - transaction_time = end_time - start_time; - gen->transactions[tid].benchTime += transaction_time; - gen->transactions[tid].count++; - - if(branchExecuted) - gen->transactions[tid].branchExecuted++; - if(rollback) - gen->transactions[tid].rollbackExecuted++; - - if( branchExecuted && !rollback ) { - insertSession(&gen->activeSessions, number, serverId); - } -} - -static void doTransaction_T5(UserHandle *uh, GeneratorStatistics *gen) -{ - SubscriberNumber number; - ServerId serverId; - ServerBit serverBit; - unsigned int branchExecuted; - unsigned int rollback; - SessionElement *se; - - double start_time; - double end_time; - double transaction_time; - - unsigned int tid = 4; - - /*----------------*/ - /* Init arguments */ - /*----------------*/ - se = getNextSession(&gen->activeSessions); - if( se ) { - strcpy(number, se->subscriberNumber); - serverId = se->serverId; - } - else { - getRandomSubscriberNumber(number); - getRandomServerId(&serverId); - } - - serverBit = 1 << serverId; - rollback = getNextRandom(&gen->rollbackSequenceT5); - - /*-----------------*/ - /* Run transaction */ - /*-----------------*/ - start_time = userGetTimeSync(); - userTransaction_T5(uh, - number, - serverId, - serverBit, - rollback, - &branchExecuted); - end_time = userGetTimeSync(); - - /*-------------------*/ - /* Update Statistics */ - /*-------------------*/ - transaction_time = end_time - start_time; - gen->transactions[tid].benchTime += transaction_time; - gen->transactions[tid].count++; - - if(branchExecuted) - gen->transactions[tid].branchExecuted++; - if(rollback) - gen->transactions[tid].rollbackExecuted++; - - if( se && !rollback) { - deleteSession(&gen->activeSessions); - } -} - -/*************************************************************** -**************************************************************** -* P U B L I C F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - - -void dbGenerator(UserHandle *uh, ThreadData *data) -{ - GeneratorStatistics rg_warmUp; - GeneratorStatistics rg_coolDown; - GeneratorStatistics *st; - double periodStop; - double benchTimeStart; - double benchTimeEnd; - int i; - - myRandom48Init(data->randomSeed); - - initGeneratorStatistics(&rg_warmUp); - initGeneratorStatistics(&data->generator); - initGeneratorStatistics(&rg_coolDown); - - /*----------------*/ - /* warm up period */ - /*----------------*/ - periodStop = userGetTimeSync() + (double)data->warmUpSeconds; - while(userGetTimeSync() < periodStop){ - doOneTransaction(uh, &rg_warmUp); - } - - /*-------------------------*/ - /* normal benchmark period */ - /*-------------------------*/ - benchTimeStart = userGetTimeSync(); - - if( data->numTransactions > 0 ) { - for(i = 0; i < data->numTransactions; i++) - doOneTransaction(uh, &data->generator); - } - else { - periodStop = benchTimeStart + (double)data->testSeconds; - while(userGetTimeSync() < periodStop) - doOneTransaction(uh, &data->generator); - } - - benchTimeEnd = userGetTimeSync(); - - /*------------------*/ - /* cool down period */ - /*------------------*/ - periodStop = benchTimeEnd + data->coolDownSeconds; - while(userGetTimeSync() < periodStop){ - doOneTransaction(uh, &rg_coolDown); - } - - /*---------------------------------------------------------*/ - /* add the times for all transaction for inner loop timing */ - /*---------------------------------------------------------*/ - st = &data->generator; - st->innerLoopTime = 0.0; - for(i = 0 ; i < NUM_TRANSACTION_TYPES; i++) { - st->innerLoopTime += st->transactions[i].benchTime; - st->transactions[i].tps = getTps(st->transactions[i].count, - st->transactions[i].benchTime); - } - - st->outerLoopTime = benchTimeEnd - benchTimeStart; - st->outerTps = getTps(st->totalTransactions, st->outerLoopTime); - st->innerTps = getTps(st->totalTransactions, st->innerLoopTime); - - /* printf("maxsize = %d\n",maxsize); */ -} diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h deleted file mode 100644 index 206b13c3f00..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h +++ /dev/null @@ -1,60 +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; version 2 of the License. - - 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 DBGENERATOR_H -#define DBGENERATOR_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include "testData.h" -#include "userInterface.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -extern void dbGenerator(UserHandle *uh, ThreadData *data); - - -#ifdef __cplusplus -} -#endif - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - - -#endif /* DBGENERATOR_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c deleted file mode 100644 index cb47207a0f2..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c +++ /dev/null @@ -1,322 +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; version 2 of the License. - - 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 - -#include -#include -#include -#include - -#include "userInterface.h" -#include "dbGenerator.h" - - -static int numProcesses; -static int numTransactions; -static int numSeconds; -static int numWarmSeconds; -static char *testDbName; - -static ThreadData data[100]; - -typedef struct { - pthread_t threadId; - int waitSeconds; - int toExit; -}CheckpointData; - -static void usage(char *prog) -{ - char *progname; - - /*--------------------------------------------*/ - /* Get the name of the program (without path) */ - /*--------------------------------------------*/ - progname = strrchr(prog, '/'); - - if (progname == 0) - progname = prog; - else - ++progname; - - fprintf(stderr, - "Usage: %s [-db ] [-proc ] [-transactions ] [-time ]\n" - " -db Specifies the database name\n" - " default = '%s'\n" - " -proc Specifies that is the number of\n" - " concurrent processes. The default is 1.\n" - " -transactions Specifies that transactions will be\n" - " performed. The default is to do a specific time interval\n" - " -time Specifies that the test will run for sec.\n" - " The default is 10 sec\n" - " -warm Specifies the warm-up/cooldown period of sec.\n" - " The default is 10 sec\n", - progname, DEFAULTDB); - exit(1); -} - -static void parse_args(int argc,char **argv) -{ - int i; - - testDbName = DEFAULTDB; - numProcesses = 1; - numTransactions = 0; - numSeconds = 10; - numWarmSeconds = 10; - - i = 1; - while (i < argc){ - if (strcmp("-db",argv[i]) == 0) { - if (i + 1 >= argc) { - usage(argv[0]); - exit(1); - } - testDbName = argv[i + 1]; - i += 2; - } - else if (strcmp("-proc",argv[i]) == 0) { - if (i + 1 >= argc) { - usage(argv[0]); - exit(1); - } - if (sscanf(argv[i+1], "%d", &numProcesses) == -1 || - numProcesses <= 0 || numProcesses > 99) { - fprintf(stderr, "-proc flag requires a positive integer argument [1..99]\n"); - usage(argv[0]); - exit(1); - } - i += 2; - } - else if (strcmp("-transactions",argv[i]) == 0) { - if (i + 1 >= argc) { - usage(argv[0]); - exit(1); - } - if (sscanf(argv[i+1], "%d", &numTransactions) == -1 || - numTransactions < 0) { - fprintf(stderr, "-transactions flag requires a positive integer argument\n"); - usage(argv[0]); - exit(1); - } - i += 2; - } - else if (strcmp("-time",argv[i]) == 0) { - if (i + 1 >= argc) { - usage(argv[0]); - exit(1); - } - if (sscanf(argv[i+1], "%d", &numSeconds) == -1 || - numSeconds < 0) { - fprintf(stderr, "-time flag requires a positive integer argument\n"); - usage(argv[0]); - exit(1); - } - i += 2; - } - else if (strcmp("-warm",argv[i]) == 0) { - if (i + 1 >= argc) { - usage(argv[0]); - exit(1); - } - if (sscanf(argv[i+1], "%d", &numWarmSeconds) == -1 || - numWarmSeconds < 0) { - fprintf(stderr, "-warm flag requires a positive integer argument\n"); - usage(argv[0]); - exit(1); - } - i += 2; - } - else - usage(argv[0]); - } -} - -static void print_transaction(const char *header, - unsigned long totalCount, - TransactionDefinition *trans, - unsigned int printBranch, - unsigned int printRollback) -{ - double f; - - printf(" %s: %d (%.2f%%) Time: %.4f sec TPS = %.0f\n", - header, - trans->count, - (double)trans->count / (double)totalCount * 100.0, - trans->benchTime, - trans->tps); - - if( printBranch ){ - if( trans->count == 0 ) - f = 0.0; - else - f = (double)trans->branchExecuted / (double)trans->count * 100.0; - printf(" Branches Executed: %d (%.2f%%)\n", trans->branchExecuted, f); - } - - if( printRollback ){ - if( trans->count == 0 ) - f = 0.0; - else - f = (double)trans->rollbackExecuted / (double)trans->count * 100.0; - printf(" Rollback Executed: %d (%.2f%%)\n", trans->rollbackExecuted, f); - } -} - -void print_stats_sync(const char *title, - unsigned int length, - unsigned int transactionFlag, - GeneratorStatistics *gen, - int numProc) -{ - int i; - char buf[10]; - char name[100]; - - name[0] = 0; - NdbHost_GetHostName(name); - - printf("\n------ %s ------\n",title); - printf("Length : %d %s\n", - length, - transactionFlag ? "Transactions" : "sec"); - printf("Processor : %s\n", name); - printf("Number of Proc: %d\n",numProc); - printf("\n"); - - if( gen->totalTransactions == 0 ) { - printf(" No Transactions for this test\n"); - } - else { - for(i = 0; i < 5; i++) { - sprintf(buf, "T%d",i+1); - print_transaction(buf, - gen->totalTransactions, - &gen->transactions[i], - i >= 2, - i >= 3 ); - } - - printf("\n"); - printf(" Overall Statistics:\n"); - printf(" Transactions: %d\n", gen->totalTransactions); - printf(" Inner : %.0f TPS\n",gen->innerTps); - printf(" Outer : %.0f TPS\n",gen->outerTps); - printf("\n"); - } -} - -static void *threadRoutine(void *arg) -{ - UserHandle *uh; - ThreadData *data = (ThreadData *)arg; - - uh = userDbConnect(0, testDbName); - NdbSleep_MilliSleep(data->threadId); - dbGenerator(uh,data); - userDbDisconnect(uh); - - pthread_exit(0); - return(0); -} - -NDB_COMMAND(DbGenerator, "DbGenerator", "DbGenerator", "DbGenerator", 16384) -{ - int i; - int j; - GeneratorStatistics stats; - GeneratorStatistics *p; - CheckpointData cd; - - parse_args(argc,argv); - - printf("\nStarting Test with %d process(es) for %d %s\n", - numProcesses, - numTransactions ? numTransactions : numSeconds, - numTransactions ? "Transactions" : "sec"); - printf(" WarmUp/coolDown = %d sec\n", numWarmSeconds); - - /* - cd.waitSeconds = 300; - cd.toExit = 0; - pthread_create(&cd.threadId, 0, checkpointRoutine, &cd); - */ - - for(i = 0; i < numProcesses; i++) { - data[i].warmUpSeconds = numWarmSeconds; - data[i].testSeconds = numSeconds; - data[i].coolDownSeconds = numWarmSeconds; - data[i].numTransactions = numTransactions; - data[i].randomSeed = time(0)+i; - j = pthread_create(&data[i].threadId, 0, threadRoutine, &data[i]); - if(j != 0){ - perror("Failed to create thread"); - } - } - - /*--------------------------------*/ - /* Wait for all processes to exit */ - /*--------------------------------*/ - for(i = 0; i < numProcesses; i++) - pthread_join(data[i].threadId, 0); - - printf("All threads have finished\n"); - - cd.toExit = 1; - - /*-------------------------------------------*/ - /* Clear all structures for total statistics */ - /*-------------------------------------------*/ - stats.totalTransactions = 0; - stats.outerTps = 0.0; - stats.innerTps = 0.0; - - for(i = 0; i < NUM_TRANSACTION_TYPES; i++ ) { - stats.transactions[i].benchTime = 0.0; - stats.transactions[i].count = 0; - stats.transactions[i].tps = 0.0; - stats.transactions[i].branchExecuted = 0; - stats.transactions[i].rollbackExecuted = 0; - } - - /*--------------------------------*/ - /* Add the values for all Threads */ - /*--------------------------------*/ - for(i = 0; i < numProcesses; i++) { - p = &data[i].generator; - - stats.totalTransactions += p->totalTransactions; - stats.outerTps += p->outerTps; - stats.innerTps += p->innerTps; - - for(j = 0; j < NUM_TRANSACTION_TYPES; j++ ) { - stats.transactions[j].benchTime += p->transactions[j].benchTime; - stats.transactions[j].count += p->transactions[j].count; - stats.transactions[j].tps += p->transactions[j].tps; - stats.transactions[j].branchExecuted += p->transactions[j].branchExecuted; - stats.transactions[j].rollbackExecuted += p->transactions[j].rollbackExecuted; - } - } - - print_stats_sync("Test Results", - numTransactions ? numTransactions : numSeconds, - numTransactions ? 1 : 0, - &stats, - numProcesses); - - return(0); -} diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h deleted file mode 100644 index 494b111ea7f..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h +++ /dev/null @@ -1,102 +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; version 2 of the License. - - 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 TESTDATA_H -#define TESTDATA_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include "testDefinitions.h" -#include - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -#define NUM_TRANSACTION_TYPES 5 -#define SESSION_LIST_LENGTH 1000 - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -typedef struct { - SubscriberNumber subscriberNumber; - ServerId serverId; -} SessionElement; - -typedef struct { - SessionElement list[SESSION_LIST_LENGTH]; - unsigned int readIndex; - unsigned int writeIndex; - unsigned int numberInList; -} SessionList; - -typedef struct { - double benchTime; - unsigned int count; - double tps; - unsigned int branchExecuted; - unsigned int rollbackExecuted; -}TransactionDefinition; - -typedef struct { - RandomSequence transactionSequence; - RandomSequence rollbackSequenceT4; - RandomSequence rollbackSequenceT5; - - TransactionDefinition transactions[NUM_TRANSACTION_TYPES]; - - unsigned int totalTransactions; - - double innerLoopTime; - double innerTps; - - double outerLoopTime; - double outerTps; - - SessionList activeSessions; -} GeneratorStatistics; - -typedef struct { - unsigned long threadId; - unsigned long randomSeed; - - unsigned int warmUpSeconds; - unsigned int testSeconds; - unsigned int coolDownSeconds; - unsigned int numTransactions; - - GeneratorStatistics generator; -}ThreadData; - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - - -#endif /* TESTDATA_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h deleted file mode 100644 index ed1146f3a0c..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h +++ /dev/null @@ -1,127 +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; version 2 of the License. - - 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 DBINTERFACE_H -#define DBINTERFACE_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include "testDefinitions.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -/*-----------------------*/ -/* Default Database Name */ -/*-----------------------*/ -#define DEFAULTDB "TestDbClient" - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -typedef struct { - struct Ndb * pNDB; - struct NdbConnection * pCurrTrans; -} UserHandle; - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -extern double userGetTimeSync(void); - -extern void userCheckpoint(UserHandle *uh); - -extern UserHandle *userDbConnect(uint32 createDb, char *dbName); -extern void userDbDisconnect(UserHandle *uh); - -extern int userDbInsertServer(UserHandle *uh, - ServerId serverId, - SubscriberSuffix suffix, - ServerName name); - -extern int userDbInsertSubscriber(UserHandle *uh, - SubscriberNumber number, - uint32 groupId, - SubscriberName name); - -extern int userDbInsertGroup(UserHandle *uh, - GroupId groupId, - GroupName name, - Permission allowRead, - Permission allowInsert, - Permission allowDelete); - -extern int userDbCommit(UserHandle *uh); -extern int userDbRollback(UserHandle *uh); - -extern void userTransaction_T1(UserHandle *uh, - SubscriberNumber number, - Location new_location, - ChangedBy changed_by, - ChangedTime changed_time); - -extern void userTransaction_T2(UserHandle *uh, - SubscriberNumber number, - Location *new_location, - ChangedBy changed_by, - ChangedTime changed_time, - SubscriberName subscriberName); - -extern void userTransaction_T3(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - SessionDetails session_details, - unsigned int *branch_executed); - -extern void userTransaction_T4(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - SessionDetails session_details, - unsigned int do_rollback, - unsigned int *branch_executed); - -extern void userTransaction_T5(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - unsigned int do_rollback, - unsigned int *branch_executed); - - -#ifdef __cplusplus -} -#endif - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - -#endif /* DBINTERFACE_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux b/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux deleted file mode 100644 index a933669cfe7..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux +++ /dev/null @@ -1,6 +0,0 @@ -PROJECT_TOP = /home/lmcritr/ecurlmc/users/lmcritr/dbBenchmark - -CFLAGS = -Wall -Wstrict-prototypes -O2 -I/opt/TimesTen4.1/32/include/ -I../include -LDFLAGS = -L/opt/TimesTen4.1/32/lib -Wl,-rpath,/opt/TimesTen4.1/32/lib -LIBS = -ltten -ldl -LIBSCS = -lttclient -ldl diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc b/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc deleted file mode 100644 index 57ab8bf982f..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc +++ /dev/null @@ -1,15 +0,0 @@ - -include $(UAS_TOP)/Defs.mk - -LINK.CC = CC -CC := /opt/as/forte6/SUNWspro/bin/cc -export CC - -NDB_LIB = -L$(UAS_TOP)/API -lNDB_API \ - -L$(UAS_OSPACE_LOC)/lib -lospace \ - -lrt - -CFLAGS = -xO3 -I../include -mt -LDFLAGS = $(NDB_LIB) -lpthread -LIBS = -LIBSCS = diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile deleted file mode 100644 index 2107c948843..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := DbCreate -BIN_TARGET_ARCHIVES := lmc_User - -CCFLAGS_LOC:= -I../include -I../../include - -SOURCES := \ - mainPopulate.c\ - dbPopulate.c - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c deleted file mode 100644 index 89c312ab636..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c +++ /dev/null @@ -1,243 +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; version 2 of the License. - - 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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include - -#include "userInterface.h" - -#include "dbPopulate.h" -#include -#include - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - -static void getRandomSubscriberData(int subscriberNo, - SubscriberNumber number, - SubscriberName name); - -static void populate(char *title, - int count, - void (*func)(UserHandle*,int), - UserHandle *uh); - -static void populateServers(UserHandle *uh, int count); -static void populateSubscribers(UserHandle *uh, int count); -static void populateGroups(UserHandle *uh, int count); - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -static SequenceValues permissionsDefinition[] = { - {90, 1}, - {10, 0}, - {0, 0} -}; - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -static void getRandomSubscriberData(int subscriberNo, - SubscriberNumber number, - SubscriberName name) -{ - char sbuf[SUBSCRIBER_NUMBER_LENGTH + 1]; - sprintf(sbuf, "%.*d", SUBSCRIBER_NUMBER_LENGTH, subscriberNo); - memcpy(number, sbuf, SUBSCRIBER_NUMBER_LENGTH); - - memset(name, myRandom48(26)+'A', SUBSCRIBER_NAME_LENGTH); -} - -static void populate(char *title, - int count, - void (*func)(UserHandle*, int), - UserHandle *uh) -{ - ndbout_c("Populating %d '%s' ... ",count, title); - /* fflush(stdout); */ - func(uh,count); - ndbout_c("done"); -} - -static void populateServers(UserHandle *uh, int count) -{ - int i, j; - int len; - char tmp[80]; - int suffix_length = 1; - ServerName serverName; - SubscriberSuffix suffix; - - int commitCount = 0; - - for(i = 0; i < SUBSCRIBER_NUMBER_SUFFIX_LENGTH; i++) - suffix_length *= 10; - - for(i = 0; i < count; i++) { - sprintf(tmp, "-Server %d-", i); - - len = strlen(tmp); - for(j = 0; j < SERVER_NAME_LENGTH; j++){ - serverName[j] = tmp[j % len]; - } - /* serverName[j] = 0; not null-terminated */ - - for(j = 0; j < suffix_length; j++){ - char sbuf[SUBSCRIBER_NUMBER_SUFFIX_LENGTH + 1]; - sprintf(sbuf, "%.*d", SUBSCRIBER_NUMBER_SUFFIX_LENGTH, j); - memcpy(suffix, sbuf, SUBSCRIBER_NUMBER_SUFFIX_LENGTH); - userDbInsertServer(uh, i, suffix, serverName); - commitCount ++; - if((commitCount % OP_PER_TRANS) == 0) - userDbCommit(uh); - } - } - if((commitCount % OP_PER_TRANS) != 0) - userDbCommit(uh); -} - -static void populateSubscribers(UserHandle *uh, int count) -{ - SubscriberNumber number; - SubscriberName name; - int i, j, k; - int res; - - SequenceValues values[NO_OF_GROUPS+1]; - RandomSequence seq; - - for(i = 0; i < NO_OF_GROUPS; i++) { - values[i].length = 1; - values[i].value = i; - } - - values[i].length = 0; - values[i].value = 0; - - if( initSequence(&seq, values) != 0 ) { - ndbout_c("could not set the sequence of random groups"); - exit(0); - } - -#define RETRIES 25 - - for(i = 0; i < count; i+= OP_PER_TRANS) { - for(j = 0; j - -#include "userInterface.h" -#include "dbPopulate.h" -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -int useTableLogging; -int useIndexTables; -#ifdef __cplusplus -} -#endif - - -static -void usage(const char *prog) -{ - - ndbout_c( - "Usage: %s [-l]\n" - " -l Use logging and checkpointing on tables\n", - " -i Use index tables\n", - prog); - - exit(1); -} - -NDB_COMMAND(DbCreate, "DbCreate", "DbCreate", "DbCreate", 16384) -{ - int i; - UserHandle *uh; - - useTableLogging = useIndexTables = 0; - - for(i = 1; i - -#include "userInterface.h" -#include "userHandle.h" - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -/*----------------*/ -/* Transaction T1 */ -/*----------------*/ -static char *update_subscriber_stmnt = "update subscriber set \ -location = ?,changedBy = ?, changedTime = ? where subscriberNumber = ?"; - -/*----------------*/ -/* Transaction T2 */ -/*----------------*/ -static char *read_subscriber_stmnt = "select subscriberName,location,\ -changedBy,changedTime from subscriber where subscriberNumber = ? for update"; - -/*----------------*/ -/* Transaction T3 */ -/*----------------*/ -static char *read_subscriber_session_stmnt = "select activeSessions,groupId,\ -changedBy,changedTime from subscriber where subscriberNumber = ? for update"; - -static char *read_group_allowRead_stmnt = "select allowRead from userGroup \ -where groupId = ?"; -static char *read_group_allowInsert_stmnt = "select allowInsert from userGroup \ -where groupId = ?"; -static char *read_group_allowDelete_stmnt = "select allowDelete from userGroup \ -where groupId = ?"; - -static char *read_session_details_stmnt = "select sessionData from userSession \ -where subscriberNumber = ? and serverId = ? for update"; - -static char *update_noOfRead_stmnt = "update server \ -set noOfRead = noOfRead + 1 where serverId = ? and subscriberSuffix = ?"; -static char *update_noOfInsert_stmnt = "update server \ -set noOfInsert = noOfInsert + 1 where serverId = ? and subscriberSuffix = ?"; -static char *update_noOfDelete_stmnt = "update server \ -set noOfDelete = noOfDelete + 1 where serverId = ? and subscriberSuffix = ?"; - -static char *insert_session_stmnt = "insert into userSession values (?,?,?)"; - -static char *delete_session_stmnt = "delete from userSession \ -where subscriberNumber = ? and serverId = ?"; - -static char *update_subscriber_session_stmnt = "update subscriber set \ -activeSessions = ? where subscriberNumber = ?"; - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -extern void handle_error(SQLHDBC hdbc, - SQLHENV henv, - SQLHSTMT hstmt, - SQLRETURN rc, - char *filename, - int lineno); - -/*************************************************************** -**************************************************************** -* P U B L I C F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -int localDbPrepare(UserHandle *uh) -{ - SQLRETURN rc; - - if(!uh) return(-1); - - /*-----------------------------*/ - /* Update Subscriber Statement */ - /*-----------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->updateSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate insert group statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->updateSubscriber.stmt,(SQLCHAR *) update_subscriber_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { -/* -handle_error(uh->hdbc, uh->henv, uh->updateSubscriber.stmt, rc, __FILE__, __LINE__); -*/ - printf("Unable to prepare update subscriber statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateSubscriber.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->updateSubscriber.values.location,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update subscriber statement param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateSubscriber.stmt, - 2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - CHANGED_BY_LENGTH+1,0, - uh->updateSubscriber.values.changedBy,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update subscriber statement param 2\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateSubscriber.stmt, - 3,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - CHANGED_TIME_LENGTH+1,0, - uh->updateSubscriber.values.changedTime,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update subscriber statement param 3\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateSubscriber.stmt, - 4,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->updateSubscriber.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update subscriber statement param 3\n"); - return(-1); - } - - /*---------------------------*/ - /* Read Subscriber Statement */ - /*---------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->readSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate read subscriber statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->readSubscriber.stmt,(SQLCHAR *) read_subscriber_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read subscriber statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readSubscriber.stmt, - 1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->readSubscriber.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read subscriber statement param 1\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriber.stmt, 1, - SQL_C_CHAR, - uh->readSubscriber.values.name, SUBSCRIBER_NAME_LENGTH+1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 1 to read subscriber statement\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriber.stmt, 2, - SQL_C_DEFAULT, - &uh->readSubscriber.values.location, 1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 2 to read subscriber statement\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriber.stmt, 3, - SQL_C_CHAR, - uh->readSubscriber.values.changedBy, CHANGED_BY_LENGTH+1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 3 to read subscriber statement\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriber.stmt, 4, - SQL_C_CHAR, - uh->readSubscriber.values.changedTime, CHANGED_TIME_LENGTH+1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 4 to read subscriber statement\n"); - return(-1); - } - - /*------------------------------------*/ - /* Read Subscriber Sessions Statement */ - /*------------------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->readSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate read subscriber session statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->readSubscriberSession.stmt,(SQLCHAR *) read_subscriber_session_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read subscriber sessions statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readSubscriberSession.stmt, - 1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->readSubscriberSession.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read subscriber statement param 1\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriberSession.stmt, 1, - SQL_C_DEFAULT, - &uh->readSubscriberSession.values.activeSessions, 0, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 1 to read subscriber sessions statement\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriberSession.stmt, 2, - SQL_C_DEFAULT, - &uh->readSubscriberSession.values.groupId, 0, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 2 to read subscriber sessions statement\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriberSession.stmt, 3, - SQL_C_CHAR, - uh->readSubscriberSession.values.changedBy, CHANGED_BY_LENGTH+1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 3 to read subscriber sessions statement\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSubscriberSession.stmt, 4, - SQL_C_CHAR, - uh->readSubscriberSession.values.changedTime, CHANGED_TIME_LENGTH+1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 4 to read subscriber sessions statement\n"); - return(-1); - } - - /*--------------------------------*/ - /* Read Group AllowRead Statement */ - /*--------------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->readGroupAllowRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate read subscriber session statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->readGroupAllowRead.stmt,(SQLCHAR *) read_group_allowRead_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read group allow read statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readGroupAllowRead.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->readGroupAllowRead.values.groupId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read allow read statement param 1\n"); - return(-1); - } - - rc = SQLBindCol(uh->readGroupAllowRead.stmt, 1, - SQL_C_DEFAULT, - &uh->readGroupAllowRead.values.allowRead, 0, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 1 to read group allow read statement\n"); - return(-1); - } - - /*----------------------------------*/ - /* Read Group AllowInsert Statement */ - /*----------------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->readGroupAllowInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate read subscriber session statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->readGroupAllowInsert.stmt,(SQLCHAR *) read_group_allowInsert_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read group allow read statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readGroupAllowInsert.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->readGroupAllowInsert.values.groupId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read allow read statement param 1\n"); - return(-1); - } - - rc = SQLBindCol(uh->readGroupAllowInsert.stmt, 1, - SQL_C_DEFAULT, - &uh->readGroupAllowInsert.values.allowInsert, 0, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 1 to read group allow read statement\n"); - return(-1); - } - - /*----------------------------------*/ - /* Read Group AllowDelete Statement */ - /*----------------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->readGroupAllowDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate read subscriber session statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->readGroupAllowDelete.stmt,(SQLCHAR *) read_group_allowDelete_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read group allow read statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readGroupAllowDelete.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->readGroupAllowDelete.values.groupId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read allow read statement param 1\n"); - return(-1); - } - - rc = SQLBindCol(uh->readGroupAllowDelete.stmt, 1, - SQL_C_DEFAULT, - &uh->readGroupAllowDelete.values.allowDelete, 0, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 1 to read group allow read statement\n"); - return(-1); - } - - /*----------------------*/ - /* read session details */ - /*----------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->readSessionDetails.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate read session details statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->readSessionDetails.stmt,(SQLCHAR *) read_session_details_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read session details statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readSessionDetails.stmt, - 1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->readSessionDetails.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read sessions param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->readSessionDetails.stmt, - 2,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->readSessionDetails.values.serverId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read sessions param 2\n"); - return(-1); - } - - rc = SQLBindCol(uh->readSessionDetails.stmt, 1, - SQL_C_CHAR, - uh->readSessionDetails.values.details, SESSION_DETAILS_LENGTH+1, - NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to bind column 1 to read group allow read statement\n"); - return(-1); - } - - /*-------------------*/ - /* Update no of Read */ - /*-------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->updateServerNoOfRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate update noOfRead statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->updateServerNoOfRead.stmt,(SQLCHAR *) update_noOfRead_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update noOfRead statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateServerNoOfRead.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->updateServerNoOfRead.values.serverId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateServerNoOfRead.stmt, - 2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_SUFFIX_LENGTH+1,0, - uh->updateServerNoOfRead.values.suffix,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 2\n"); - return(-1); - } - - /*----------------*/ - /* Insert Session */ - /*----------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->insertSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate update noOfRead statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->insertSession.stmt,(SQLCHAR *) insert_session_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare insert session statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->insertSession.stmt, - 1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->insertSession.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read sessions param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->insertSession.stmt, - 2,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->insertSession.values.serverId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 2\n"); - return(-1); - } - - rc = SQLBindParameter(uh->insertSession.stmt, - 3,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SESSION_DETAILS_LENGTH+1,0, - uh->insertSession.values.details,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read sessions param 1\n"); - return(-1); - } - - /*----------------------------*/ - /* Update subscriber sessions */ - /*----------------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->updateSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate update noOfRead statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->updateSubscriberSession.stmt,(SQLCHAR *) update_subscriber_session_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update subscriber session statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateSubscriberSession.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->updateSubscriberSession.values.activeSessions,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 2\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateSubscriberSession.stmt, - 2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->updateSubscriberSession.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read sessions param 1\n"); - return(-1); - } - - /*---------------------*/ - /* Update no of Insert */ - /*---------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->updateServerNoOfInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate update noOfRead statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->updateServerNoOfInsert.stmt,(SQLCHAR *) update_noOfInsert_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update noOfRead statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateServerNoOfInsert.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->updateServerNoOfInsert.values.serverId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateServerNoOfInsert.stmt, - 2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_SUFFIX_LENGTH+1,0, - uh->updateServerNoOfInsert.values.suffix,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 2\n"); - return(-1); - } - - /*----------------*/ - /* Delete Session */ - /*----------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->deleteSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate update noOfRead statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->deleteSession.stmt,(SQLCHAR *) delete_session_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare insert session statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->deleteSession.stmt, - 1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_LENGTH+1,0, - uh->deleteSession.values.number,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read sessions param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->deleteSession.stmt, - 2,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->deleteSession.values.serverId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 2\n"); - return(-1); - } - - /*---------------------*/ - /* Update no of Delete */ - /*---------------------*/ - rc = SQLAllocStmt(uh->hdbc, &uh->updateServerNoOfDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate update noOfRead statement\n"); - return(-1); - } - - rc = SQLPrepare(uh->updateServerNoOfDelete.stmt,(SQLCHAR *) update_noOfDelete_stmnt, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare update noOfRead statement\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateServerNoOfDelete.stmt, - 1,SQL_PARAM_INPUT,SQL_C_DEFAULT,SQL_INTEGER, - 0,0, - &uh->updateServerNoOfDelete.values.serverId,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 1\n"); - return(-1); - } - - rc = SQLBindParameter(uh->updateServerNoOfDelete.stmt, - 2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR, - SUBSCRIBER_NUMBER_SUFFIX_LENGTH+1,0, - uh->updateServerNoOfInsert.values.suffix,0,NULL); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to prepare read noOfRead param 2\n"); - return(-1); - } - - /*-------------------------------*/ - /* Commit all prepare statements */ - /*-------------------------------*/ - rc = SQLTransact(uh->henv, uh->hdbc, SQL_COMMIT); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to commit all prepare insert statement\n"); - return(-1); - } - - return(0); -} diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h deleted file mode 100644 index c4a9c38f2a3..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h +++ /dev/null @@ -1,50 +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; version 2 of the License. - - 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 MACROS_H -#define MACROS_H - -#include -#include - -#define ERROR(x) {ndbout_c((x)); } -#define ERROR1(x,y) {ndbout_c((x), (y)); } -#define ERROR2(x,y,z) {ndbout_c((x), (y), (z)); } -#define ERROR3(x,y,z,u) {ndbout_c((x), (y), (z), (u)); } -#define ERROR4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w)); } - -#define INIT_RANDOM(x) srand48((x)) -#define UI_RANDOM(x) ((unsigned int)(lrand48()%(x))) - -#define ASSERT(cond, message) \ - { if(!(cond)) { ERROR(message); exit(-1); }} - -#ifdef DEBUG_ON -#define DEBUG(x) {ndbout_c((x)); } -#define DEBUG1(x,y) {ndbout_c((x), (y)); } -#define DEBUG2(x,y,z) {ndbout_c((x), (y), (z)); } -#define DEBUG3(x,y,z,u) {ndbout_c((x), (y), (z), (u)); } -#define DEBUG4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w)); } -#define DEBUG5(x,y,z,u,w, v) {ndbout_c((x), (y), (z), (u), (w), (v)); } -#else -#define DEBUG(x) -#define DEBUG1(x,y) -#define DEBUG2(x,y,z) -#define DEBUG3(x,y,z,u) -#define DEBUG4(x,y,z,u,w) -#define DEBUG5(x,y,z,u,w, v) -#endif - -#endif diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp deleted file mode 100644 index a86966d128e..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp +++ /dev/null @@ -1,30 +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; version 2 of the License. - - 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_ERROR_H -#define NDB_ERROR_H - -#include - -#define error_handler(x,y, z) { \ - ndbout << x << " " << y << endl; \ - exit(-1); } - -#define CHECK_NULL(x,y, z) if(x == 0) \ - error_handler(y,(z->getNdbError()), 0) -#define CHECK_MINUS_ONE(x, y, z) if(x == -1) \ - error_handler(y,(z->getNdbError()), 0) - -#endif diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile deleted file mode 100644 index 9b1247d44af..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../makevars.$(ARCH) - -LIBRARY = ../../lib/libUser.so - -OBJECTS = \ - $(LIBRARY)(localDbPrepare.o)\ - $(LIBRARY)(userInterface.o)\ - $(LIBRARY)(userTransaction.o) - -$(LIBRARY): $(OBJECTS) diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h deleted file mode 100644 index 61baca41501..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h +++ /dev/null @@ -1,189 +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; version 2 of the License. - - 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 USERHANDLE_H -#define USERHANDLE_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include "sql.h" -#include "sqlext.h" -#include "sqltypes.h" - -#include "testDefinitions.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -struct userHandle{ - SQLHENV henv; - SQLHDBC hdbc; - SQLHSTMT stmt; - - /*----------------*/ - /* Transaction T1 */ - /*----------------*/ - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - Location location; - ChangedBy changedBy; - ChangedTime changedTime; - }values; - }updateSubscriber; - - /*----------------*/ - /* Transaction T2 */ - /*----------------*/ - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - SubscriberName name; - Location location; - ChangedBy changedBy; - ChangedTime changedTime; - }values; - }readSubscriber; - - /*----------------*/ - /* Transaction T3 */ - /*----------------*/ - struct { - SQLHSTMT stmt; - struct { - GroupId groupId; - Permission allowRead; - }values; - }readGroupAllowRead; - - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - ServerId serverId; - SessionDetails details; - }values; - }readSessionDetails; - - struct { - SQLHSTMT stmt; - struct { - ServerId serverId; - SubscriberSuffix suffix; - }values; - }updateServerNoOfRead; - - /*----------------*/ - /* Transaction T4 */ - /*----------------*/ - struct { - SQLHSTMT stmt; - struct { - GroupId groupId; - Permission allowInsert; - }values; - }readGroupAllowInsert; - - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - ServerId serverId; - SessionDetails details; - }values; - }insertSession; - - struct { - SQLHSTMT stmt; - struct { - ServerId serverId; - SubscriberSuffix suffix; - }values; - }updateServerNoOfInsert; - - /*----------------*/ - /* Transaction T5 */ - /*----------------*/ - struct { - SQLHSTMT stmt; - struct { - GroupId groupId; - Permission allowDelete; - }values; - }readGroupAllowDelete; - - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - ServerId serverId; - }values; - }deleteSession; - - struct { - SQLHSTMT stmt; - struct { - ServerId serverId; - SubscriberSuffix suffix; - }values; - }updateServerNoOfDelete; - - /*--------------------------*/ - /* Transaction T3 + T4 + T5 */ - /*--------------------------*/ - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - uint32 activeSessions; - GroupId groupId; - ChangedBy changedBy; - ChangedTime changedTime; - }values; - }readSubscriberSession; - - struct { - SQLHSTMT stmt; - struct { - SubscriberNumber number; - uint32 activeSessions; - }values; - }updateSubscriberSession; -}; - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - -#endif /* USERHANDLE_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c deleted file mode 100644 index 03a9465b32c..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c +++ /dev/null @@ -1,452 +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; version 2 of the License. - - 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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include - -#include "userInterface.h" -#include "userHandle.h" - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - -extern int localDbPrepare(UserHandle *uh); - -static int dbCreate(UserHandle *uh); - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -static char *create_subscriber_table = -"CREATE TABLE subscriber(\ -subscriberNumber CHAR(12) NOT NULL primary key,\ -subscriberName CHAR(32) NOT NULL,\ -groupId INT NOT NULL,\ -location INT NOT NULL,\ -activeSessions INT NOT NULL,\ -changedBy CHAR(32) NOT NULL,\ -changedTime CHAR(32) NOT NULL)"; - -static char *create_group_table = -"CREATE TABLE userGroup(\ -groupId INT NOT NULL primary key,\ -groupName CHAR(32) NOT NULL,\ -allowRead INT NOT NULL,\ -allowInsert INT NOT NULL,\ -allowDelete INT NOT NULL)"; - -static char *create_server_table = "CREATE TABLE server(\ -serverId INT NOT NULL,\ -subscriberSuffix CHAR(2) NOT NULL,\ -serverName CHAR(32) NOT NULL,\ -noOfRead INT NOT NULL,\ -noOfInsert INT NOT NULL,\ -noOfDelete INT NOT NULL,\ -PRIMARY KEY(serverId,subscriberSuffix))"; - -static char *create_session_table = -"CREATE TABLE userSession(\ -subscriberNumber CHAR(12) NOT NULL,\ -serverId INT NOT NULL,\ -sessionData CHAR(2000) NOT NULL,\ -PRIMARY KEY(subscriberNumber,serverId))"; - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -/*************************************************************** -**************************************************************** -* P U B L I C F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -/*-----------------------------------*/ -/* Time related Functions */ -/* */ -/* Returns a double value in seconds */ -/*-----------------------------------*/ -double userGetTime(void) -{ - static int initialized = 0; - static struct timeval initTime; - double timeValue; - - if( !initialized ) { - initialized = 1; - gettimeofday(&initTime, 0); - timeValue = 0.0; - } - else { - struct timeval tv; - double s; - double us; - - gettimeofday(&tv, 0); - s = (double)tv.tv_sec - (double)initTime.tv_sec; - us = (double)tv.tv_usec - (double)initTime.tv_usec; - - timeValue = s + (us / 1000000.0); - } - - return(timeValue); -} - - -void handle_error(SQLHDBC hdbc, - SQLHENV henv, - SQLHSTMT hstmt, - SQLRETURN rc, - char *filename, - int lineno) -{ -#define MSG_LNG 512 - - int isError = 0; - SQLRETURN ret = SQL_SUCCESS; - SQLCHAR szSqlState[MSG_LNG]; /* SQL state string */ - SQLCHAR szErrorMsg[MSG_LNG]; /* Error msg text buffer pointer */ - SQLINTEGER pfNativeError; /* Native error code */ - SQLSMALLINT pcbErrorMsg; /* Error msg text Available bytes */ - - if ( rc == SQL_SUCCESS || rc == SQL_NO_DATA_FOUND ) - return; - else if ( rc == SQL_INVALID_HANDLE ) { - printf("ERROR in %s, line %d: invalid handle\n", - filename, lineno); - isError = 1; - } - else if ( rc == SQL_SUCCESS_WITH_INFO ) { - printf("WARNING in %s, line %d\n", - filename, lineno); - isError = 0; - } - else if ( rc == SQL_ERROR ) { - printf("ERROR in %s, line %d\n", - filename, lineno); - isError = 1; - } - - fflush(stdout); - - while ( ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO ) { - ret = SQLError(henv, hdbc, hstmt, szSqlState, &pfNativeError, szErrorMsg, - MSG_LNG, &pcbErrorMsg); - - switch (ret) { - case SQL_SUCCESS: - case SQL_SUCCESS_WITH_INFO: - printf("%s\n*** ODBC Error/Warning = %s, " - "Additional Error/Warning = %d\n", - szErrorMsg, szSqlState, pfNativeError); - - if(ret == SQL_SUCCESS_WITH_INFO) - printf("(Note: error message was truncated.\n"); - break; - - case SQL_INVALID_HANDLE: - printf("Call to SQLError failed with return code of " - "SQL_INVALID_HANDLE.\n"); - break; - - case SQL_ERROR: - printf("Call to SQLError failed with return code of SQL_ERROR.\n"); - break; - - case SQL_NO_DATA_FOUND: - break; - - default: - printf("Call to SQLError failed with return code of %d.\n", ret); - } - } - - if ( isError ) - exit(1); -} - -static int dbCreate(UserHandle *uh) -{ - SQLRETURN rc; - SQLHSTMT creatstmt; - - if(!uh) return(-1); - - rc = SQLAllocStmt(uh->hdbc, &creatstmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate create statement\n"); - return(-1); - } - - rc = SQLExecDirect(creatstmt,(SQLCHAR *)create_subscriber_table, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to create subscriber table\n"); - return(-1); - } - - rc = SQLExecDirect(creatstmt,(SQLCHAR *)create_group_table, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to create group table\n"); - return(-1); - } - - rc = SQLExecDirect(creatstmt,(SQLCHAR *)create_server_table, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to create server table\n"); - return(-1); - } - - rc = SQLExecDirect(creatstmt,(SQLCHAR *)create_session_table, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to create session table\n"); - return(-1); - } - - rc = SQLTransact(uh->henv, uh->hdbc, SQL_COMMIT); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to commit all create table\n"); - return(-1); - } - - rc = SQLFreeStmt(creatstmt, SQL_DROP); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to free create statement\n"); - return(-1); - } - - return(0); -} - -UserHandle *userDbConnect(uint32 createDb, char *dbName) -{ - char connStrIn[512]; /* ODBC Connection String */ - char connStrOut[2048]; - SQLRETURN rc; - UserHandle *uh; - - /*--------------------------*/ - /* Build the Connect string */ - /*--------------------------*/ - sprintf(connStrIn, - "AutoCreate=%d;OverWrite=%d;DSN=%s", - createDb ? 1 : 0, - createDb ? 1 : 0, - dbName); - - uh = calloc(1, sizeof(UserHandle)); - if( !uh ) { - printf("Unable to allocate memory for Handle\n"); - return(0); - } - - /*---------------------------------*/ - /* Allocate the Environment Handle */ - /*---------------------------------*/ - rc = SQLAllocEnv(&uh->henv); - - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate Environment Handle\n"); - return(0); - } - - /*--------------------------------*/ - /* Allocate the DB Connect Handle */ - /*--------------------------------*/ - rc = SQLAllocConnect(uh->henv, &uh->hdbc); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate a connection handle\n"); - return(0); - } - - /*-------------------------*/ - /* Connect to the Database */ - /*-------------------------*/ - rc = SQLDriverConnect(uh->hdbc, NULL, - (SQLCHAR *)connStrIn, SQL_NTS, - (SQLCHAR *)connStrOut, sizeof (connStrOut), - NULL, SQL_DRIVER_NOPROMPT); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { -handle_error(uh->hdbc, uh->henv, NULL, rc, __FILE__, __LINE__); - printf("Unable to connect to database server\n"); - return(0); - } - - rc = SQLSetConnectOption(uh->hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to set connection option\n"); - return(0); - } - - rc = SQLAllocStmt(uh->hdbc, &uh->stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to allocate immediate statement\n"); - return(0); - } - - if( createDb ) - dbCreate(uh); - - if( localDbPrepare(uh) < 0 ) - return(0); - - return(uh); -} - -void userDbDisconnect(UserHandle *uh) -{ - SQLRETURN rc; - - if(!uh) return; - - rc = SQLDisconnect(uh->hdbc); - - SQLFreeConnect(uh->hdbc); - SQLFreeEnv(uh->henv); - free(uh); -} - -int userDbInsertServer(UserHandle *uh, - ServerId serverId, - SubscriberSuffix suffix, - ServerName name) -{ - SQLRETURN rc; - char buf[1000]; - - if(!uh) return(-1); - - sprintf(buf, "insert into server values (%d,'%.*s','%s',0,0,0)", - serverId, - SUBSCRIBER_NUMBER_SUFFIX_LENGTH, suffix, - name); - - rc = SQLExecDirect(uh->stmt, (unsigned char *)buf, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to execute insert server\n"); - return(-1); - } - - return( userDbCommit(uh) ); -} - -int userDbInsertSubscriber(UserHandle *uh, - SubscriberNumber number, - uint32 groupId, - SubscriberName name) -{ - SQLRETURN rc; - char buf[1000]; - - if(!uh) return(-1); - - sprintf(buf, "insert into subscriber values ('%s','%s',%d,0,0,'','')", - number, - name, - groupId); - - rc = SQLExecDirect(uh->stmt, (unsigned char*)buf, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to execute insert subscriber\n"); - return(-1); - } - - return( userDbCommit(uh) ); -} - -int userDbInsertGroup(UserHandle *uh, - GroupId groupId, - GroupName name, - Permission allowRead, - Permission allowInsert, - Permission allowDelete) -{ - SQLRETURN rc; - char buf[1000]; - - if(!uh) return(-1); - - sprintf(buf, "insert into usergroup values (%d,'%s',%d,%d,%d)", - groupId, - name, - allowRead, - allowInsert, - allowDelete); - - rc = SQLExecDirect(uh->stmt, (unsigned char*)buf, SQL_NTS); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to execute insert group\n"); - return(-1); - } - - return( userDbCommit(uh) ); -} - -int userDbCommit(UserHandle *uh) -{ - SQLRETURN rc; - if(!uh) return(-1); - - rc = SQLTransact(uh->henv, uh->hdbc, SQL_COMMIT); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { -handle_error(uh->hdbc, uh->henv, 0, rc, __FILE__, __LINE__); - printf("Unable to commit Transaction\n"); - return(-1); - } - - return(0); -} - -int userDbRollback(UserHandle *uh) -{ - SQLRETURN rc; - if(!uh) return(-1); - - rc = SQLTransact(uh->henv, uh->hdbc, SQL_ROLLBACK); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("Unable to rollback Transaction\n"); - return(-1); - } - - return(0); -} - -void userCheckpoint(UserHandle *uh) -{ - SQLRETURN rc; - if(!uh) return; - - rc = SQLExecDirect(uh->stmt, (SQLCHAR *)"call ttCheckpointFuzzy", SQL_NTS); - userDbCommit(uh); -} diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c deleted file mode 100644 index bdc60912482..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c +++ /dev/null @@ -1,472 +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; version 2 of the License. - - 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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include -#include - -#include "sql.h" -#include "sqlext.h" - - -#include "userInterface.h" -#include "userHandle.h" - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - -static int readSubscriberSessions(UserHandle *uh, - SubscriberNumber number, - char *transactionType); - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -extern void handle_error(SQLHDBC hdbc, - SQLHENV henv, - SQLHSTMT hstmt, - SQLRETURN rc, - char *filename, - int lineno); - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -static int readSubscriberSessions(UserHandle *uh, - SubscriberNumber number, - char *transactionType) -{ - SQLRETURN rc; - - /*-----------------------------------------------------*/ - /* SELECT activeSessions,groupId,changedBy,changedTime */ - /* FROM SUBSCRIBER */ - /* WHERE subscriberNumber=x; */ - /*-----------------------------------------------------*/ - strcpy(uh->readSubscriberSession.values.number,number); - - rc = SQLExecute(uh->readSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("%s %s\n", - transactionType, - "Unable to execute read subscriber session"); - return(-1); - } - - rc = SQLFetch(uh->readSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("%s %s\n", - transactionType, - "Unable to fetch read subscriber session"); - return(-1); - } - - return(0); -} - -/*************************************************************** -**************************************************************** -* P U B L I C F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -void userTransaction_T1(UserHandle *uh, - SubscriberNumber number, - Location new_location, - ChangedBy changed_by, - ChangedTime changed_time) -{ - SQLRETURN rc; - - if(!uh) return; - - /*---------------------------------------------*/ - /* Update the subscriber information */ - /* */ - /* UPDATE SUBSCRIBER */ - /* SET location=x, changedBy=x, changedTime=x */ - /* WHERE subscriberNumber=x; */ - /*---------------------------------------------*/ - strcpy(uh->updateSubscriber.values.number, number); - uh->updateSubscriber.values.location = new_location; - strcpy(uh->updateSubscriber.values.changedBy, changed_by); - strcpy(uh->updateSubscriber.values.changedTime, changed_time); - - rc = SQLExecute(uh->updateSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T1 Unable to execute update subscriber\n"); - return; - } - - userDbCommit(uh); -} - -void userTransaction_T2(UserHandle *uh, - SubscriberNumber number, - Location *new_location, - ChangedBy changed_by, - ChangedTime changed_time, - SubscriberName subscriberName) -{ - SQLRETURN rc; - - if(!uh) return; - - /*------------------------------------------------------*/ - /* Read the information from the subscriber table */ - /* */ - /* SELECT location,subscriberName,changedBy,changedTime */ - /* FROM SUBSCRIBER */ - /* WHERE subscriberNumber=x; */ - /*------------------------------------------------------*/ - strcpy(uh->readSubscriber.values.number,number); - - rc = SQLExecute(uh->readSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T2 Unable to execute read subscriber\n"); - return; - } - - rc = SQLFetch(uh->readSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T2 Unable to fetch read subscriber\n"); - return; - } - - userDbCommit(uh); - - strcpy(subscriberName, uh->readSubscriber.values.name); - *new_location = uh->readSubscriber.values.location; - strcpy(changed_by, uh->readSubscriber.values.changedBy); - strcpy(changed_time, uh->readSubscriber.values.changedTime); -} - -void userTransaction_T3(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - SessionDetails session_details, - unsigned int *branch_executed) -{ - SQLRETURN rc; - - if(!uh) return; - - *branch_executed = 0; - - /*--------------------------------------*/ - /* Read active sessions from subscriber */ - /*--------------------------------------*/ - if( readSubscriberSessions(uh, number, "T3") < 0 ) - return; - - /*-----------------------------------------------*/ - /* Read the 'read' Permissions for the userGroup */ - /* */ - /* SELECT allowRead */ - /* FROM USERGROUP */ - /* WHERE groupId=x */ - /*-----------------------------------------------*/ - uh->readGroupAllowRead.values.groupId = uh->readSubscriberSession.values.groupId; - - rc = SQLExecute(uh->readGroupAllowRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to execute read group allow read\n"); - return; - } - - rc = SQLFetch(uh->readGroupAllowRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to fetch read group allow read\n"); - return; - } - - if( uh->readGroupAllowRead.values.allowRead & server_bit && - uh->readSubscriberSession.values.activeSessions & server_bit ) { - - /*----------------------------------------------------*/ - /* Read the sessionDetails from the userSession table */ - /* */ - /* SELECT sessionData */ - /* FROM userSession */ - /* WHERE subscriberNumber=x, serverId=x */ - /*----------------------------------------------------*/ - strcpy(uh->readSessionDetails.values.number,number); - uh->readSessionDetails.values.serverId = server_id; - - rc = SQLExecute(uh->readSessionDetails.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to execute read session details\n"); - return; - } - - rc = SQLFetch(uh->readSessionDetails.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to fetch read session details\n"); - return; - } - - strcpy(session_details, uh->readSessionDetails.values.details); - - /*----------------------------------------*/ - /* Increment noOfRead field in the server */ - /* */ - /* UPDATE server */ - /* SET noOfRead=noOfRead+1 */ - /* WHERE serverId=x,subscriberSuffix=x */ - /*----------------------------------------*/ - uh->updateServerNoOfRead.values.serverId = server_id; - strcpy(uh->updateServerNoOfRead.values.suffix, - &number[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH]); - - rc = SQLExecute(uh->updateServerNoOfRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to execute read no of read\n"); - return; - } - - *branch_executed = 1; - } - - userDbCommit(uh); -} - -void userTransaction_T4(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - SessionDetails session_details, - unsigned int do_rollback, - unsigned int *branch_executed) -{ - SQLRETURN rc; - - if(!uh) return; - - *branch_executed = 0; - - /*--------------------------------------*/ - /* Read active sessions from subscriber */ - /*--------------------------------------*/ - if( readSubscriberSessions(uh, number, "T4") < 0 ) - return; - - /*-------------------------------------------------*/ - /* Read the 'insert' Permissions for the userGroup */ - /* */ - /* SELECT allowInsert */ - /* FROM USERGROUP */ - /* WHERE groupId=x */ - /*-------------------------------------------------*/ - uh->readGroupAllowInsert.values.groupId = uh->readSubscriberSession.values.groupId; - - rc = SQLExecute(uh->readGroupAllowInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to execute read group allow insert\n"); - return; - } - - rc = SQLFetch(uh->readGroupAllowInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to fetch read group allow insert\n"); - return; - } - - if( uh->readGroupAllowInsert.values.allowInsert & server_bit && - !(uh->readSubscriberSession.values.activeSessions & server_bit) ) { - - /*---------------------------------------------*/ - /* Insert the session to the userSession table */ - /* */ - /* INSERT INTO userSession */ - /* VALUES (x,x,x) */ - /*---------------------------------------------*/ - strcpy(uh->insertSession.values.number, number); - uh->insertSession.values.serverId = server_id; - strcpy(uh->insertSession.values.details, session_details); - - rc = SQLExecute(uh->insertSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { -handle_error(uh->hdbc, uh->henv, uh->insertSession.stmt, rc, __FILE__, __LINE__); - printf("T4 Unable to execute insert session \n"); - return; - } - - /*----------------------------------------*/ - /* Update subscriber activeSessions field */ - /* */ - /* UPDATE subscriber */ - /* SET activeSessions=x */ - /* WHERE subscriberNumber=x */ - /*----------------------------------------*/ - strcpy(uh->updateSubscriberSession.values.number, number); - uh->updateSubscriberSession.values.activeSessions = - uh->readSubscriberSession.values.activeSessions | server_bit; - - rc = SQLExecute(uh->updateSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to execute update session \n"); - return; - } - - /*------------------------------------------*/ - /* Increment noOfInsert field in the server */ - /* */ - /* UPDATE server */ - /* SET noOfInsert=noOfInsert+1 */ - /* WHERE serverId=x,subscriberSuffix=x */ - /*------------------------------------------*/ - uh->updateServerNoOfInsert.values.serverId = server_id; - strcpy(uh->updateServerNoOfInsert.values.suffix, - &number[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH]); - - rc = SQLExecute(uh->updateServerNoOfInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to execute update no of read\n"); - return; - } - - *branch_executed = 1; - } - - if(do_rollback) - userDbRollback(uh); - else - userDbCommit(uh); -} - -void userTransaction_T5(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - unsigned int do_rollback, - unsigned int *branch_executed) -{ - SQLRETURN rc; - - if(!uh) return; - - *branch_executed = 0; - - /*--------------------------------------*/ - /* Read active sessions from subscriber */ - /*--------------------------------------*/ - if( readSubscriberSessions(uh, number, "T5") < 0 ) - return; - - /*-------------------------------------------------*/ - /* Read the 'delete' Permissions for the userGroup */ - /* */ - /* SELECT allowDelete */ - /* FROM USERGROUP */ - /* WHERE groupId=x */ - /*-------------------------------------------------*/ - uh->readGroupAllowDelete.values.groupId = uh->readSubscriberSession.values.groupId; - - rc = SQLExecute(uh->readGroupAllowDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute read group allow delete\n"); - return; - } - - rc = SQLFetch(uh->readGroupAllowDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to fetch read group allow delete\n"); - return; - } - - if( uh->readGroupAllowDelete.values.allowDelete & server_bit && - uh->readSubscriberSession.values.activeSessions & server_bit ) { - - /*-----------------------------------------------*/ - /* Delete the session from the userSession table */ - /* */ - /* DELETE FROM userSession */ - /* WHERE subscriberNumber=x,serverId=x */ - /*-----------------------------------------------*/ - strcpy(uh->deleteSession.values.number,number); - uh->deleteSession.values.serverId = server_id; - - rc = SQLExecute(uh->deleteSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute delete session\n"); - return; - } - - /*----------------------------------------*/ - /* Update subscriber activeSessions field */ - /* */ - /* UPDATE subscriber */ - /* SET activeSessions=x */ - /* WHERE subscriberNumber=x */ - /*----------------------------------------*/ - strcpy(uh->updateSubscriberSession.values.number, number); - uh->updateSubscriberSession.values.activeSessions = - uh->readSubscriberSession.values.activeSessions & ~server_bit; - - rc = SQLExecute(uh->updateSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute update subscriber session \n"); - return; - } - - /*------------------------------------------*/ - /* Increment noOfDelete field in the server */ - /* */ - /* UPDATE server */ - /* SET noOfDelete=noOfDelete+1 */ - /* WHERE serverId=x,subscriberSuffix=x */ - /*------------------------------------------*/ - uh->updateServerNoOfDelete.values.serverId = server_id; - strcpy(uh->updateServerNoOfDelete.values.suffix, - &number[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH]); - - rc = SQLExecute(uh->updateServerNoOfDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute update no of delete\n"); - return; - } - - *branch_executed = 1; - } - - if(do_rollback) - userDbRollback(uh); - else - userDbCommit(uh); -} - - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h deleted file mode 100644 index 9b6ac1ef161..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h +++ /dev/null @@ -1,50 +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; version 2 of the License. - - 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 USERHANDLE_H -#define USERHANDLE_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include -#include "testDefinitions.h" - -/*************************************************************** -* M A C R O S * -***************************************************************/ - -/***************************************************************/ -/* C O N S T A N T S */ -/***************************************************************/ - -/*************************************************************** -* D A T A S T R U C T U R E S * -***************************************************************/ - -typedef Ndb userHandle; - -/*************************************************************** -* P U B L I C F U N C T I O N S * -***************************************************************/ - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - -#endif /* USERHANDLE_H */ - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp deleted file mode 100644 index f20316ec52a..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp +++ /dev/null @@ -1,738 +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; version 2 of the License. - - 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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include -#ifndef NDB_WIN32 -#include -#endif - -#include "ndb_error.hpp" -#include "userHandle.h" -#include "userInterface.h" -#include -#include -#include -#include -#include "ndb_schema.hpp" -#include -#include - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - -extern int localDbPrepare(UserHandle *uh); - -static int dbCreate(UserHandle *uh); - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -/*************************************************************** -**************************************************************** -* P U B L I C F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -/*-----------------------------------*/ -/* Time related Functions */ -/* */ -/* Returns a double value in seconds */ -/*-----------------------------------*/ -double userGetTimeSync(void) -{ - static int initialized = 0; - static NDB_TICKS initSecs = 0; - static Uint32 initMicros = 0; - double timeValue = 0; - - if ( !initialized ) { - initialized = 1; - NdbTick_CurrentMicrosecond(&initSecs, &initMicros); - timeValue = 0.0; - } else { - NDB_TICKS secs = 0; - Uint32 micros = 0; - - NdbTick_CurrentMicrosecond(&secs, µs); - - double s = (double)secs - (double)initSecs; - double us = (double)secs - (double)initMicros; - - timeValue = s + (us / 1000000.0); - } - - return timeValue; -} - -// 0 - OK -// 1 - Retry transaction -// 2 - Permanent -int -userDbCommit(UserHandle *uh){ - if(uh->pCurrTrans != 0){ - int check = uh->pCurrTrans->execute( Commit ); - NdbError err = uh->pCurrTrans->getNdbError(); - uh->pNDB->closeTransaction(uh->pCurrTrans); - uh->pCurrTrans = 0; - - if(err.status != NdbError::Success) - ndbout << err << endl; - - if(err.status == NdbError::TemporaryError && - err.classification == NdbError::OverloadError){ - NdbSleep_SecSleep(3); - } - - return err.status; - } - return 2; -} - -/** - * TRUE - Normal table - * FALSE - Table w.o. checkpoing and logging - */ - -#ifdef __cplusplus -extern "C" { -#endif -extern int useTableLogging; -extern int useIndexTables; -#ifdef __cplusplus -} -#endif - - -int -create_table_server(Ndb * pNdb){ - int check; - NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); - if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); - - NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); - if( MySchemaOp == NULL ) - error_handler("getNdbSchemaOp", MySchemaTransaction->getNdbError(), 0); - - // Create table - check = MySchemaOp->createTable( SERVER_TABLE, - 8, // Table size - TupleKey, // Key Type - 1 // Nr of Pages - ,DistributionGroup, - 6, - 78, - 80, - 1, - useTableLogging - ); - if( check == -1 ) - error_handler("createTable", MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute - ( SERVER_SUBSCRIBER_SUFFIX, - TupleKey, - sizeof(char) << 3, - SUBSCRIBER_NUMBER_SUFFIX_LENGTH, - String, - MMBased, - NotNullAttribute, - NormalStorageAttribute, - 0, - 1, - 16); - if( check == -1 ) - error_handler("createAttribute (subscriber suffix)", - MySchemaTransaction->getNdbError(), 0); - - // Create first column, primary key - check = MySchemaOp->createAttribute( SERVER_ID, - TupleKey, - sizeof(ServerId) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (serverid)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( SERVER_NAME, - NoKey, - sizeof(char) << 3, - SERVER_NAME_LENGTH, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (server name)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( SERVER_READS, - NoKey, - sizeof(Counter) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (server reads)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SERVER_INSERTS, - NoKey, - sizeof(Counter) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (server inserts)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SERVER_DELETES, - NoKey, - sizeof(Counter) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (server deletes)", - MySchemaTransaction->getNdbError(), 0); - - if( MySchemaTransaction->execute() == -1 ) { - error_handler("schemaTransaction->execute()", - MySchemaTransaction->getNdbError(), 0); - } - NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); - return 0; -} - -int -create_table_group(Ndb * pNdb){ - int check; - - NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); - if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); - - NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); - if( MySchemaOp == NULL ) - error_handler("getNdbSchemaOp", MySchemaTransaction->getNdbError(), 0); - - // Create table - check = MySchemaOp->createTable( GROUP_TABLE, - 8, // Table size - TupleKey, // Key Type - 1 // Nr of Pages - ,All, - 6, - 78, - 80, - 1, - useTableLogging - ); - - if( check == -1 ) - error_handler("createTable", MySchemaTransaction->getNdbError(), 0); - - // Create first column, primary key - check = MySchemaOp->createAttribute( GROUP_ID, - TupleKey, - sizeof(GroupId) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (group id)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( GROUP_NAME, - NoKey, - sizeof(char) << 3, - GROUP_NAME_LENGTH, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (group name)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( GROUP_ALLOW_READ, - NoKey, - sizeof(Permission) << 3, - 1, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (group read)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( GROUP_ALLOW_INSERT, - NoKey, - sizeof(Permission) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (group insert)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( GROUP_ALLOW_DELETE, - NoKey, - sizeof(Permission) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (group delete)", - MySchemaTransaction->getNdbError(), 0); - - if( MySchemaTransaction->execute() == -1 ) { - error_handler("schemaTransaction->execute()", - MySchemaTransaction->getNdbError(), 0); - } - NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); - return 0; -} - -int -create_table_subscriber(Ndb * pNdb){ - int check; - NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); - if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); - - NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); - if( MySchemaOp == NULL ) - error_handler("getNdbSchemaOp", MySchemaTransaction->getNdbError(), 0); - - // Create table - check = MySchemaOp->createTable( SUBSCRIBER_TABLE, - 8, // Table size - TupleKey, // Key Type - 1 // Nr of Pages - ,DistributionGroup, - 6, - 78, - 80, - 1, - useTableLogging - ); - if( check == -1 ) - error_handler("createTable", MySchemaTransaction->getNdbError(), 0); - - // Create first column, primary key - check = MySchemaOp->createAttribute - ( SUBSCRIBER_NUMBER, - TupleKey, - sizeof(char) << 3, - SUBSCRIBER_NUMBER_LENGTH, - String, - MMBased, - NotNullAttribute, - (useIndexTables ? IndexStorageAttribute : NormalStorageAttribute), - 0, - 1, - 16); - if( check == -1 ) - error_handler("createAttribute (subscriber number)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SUBSCRIBER_NAME, - NoKey, - sizeof(char) << 3, - SUBSCRIBER_NAME_LENGTH, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (subscriber name)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( SUBSCRIBER_GROUP, - NoKey, - sizeof(GroupId) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (subscriber_group)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( SUBSCRIBER_LOCATION, - NoKey, - sizeof(Location) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (server reads)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SUBSCRIBER_SESSIONS, - NoKey, - sizeof(ActiveSessions) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (subscriber_sessions)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SUBSCRIBER_CHANGED_BY, - NoKey, - sizeof(char) << 3, - CHANGED_BY_LENGTH, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (subscriber_changed_by)", - MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SUBSCRIBER_CHANGED_TIME, - NoKey, - sizeof(char) << 3, - CHANGED_TIME_LENGTH, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (subscriber_changed_time)", - MySchemaTransaction->getNdbError(), 0); - - if( MySchemaTransaction->execute() == -1 ) { - error_handler("schemaTransaction->execute()", - MySchemaTransaction->getNdbError(), 0); - } - NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); - return 0; -} - -int -create_table_session(Ndb * pNdb){ - int check; - NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); - if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); - - NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); - if( MySchemaOp == NULL ) - error_handler("getNdbSchemaOp", - MySchemaTransaction->getNdbError(), 0); - - // Create table - check = MySchemaOp->createTable( SESSION_TABLE, - 8, // Table size - TupleKey, // Key Type - 1 // Nr of Pages - ,DistributionGroup, - 6, - 78, - 80, - 1, - useTableLogging - ); - if( check == -1 ) - error_handler("createTable", MySchemaTransaction->getNdbError(), 0); - - check = MySchemaOp->createAttribute( SESSION_SUBSCRIBER, - TupleKey, - sizeof(char) << 3, - SUBSCRIBER_NUMBER_LENGTH, - String, - MMBased, - NotNullAttribute, - NormalStorageAttribute, - 0, - 1, - 16); - if( check == -1 ) - error_handler("createAttribute (session_subscriber)", - MySchemaTransaction->getNdbError(), 0); - - // Create first column, primary key - check = MySchemaOp->createAttribute( SESSION_SERVER, - TupleKey, - sizeof(ServerId) << 3, - 1, - UnSigned, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (session_server)", - MySchemaTransaction->getNdbError(), 0); - - - check = MySchemaOp->createAttribute( SESSION_DATA, - NoKey, - sizeof(char) << 3, - SESSION_DETAILS_LENGTH, - String, - MMBased, - NotNullAttribute ); - if( check == -1 ) - error_handler("createAttribute (session_data)", - MySchemaTransaction->getNdbError(), 0); - - if( MySchemaTransaction->execute() == -1 ) { - error_handler("schemaTransaction->execute()", - MySchemaTransaction->getNdbError(), 0); - } - NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); - return 0; -} - -void -create_table(const char * name, int (* function)(Ndb * pNdb), Ndb* pNdb){ - printf("creating table %s...", name); - if(pNdb->getDictionary()->getTable(name) != 0){ - printf(" it already exists\n"); - return; - } else { - printf("\n"); - } - function(pNdb); - printf("creating table %s... done\n", name); -} - -static int dbCreate(Ndb * pNdb) -{ - create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNdb); - create_table(GROUP_TABLE , create_table_group, pNdb); - create_table(SESSION_TABLE , create_table_session, pNdb); - create_table(SERVER_TABLE , create_table_server, pNdb); - return 0; -} - -#ifndef NDB_WIN32 -#include -#endif - -static NdbMutex* startupMutex = NdbMutex_Create(); - -UserHandle* -userDbConnect(uint32 createDb, char *dbName) -{ - NdbMutex_Lock(startupMutex); - - Ndb * pNdb = new Ndb(""); - - //printf("Initializing...\n"); - pNdb->init(); - - //printf("Waiting..."); - while(pNdb->waitUntilReady() != 0){ - //printf("..."); - } - // printf("done\n"); - - if( createDb ) - dbCreate(pNdb); - - - UserHandle * uh = new UserHandle; - uh->pNDB = pNdb; - uh->pCurrTrans = 0; - - NdbMutex_Unlock(startupMutex); - - return uh; -} - -void userDbDisconnect(UserHandle *uh) -{ - delete uh; -} - -int userDbInsertServer(UserHandle *uh, - ServerId serverId, - SubscriberSuffix suffix, - ServerName name) -{ - int check; - - uint32 noOfRead = 0; - uint32 noOfInsert = 0; - uint32 noOfDelete = 0; - - NdbConnection * MyTransaction = 0; - if(uh->pCurrTrans != 0){ - MyTransaction = uh->pCurrTrans; - } else { - uh->pCurrTrans = MyTransaction = uh->pNDB->startTransaction(); - } - if (MyTransaction == NULL) - error_handler("startTranscation", uh->pNDB->getNdbError(), 0); - - NdbOperation *MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE); - CHECK_NULL(MyOperation, "getNdbOperation", MyTransaction); - - check = MyOperation->insertTuple(); - CHECK_MINUS_ONE(check, "insert tuple", MyTransaction); - - check = MyOperation->equal(SERVER_ID, (char*)&serverId); - CHECK_MINUS_ONE(check, "setValue id", MyTransaction); - - check = MyOperation->setValue(SERVER_SUBSCRIBER_SUFFIX, suffix); - CHECK_MINUS_ONE(check, "setValue suffix", MyTransaction); - - check = MyOperation->setValue(SERVER_NAME, name); - CHECK_MINUS_ONE(check, "setValue name", MyTransaction); - - check = MyOperation->setValue(SERVER_READS, (char*)&noOfRead); - CHECK_MINUS_ONE(check, "setValue reads", MyTransaction); - - check = MyOperation->setValue(SERVER_INSERTS, (char*)&noOfInsert); - CHECK_MINUS_ONE(check, "setValue inserts", MyTransaction); - - check = MyOperation->setValue(SERVER_DELETES, (char*)&noOfDelete); - CHECK_MINUS_ONE(check, "setValue deletes", MyTransaction); - - return 0; -} - -int userDbInsertSubscriber(UserHandle *uh, - SubscriberNumber number, - uint32 groupId, - SubscriberName name) -{ - int check; - uint32 activeSessions = 0; - Location l = 0; - ChangedBy changedBy; snprintf(changedBy, sizeof(changedBy), "ChangedBy"); - ChangedTime changedTime; snprintf(changedTime, sizeof(changedTime), "ChangedTime"); - - NdbConnection * MyTransaction = 0; - if(uh->pCurrTrans != 0){ - MyTransaction = uh->pCurrTrans; - } else { - uh->pCurrTrans = MyTransaction = uh->pNDB->startTransaction(); - } - if (MyTransaction == NULL) - error_handler("startTranscation", uh->pNDB->getNdbError(), 0); - - NdbOperation *MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE); - CHECK_NULL(MyOperation, "getNdbOperation", MyTransaction); - - check = MyOperation->insertTuple(); - CHECK_MINUS_ONE(check, "insertTuple", MyTransaction); - - check = MyOperation->equal(SUBSCRIBER_NUMBER, number); - CHECK_MINUS_ONE(check, "equal", MyTransaction); - - check = MyOperation->setValue(SUBSCRIBER_NAME, name); - CHECK_MINUS_ONE(check, "setValue name", MyTransaction); - - check = MyOperation->setValue(SUBSCRIBER_GROUP, (char*)&groupId); - CHECK_MINUS_ONE(check, "setValue group", MyTransaction); - - check = MyOperation->setValue(SUBSCRIBER_LOCATION, (char*)&l); - CHECK_MINUS_ONE(check, "setValue location", MyTransaction); - - check = MyOperation->setValue(SUBSCRIBER_SESSIONS, (char*)&activeSessions); - CHECK_MINUS_ONE(check, "setValue sessions", MyTransaction); - - check = MyOperation->setValue(SUBSCRIBER_CHANGED_BY, changedBy); - CHECK_MINUS_ONE(check, "setValue changedBy", MyTransaction); - - check = MyOperation->setValue(SUBSCRIBER_CHANGED_TIME, changedTime); - CHECK_MINUS_ONE(check, "setValue changedTime", MyTransaction); - - return 0; -} - -int userDbInsertGroup(UserHandle *uh, - GroupId groupId, - GroupName name, - Permission allowRead, - Permission allowInsert, - Permission allowDelete) -{ - int check; - - NdbConnection * MyTransaction = 0; - if(uh->pCurrTrans != 0){ - MyTransaction = uh->pCurrTrans; - } else { - uh->pCurrTrans = MyTransaction = uh->pNDB->startTransaction(); - } - if (MyTransaction == NULL) - error_handler("startTranscation", uh->pNDB->getNdbError(), 0); - - NdbOperation *MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE); - CHECK_NULL(MyOperation, "getNdbOperation", MyTransaction); - - check = MyOperation->insertTuple(); - CHECK_MINUS_ONE(check, "insertTuple", MyTransaction); - - check = MyOperation->equal(GROUP_ID, (char*)&groupId); - CHECK_MINUS_ONE(check, "equal", MyTransaction); - - check = MyOperation->setValue(GROUP_NAME, name); - CHECK_MINUS_ONE(check, "setValue name", MyTransaction); - - check = MyOperation->setValue(GROUP_ALLOW_READ, (char*)&allowRead); - CHECK_MINUS_ONE(check, "setValue allowRead", MyTransaction); - - check = MyOperation->setValue(GROUP_ALLOW_INSERT, (char*)&allowInsert); - CHECK_MINUS_ONE(check, "setValue allowInsert", MyTransaction); - - check = MyOperation->setValue(GROUP_ALLOW_DELETE, (char*)&allowDelete); - CHECK_MINUS_ONE(check, "setValue allowDelete", MyTransaction); - - return 0; -} - diff --git a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c deleted file mode 100644 index bdc60912482..00000000000 --- a/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c +++ /dev/null @@ -1,472 +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; version 2 of the License. - - 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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include -#include - -#include "sql.h" -#include "sqlext.h" - - -#include "userInterface.h" -#include "userHandle.h" - -/*************************************************************** -* L O C A L C O N S T A N T S * -***************************************************************/ - -/*************************************************************** -* L O C A L D A T A S T R U C T U R E S * -***************************************************************/ - -/*************************************************************** -* L O C A L F U N C T I O N S * -***************************************************************/ - -static int readSubscriberSessions(UserHandle *uh, - SubscriberNumber number, - char *transactionType); - -/*************************************************************** -* L O C A L D A T A * -***************************************************************/ - -extern void handle_error(SQLHDBC hdbc, - SQLHENV henv, - SQLHSTMT hstmt, - SQLRETURN rc, - char *filename, - int lineno); - -/*************************************************************** -* P U B L I C D A T A * -***************************************************************/ - - -/*************************************************************** -**************************************************************** -* L O C A L F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -static int readSubscriberSessions(UserHandle *uh, - SubscriberNumber number, - char *transactionType) -{ - SQLRETURN rc; - - /*-----------------------------------------------------*/ - /* SELECT activeSessions,groupId,changedBy,changedTime */ - /* FROM SUBSCRIBER */ - /* WHERE subscriberNumber=x; */ - /*-----------------------------------------------------*/ - strcpy(uh->readSubscriberSession.values.number,number); - - rc = SQLExecute(uh->readSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("%s %s\n", - transactionType, - "Unable to execute read subscriber session"); - return(-1); - } - - rc = SQLFetch(uh->readSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("%s %s\n", - transactionType, - "Unable to fetch read subscriber session"); - return(-1); - } - - return(0); -} - -/*************************************************************** -**************************************************************** -* P U B L I C F U N C T I O N S C O D E S E C T I O N * -**************************************************************** -***************************************************************/ - -void userTransaction_T1(UserHandle *uh, - SubscriberNumber number, - Location new_location, - ChangedBy changed_by, - ChangedTime changed_time) -{ - SQLRETURN rc; - - if(!uh) return; - - /*---------------------------------------------*/ - /* Update the subscriber information */ - /* */ - /* UPDATE SUBSCRIBER */ - /* SET location=x, changedBy=x, changedTime=x */ - /* WHERE subscriberNumber=x; */ - /*---------------------------------------------*/ - strcpy(uh->updateSubscriber.values.number, number); - uh->updateSubscriber.values.location = new_location; - strcpy(uh->updateSubscriber.values.changedBy, changed_by); - strcpy(uh->updateSubscriber.values.changedTime, changed_time); - - rc = SQLExecute(uh->updateSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T1 Unable to execute update subscriber\n"); - return; - } - - userDbCommit(uh); -} - -void userTransaction_T2(UserHandle *uh, - SubscriberNumber number, - Location *new_location, - ChangedBy changed_by, - ChangedTime changed_time, - SubscriberName subscriberName) -{ - SQLRETURN rc; - - if(!uh) return; - - /*------------------------------------------------------*/ - /* Read the information from the subscriber table */ - /* */ - /* SELECT location,subscriberName,changedBy,changedTime */ - /* FROM SUBSCRIBER */ - /* WHERE subscriberNumber=x; */ - /*------------------------------------------------------*/ - strcpy(uh->readSubscriber.values.number,number); - - rc = SQLExecute(uh->readSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T2 Unable to execute read subscriber\n"); - return; - } - - rc = SQLFetch(uh->readSubscriber.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T2 Unable to fetch read subscriber\n"); - return; - } - - userDbCommit(uh); - - strcpy(subscriberName, uh->readSubscriber.values.name); - *new_location = uh->readSubscriber.values.location; - strcpy(changed_by, uh->readSubscriber.values.changedBy); - strcpy(changed_time, uh->readSubscriber.values.changedTime); -} - -void userTransaction_T3(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - SessionDetails session_details, - unsigned int *branch_executed) -{ - SQLRETURN rc; - - if(!uh) return; - - *branch_executed = 0; - - /*--------------------------------------*/ - /* Read active sessions from subscriber */ - /*--------------------------------------*/ - if( readSubscriberSessions(uh, number, "T3") < 0 ) - return; - - /*-----------------------------------------------*/ - /* Read the 'read' Permissions for the userGroup */ - /* */ - /* SELECT allowRead */ - /* FROM USERGROUP */ - /* WHERE groupId=x */ - /*-----------------------------------------------*/ - uh->readGroupAllowRead.values.groupId = uh->readSubscriberSession.values.groupId; - - rc = SQLExecute(uh->readGroupAllowRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to execute read group allow read\n"); - return; - } - - rc = SQLFetch(uh->readGroupAllowRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to fetch read group allow read\n"); - return; - } - - if( uh->readGroupAllowRead.values.allowRead & server_bit && - uh->readSubscriberSession.values.activeSessions & server_bit ) { - - /*----------------------------------------------------*/ - /* Read the sessionDetails from the userSession table */ - /* */ - /* SELECT sessionData */ - /* FROM userSession */ - /* WHERE subscriberNumber=x, serverId=x */ - /*----------------------------------------------------*/ - strcpy(uh->readSessionDetails.values.number,number); - uh->readSessionDetails.values.serverId = server_id; - - rc = SQLExecute(uh->readSessionDetails.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to execute read session details\n"); - return; - } - - rc = SQLFetch(uh->readSessionDetails.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to fetch read session details\n"); - return; - } - - strcpy(session_details, uh->readSessionDetails.values.details); - - /*----------------------------------------*/ - /* Increment noOfRead field in the server */ - /* */ - /* UPDATE server */ - /* SET noOfRead=noOfRead+1 */ - /* WHERE serverId=x,subscriberSuffix=x */ - /*----------------------------------------*/ - uh->updateServerNoOfRead.values.serverId = server_id; - strcpy(uh->updateServerNoOfRead.values.suffix, - &number[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH]); - - rc = SQLExecute(uh->updateServerNoOfRead.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T3 Unable to execute read no of read\n"); - return; - } - - *branch_executed = 1; - } - - userDbCommit(uh); -} - -void userTransaction_T4(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - SessionDetails session_details, - unsigned int do_rollback, - unsigned int *branch_executed) -{ - SQLRETURN rc; - - if(!uh) return; - - *branch_executed = 0; - - /*--------------------------------------*/ - /* Read active sessions from subscriber */ - /*--------------------------------------*/ - if( readSubscriberSessions(uh, number, "T4") < 0 ) - return; - - /*-------------------------------------------------*/ - /* Read the 'insert' Permissions for the userGroup */ - /* */ - /* SELECT allowInsert */ - /* FROM USERGROUP */ - /* WHERE groupId=x */ - /*-------------------------------------------------*/ - uh->readGroupAllowInsert.values.groupId = uh->readSubscriberSession.values.groupId; - - rc = SQLExecute(uh->readGroupAllowInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to execute read group allow insert\n"); - return; - } - - rc = SQLFetch(uh->readGroupAllowInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to fetch read group allow insert\n"); - return; - } - - if( uh->readGroupAllowInsert.values.allowInsert & server_bit && - !(uh->readSubscriberSession.values.activeSessions & server_bit) ) { - - /*---------------------------------------------*/ - /* Insert the session to the userSession table */ - /* */ - /* INSERT INTO userSession */ - /* VALUES (x,x,x) */ - /*---------------------------------------------*/ - strcpy(uh->insertSession.values.number, number); - uh->insertSession.values.serverId = server_id; - strcpy(uh->insertSession.values.details, session_details); - - rc = SQLExecute(uh->insertSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { -handle_error(uh->hdbc, uh->henv, uh->insertSession.stmt, rc, __FILE__, __LINE__); - printf("T4 Unable to execute insert session \n"); - return; - } - - /*----------------------------------------*/ - /* Update subscriber activeSessions field */ - /* */ - /* UPDATE subscriber */ - /* SET activeSessions=x */ - /* WHERE subscriberNumber=x */ - /*----------------------------------------*/ - strcpy(uh->updateSubscriberSession.values.number, number); - uh->updateSubscriberSession.values.activeSessions = - uh->readSubscriberSession.values.activeSessions | server_bit; - - rc = SQLExecute(uh->updateSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to execute update session \n"); - return; - } - - /*------------------------------------------*/ - /* Increment noOfInsert field in the server */ - /* */ - /* UPDATE server */ - /* SET noOfInsert=noOfInsert+1 */ - /* WHERE serverId=x,subscriberSuffix=x */ - /*------------------------------------------*/ - uh->updateServerNoOfInsert.values.serverId = server_id; - strcpy(uh->updateServerNoOfInsert.values.suffix, - &number[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH]); - - rc = SQLExecute(uh->updateServerNoOfInsert.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T4 Unable to execute update no of read\n"); - return; - } - - *branch_executed = 1; - } - - if(do_rollback) - userDbRollback(uh); - else - userDbCommit(uh); -} - -void userTransaction_T5(UserHandle *uh, - SubscriberNumber number, - ServerId server_id, - ServerBit server_bit, - unsigned int do_rollback, - unsigned int *branch_executed) -{ - SQLRETURN rc; - - if(!uh) return; - - *branch_executed = 0; - - /*--------------------------------------*/ - /* Read active sessions from subscriber */ - /*--------------------------------------*/ - if( readSubscriberSessions(uh, number, "T5") < 0 ) - return; - - /*-------------------------------------------------*/ - /* Read the 'delete' Permissions for the userGroup */ - /* */ - /* SELECT allowDelete */ - /* FROM USERGROUP */ - /* WHERE groupId=x */ - /*-------------------------------------------------*/ - uh->readGroupAllowDelete.values.groupId = uh->readSubscriberSession.values.groupId; - - rc = SQLExecute(uh->readGroupAllowDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute read group allow delete\n"); - return; - } - - rc = SQLFetch(uh->readGroupAllowDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to fetch read group allow delete\n"); - return; - } - - if( uh->readGroupAllowDelete.values.allowDelete & server_bit && - uh->readSubscriberSession.values.activeSessions & server_bit ) { - - /*-----------------------------------------------*/ - /* Delete the session from the userSession table */ - /* */ - /* DELETE FROM userSession */ - /* WHERE subscriberNumber=x,serverId=x */ - /*-----------------------------------------------*/ - strcpy(uh->deleteSession.values.number,number); - uh->deleteSession.values.serverId = server_id; - - rc = SQLExecute(uh->deleteSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute delete session\n"); - return; - } - - /*----------------------------------------*/ - /* Update subscriber activeSessions field */ - /* */ - /* UPDATE subscriber */ - /* SET activeSessions=x */ - /* WHERE subscriberNumber=x */ - /*----------------------------------------*/ - strcpy(uh->updateSubscriberSession.values.number, number); - uh->updateSubscriberSession.values.activeSessions = - uh->readSubscriberSession.values.activeSessions & ~server_bit; - - rc = SQLExecute(uh->updateSubscriberSession.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute update subscriber session \n"); - return; - } - - /*------------------------------------------*/ - /* Increment noOfDelete field in the server */ - /* */ - /* UPDATE server */ - /* SET noOfDelete=noOfDelete+1 */ - /* WHERE serverId=x,subscriberSuffix=x */ - /*------------------------------------------*/ - uh->updateServerNoOfDelete.values.serverId = server_id; - strcpy(uh->updateServerNoOfDelete.values.suffix, - &number[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH]); - - rc = SQLExecute(uh->updateServerNoOfDelete.stmt); - if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - printf("T5 Unable to execute update no of delete\n"); - return; - } - - *branch_executed = 1; - } - - if(do_rollback) - userDbRollback(uh); - else - userDbCommit(uh); -} - - diff --git a/ndb/test/ndbapi/old_dirs/restarter/Makefile b/ndb/test/ndbapi/old_dirs/restarter/Makefile deleted file mode 100644 index 041fbfd82ba..00000000000 --- a/ndb/test/ndbapi/old_dirs/restarter/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := restarter - -# Source files of non-templated classes (.C files) -SOURCES = restarter.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/restarter2/Makefile b/ndb/test/ndbapi/old_dirs/restarter2/Makefile deleted file mode 100644 index ba33a2e21dc..00000000000 --- a/ndb/test/ndbapi/old_dirs/restarter2/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := restarter2 - -# Source files of non-templated classes (.C files) -SOURCES = restarter2.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/restarts/Makefile b/ndb/test/ndbapi/old_dirs/restarts/Makefile deleted file mode 100644 index 9f14b81fae5..00000000000 --- a/ndb/test/ndbapi/old_dirs/restarts/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := restarts - -# Source files of non-templated classes (.C files) -SOURCES = restarts.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/ronja/Makefile b/ndb/test/ndbapi/old_dirs/ronja/Makefile deleted file mode 100644 index a11a27c5fd7..00000000000 --- a/ndb/test/ndbapi/old_dirs/ronja/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include .defs.mk - -DIRS = initronja \ - benchronja - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile b/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile deleted file mode 100644 index f0521c3ba77..00000000000 --- a/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - - -BIN_TARGET := benchronja - -SOURCES := benchronja.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile b/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile deleted file mode 100644 index dd66dd813d1..00000000000 --- a/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := initronja - -SOURCES := initronja.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/telco/Makefile b/ndb/test/ndbapi/old_dirs/telco/Makefile deleted file mode 100644 index 8f82c714119..00000000000 --- a/ndb/test/ndbapi/old_dirs/telco/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := telco - -# Source files of non-templated classes (.C files) -SOURCES = msa.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/telco/readme b/ndb/test/ndbapi/old_dirs/telco/readme deleted file mode 100644 index 627b4256eef..00000000000 --- a/ndb/test/ndbapi/old_dirs/telco/readme +++ /dev/null @@ -1,9 +0,0 @@ - -adoInsertRecs.cpp - the original evaluation program - -InsertRecs.cpp - replaced ado with ndb api, still windows only - -msa.cpp - removed windows and exceptions, portable - - - diff --git a/ndb/test/ndbapi/old_dirs/testBackup/Makefile b/ndb/test/ndbapi/old_dirs/testBackup/Makefile deleted file mode 100644 index abf47dcfb2d..00000000000 --- a/ndb/test/ndbapi/old_dirs/testBackup/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testBackup -SOURCES = testBackup.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testBasic/Makefile b/ndb/test/ndbapi/old_dirs/testBasic/Makefile deleted file mode 100644 index 755b19939cb..00000000000 --- a/ndb/test/ndbapi/old_dirs/testBasic/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := testBasic - -SOURCES := testBasic.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testBlobs/Makefile b/ndb/test/ndbapi/old_dirs/testBlobs/Makefile deleted file mode 100644 index cc5bb629c17..00000000000 --- a/ndb/test/ndbapi/old_dirs/testBlobs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testBlobs - -SOURCES = testBlobs.cpp - -include $(NDB_TOP)/Epilogue.mk - -CCFLAGS_LOC += -I$(NDB_TOP)/include/kernel diff --git a/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile b/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile deleted file mode 100644 index 181fbc829d4..00000000000 --- a/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testDataBuffers - -SOURCES = testDataBuffers.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testDict/Makefile b/ndb/test/ndbapi/old_dirs/testDict/Makefile deleted file mode 100644 index 75d493c3424..00000000000 --- a/ndb/test/ndbapi/old_dirs/testDict/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testDict - -SOURCES = testDict.cpp - -CFLAGS_testDict.cpp := -I$(call fixpath,$(NDB_TOP)/include/kernel) - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testGrep/Makefile b/ndb/test/ndbapi/old_dirs/testGrep/Makefile deleted file mode 100644 index 6bad3d56a00..00000000000 --- a/ndb/test/ndbapi/old_dirs/testGrep/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest -DIRS = verify -BIN_TARGET = testGrep -SOURCES = testGrep.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile b/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile deleted file mode 100644 index 256e3c98f36..00000000000 --- a/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testGrepVerify -SOURCES = testGrepVerify.cpp - -CFLAGS_testGrepVerify.cpp += -I$(call fixpath,$(NDB_TOP)/include/kernel) -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testIndex/Makefile b/ndb/test/ndbapi/old_dirs/testIndex/Makefile deleted file mode 100644 index e5cd4542c9c..00000000000 --- a/ndb/test/ndbapi/old_dirs/testIndex/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testIndex - -SOURCES = testIndex.cpp - -CFLAGS_testIndex.cpp := -I$(call fixpath,$(NDB_TOP)/include/kernel) - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile b/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile deleted file mode 100644 index e84287a1b16..00000000000 --- a/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testInterpreter - -SOURCES = testInterpreter.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testMgm/Makefile b/ndb/test/ndbapi/old_dirs/testMgm/Makefile deleted file mode 100644 index be50d3dae7e..00000000000 --- a/ndb/test/ndbapi/old_dirs/testMgm/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testMgm - -SOURCES = testMgm.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile b/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile deleted file mode 100644 index 3bb3cba427e..00000000000 --- a/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testNdbApi - -SOURCES = testNdbApi.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile b/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile deleted file mode 100644 index 8c13ab3beb4..00000000000 --- a/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testNodeRestart - -SOURCES = testNodeRestart.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile b/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile deleted file mode 100644 index 1bbbcf1d17e..00000000000 --- a/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testOIBasic - -SOURCES = testOIBasic.cpp - -ifeq ($(NDB_COMPILER),GCC) -CCFLAGS_WARNINGS += -Wno-unused -Wformat -endif - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt b/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt deleted file mode 100644 index 641e9ddb4bf..00000000000 --- a/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt +++ /dev/null @@ -1,8 +0,0 @@ -one db-node -testOIBasic -case t -table 1 -index 1 -fragtype small -threads 10 -rows 5000 -subloop 1 ------------------------------------------------------------- -040331 -build index - 5769 ms per 50000 ( 115 ms per 1000 ) -update - 5962 ms per 50000 ( 119 ms per 1000 ) -update indexed - 14851 ms per 50000 ( 297 ms per 1000 ) -overhead - 149 pct diff --git a/ndb/test/ndbapi/old_dirs/testOperations/Makefile b/ndb/test/ndbapi/old_dirs/testOperations/Makefile deleted file mode 100644 index 25546ade639..00000000000 --- a/ndb/test/ndbapi/old_dirs/testOperations/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := testOperations - -SOURCES := testOperations.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile b/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile deleted file mode 100644 index d8899a37895..00000000000 --- a/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testOrderedIndex - -SOURCES = testOrderedIndex.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile b/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile deleted file mode 100644 index 24f449b747d..00000000000 --- a/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := testRestartGci - -SOURCES := testRestartGci.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testScan/Makefile b/ndb/test/ndbapi/old_dirs/testScan/Makefile deleted file mode 100644 index fe48f5bc926..00000000000 --- a/ndb/test/ndbapi/old_dirs/testScan/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testScan - -SOURCES = testScan.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile b/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile deleted file mode 100644 index c7d96494148..00000000000 --- a/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testScanInterpreter - -SOURCES = testScanInterpreter.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile b/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile deleted file mode 100644 index 7a306eb313d..00000000000 --- a/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testSystemRestart - -SOURCES = testSystemRestart.cpp - -CFLAGS_testSystemRestart.cpp := -I$(call fixpath,$(NDB_TOP)/include/kernel) - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testTimeout/Makefile b/ndb/test/ndbapi/old_dirs/testTimeout/Makefile deleted file mode 100644 index 01a9df9887f..00000000000 --- a/ndb/test/ndbapi/old_dirs/testTimeout/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = testTimeout - -SOURCES = testTimeout.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/testTransactions/Makefile b/ndb/test/ndbapi/old_dirs/testTransactions/Makefile deleted file mode 100644 index 0279a526923..00000000000 --- a/ndb/test/ndbapi/old_dirs/testTransactions/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := testTransactions - -SOURCES := testTransactions.cpp -CFLAGS_testTransactions.cpp := -I$(call fixpath,$(NDB_TOP)/include/kernel) - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/test_event/Makefile b/ndb/test/ndbapi/old_dirs/test_event/Makefile deleted file mode 100644 index 6299fa47845..00000000000 --- a/ndb/test/ndbapi/old_dirs/test_event/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := test_event - -SOURCES := test_event.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/vw_test/Makefile b/ndb/test/ndbapi/old_dirs/vw_test/Makefile deleted file mode 100644 index 144873dcc69..00000000000 --- a/ndb/test/ndbapi/old_dirs/vw_test/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := vw_test -BIN_TARGET_LIBS := orafunctr decode cirk inifunc -BIN_TARGET_LIBS_DIRS := /home/ndb/junk/vw/ndb/lib - -SOURCES := cdrserver.C - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/ndbapi/old_dirs/vw_test/bcd.h b/ndb/test/ndbapi/old_dirs/vw_test/bcd.h deleted file mode 100644 index 9e42355d30f..00000000000 --- a/ndb/test/ndbapi/old_dirs/vw_test/bcd.h +++ /dev/null @@ -1,25 +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; version 2 of the License. - - 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 - -struct bcdtab { - char tab[3]; -}; - -int dec2hex(int dec,int last); -int bcd_code (char *bcd_in,char *bcd_out); -int bcd_decode (int bcd_len,char *bcd_in,char *bcd_out); -int bcd_decode2 (int bcd_len,char *bcd_in,char *bcd_out); diff --git a/ndb/test/ndbapi/old_dirs/vw_test/script/client_start b/ndb/test/ndbapi/old_dirs/vw_test/script/client_start deleted file mode 100644 index 2965be6fbb5..00000000000 --- a/ndb/test/ndbapi/old_dirs/vw_test/script/client_start +++ /dev/null @@ -1,10 +0,0 @@ -# Argument to the client program is: -# 1. ip-adress to the server -# 2. location to the raw cdr-file -# 3. nanoseconds (0-1000) between writing the buffer to the port -# 4. how many writes to the buffer before the sleep command should accur -# Argument 3 and 4 controlls the flow of the raw cdr-file to the cdrserver - -cd $VCDRPATH/bin -# ./client stat181.xxx.com /ext06/data/indata_fraud1/port2file.data.-2089540139 1000 0 & -./client xxx.xxx.xxx.xxx.xxx /export2/home/ndb/vw/data/port2file_data_-2089540139 0 100000 & diff --git a/ndb/test/ndbapi/old_dirs/vw_test/utv.h b/ndb/test/ndbapi/old_dirs/vw_test/utv.h deleted file mode 100644 index 7dfbf29b467..00000000000 --- a/ndb/test/ndbapi/old_dirs/vw_test/utv.h +++ /dev/null @@ -1,160 +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; version 2 of the License. - - 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 -#include -#include - -#define TESTLEV - -#define ASubscriberNumber_SIZE 16 -#define BSubscriberNumber_SIZE 29 -#define TRUE 1 -#define FALSE 0 -#define WRITE_LIMIT 100000 -#define EVER ;; -#define CONNINFO "/" -#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) - -#define BIT_1 0x1 -#define BIT_2 0x2 -#define BIT_3 0x4 -#define BIT_4 0x8 -#define BIT_5 0x10 -#define BIT_6 0x20 -#define BIT_7 0x40 -#define BIT_8 0x80 - -/*------------------------------------------------------*/ -/* record defines structure over an alarm thresholds */ -/* CallAttemptState Beskriver status på samtal */ -/* 0 - Subscriber is calling */ -/* 1 - Called part answer call */ -/* 2 - Release of call */ -/* 3-255 reserved for furter use */ -/* USED_FILEDS Indicates active fields within call */ -/* bit 1 - START_TIME */ -/* 2 - TimeForStartOfCharge */ -/* 3 - TimeForStopOfCharge */ -/* 4 - ReroutingIndicator */ -/* 5 - RINParameter */ -/* 6 - ACategory */ -/* 7 - EndOfSelectionInformation */ -/* 8 - UserToUserIndicatior */ -/* 9 - UserToUserInformation */ -/* 10 - CauseCode */ -/* 11 - ASubscriberNumber */ -/* 12 - BSubscriberNumber */ -/* 13 - RedirectingNumber */ -/* 14 - OriginalCalledNumber */ -/* 15 - LocationCode */ -/* 16 - OriginatingPointCode */ -/* 17 - DestinationPointCode */ -/* 18 - CircuitIdentificationCode */ -/* 19 - NetworkIndicator */ -/*------------------------------------------------------*/ - -struct cdr_record -{ - unsigned int USED_FIELDS; - unsigned long ClientId; - unsigned int CallIdentificationNumber; - unsigned int START_TIME; - unsigned int OurSTART_TIME; - unsigned int TimeForStartOfCharge; - unsigned int TimeForStopOfCharge; - time_t OurTimeForStartOfCharge; - time_t OurTimeForStopOfCharge; - unsigned short DestinationPointCode; - unsigned short CircuitIdentificationCode; - unsigned short OriginatingPointCode; - unsigned short ReroutingIndicator; - unsigned short RINParameter; - char NetworkIndicator; - char CallAttemptState; - char ACategory; - char EndOfSelectionInformation; - char UserToUserInformation; - char UserToUserIndicatior; - char CauseCode; - char ASubscriberNumber[ASubscriberNumber_SIZE]; - char ASubscriberNumberLength; - char TonASubscriberNumber; - char BSubscriberNumber[BSubscriberNumber_SIZE]; - char BSubscriberNumberLength; - char TonBSubscriberNumber; - char RedirectingNumber[16]; - char TonRedirectingNumber; - char OriginalCalledNumber[16]; - char TonOriginalCalledNumber; - char LocationCode[16]; - char TonLocationCode; -}; - -/*------------------------------------------------------*/ -/* Define switches for each tag */ -/*------------------------------------------------------*/ - -#define B_START_TIME 0x1 -#define B_TimeForStartOfCharge 0x2 -#define B_TimeForStopOfCharge 0x4 -#define B_ReroutingIndicator 0x8 -#define B_RINParameter 0x10 -#define B_ACategory 0x20 -#define B_EndOfSelectionInformation 0x40 -#define B_UserToUserIndicatior 0x80 -#define B_UserToUserInformation 0x100 -#define B_CauseCode 0x200 -#define B_ASubscriberNumber 0x400 -#define B_BSubscriberNumber 0x800 -#define B_RedirectingNumber 0x1000 -#define B_OriginalCalledNumber 0x2000 -#define B_LocationCode 0x4000 -#define B_OriginatingPointCode 0x8000 -#define B_DestinationPointCode 0x10000 -#define B_CircuitIdentificationCode 0x20000 - -#define B_NetworkIndicator 0x40000 -#define B_TonASubscriberNumber 0x80000 -#define B_TonBSubscriberNumber 0x100000 -#define B_TonRedirectingNumber 0x200000 -#define B_TonOriginalCalledNumber 0x4000000 -#define B_TonLocationCode 0x8000000 - -#define K_START_TIME 0xFF01 -#define K_TimeForStartOfCharge 0xFF02 -#define K_TimeForStopOfCharge 0xFF03 -#define K_ReroutingIndicator 0x13 -#define K_RINParameter 0xFC -#define K_ACategory 0x09 -#define K_EndOfSelectionInformation 0x11 -#define K_UserToUserIndicatior 0x2A -#define K_UserToUserInformation 0x20 -#define K_CauseCode 0x12 -#define K_ASubscriberNumber 0x0A -#define K_BSubscriberNumber 0x04 -#define K_RedirectingNumber 0x0B -#define K_OriginalCalledNumber 0x28 -#define K_LocationCode 0x3F -#define K_OriginatingPointCode 0xFD -#define K_DestinationPointCode 0xFE -#define K_CircuitIdentificationCode 0xFF - -#define K_NetworkIndicator 0xF0 -#define K_TonASubscriberNumber 0xF1 -#define K_TonBSubscriberNumber 0xF2 -#define K_TonRedirectingNumber 0xF3 -#define K_TonOriginalCalledNumber 0xF4 -#define K_TonLocationCode 0xF5 diff --git a/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h b/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h deleted file mode 100644 index 156cd4d3c3d..00000000000 --- a/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h +++ /dev/null @@ -1,54 +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; version 2 of the License. - - 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 */ - -/********************************************************/ -/* Common functions */ -/* unix_ps checks if a process is running with a */ -/* name and pid rc 0=not running */ -/* 1=Running */ -/* logname create a log filename */ -/* Parm */ -/* 1 lvl1 name */ -/* 2 lvl2 name */ -/* 3 lvl3 name */ -/* m2log Skriv log rader som moder */ -/* Parm */ -/* 1 pointer to filehandler */ -/* 2 Log text max 600 tecken */ -/* c2log Skriv log rader som barn */ -/* Parm */ -/* 1 pointer to filehandler */ -/* 2 Log text max 600 tecken */ -/* n2log Skriv log rader utan relation */ -/* Parm */ -/* 1 pointer to filehandler */ -/* 2 Log text max 600 tecken */ -/********************************************************/ - -int n2log(FILE *fi,char *text); -int m2log(FILE *fi,char *text); -int c2log(FILE *fi,char *text); -int checkchangelog(FILE* fp,char *filename); -void logname(char *filename, char *lvl1, char *lvl2, char *lvl3); -void logname_unique_day(char *filename, char *lvl1, char *lvl2, char *lvl3); -int unix_ps(char *proc_name,char *pid); -/* -int unix_ps2(char *proc_name,char *pid); -*/ -int unix_ps3(char *proc_name); -int replacetoken(const char* instring,char token,char replace); -int CompAsciiNum(char *, char *); -int CompareIt(char *,char *); -int CompCdrNum(const void *,const void *,void *); diff --git a/ndb/test/ndbapi/slow_select.cpp b/ndb/test/ndbapi/slow_select.cpp index 8d615fa5771..21e3ce7400c 100644 --- a/ndb/test/ndbapi/slow_select.cpp +++ b/ndb/test/ndbapi/slow_select.cpp @@ -1,3 +1,17 @@ +/* Copyright (C) 2004, 2005 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; version 2 of the License. + + 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 #include diff --git a/ndb/test/ndbapi/testBitfield.cpp b/ndb/test/ndbapi/testBitfield.cpp index 40a7a9d4557..ee22634586b 100644 --- a/ndb/test/ndbapi/testBitfield.cpp +++ b/ndb/test/ndbapi/testBitfield.cpp @@ -1,3 +1,17 @@ +/* Copyright (C) 2004, 2008 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; version 2 of the License. + + 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 #include diff --git a/ndb/test/ndbapi/testLcp.cpp b/ndb/test/ndbapi/testLcp.cpp index 8bfc7ccf9b9..a3e38e975eb 100644 --- a/ndb/test/ndbapi/testLcp.cpp +++ b/ndb/test/ndbapi/testLcp.cpp @@ -1,3 +1,17 @@ +/* Copyright (C) 2004, 2005 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; version 2 of the License. + + 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 #include diff --git a/ndb/test/ndbnet/test.run b/ndb/test/ndbnet/test.run index 30042488c92..195a657aeb5 100644 --- a/ndb/test/ndbnet/test.run +++ b/ndb/test/ndbnet/test.run @@ -1,3 +1,18 @@ +# Copyright (C) 2004 MySQL AB # +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA system("printenv|sort"); diff --git a/ndb/test/ndbnet/testError.run b/ndb/test/ndbnet/testError.run index 3cce489a3da..6ace2cbbd20 100644 --- a/ndb/test/ndbnet/testError.run +++ b/ndb/test/ndbnet/testError.run @@ -1,3 +1,20 @@ +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # # file : test/ndbnet/testError.run # usage: perl testError.run diff --git a/ndb/test/ndbnet/testMNF.run b/ndb/test/ndbnet/testMNF.run index df226cd3359..2903313f306 100644 --- a/ndb/test/ndbnet/testMNF.run +++ b/ndb/test/ndbnet/testMNF.run @@ -1,3 +1,20 @@ +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # # file : test/ndbnet/testError.run # usage: perl testError.run diff --git a/ndb/test/ndbnet/testNR.run b/ndb/test/ndbnet/testNR.run index 01a3d76266d..5019f597b42 100644 --- a/ndb/test/ndbnet/testNR.run +++ b/ndb/test/ndbnet/testNR.run @@ -1,4 +1,19 @@ +# Copyright (C) 2004 MySQL AB # +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA use strict; use NDB::Run; diff --git a/ndb/test/ndbnet/testNR1.run b/ndb/test/ndbnet/testNR1.run index 8819a92c8ca..a02b487b663 100644 --- a/ndb/test/ndbnet/testNR1.run +++ b/ndb/test/ndbnet/testNR1.run @@ -1,3 +1,20 @@ +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # Node recovery killing 1 node out of 4 at the time and waiting for recover use strict; diff --git a/ndb/test/ndbnet/testNR4.run b/ndb/test/ndbnet/testNR4.run index f7a5eef3494..378d2743145 100644 --- a/ndb/test/ndbnet/testNR4.run +++ b/ndb/test/ndbnet/testNR4.run @@ -1,3 +1,20 @@ +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # Node recovery killing 1 node out of 4 at the time and waiting for recover use strict; diff --git a/ndb/test/ndbnet/testSRhang.run b/ndb/test/ndbnet/testSRhang.run index 8cb65a75ded..570ed897eef 100644 --- a/ndb/test/ndbnet/testSRhang.run +++ b/ndb/test/ndbnet/testSRhang.run @@ -1,4 +1,19 @@ +# Copyright (C) 2004 MySQL AB # +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA use strict; use NDB::Run; diff --git a/ndb/test/ndbnet/testTR295.run b/ndb/test/ndbnet/testTR295.run index ce4250b60ae..df26000cbda 100644 --- a/ndb/test/ndbnet/testTR295.run +++ b/ndb/test/ndbnet/testTR295.run @@ -1,3 +1,20 @@ +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # testing TR295, kill non-master when recovering in phase 4 use strict; diff --git a/ndb/test/run-test/16node-tests.txt b/ndb/test/run-test/16node-tests.txt index 11ade56c28c..21dd67c9b4b 100644 --- a/ndb/test/run-test/16node-tests.txt +++ b/ndb/test/run-test/16node-tests.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2005 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # BASIC FUNCTIONALITY max-time: 500 cmd: testBasic diff --git a/ndb/test/run-test/atrt-analyze-result.sh b/ndb/test/run-test/atrt-analyze-result.sh index 0fa46e918ef..9a482faee86 100755 --- a/ndb/test/run-test/atrt-analyze-result.sh +++ b/ndb/test/run-test/atrt-analyze-result.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + f=`find result -name 'log.out' | xargs grep "NDBT_ProgramExit: " | grep -c "Failed"` o=`find result -name 'log.out' | xargs grep "NDBT_ProgramExit: " | grep -c "OK"` diff --git a/ndb/test/run-test/atrt-clear-result.sh b/ndb/test/run-test/atrt-clear-result.sh index 57d3d43d247..7eeb54daef3 100755 --- a/ndb/test/run-test/atrt-clear-result.sh +++ b/ndb/test/run-test/atrt-clear-result.sh @@ -1,4 +1,21 @@ #!/bin/sh +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + set -e rm -rf result diff --git a/ndb/test/run-test/atrt-gather-result.sh b/ndb/test/run-test/atrt-gather-result.sh index 93d4ae428d0..48704651813 100755 --- a/ndb/test/run-test/atrt-gather-result.sh +++ b/ndb/test/run-test/atrt-gather-result.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + set -e mkdir -p result diff --git a/ndb/test/run-test/atrt-mysql-test-run b/ndb/test/run-test/atrt-mysql-test-run index 2ebc11b0070..55afc45bef9 100755 --- a/ndb/test/run-test/atrt-mysql-test-run +++ b/ndb/test/run-test/atrt-mysql-test-run @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004, 2005 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + set -x p=`pwd` cd $MYSQL_BASE_DIR/mysql-test diff --git a/ndb/test/run-test/atrt-setup.sh b/ndb/test/run-test/atrt-setup.sh index aff5d4119dc..786b1d812de 100755 --- a/ndb/test/run-test/atrt-setup.sh +++ b/ndb/test/run-test/atrt-setup.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + set -e ssh $1 mkdir -p $3 diff --git a/ndb/test/run-test/atrt-testBackup b/ndb/test/run-test/atrt-testBackup index 3ed7641a42e..2ed6f70b7aa 100755 --- a/ndb/test/run-test/atrt-testBackup +++ b/ndb/test/run-test/atrt-testBackup @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + PATH=$PATH:$MYSQL_BASE_DIR/bin export PATH diff --git a/ndb/test/run-test/basic.txt b/ndb/test/run-test/basic.txt index ec9e21359e5..69555b8c587 100644 --- a/ndb/test/run-test/basic.txt +++ b/ndb/test/run-test/basic.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # BASIC FUNCTIONALITY max-time: 500 cmd: testBasic diff --git a/ndb/test/run-test/conf-daily-devel-ndbmaster.txt b/ndb/test/run-test/conf-daily-devel-ndbmaster.txt index 51c171a6357..ccd11fb6056 100644 --- a/ndb/test/run-test/conf-daily-devel-ndbmaster.txt +++ b/ndb/test/run-test/conf-daily-devel-ndbmaster.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2005, 2006 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + baseport: 16000 basedir: /space/autotest mgm: CHOOSE_host1 diff --git a/ndb/test/run-test/conf-daily-sql-ndbmaster.txt b/ndb/test/run-test/conf-daily-sql-ndbmaster.txt index 0d6a99f8d48..6777eb98cfe 100644 --- a/ndb/test/run-test/conf-daily-sql-ndbmaster.txt +++ b/ndb/test/run-test/conf-daily-sql-ndbmaster.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2005 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + baseport: 16000 basedir: /space/autotest mgm: CHOOSE_host1 diff --git a/ndb/test/run-test/conf-dl145a.txt b/ndb/test/run-test/conf-dl145a.txt index d0a240f09d1..ed10fe6bb4d 100644 --- a/ndb/test/run-test/conf-dl145a.txt +++ b/ndb/test/run-test/conf-dl145a.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2005 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + baseport: 14000 basedir: /home/ndbdev/autotest/run mgm: CHOOSE_host1 diff --git a/ndb/test/run-test/conf-ndbmaster.txt b/ndb/test/run-test/conf-ndbmaster.txt index 89b41850ec0..cca9aa5ae7c 100644 --- a/ndb/test/run-test/conf-ndbmaster.txt +++ b/ndb/test/run-test/conf-ndbmaster.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2005, 2006 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + baseport: 14000 basedir: /space/autotest mgm: CHOOSE_host1 diff --git a/ndb/test/run-test/conf-shark.txt b/ndb/test/run-test/conf-shark.txt index d66d0280d8a..3a216575ea4 100644 --- a/ndb/test/run-test/conf-shark.txt +++ b/ndb/test/run-test/conf-shark.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2005, 2006 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + baseport: 14000 basedir: /space/autotest mgm: CHOOSE_host1 diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt index a27b94193e5..59d916f6f86 100644 --- a/ndb/test/run-test/daily-basic-tests.txt +++ b/ndb/test/run-test/daily-basic-tests.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2004-2008 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + max-time: 3600 cmd: atrt-mysql-test-run args: --force diff --git a/ndb/test/run-test/daily-devel-tests.txt b/ndb/test/run-test/daily-devel-tests.txt index 20f54e031e5..c5667fd7518 100644 --- a/ndb/test/run-test/daily-devel-tests.txt +++ b/ndb/test/run-test/daily-devel-tests.txt @@ -1,3 +1,18 @@ +# Copyright (C) 2004, 2005 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; version 2 of the License. +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # # INDEX # diff --git a/ndb/test/run-test/make-config.sh b/ndb/test/run-test/make-config.sh index e82acb8a7dd..94070389764 100755 --- a/ndb/test/run-test/make-config.sh +++ b/ndb/test/run-test/make-config.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004, 2005 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + baseport="" basedir="" proc_no=1 diff --git a/ndb/test/run-test/make-html-reports.sh b/ndb/test/run-test/make-html-reports.sh index 67395ceba47..dc6d1225dbe 100755 --- a/ndb/test/run-test/make-html-reports.sh +++ b/ndb/test/run-test/make-html-reports.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Copyright (C) 2004, 2005 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + src_dir=$1 run=$2 date=$3 diff --git a/ndb/test/run-test/make-index.sh b/ndb/test/run-test/make-index.sh index 944f0df790b..f13ac098567 100755 --- a/ndb/test/run-test/make-index.sh +++ b/ndb/test/run-test/make-index.sh @@ -1,4 +1,22 @@ #!/bin/sh + +# Copyright (C) 2004 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # NAME # make-index.sh # diff --git a/ndb/test/run-test/ndb-autotest.sh b/ndb/test/run-test/ndb-autotest.sh index 544897a2aa2..d82c3e52b1f 100755 --- a/ndb/test/run-test/ndb-autotest.sh +++ b/ndb/test/run-test/ndb-autotest.sh @@ -1,4 +1,22 @@ #!/bin/sh + +# Copyright (C) 2005, 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + ############################################################# # This script created by Jonas does the following # # Cleans up clones and pevious builds, pulls new clones, # diff --git a/ndb/test/sql/test_create_drop.pl b/ndb/test/sql/test_create_drop.pl index 7f62898b3d1..eb9d5e31dc8 100644 --- a/ndb/test/sql/test_create_drop.pl +++ b/ndb/test/sql/test_create_drop.pl @@ -1,3 +1,20 @@ +# Copyright (C) 2005 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + use strict; use IO::Socket; use DBI; diff --git a/ndb/test/sql/test_range_bounds.pl b/ndb/test/sql/test_range_bounds.pl index abe1ea28298..964847044de 100644 --- a/ndb/test/sql/test_range_bounds.pl +++ b/ndb/test/sql/test_range_bounds.pl @@ -1,3 +1,20 @@ +# Copyright (C) 2005 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # # test range scan bounds # give option --all to test all cases diff --git a/ndb/tools/clean-links.sh b/ndb/tools/clean-links.sh index 01820f30616..84052a619d0 100755 --- a/ndb/tools/clean-links.sh +++ b/ndb/tools/clean-links.sh @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # 1 - Dir # 2 - Link dst diff --git a/ndb/tools/make-errors.pl b/ndb/tools/make-errors.pl index 65819209a89..ac9c7d1d58a 100644 --- a/ndb/tools/make-errors.pl +++ b/ndb/tools/make-errors.pl @@ -1,5 +1,20 @@ #! /usr/local/bin/perl +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + use strict; use Getopt::Long; use XML::Parser; diff --git a/ndb/tools/make-links.sh b/ndb/tools/make-links.sh index e0c4f55986e..6008406ad6a 100755 --- a/ndb/tools/make-links.sh +++ b/ndb/tools/make-links.sh @@ -1,5 +1,20 @@ #! /bin/sh +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + # 1 - Link top src # 2 - Link dst diff --git a/ndb/tools/ndb_error_reporter b/ndb/tools/ndb_error_reporter index 2b5aadb6171..e82f8d05810 100755 --- a/ndb/tools/ndb_error_reporter +++ b/ndb/tools/ndb_error_reporter @@ -1,5 +1,20 @@ #!/usr/bin/perl -w +# Copyright (C) 2005 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; version 2 of the License. +# +# 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 + use strict; if(@ARGV < 1) diff --git a/ndb/tools/ndb_size.pl b/ndb/tools/ndb_size.pl index 3d1ea3f4231..2d7ab4379b0 100644 --- a/ndb/tools/ndb_size.pl +++ b/ndb/tools/ndb_size.pl @@ -1,17 +1,23 @@ #!/usr/bin/perl -w -use strict; - -use DBI; -use POSIX; -use HTML::Template; +# Copyright (C) 2005, 2006 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; version 2 of the License. +# +# 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 # MySQL Cluster size estimator # ---------------------------- # -# (C)2005 MySQL AB -# -# # The purpose of this tool is to work out storage requirements # from an existing MySQL database. # @@ -21,8 +27,6 @@ use HTML::Template; # We currently estimate sizes for: 4.1, 5.0 and 5.1 to various amounts # of accurracy. # -# There is no warranty. -# # BUGS # ---- # - enum/set is 0 byte storage! Woah - efficient! @@ -32,6 +36,12 @@ use HTML::Template; # - computes the storage requirements of views (and probably MERGE) # - ignores character sets. +use strict; + +use DBI; +use POSIX; +use HTML::Template; + my $template = HTML::Template->new(filename => 'ndb_size.tmpl', die_on_bad_params => 0) or die "Could not open ndb_size.tmpl."; diff --git a/ndb/tools/ndb_size.tmpl b/ndb/tools/ndb_size.tmpl index 1e19ea132ba..2867216e7f4 100644 --- a/ndb/tools/ndb_size.tmpl +++ b/ndb/tools/ndb_size.tmpl @@ -1,4 +1,21 @@ + + diff --git a/ndb/tools/rgrep b/ndb/tools/rgrep index 212b068639d..b1ed4fb6f5e 100755 --- a/ndb/tools/rgrep +++ b/ndb/tools/rgrep @@ -1,5 +1,20 @@ #!/vobs/wds/swt/bin/perl +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# 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 + die "Usage: rgrep [-iredblLn] regexp filepat ...\n rgrep -h for help\n" if $#ARGV < $[; diff --git a/os2/BldLevel.RES b/os2/BldLevel.RES deleted file mode 100644 index 302d9fc875e..00000000000 Binary files a/os2/BldLevel.RES and /dev/null differ diff --git a/os2/BldLevel.cmd b/os2/BldLevel.cmd deleted file mode 100644 index d98d8c9dfb9..00000000000 --- a/os2/BldLevel.cmd +++ /dev/null @@ -1,10 +0,0 @@ -@echo off - -REM I'm using resources for BLDLEVEL info, because VA4 linker has the bad -REM feature of using versionstring content for padding files. - -REM To set fixpak level: -P"fixpak level" -SET MYSQL_VERSION=3.23.50 -SET MYSQL_BUILD=B1 - -BldLevelInf -V%MYSQL_VERSION% -N"MySQL AB, Yuri Dario" -D"MySQL %MYSQL_VERSION% for OS/2 - Build %MYSQL_BUILD%" -Len BldLevel.rc diff --git a/os2/BldLevel.rc b/os2/BldLevel.rc deleted file mode 100644 index ac028379892..00000000000 --- a/os2/BldLevel.rc +++ /dev/null @@ -1 +0,0 @@ -RCDATA 1 { "@#MySQL AB, Yuri Dario:3.23.50#@##1## 24 Jun 2002 22:42:20 paperino::en::::@@MySQL 3.23.50 for OS/2 - Build B1" } diff --git a/os2/BldLevelInf.cmd b/os2/BldLevelInf.cmd deleted file mode 100644 index 40a85f3782a..00000000000 --- a/os2/BldLevelInf.cmd +++ /dev/null @@ -1,570 +0,0 @@ -/* $Id: BldLevelInf.cmd,v 1.5 2001/01/26 21:33:13 phaller Exp $ - * - * Adds a Description string to the given .def-file. - * Fills in default values; like build time and host. - * - */ - -if RxFuncQuery('SysLoadFuncs') = 1 then -do - call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'; - call SysLoadFuncs; -end - - -/* - * Set default parameter values. - */ -sDefFileIn = ''; -sDefFileOut = ''; -sASDFeatureId = ''; -sCountryCode = ''; -sDateTime = left(' 'date()' 'time(), 26); -sDescription = 'Odin32'; -sFixPakVer = ''; -sHostname = strip(substr(VALUE('HOSTNAME',,'OS2ENVIRONMENT'), 1, 11)); -sLanguageCode = ''; -sMiniVer = ''; -sVendor = 'Project Odin'; -sVersion = '0.5'; - - -/* - * Parse parameters. - */ -parse arg sArgs -if (sArgs = '') then -do - call syntax; - exit(1); -end - -do while (sArgs <> '') - sArgs = strip(sArgs); - if (substr(sArgs, 1, 1) = '-' | substr(sArgs, 1, 1) = '/') then - do /* - * Option. - */ - ch = translate(substr(sArgs, 2, 1)); - if (pos(ch, 'ACDHLMNPRTV') < 1) then - do - say 'invalid option:' substr(sArgs, 1, 2); - call syntax; - exit(2); - end - - /* get value and advance sArgs to next or to end. */ - if (substr(sArgs, 3, 1) = '"') then - do - iNext = pos('"', sArgs, 4); - fQuote = 1; - end - else - do - iNext = pos(' ', sArgs, 3); - if (iNext <= 0) then - iNext = length(sArgs); - fQuote = 0; - end - - if (iNext > 3 | ch = 'R') then - do - sValue = substr(sArgs, 3 + fQuote, iNext - 3 - fQuote); - sArgs = strip(substr(sArgs, iNext+1)); - /*say 'iNext:' iNext 'sValue:' sValue 'sArgs:' sArgs; */ - - /* check if we're gonna search for something in an file. */ - if (sValue <> '' & pos('#define=', sValue) > 0) then - sValue = LookupDefine(sValue); - end - else - do - say 'syntax error near' substr(sArgs, 1, 2)'.'; - call syntax; - exit(3); - end - - - /* set value */ - select - when (ch = 'A') then /* ASD Feature Id */ - sASDFeatureId = sValue; - - when (ch = 'C') then /* Country code */ - sCountryCode = sValue; - - when (ch = 'D') then /* Description */ - sDescription = sValue; - - when (ch = 'H') then /* Hostname */ - sHostname = sValue; - - when (ch = 'L') then /* Language code */ - sLanguageCode = sValue; - - when (ch = 'M') then /* MiniVer */ - sMiniVer = sValue; - - when (ch = 'N') then /* Vendor */ - sVendor = sValue; - - when (ch = 'R') then /* Vendor */ - sDescription = ReadDescription(sValue, sDefFile); - - when (ch = 'P') then /* Fixpak version */ - sFixPakVer = sValue; - - when (ch = 'T') then /* Date Time */ - sDateTime = sValue; - - when (ch = 'V') then /* Version */ - sVersion = sValue; - - /* Otherwise it's an illegal option */ - otherwise - say 'invalid option:' substr(sArgs, 1, 2); - call syntax; - exit(2); - end /* select */ - end - else - do /* - * Defition file... - */ - if (sDefFileOut <> '') then - do - say 'Syntax error: Can''t specify more than two defintion files!'; - exit(4); - end - if (sDefFileIn = '') then - parse value sArgs with sDefFileIn' 'sArgs - else - parse value sArgs with sDefFileOut' 'sArgs - sArgs = strip(sArgs); - end -end - - -/* check that a defintion file was specified. */ -if (sDefFileIn = '') then -do - say 'Syntax error: Will have to specify a .def-file to update.'; - call syntax; - exit(5); -end - - -/* - * Trim strings to correct lengths. - */ -sVendor = strip(substr(sVendor, 1, 31)); -if (substr(sDateTime, 1, 1) <> ' ') then - sDateTime = ' ' || sDateTime; -sDateTime = left(sDateTime, 26); -sHostname = strip(substr(sHostname, 1, 11)); -sMiniVer = strip(substr(sMiniVer, 1, 11)); -sDescription = strip(substr(sDescription, 1, 80)); -sCountryCode = strip(substr(sCountryCode, 1, 4)); -sLanguageCode = strip(substr(sLanguageCode, 1, 4)); -sASDFeatureId = strip(substr(sASDFeatureId, 1, 11)); -sFixPakVer = strip(substr(sFixPakVer, 1, 11)); - - -/* - * Signature - */ -sEnhSign = '##1##' - -/* - * Build description string. - */ -sDescription = '@#'sVendor':'sVersion'#@'sEnhSign||, - sDateTime||sHostname||, - ':'sASDFeatureId':'sLanguageCode':'sCountryCode':'sMiniVer||, - '::'sFixPakVer'@@'sDescription; - -/* - * Update .def-file. - */ -call SysFileDelete(sDefFileIn); -rc = lineout( sDefFileIn, 'RCDATA 1 { "' || sDescription || '" }'); - -/*rc = UpdateDefFile(sDefFileIn, sDefFileOut, sDescription);*/ -exit(rc); - - -/** - * Display script syntax. - */ -syntax: procedure - say 'Syntax: MakeDesc.cmd [options] [options]' - say ' Defitionfile which will have an DESCRIPTION appended.' - say 'Options:' - say ' -A ASD Feature Id.' - say ' -C Country code.' - say ' -D Description.' - say ' -R[deffile] Read description from .def file.' - say ' -H Hostname.' - say ' -L Language code.' - say ' -M MiniVer.' - say ' -N Vendor.' - say ' -P Fixpak version.' - say ' -T Date Time.' - say ' -V Version.' - say ' could be a double qoute qouted string or a single word.' - say ' You could also reference #defines in C/C++ include files.' - say ' The string should then have this form:' - say ' "#define=,"' - say ''; - - return; - - -/** - * Search for a #define in an C/C++ header or source file. - * - * @returns String containing the defined value - * found for the define in the header file. - * Quits on fatal errors. - * @param A string on the form: "#define=DEFINETOFIND,includefile.h" - * @remark Write only code... - let's hope it works. - */ -LookupDefine: procedure - parse arg '#'sDefine'='sMacro','sIncludeFile - - /* - * Validate parameters. - */ - sMacro = strip(sMacro); - sIncludeFile = strip(sIncludeFile); - if (sMacro = '') then - do - say 'syntax error: #define=,.'; - say ' was empty.'; - exit(-20); - end - if (sIncludeFile = '') then - do - say 'syntax error: #define=,.'; - say ' was empty.'; - exit(-20); - end - - - sIllegal = translate(translate(sMacro),, - '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',, - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_'); - - if (strip(translate(sIllegal, ' ', '!')) <> '') then - do - say 'syntax error: #define=,.'; - say ' contains illegal charater(s).' - say ' 'sMacro; - say ' 'translate(sIllegal, ' ', '!'); - exit(-20); - end - - /* - * Open include file. - */ - sRc = stream(sIncludeFile, 'c', 'open read'); - if (pos('READY', sRc) <> 1) then - do /* search INCLUDE variable */ - sFile = SysSearchPath('INCLUDE', sIncludeFile); - if (sFile = '') then - do - say 'Can''t find include file 'sIncludeFile'.'; - exit(-20); - end - sIncludeFile = sFile; - - sRc = stream(sIncludeFile, 'c', 'open read'); - if (pos('READY', sRc) <> 1) then - do - say 'Failed to open include file' sIncludeFile'.'; - exit(-20); - end - end - - /* - * Search the file line by line. - * We'll check for lines starting with a hash (#) char. - * Then check that the word after the hash is 'define'. - * Then match the next word with the macro name. - * Then then get the next rest of the line to comment or continuation char. - * (continuation is not supported) - * Finally strip quotes. - */ - sValue = ''; - do while (lines(sIncludeFile) > 0) - sLine = strip(linein(sIncludeFile)); - if (sLine = '') then - iterate; - if (substr(sLine, 1, 1) <> '#') then - iterate; - sLine = substr(sLine, 2); - if (word(sLine, 1) <> 'define') then - iterate; - sLine = strip(substr(sLine, wordpos(sLine, 1) + length('define')+1)); - if ( substr(sLine, 1, length(sMacro)) <> sMacro, - | substr(sLine, length(sMacro)+1, 1) <> ' ') then - iterate; - sLine = strip(substr(sLine, length(sMacro) + 1)); - if (sLine = '') then - do - say 'error: #define' sMacro' is empty.'; - call stream sIncludeFile, 'c', 'close'; - exit(-20); - end - - chQuote = substr(sLine, 1, 1); - if (chQuote = '"' | chQuote = "'") then - do /* quoted string */ - iLastQuote = 0; - do forever - iLast = pos(chQuote, sLine, 2); - if (iLast <= 0) then - leave; - if (substr(sLine, iLast, 1) = '\') then - iterate; - iLastQuote = iLast; - leave; - end - - if (iLastQuote <= 0) then - do - say 'C/C++ syntax error in 'sIncludefile': didn''t find end quote.'; - call stream sIncludeFile, 'c', 'close'; - exit(-20); - end - - call stream sIncludeFile, 'c', 'close'; - sValue = substr(sLine, 2, iLastQuote - 2); - say 'Found 'sMacro'='sValue; - return sValue; - end - else - do - iCommentCPP = pos('//',sLine); - iCommentC = pos('/*',sLine); - if (iCommentC > 0 & iCommentCPP > 0 & iCommentC > iCommentCPP) then - iComment = iCommentCPP; - else if (iCommentC > 0 & iCommentCPP > 0 & iCommentC < iCommentCPP) then - iComment = iCommentC; - else if (iCommentCPP > 0) then - iComment = iCommentCPP; - else if (iCommentC > 0) then - iComment = iCommentC; - else - iComment = 0; - - if (iComment > 0) then - sValue = strip(substr(sLine, 1, iComment-1)); - else - sValue = strip(sLine); - - if (sValue <> '') then - do - if (substr(sValue, length(sValue)) = '\') then - do - say 'Found continuation char: Multiline definitions are not supported!\n'; - call stream sIncludeFile, 'c', 'close'; - exit(-20); - end - end - - if (sValue = '') then - say 'warning: The #define has no value.'; - - call stream sIncludeFile, 'c', 'close'; - say 'Found 'sMacro'='sValue; - return sValue; - end - end - - call stream sIncludeFile, 'c', 'close'; - say 'error: didn''t find #define' sMacro'.'; - exit(-20); - - - -/** - * Reads the description line for a .def-file. - * @returns The Description string, with quotes removed. - * Empty string is acceptable. - * On error we'll terminate the script. - * @param sDefFile Filaname of .def-file to read the description from. - * @param sDefFile2 Used if sDefFile is empty. - * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) - */ -ReadDescription: procedure; - parse arg sDefFile, sDefFile2 - - /* - * Validate parameters. - */ - if (sDefFile = '') then - sDefFile = sDefFile2; - if (sDefFile = '') then - do - say 'error: no definition file to get description from.' - exit(-1); - end - - /* - * Open file - */ - rc = stream(sDefFile, 'c', 'open read'); - if (pos('READY', rc) <> 1) then - do - say 'error: failed to open deffile file.'; - exit(-1); - end - - - /* - * Search for the 'DESCRIPTION' line. - */ - do while (lines(sDefFile) > 0) - sLine = strip(linein(sDefFile)); - if (sLine = '') then - iterate; - if (translate(word(sLine, 1)) <> 'DESCRIPTION') then - iterate; - sLine = strip(substr(sLine, wordpos(sLine, 1) + length('DESCRIPTION')+1)); - - ch = substr(sLine, 1, 1); - if (ch <> "'" & ch <> '"') then - do - say 'syntax error: description line in' sDefFile 'is misformed.'; - call stream sDefFile, 'c', 'close'; - exit(-10); - end - - iEnd = pos(ch, sLine, 2); - if (iEnd <= 0) then - do - say 'syntax error: description line in' sDefFile 'is misformed.'; - call stream sDefFile, 'c', 'close'; - exit(-10); - end - - call stream sDefFile, 'c', 'close'; - sValue = substr(sLine, 2, iEnd - 2); - say 'Found Description:' sValue; - return sValue; - end - - call stream sDefFile, 'c', 'close'; - say 'info: Didn''t find description line in' sDefFile'.'; - return ''; - - -/** - * This is a function which reads sDefFileIn into and - * internal array and changes the DESCRIPTION text if found. - * If DESCRIPTION isn't found, it is added at the end. - * The array is written to sDefFileOut. - * @returns 0 on succes. - * Errorcode on error. - * @param sDefFileIn Input .def-file. - * @param sDefFileOut Output .def-file. Overwritten. - * @param sDescription New description string. - * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) - */ -UpdateDefFile: procedure; - parse arg sDefFileIn, sDefFileOut, sDescription - - /* - * Validate parameters. - */ - if (sDefFileOut = '') then - sDefFileOut = sDefFileIn; - - /* - * Open file input file. - */ - rc = stream(sDefFileIn, 'c', 'open read'); - if (pos('READY', rc) <> 1) then - do - say 'error: failed to open' sDefFileIn 'file.'; - return 110; - end - - - /* - * Search for the 'BLDLEVEL' line. - */ - i = 0; - fDescription = 0; - do while (lines(sDefFileIn) > 0) - /* - * Read line. - */ - i = i + 1; - asFile.i = linein(sDefFileIn); - - /* - * Look for BLDLEVEL; - */ - if (asFile.i = '') then - iterate; - if (translate(word(strip(asFile.i), 1)) <> 'BLDLEVEL') then - iterate; - if (fDescription) then - do - say 'warning: multiple descriptions lines. Line' i 'removed'; - i = i - 1; - iterate; - end - - /* - * Found description - replace with new description. - */ - asFile.i = "BldLevel = '"||sDescription||"'"; - fDescription = 1; - end - - /* - * Add description is none was found. - */ - if (\fDescription) then - do - i = i + 1; - asFile.i = "BldLevel = '"||sDescription||"'"; - end - asFile.0 = i; - - - /* - * Close input file and open output file. - */ - call stream sDefFileIn, 'c', 'close'; - call SysFileDelete(sDefFileOut); - rc = stream(sDefFileOut, 'c', 'open write'); - if (pos('READY', rc) <> 1) then - do - say 'error: failed to open outputfile' sDefFileOut 'file.'; - return 110; - end - - /* - * Make firstline and write all the lines to the output file. - */ - /*call lineout sDefFileOut, '; Updated by makedesc.cmd', 1;*/ - do i = 1 to asFile.0 - rc = lineout(sDefFileOut, asFile.i); - if (rc > 0) then - do - say 'error: failed to write line' i 'to' sDefFileOut'.' - call stream sDefFileOut, 'c', 'close'; - return 5; - end - end - - /* - * Close output file and return succesfully. - */ - call stream sDefFileOut, 'c', 'close'; - return 0; - diff --git a/os2/ChangeLog.os2 b/os2/ChangeLog.os2 deleted file mode 100644 index 18356b840ed..00000000000 --- a/os2/ChangeLog.os2 +++ /dev/null @@ -1,56 +0,0 @@ - - -2005/01/01 - - removed references to ISAM and MERGE - -2002/05/02 - - now libinit is automatically called on client dll startup - -2002/01/27 - - fixed console output for get_password - -2002/01/20 - - back-ported fix for fulltext indexes (wrong report by myisamchk) - -2001/11/21 - - MySQL 3.32.42 build 3 released. - -2001/11/19 - - got GNU Readline to compile with VAC++, now console has a working - history. - -2001/11/10 - - fixed file locking on non-JFS disks; DosSetFileLocksL does not - support ranges > 2GB on non-JFS disks. - -2001/09/16 - - fixed creation directory of temporary files - - enabled cached list file for deleting temp open files - -2001/09/10 - - Build source 3.23.42, released - -2001/09/08 - - fixed file api - -2001/06/12 - - fixed support for > 2GB file size, needs also DosOpenL - - mixed 64bit/32bit file size support, dinamic loading of - 64bit API. - -2001/06/03 - - added support for > 2GB file size - -2001/06/02 - - fixed file locking code - -2001/05/29 - - 3.23.38 build - -2001/05/20 - - rint fix - - isam O_RDONLY table handled fix - -2001/05/19 - - new TLS code, fixed parser crashes and many other problems. - - fixed pthread_cond_timedwait, now handle manager expires diff --git a/os2/Makefile.am b/os2/Makefile.am deleted file mode 100644 index b1bc832a8a8..00000000000 --- a/os2/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2002 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; version 2 of the License. -# -# 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 - -## Process this file with automake to create Makefile.in - -EXTRA_DIST = BldLevel.RES BldLevel.cmd BldLevel.rc \ - BldLevelInf.cmd ChangeLog.os2 MySQL-Client.icc \ - MySQL-Opt.icc MySQL-Source.icc MySQL-Sql.icc \ - MySQL-Sql.irs MySQL-Util.icc MySQL-Util.irs \ - ReadMe.txt build-all.cmd mysql-inf.wis \ - mysql.wis mysqlalt.wis rint.cmd rint.obj rint.s -SUBDIRS = include - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/os2/MySQL-Client.icc b/os2/MySQL-Client.icc deleted file mode 100644 index bc614c1c723..00000000000 --- a/os2/MySQL-Client.icc +++ /dev/null @@ -1,122 +0,0 @@ -// disable code inlining when building static libs -InlineCode = "no" - -// include common options -include "MySQL-Opt.icc" -include "MySQL-Source.icc" - -option ProjectOptions = MySQLOptions -{ - - option file(genobject, "..\\OBJ\\ZLIB\\") - { - target "..\\bin\\mysql.dll" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source zlib - if debug_build { - source type('cpp') dbug - } - source type('cpp') my_sys - source type('cpp') my_sys_cli - source type('cpp') strings - source type('cpp') mysqlclientlib - source type('cpp') '..\libmysql\dll.c' - source BldLevelInfo - } - } - - option file(genobject, "..\\OBJ\\READLINE\\") - { - target "..\\bin\\mysql.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\client\\mysql.cc" - source BldLevelInfo - option define("HAVE_STRING_H", ), define("HAVE_CONFIG_H", ) - { - source GnuReadline - } - } - } - - target "..\\bin\\mysqladmin.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\client\\mysqladmin.c" - source BldLevelInfo - } - - target "..\\bin\\mysqldump.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\client\\mysqldump.c" - source BldLevelInfo - } - - target "..\\bin\\mysqlshow.exe" - { - // target source files - source type('cpp') "..\\client\\mysqlshow.c" - source BldLevelInfo - } - - target "..\\bin\\mysqlimport.exe" - { - // target source files - source type('cpp') "..\\client\\mysqlimport.c" - source BldLevelInfo - } - - target "..\\bin\\mysqltest.exe" - { - source type('cpp') "..\\client\\mysqltest.c" - source BldLevelInfo - } - - target "..\\bin\\mysqlbinlog.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\client\\mysqlbinlog.cc" - source BldLevelInfo - } - - target "..\\bin\\mysqlcheck.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - - // target source files - source type('cpp') "..\\client\\mysqlcheck.c" - source BldLevelInfo - } - -} diff --git a/os2/MySQL-Opt.icc b/os2/MySQL-Opt.icc deleted file mode 100644 index 56e89057862..00000000000 --- a/os2/MySQL-Opt.icc +++ /dev/null @@ -1,59 +0,0 @@ -// set to 1 to enable debug code -debug_build = 0 - -// set to zlib relative directory name -zlib_dir = '../../zlib-1.1.4' - -// common options -option BaseOptions = link(defaultlibsname, "tcpip32.lib") - , link(libsearchpath, "..\\lib\\") - , link(libsearchpath, "..\\bin\\") - , link(pmtype, vio) - , link(padding, no) - , link(linkwithmultithreadlib, "yes") - , link(linkwithsharedlib, "no") - , link(stack, 131072, 131072) - , gen(initauto, "yes") - , define("__MT__", ) - , define("HAVE_BSD_SIGNALS", ) - , define("INCL_DOS", ) - , define("INCL_DOSERRORS", ) - , define("INCL_LONGLONG", ) - , define("OS2", ) - , define("USE_TLS", ) - , lang(signedchars, yes) - , incl(searchpath, "..") - , incl(searchpath, "include") - , incl(searchpath, "..\\include") - , incl(searchpath, "..\\my_sys") - , incl(searchpath, "..\\regex") - , incl(searchpath, "..\\sql") - , incl(searchpath, zlib_dir) - , incl(searchpath, "..\\..\\ufc") - , incl(searchpath, "..\\os2") - -option ReleaseOptions = link(debug, "no") - , define("DBUG_OFF", ) - , gen(arch, "pentium") - , opt(tune, "pentium2") - , opt(level, "0") - , opt(stackchaining, no) - , opt(size, yes) - , opt(autoinline, InlineCode) - , opt(inline, InlineCode) - , opt(schedule, no) - -option DebugOptions = link(debug, "yes") - , gen(debug, "yes") - , define("DBUG_ON", ) - - -if debug_build { - -option MySQLOptions = BaseOptions, DebugOptions - -} else { - -option MySQLOptions = BaseOptions, ReleaseOptions - -} diff --git a/os2/MySQL-Source.icc b/os2/MySQL-Source.icc deleted file mode 100644 index 285811d0eae..00000000000 --- a/os2/MySQL-Source.icc +++ /dev/null @@ -1,324 +0,0 @@ -group client_global_pch = - 'os2.h', - 'assert.h', 'direct.h', 'errno.h', 'nerrno.h', - 'limits.h', 'io.h', 'math.h', - 'stdio.h', 'stdlib.h', 'stddef.h', - 'sys/stat.h', 'sys/types.h', 'sys/time.h', - 'types.h', 'string.h', 'stdarg.h', - - 'my_base.h', 'config-os2.h', 'my_dir.h', - 'global.h', 'thr_alarm.h', 'm_string.h', - 'mysql.h', 'zconf.h', 'zlib.h', 'mysys_err.h', - 'm_ctype.h', 'mysqld_error.h', - 'my_list.h', 'my_sys.h', 'my_net.h', - 'myisam.h', 'myisampack.h', '.\myisam\myisamdef.h', - '.\regex\my_regex.h' - -group server_global_pch = - 'os2.h', - 'string.h', 'assert.h', 'share.h', 'stdarg.h', 'stdio.h', - 'stdlib.h', 'stddef.h', 'math.h', 'io.h', 'limits.h', - 'process.h', 'errno.h', 'nerrno.h', 'sys/types.h', - 'sys/time.h', 'sys/stat.h', 'sys/param.h', 'sys/ioccom.h', - 'sys/filio.h', 'sys/sockio.h', 'sys/ioctlos2.h','sys/ioctl.h', 'types.h', - 'sys/utime.h', 'sys/select.h', 'sys/un.h', - 'netinet/in_systm.h', 'netinet/tcp.h', - - 'global.h', 'my_base.h', 'config-os2.h', - 'my_dir.h', 'my_sys.h', 'mysql.h', - 'my_bitmap.h', 'violite.h', 'mysql_priv.h', - 'm_string.h', 'm_ctype.h', - 'myisam.h', 'myisampack.h', '.\myisam\myisamdef.h', - 'sql_string.h', 'item.h', 'unireg.h', - 'field.h', 'sql_lex.h', 'sql_list.h', 'sql_repl.h', - 'my_md5.h', 'sql_acl.h', 'slave.h', - 'ha_myisam.h', 'procedure.h', 'sql_select.h', - 'errmsg.h', 't_ctype.h', 'direct.h', - 'mysys_err.h', 'zconf.h', 'zlib.h', - 'my_tree.h', '..\mysys\my_static.h', 'netdb.h', - 'thr_alarm.h', 'heap.h', '..\myisam\fulltext.h', - '..\myisam\ftdefs.h', 'myisammrg.h', - '.\regex\my_regex.h' - -group server_pch = - 'ha_heap.h', 'ha_myisammrg.h', 'opt_ft.h', - 'hash_filo.h', 'mini_client.h', 'sql_repl.h', - 'sql_analyse.h', 'item_create.h', '..\mysys\mysys_priv.h' - -group mysqlclientlib = - "..\\client\\readline.cc", - "..\\client\\sql_string.cc", - "..\\client\\completion_hash.cc", - "..\\libmysql\\libmysql.c", - "..\\libmysql\\errmsg.c", - "..\\libmysql\\get_password.c", - "..\\libmysql\\net.c", - "..\\libmysql\\password.c", - "..\\libmysql\\violite.c" - -group zlib = - zlib_dir "/compress.c", - zlib_dir "/crc32.c", - zlib_dir "/deflate.c", - zlib_dir "/gzio.c", - zlib_dir "/infblock.c", - zlib_dir "/infcodes.c", - zlib_dir "/inffast.c", - zlib_dir "/inflate.c", - zlib_dir "/inftrees.c", - zlib_dir "/infutil.c", - zlib_dir "/trees.c", - zlib_dir "/uncompr.c", - zlib_dir "/zutil.c", - zlib_dir "/adler32.c" - -group ufc = - "..\\..\\ufc\\crypt.c", - "..\\..\\ufc\\crypt_util.c", - "..\\..\\ufc\\crypt-entry.c" - -group sql = - "..\\sql\\convert.cc", - "..\\sql\\derror.cc", - "..\\sql\\field.cc", - "..\\sql\\field_conv.cc", - "..\\sql\\filesort.cc", - "..\\sql\\ha_heap.cc", - "..\\sql\\ha_myisam.cc", - "..\\sql\\ha_myisammrg.cc", - "..\\sql\\handler.cc", - "..\\sql\\hash_filo.cc", - "..\\sql\\hostname.cc", - "..\\sql\\init.cc", - "..\\sql\\item.cc", - "..\\sql\\item_buff.cc", - "..\\sql\\item_cmpfunc.cc", - "..\\sql\\item_create.cc", - "..\\sql\\item_func.cc", - "..\\sql\\item_strfunc.cc", - "..\\sql\\item_sum.cc", - "..\\sql\\item_timefunc.cc", - "..\\sql\\item_uniq.cc", - "..\\sql\\key.cc", - "..\\sql\\lock.cc", - "..\\sql\\log.cc", - "..\\sql\\log_event.cc", - "..\\sql\\md5.c", - "..\\sql\\mf_iocache.cc", - "..\\sql\\mini_client.cc", - "..\\sql\\mini_client_errors.c", - "..\\sql\\mysqld.cc", - "..\\sql\\net_pkg.cc", - "..\\sql\\net_serv.cc", - "..\\sql\\opt_ft.cc", - "..\\sql\\opt_range.cc", - "..\\sql\\OPT_SUM.cc", - "..\\sql\\password.c", - "..\\sql\\procedure.cc", - "..\\sql\\records.cc", - "..\\sql\\slave.cc", - "..\\sql\\sql_acl.cc", - "..\\sql\\sql_analyse.cc", - "..\\sql\\sql_base.cc", - "..\\sql\\sql_cache.cc", - "..\\sql\\sql_class.cc", - "..\\sql\\sql_crypt.cc", - "..\\sql\\sql_db.cc", - "..\\sql\\sql_do.cc", - "..\\sql\\sql_delete.cc", - "..\\sql\\sql_insert.cc", - "..\\sql\\sql_lex.cc", - "..\\sql\\sql_list.cc", - "..\\sql\\sql_load.cc", - "..\\sql\\sql_manager.cc", - "..\\sql\\sql_map.cc", - "..\\sql\\sql_parse.cc", - "..\\sql\\sql_rename.cc", - "..\\sql\\sql_repl.cc", - "..\\sql\\sql_select.cc", - "..\\sql\\sql_show.cc", - "..\\sql\\sql_string.cc", - "..\\sql\\sql_table.cc", - "..\\sql\\sql_test.cc", - "..\\sql\\sql_update.cc", - "..\\sql\\sql_udf.cc", - "..\\sql\\sql_yacc.c", - "..\\sql\\table.cc", - "..\\sql\\thr_malloc.cc", - "..\\sql\\time.cc", - "..\\sql\\unireg.cc", - "..\\sql\\violite.c" - -group strings = - "..\\strings\\bchange.c", - "..\\strings\\bmove.c", - "..\\strings\\bmove_upp.c", - "..\\strings\\ctype-big5.c", - "..\\strings\\ctype-czech.c", - "..\\strings\\ctype-euc_kr.c", - "..\\strings\\ctype-gb2312.c", - "..\\strings\\ctype-gbk.c", - "..\\strings\\ctype-sjis.c", - "..\\strings\\ctype-tis620.c", - "..\\strings\\ctype-ujis.c", - "..\\strings\\ctype.c", - "..\\strings\\int2str.c", - "..\\strings\\is_prefix.c", - "..\\strings\\llstr.c", - "..\\strings\\longlong2str.c", - "..\\strings\\str2int.c", - "..\\strings\\strappend.c", - "..\\strings\\strcend.c", - "..\\strings\\strcont.c", - "..\\strings\\strend.c", - "..\\strings\\strfill.c", - "..\\strings\\strinstr.c", - "..\\strings\\strmake.c", - "..\\strings\\strmov.c", - "..\\strings\\strnlen.c", - "..\\strings\\strnmov.c", - "..\\strings\\strtoull.c", - "..\\strings\\strxmov.c", - "..\\strings\\strxnmov.c" - -/* -*/ - - group heap = "..\\heap\\hp_block.c", "..\\heap\\hp_clear.c", - "..\\heap\\hp_close.c", "..\\heap\\hp_create.c", "..\\heap\\hp_delete.c", - "..\\heap\\hp_extra.c", "..\\heap\\hp_hash.c", - "..\\heap\\hp_info.c", "..\\heap\\hp_open.c", - "..\\heap\\hp_panic.c", "..\\heap\\hp_rename.c", - "..\\heap\\hp_rfirst.c", "..\\heap\\hp_rkey.c", - "..\\heap\\hp_rlast.c", "..\\heap\\hp_rnext.c", - "..\\heap\\hp_rprev.c", "..\\heap\\hp_rrnd.c", - "..\\heap\\hp_rsame.c", "..\\heap\\hp_scan.c", - "..\\heap\\hp_static.c", "..\\heap\\hp_update.c", - "..\\heap\\hp_write.c", "..\\heap\\_check.c", "..\\heap\\_rectest.c" - - - group myisammrg = "..\\myisammrg\\myrg_close.c", - "..\\myisammrg\\myrg_create.c", "..\\myisammrg\\myrg_delete.c", - "..\\myisammrg\\myrg_extra.c", "..\\myisammrg\\myrg_info.c", - "..\\myisammrg\\myrg_locking.c", - "..\\myisammrg\\myrg_open.c", "..\\myisammrg\\myrg_panic.c", - "..\\myisammrg\\myrg_queue.c", - "..\\myisammrg\\myrg_rfirst.c", "..\\myisammrg\\myrg_rkey.c", - "..\\myisammrg\\myrg_rlast.c", "..\\myisammrg\\myrg_rnext.c", - "..\\myisammrg\\myrg_rprev.c", "..\\myisammrg\\myrg_rrnd.c", - "..\\myisammrg\\myrg_rsame.c", - "..\\myisammrg\\myrg_static.c", - "..\\myisammrg\\myrg_update.c" - - group my_sys = "..\\mysys\\array.c", "..\\mysys\\charset.c", - "..\\mysys\\checksum.c", "..\\mysys\\default.c", "..\\mysys\\errors.c", - "..\\mysys\\getopt.c", "..\\mysys\\getopt1.c", - "..\\mysys\\getvar.c", "..\\mysys\\hash.c", "..\\mysys\\list.c", - "..\\mysys\\mf_brkhant.c", "..\\mysys\\mf_cache.c", - "..\\mysys\\mf_casecnv.c", "..\\mysys\\mf_dirname.c", - "..\\mysys\\mf_fn_ext.c", "..\\mysys\\mf_format.c", - "..\\mysys\\mf_getdate.c", - "..\\mysys\\mf_iocache2.c", "..\\mysys\\mf_keycache.c", - "..\\mysys\\mf_loadpath.c", "..\\mysys\\mf_pack.c", - "..\\mysys\\mf_pack2.c", "..\\mysys\\mf_path.c", - "..\\mysys\\mf_qsort2.c", - //"..\\mysys\\mf_qsort.c", - "..\\mysys\\mf_radix.c", "..\\mysys\\mf_same.c", - "..\\mysys\\mf_sort.c", "..\\mysys\\mf_soundex.c", - "..\\mysys\\mf_stripp.c", "..\\mysys\\mf_tempfile.c", - "..\\mysys\\mf_unixpath.c", "..\\mysys\\mf_wcomp.c", - "..\\mysys\\mf_wfile.c", "..\\mysys\\mulalloc.c", - "..\\mysys\\my_alarm.c", "..\\mysys\\my_alloc.c", - "..\\mysys\\my_append.c", "..\\mysys\\my_bitmap.c", - "..\\mysys\\my_chsize.c", "..\\mysys\\my_clock.c", - "..\\mysys\\my_compress.c", "..\\mysys\\my_copy.c", - "..\\mysys\\my_create.c", "..\\mysys\\my_delete.c", - "..\\mysys\\my_div.c", "..\\mysys\\my_error.c", - "..\\mysys\\my_fopen.c", "..\\mysys\\my_fstream.c", - "..\\mysys\\my_getwd.c", "..\\mysys\\my_init.c", - "..\\mysys\\my_lib.c", "..\\mysys\\my_lock.c", - "..\\mysys\\my_lockmem.c", "..\\mysys\\my_lread.c", - "..\\mysys\\my_lwrite.c", "..\\mysys\\my_malloc.c", - "..\\mysys\\my_messnc.c", "..\\mysys\\my_mkdir.c", - "..\\mysys\\my_net.c", "..\\mysys\\my_once.c", - "..\\mysys\\my_open.c", - "..\\mysys\\my_os2cond.c", - "..\\mysys\\my_os2dlfcn.c", - "..\\mysys\\my_os2dirsrch.c", - "..\\mysys\\my_os2mutex.c", "..\\mysys\\my_os2thread.c", - "..\\mysys\\my_os2tls.c", - "..\\mysys\\my_os2file64.c", - "..\\mysys\\my_pread.c", "..\\mysys\\my_pthread.c", - "..\\mysys\\my_quick.c", "..\\mysys\\my_read.c", - "..\\mysys\\my_realloc.c", "..\\mysys\\my_redel.c", - "..\\mysys\\my_rename.c", "..\\mysys\\my_seek.c", - "..\\mysys\\my_static.c", "..\\mysys\\my_tempnam.c", - "..\\mysys\\my_thr_init.c", "..\\mysys\\my_vsnprintf.c", - "..\\mysys\\my_write.c", "..\\mysys\\ptr_cmp.c", - "..\\mysys\\queues.c", "..\\mysys\\raid.cc", - //"..\\mysys\\safemalloc.c", - "..\\mysys\\string.c", - "..\\mysys\\thr_alarm.c", - "..\\mysys\\thr_mutex.c", "..\\mysys\\thr_rwlock.c", - "..\\mysys\\tree.c", "..\\mysys\\typelib.c" - - group my_sys_cli = "..\\mysys\\mf_iocache.c" - group my_sys_sql = "..\\mysys\\thr_lock.c" - - group myisam = "..\\myisam\\ft_parser.c", - "..\\myisam\\ft_search.c", "..\\myisam\\ft_static.c", - "..\\myisam\\ft_stopwords.c", "..\\myisam\\ft_update.c", - "..\\myisam\\mi_cache.c", "..\\myisam\\mi_changed.c", - //"..\\myisam\\mi_check.c", - "..\\myisam\\mi_checksum.c", - "..\\myisam\\mi_close.c", "..\\myisam\\mi_create.c", - "..\\myisam\\mi_dbug.c", "..\\myisam\\mi_delete.c", - "..\\myisam\\mi_delete_all.c", "..\\myisam\\mi_delete_table.c", - "..\\myisam\\mi_dynrec.c", "..\\myisam\\mi_extra.c", - //"..\\myisam\\mi_error.c", - "..\\myisam\\mi_info.c", "..\\myisam\\mi_key.c", - "..\\myisam\\mi_locking.c", "..\\myisam\\mi_log.c", - "..\\myisam\\mi_open.c", "..\\myisam\\mi_packrec.c", - "..\\myisam\\mi_page.c", "..\\myisam\\mi_panic.c", - "..\\myisam\\mi_range.c", "..\\myisam\\mi_rename.c", - "..\\myisam\\mi_rfirst.c", "..\\myisam\\mi_rkey.c", - "..\\myisam\\mi_rlast.c", "..\\myisam\\mi_rnext.c", - "..\\myisam\\mi_rnext_same.c", "..\\myisam\\mi_rprev.c", - "..\\myisam\\mi_rrnd.c", "..\\myisam\\mi_rsame.c", - "..\\myisam\\mi_rsamepos.c", "..\\myisam\\mi_scan.c", - "..\\myisam\\mi_search.c", "..\\myisam\\mi_static.c", - "..\\myisam\\mi_statrec.c", "..\\myisam\\mi_unique.c", - "..\\myisam\\mi_update.c", "..\\myisam\\mi_write.c" - //"..\\myisam\\sort.c" - - group dbug = "..\\dbug\\dbug.c", "..\\dbug\\factorial.c", "..\\dbug\\sanity.c" - - group regex = "..\\regex\\regcomp.c", "..\\regex\\regerror.c", - "..\\regex\\regexec.c", "..\\regex\\regfree.c", "..\\regex\\reginit.c" - - group BldLevelInfo = 'os2\BldLevel.rc' - - group GnuReadline = - "..\\readline\\bind.c", - "..\\readline\\callback.c", - "..\\readline\\complete.c", - "..\\readline\\display.c", - "..\\readline\\funmap.c", - "..\\readline\\histexpand.c", "..\\readline\\histfile.c", - "..\\readline\\history.c", "..\\readline\\histsearch.c", - "..\\readline\\input.c", "..\\readline\\isearch.c", - "..\\readline\\keymaps.c", - "..\\readline\\kill.c", - "..\\readline\\macro.c", - "..\\readline\\nls.c", "..\\readline\\parens.c", - "..\\readline\\readline.c", - "..\\readline\\rltty.c", - "..\\readline\\search.c", - "..\\readline\\shell.c", - "..\\readline\\signals.c", - "..\\readline\\terminal.c", - "..\\readline\\tilde.c", - "..\\readline\\undo.c", - "..\\readline\\util.c", - "..\\readline\\vi_mode.c", - "..\\readline\\xmalloc.c" diff --git a/os2/MySQL-Sql.icc b/os2/MySQL-Sql.icc deleted file mode 100644 index 7c8c61fe7de..00000000000 --- a/os2/MySQL-Sql.icc +++ /dev/null @@ -1,44 +0,0 @@ -// disable code inlining when building static libs -InlineCode = "no" - -// include common options -include "MySQL-Opt.icc" -include "MySQL-Source.icc" - -run before sources('..\sql\sql_yacc.yy') targets('..\sql\sql_yacc.c') - 'bison -y -d -o ..\sql\sql_yacc.c ..\sql\sql_yacc.yy' - -option ProjectOptions = MySQLOptions - , define( "MYSQL_SERVER", "") -{ - - option file(genobject, "..\\OBJ\\ZLIB\\") - { - target "..\\bin\\mysqld.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') server_global_pch - } - source type('cpp') server_pch - - // target source files - source "rint.obj" - source zlib, ufc, regex, 'strings\bmove_upp.c' - if debug_build { - source type('cpp') dbug - } - source type('cpp') heap - source type('cpp') myisam - source type('cpp') myisammrg - source type('cpp') my_sys - source type('cpp') my_sys_sql - source type('cpp') strings - source type('cpp') sql, - "..\\myisam\\mi_check.c", - "..\\myisam\\sort.c" - source BldLevelInfo - } - } -} diff --git a/os2/MySQL-Sql.irs b/os2/MySQL-Sql.irs deleted file mode 100644 index b651a678c91..00000000000 --- a/os2/MySQL-Sql.irs +++ /dev/null @@ -1,7 +0,0 @@ -31 Run Specifications: Version 1.1 -40 E:\rd\MySQL\vacpp-3.23.50\bin\mysqld.exe -1 -0 -0 -5 Local -0 diff --git a/os2/MySQL-Util.icc b/os2/MySQL-Util.icc deleted file mode 100644 index 8eaee41b6a2..00000000000 --- a/os2/MySQL-Util.icc +++ /dev/null @@ -1,171 +0,0 @@ -// disable code inlining when building static libs -InlineCode = "no" - -// include common options -include "MySQL-Opt.icc" -include "MySQL-Source.icc" - -option ProjectOptions = MySQLOptions - , link(defaultlibsname, "mysql.lib") -{ - - option file(genobject, "..\\OBJ\\ZLIB\\") - ,link(exportAll) - { - target "..\\bin\\mysqlu.dll" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source zlib, ufc, regex, 'strings\bmove_upp.c' - if debug_build { - source type('cpp') dbug - } - source type('cpp') heap - source type('cpp') myisam - source type('cpp') myisammrg - source type('cpp') my_sys - source type('cpp') my_sys_cli - source type('cpp') my_sys_sql - source type('cpp') strings - source type('cpp') '..\libmysql\dll.c' - source BldLevelInfo - } - } - - - target "..\\bin\\myisamchk.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\myisam\\myisamchk.c", - "..\\myisam\\mi_check.c", - "..\\myisam\\sort.c" - source BldLevelInfo - } - - target "..\\bin\\myisamlog.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\myisam\\myisamlog.c" - source BldLevelInfo - } - - target "..\\bin\\myisampack.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - // target source files - source type('cpp') "..\\myisam\\myisampack.c" - source BldLevelInfo - } - - target "..\\bin\\test\\comp_err.exe" - { - // target source files - source type('cpp') "..\\extra\\comp_err.c" - } - - target "..\\bin\\gen_lex_hash.exe" - { - // target source files - source type('cpp') "..\\sql\\gen_lex_hash.cc" - } - - target "..\\bin\\test\\mi_test1.exe" - { - // target source files - source type('cpp') "..\\myisam\\mi_test1.c" - } - target "..\\bin\\test\\mi_test2.exe" - { - // target source files - source type('cpp') "..\\myisam\\mi_test2.c" - } - target "..\\bin\\test\\ft_eval.exe" - { - // target source files - source type('cpp') "..\\myisam\\ft_eval.c" - } - target "..\\bin\\test\\ft_test1.exe" - { - // target source files - source type('cpp') "..\\myisam\\ft_test1.c" - } -/* - target "..\\bin\\test\\testhash.exe" - { - // target source files - source type('cpp') "..\\mysys\\testhash.c" - } -*/ - target "..\\bin\\test\\test_charset.exe" - { - // target source files - source type('cpp') "..\\mysys\\test_charset.c" - } - - target "..\\bin\\test\\hp_test1.exe" - { - // target source files - source type('cpp') "..\\heap\\hp_test1.c" - } - target "..\\bin\\test\\hp_test2.exe" - { - // target source files - source type('cpp') "..\\heap\\hp_test2.c" - } - -/* - option define( "MAIN", "") - { - target "..\\bin\\test\\thr_lock.exe" - { - // target source files - source type('cpp') "..\\mysys\\thr_lock.c" - } - } -*/ - - target "..\\bin\\test\\insert_test.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - source type('cpp') "..\\client\\insert_test.c" - } - target "..\\bin\\test\\select_test.exe" - { - source type('cpp') "..\\client\\select_test.c" - } - target "..\\bin\\test\\thread_test.exe" - { - // optimized precompiled headers - option macros('global', 'yes') - { - source type('cpp') client_global_pch - } - source type('cpp') "..\\client\\thread_test.c" - } - -} - -run after sources('..\bin\gen_lex_hash.exe') targets('..\sql\lex_hash.h') - 'cd ..\bin & ..\bin\gen_lex_hash.exe > ..\sql\lex_hash.h' diff --git a/os2/MySQL-Util.irs b/os2/MySQL-Util.irs deleted file mode 100644 index 183aa13ba27..00000000000 --- a/os2/MySQL-Util.irs +++ /dev/null @@ -1,3271 +0,0 @@ -31 Run Specifications: Version 1.1 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamchk.exe -1 -0 -0 -5 Local -0 -43 E:\rd\MySQL\vacpp-3.23.50\bin\myisamlog.exe -1 -0 -0 -5 Local -0 -44 E:\rd\MySQL\vacpp-3.23.50\bin\myisampack.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\comp_err.exe -1 -0 -0 -5 Local -0 -46 E:\rd\MySQL\vacpp-3.23.50\bin\gen_lex_hash.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\is_test1.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\is_test2.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\mi_test1.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\mi_test2.exe -1 -0 -0 -5 Local -0 -46 E:\rd\MySQL\vacpp-3.23.50\bin\test\ft_eval.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\ft_test1.exe -1 -0 -0 -5 Local -0 -51 E:\rd\MySQL\vacpp-3.23.50\bin\test\test_charset.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\hp_test1.exe -1 -0 -0 -5 Local -0 -47 E:\rd\MySQL\vacpp-3.23.50\bin\test\hp_test2.exe -1 -0 -0 -5 Local -0 -50 E:\rd\MySQL\vacpp-3.23.50\bin\test\insert_test.exe -1 -0 -0 -5 Local -0 -50 E:\rd\MySQL\vacpp-3.23.50\bin\test\select_test.exe -1 -0 -0 -5 Local -0 -50 E:\rd\MySQL\vacpp-3.23.50\bin\test\thread_test.exe -1 -0 -0 -5 Local -0 diff --git a/os2/ReadMe.txt b/os2/ReadMe.txt deleted file mode 100644 index 7dadf4a391d..00000000000 --- a/os2/ReadMe.txt +++ /dev/null @@ -1,205 +0,0 @@ -==================================================== - -Contents --------- -Welcome to the latest port of MySQL for OS/2 and eComStation. - -Modules included in this build: - - protocol data compression - - perl BDB/BDI support (not in this package) - - Library and header files for C/CPP developers included - -This package has been built using IBM VAC++ 4.0 - -The MySQL server is distributed under the GPL license. Please refer to -the file COPYING for the license information. - -The MySQL client library is distributed under the LGPL license. -Please refer to the file COPYING for the license information. - -Most of the MySQL clients are distributed under the GPL license, but -some files may be in the public domain. - -The latest information about MySQL can be found at: http://www.mysql.com - -To get the latest information about this port please subscribe to our -newsgroup/mailinglist mysql2 at groups.yahoo.com. - -To see what MySQL can do, take a look at the features section in the -manual. For future plans see the TODO appendix in the manual. - -New features/bug fixes history is in the news appendix in the manual. - -For the currently known bugs/misfeatures (known errors) see the bugs -appendix in the manual. The OS/2 section contains notes that are -specific to the MySQL OS/2 and eComStation version. - -Please note that MySQL is a constantly moving target. New builds for -Linux are made available every week. This port may therefore be a few -minor versions after the latest Linux/Win32 builds but its generally -more stable than the "latest and greates" port. - -MySQL is brought to you by: MySQL AB - -This port is brought to you by: - -Yuri Dario , development, porting -Timo Maier , documentation, testing -John M Alfredsson , documentation, testing - - -Installation ------------- -Prerequisite: - -- OS/2 Warp 3 with FP ?? or later, - OS/2 Warp 4 with FP ?? or later, - OS/2 Warp Server for e-Business, - eComStation 1.0 (prev 1/2 OK) -- TCPIP 4.x installed (requires 32-bit tcpip stack) -- WarpIN installer 0.9.16 (ftp://ftp.os2.org/xworkplace/warpin-0-9-16.exe) - -Note: probably some fixpak level is required on both Warp3&Warp4 to - support >2GB file sizes. - -Save the installation archives into a temporary folder and double click -on the main package; otherwise you can drop the mysql package in your -WarpIN object or type - - WARPIN MYSQL-3-23-??-B1.WPI - -from the command line. -The configuration file for MySQL is named my.cnf and it is placed into -your %ETC% directory. Usually it located into the boot driver under - - x:\MPTN\ETC - -If the installation detect an existing configuration file, it will not be -overwritten, keeping you settings; see x:\...\mysql\data\my.cnf.sample -for new settings. This file is not deleted by uninstall process. -Startup options for MySQL daemon could be added there. - -As default, client connections uses data compression: if you don't like it, -remove the following from your %ETC%\my.cnf - - [client] - compress - -The server switches automatically compression mode on client request. - -This release comes with DLL client library MYSQL.DLL: it is installed by -default into mysql\bin together with client applications. Copy it to your -x:\OS2\DLL or another directory in your LIBPATH to run command line -utilities from every place. - -See documentation for manuals installation. - - -New features ------------- -With build 4, the sql daemon supports a new option - - --preload-client-dll - -that enables preloading of mysql.dll and mysqlu.dll directly by the -server. This way, client programs doesn't need to have the dll's in -the current libpath. - - -Documentation -------------- -Documentation is provided in separate files. You can use either -the PDF documentation (requires Adobe Acrobat Reader) or the -INF documentation (requires OS/2 view or NewView). - -The PDF documentation is found in - - MYSQL-3-23-??-PDF.WPI - -and the INF documentation is found in - - MYSQL-3-23-28-INF.WPI - -The latest documentation in other formats can always be downloaded from -http://www.mysql.com. However this documentation may not fully apply to -this port. -The INF documentation could contain errors because of semi-automatic -translation from texi original. Also it is not updated as the latest PDF -manual (sorry, but conversion from texi to ipf requires quite a lot of -work). -To install the manuals, their WPI must be placed in the same directory -of the main WPI package: once the main package installation is started, -new install options will be available (inf or pdf manual). - - -Support -------- -Since MySQL is a OpenSource freeware product there are no -formal support options available. - -Please subscribe to mysql2 at www.yahoogroups.com to get in contact -with other users using this port. - -http://www.yahoogroups.com/group/mysql2 - -This newsgroup/mailinglist is the official "home" of this port. - - -Donations ---------- -Since this software is ported for free, donations are welcome! -You can get also an extended support, which is not free and subject to -custom rates. -Ask in the mailing list for details. -At least, a post card is welcome! - - -Know problems -------------- -alter_table.test and show_check are failing, reporting a different status -message: actually seems only a different text, no bugs in table checking. - - -Apache/2 + PHP --------------- -To avoid problems with different socket when you use PHP and Apache -webserver, get the PHP4 module from the Apache Server for OS/2 homepage -http://silk.apana.org.au/apache/ - - -Developing MySQL ----------------- -If you want to help us develop MySQL for OS2/eComStation please join -the mysql2 mailinglist at www.egroups.com and ask for help to set up -your environment! - -All questions that are specific to the OS2/eComStation version should -be posted to this list! Please remember to include all relevant -information that may help solve your problem. - - -Building MySQL (VAC++ 4) ------------------------- -Place zlib-1.1.4 at the same level of mysql-3.23.50 -Place ufc lib at the same level of mysql-3.23.50 - -Add the following files: - include\config-os2.h - include\mysql_version.h - mysys\my_os2*.* -Get the following files from Windows source distribution: - strings\ctype_extra_sources.c - libmysql\dll.c - -Apply file and patches found in the src\ directory (if exists). -Create the following subdirectories - - bin\ - bin\test - lib\ - obj\ - obj\zlib - -Build os2\MySQL-Client.icc project first. -Then os2\MySQL-Util.icc; last is os2\MySQL-Sql.icc - diff --git a/os2/build-all.cmd b/os2/build-all.cmd deleted file mode 100644 index 23558946c79..00000000000 --- a/os2/build-all.cmd +++ /dev/null @@ -1,10 +0,0 @@ - -mkdir ..\bin -mkdir ..\bin\test -mkdir ..\lib -mkdir ..\obj -mkdir ..\obj\zlib - -vacbld MySQL-Client.icc -showprogress=10 -showwarning >> build-all.log -vacbld MySQL-Sql.icc -showprogress=10 -showwarning >> build-all.log -vacbld MySQL-Util.icc -showprogress=10 -showwarning >> build-all.log diff --git a/os2/include/Makefile.am b/os2/include/Makefile.am deleted file mode 100644 index fcea89a2aa7..00000000000 --- a/os2/include/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2002 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; version 2 of the License. -# -# 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 - -## Process this file with automake to create Makefile.in - -EXTRA_DIST = config.h pwd.h sgtty.h termio.h -SUBDIRS = sys - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/os2/include/config.h b/os2/include/config.h deleted file mode 100644 index bb1e3d9bb0f..00000000000 --- a/os2/include/config.h +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -#undef HAVE_POSIX_SIGNALS -#undef HAVE_BSD_SIGNALS -#define TERMIO_TTY_DRIVER - -#define ScreenCols() 80 -#define ScreenRows() 25 - -#define tputs(a,b,c) puts(a) -#define kbhit _kbhit -//#define _read_kbd(a, b, c) _kbhit() diff --git a/os2/include/pwd.h b/os2/include/pwd.h deleted file mode 100644 index ec283586db2..00000000000 --- a/os2/include/pwd.h +++ /dev/null @@ -1 +0,0 @@ -/* dummy */ diff --git a/os2/include/sgtty.h b/os2/include/sgtty.h deleted file mode 100644 index ec283586db2..00000000000 --- a/os2/include/sgtty.h +++ /dev/null @@ -1 +0,0 @@ -/* dummy */ diff --git a/os2/include/sys/Makefile.am b/os2/include/sys/Makefile.am deleted file mode 100644 index 8379d3baa39..00000000000 --- a/os2/include/sys/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (C) 2002 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; version 2 of the License. -# -# 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 - -## Process this file with automake to create Makefile.in - -EXTRA_DIST = file.h - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/os2/include/sys/file.h b/os2/include/sys/file.h deleted file mode 100644 index ec283586db2..00000000000 --- a/os2/include/sys/file.h +++ /dev/null @@ -1 +0,0 @@ -/* dummy */ diff --git a/os2/include/termio.h b/os2/include/termio.h deleted file mode 100644 index cad88caccf9..00000000000 --- a/os2/include/termio.h +++ /dev/null @@ -1,156 +0,0 @@ -/* sys/termio.h (emx+gcc) */ - -#ifndef _SYS_TERMIO_H -#define _SYS_TERMIO_H - -#if defined (__cplusplus) -extern "C" { -#endif - -/* Request codes */ - -#if !defined (TCGETA) -#define TCGETA 1 -#define TCSETA 2 -#define TCSETAW 3 -#define TCSETAF 4 -#define TCFLSH 5 -#define TCSBRK 6 -#define TCXONC 7 -#endif - -/* c_cc indexes */ - -#if !defined (VINTR) /* Symbols common to termio.h and termios.h */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VEOL 5 -#define VMIN 6 -#define VTIME 7 -#endif - -#define NCC 8 /* Number of the above */ - -/* c_iflag, emx ignores most of the following bits */ - -#if !defined (IGNBRK) /* Symbols common to termio.h and termios.h */ -#define IGNBRK 0x0001 -#define BRKINT 0x0002 -#define IGNPAR 0x0004 -#define PARMRK 0x0008 -#define INPCK 0x0010 -#define ISTRIP 0x0020 -#define INLCR 0x0040 -#define IGNCR 0x0080 -#define ICRNL 0x0100 -#define IUCLC 0x0200 -#define IXON 0x0400 -#define IXANY 0x0800 -#define IXOFF 0x1000 -#define IDELETE 0x8000 /* Extension (emx) */ -#endif - -/* c_oflag, emx ignores all of the following bits */ - -#if !defined (OPOST) /* Symbols common to termio.h and termios.h */ -#define OPOST 0x0001 -#endif -#define OLCUC 0x0002 -#define ONLCR 0x0004 -#define OCRNL 0x0008 -#define ONOCR 0x0010 -#define ONLRET 0x0020 -#define OFILL 0x0040 -#define OFDEL 0x0080 -#define NLDLY 0x0100 /* Mask */ -#define NL0 0x0000 -#define NL1 0x0100 -#define CRDLY 0x0600 /* Mask */ -#define CR0 0x0000 -#define CR1 0x0200 -#define CR2 0x0400 -#define CR3 0x0600 -#define TABDLY 0x1800 /* Mask */ -#define TAB0 0x0000 -#define TAB1 0x0800 -#define TAB2 0x1000 -#define TAB3 0x1800 -#define BSDLY 0x2000 /* Mask */ -#define BS0 0x0000 -#define BS1 0x2000 -#define VTDLY 0x4000 /* Mask */ -#define VT0 0x0000 -#define VT1 0x4000 -#define FFDLY 0x8000 /* Mask */ -#define FF0 0x0000 -#define FF1 0x8000 - -/* c_cflag, emx ignores all of the following bits */ - -#if !defined (CBAUD) -#define CBAUD 0x000f /* Mask */ -#endif -#if !defined (B0) /* Symbols common to termio.h and termios.h */ -#define B0 0x0000 -#define B50 0x0001 -#define B75 0x0002 -#define B110 0x0003 -#define B134 0x0004 -#define B150 0x0005 -#define B200 0x0006 -#define B300 0x0007 -#define B600 0x0008 -#define B1200 0x0009 -#define B1800 0x000a -#define B2400 0x000b -#define B4800 0x000c -#define B9600 0x000d -#define B19200 0x000e -#define B38400 0x000f -#define CSIZE 0x0030 /* Mask */ -#define CS5 0x0000 -#define CS6 0x0010 -#define CS7 0x0020 -#define CS8 0x0030 -#define CSTOPB 0x0040 -#define CREAD 0x0080 -#define PARENB 0x0100 -#define PARODD 0x0200 -#define HUPCL 0x0400 -#define CLOCAL 0x0800 -#define LOBLK 0x1000 -#endif - -/* c_lflag, emx ignores some of the following bits */ - -#if !defined (ISIG) /* Symbols common to termio.h and termios.h */ -#define ISIG 0x0001 -#define ICANON 0x0002 -#define XCASE 0x0004 -#define ECHO 0x0008 -#define ECHOE 0x0010 -#define ECHOK 0x0020 -#define ECHONL 0x0040 -#define NOFLSH 0x0080 -#define IDEFAULT 0x8000 /* Extension (emx) */ -#endif - - -struct termio -{ - unsigned int c_iflag; - unsigned int c_oflag; - unsigned int c_cflag; - unsigned int c_lflag; - unsigned int c_line; - unsigned char c_cc[NCC]; -}; - -#if defined (__cplusplus) -} -#endif - -#endif /* not _SYS_TERMIO_H */ diff --git a/os2/mysql-inf.wis b/os2/mysql-inf.wis deleted file mode 100644 index 55259567a2e..00000000000 --- a/os2/mysql-inf.wis +++ /dev/null @@ -1,15 +0,0 @@ -#include "mysql.ih" - -> - - -This is not an installable archive. - -Please download and install the main archive: - - mysql-<$MySQL-Ver>-bld1.wpi - - - - - \ No newline at end of file diff --git a/os2/mysql.wis b/os2/mysql.wis deleted file mode 100644 index 50207a0c499..00000000000 --- a/os2/mysql.wis +++ /dev/null @@ -1,127 +0,0 @@ -#include "mysql.ih" - -> - - -This package will install MySQL for OS/2 SQL engine - - -This package will install MySQL for OS/2 sdk - - -This package will install MySQL for OS/2 documentation - - -This package will install MySQL for OS/2 documentation - - -This package will install MySQL for OS/2 test suite - - - - - - - - - - -~Next - - -ReadMe.txt - - - - -~I agree - -By pressing the "I agree" button, you agree to all terms and conditions to the below licence agreement. - -license.htm - - - - - - -~Next - -Please select the packages which are to be installed. You may change the target paths for the packages. - - - - - - -I~nstall - -Press "Install" to begin installing this archive. - - - - diff --git a/os2/mysqlalt.wis b/os2/mysqlalt.wis deleted file mode 100644 index 55259567a2e..00000000000 --- a/os2/mysqlalt.wis +++ /dev/null @@ -1,15 +0,0 @@ -#include "mysql.ih" - -> - - -This is not an installable archive. - -Please download and install the main archive: - - mysql-<$MySQL-Ver>-bld1.wpi - - - - - \ No newline at end of file diff --git a/os2/rint.cmd b/os2/rint.cmd deleted file mode 100644 index 522eff166bf..00000000000 --- a/os2/rint.cmd +++ /dev/null @@ -1,4 +0,0 @@ -REM -DLONG_DOUBLE -REM -DFLOAT -REM none -> double -gcc -Zomf -c -x assembler-with-cpp rint.s diff --git a/os2/rint.obj b/os2/rint.obj deleted file mode 100644 index 1231f093327..00000000000 Binary files a/os2/rint.obj and /dev/null differ diff --git a/os2/rint.s b/os2/rint.s deleted file mode 100644 index 7f6569ed72c..00000000000 --- a/os2/rint.s +++ /dev/null @@ -1,32 +0,0 @@ -/ rint.s (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes - -#include - -#define FUNC MATHSUFFIX2(rint) - - .globl LABEL(FUNC) - - .text - - ALIGN - -/ double _rint (double x) - -#define cw1 0(%esp) -#define cw2 2(%esp) -/define ret_addr 4(%esp) -#define x 8(%esp) - -LABEL(FUNC): - PROFILE_NOFRAME - subl $4, %esp - fstcww cw1 - movw cw1, %ax - andw $0xf3ff, %ax /* round to nearest or even */ - movw %ax, cw2 - fldcww cw2 - FLD x /* x */ - frndint - fldcww cw1 - addl $4, %esp - EPILOGUE(FUNC) diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql index 9f527c288e9..d32dfaac408 100644 --- a/scripts/fill_help_tables.sql +++ b/scripts/fill_help_tables.sql @@ -1,3 +1,18 @@ +-- Copyright (C) 2005 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; version 2 of the License. +-- +-- 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 + -- fill_help_tables.sql - this file is a placeholder to satisfy build dependencies - -- it will be replaced with the appropriate content by the Boostrap script that -- creates the official source distribution. diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 93a78037843..cafd550f839 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2000-2006 MySQL AB +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist index 34134ccd977..c1d01a0342d 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 diff --git a/scripts/make_win_src_distribution_old.sh b/scripts/make_win_src_distribution_old.sh index f319bad6d55..68a29d1d59f 100644 --- a/scripts/make_win_src_distribution_old.sh +++ b/scripts/make_win_src_distribution_old.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2003-2006 MySQL AB +# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -19,7 +19,7 @@ # new CMake build was added. The new build obsoletes this script, Unix # and Windows share the same source TAR/ZIP. # Also note that the old build from source created by this script is -# no longer tested by MySQL AB and may not work. Please use the new +# no longer tested by Oracle and may not work. Please use the new # CMake based build. # Terminate loudly on error, we don't want partial package diff --git a/scripts/mysql_fix_extensions.sh b/scripts/mysql_fix_extensions.sh index 6d4e017f678..74a47fdf4a1 100644 --- a/scripts/mysql_fix_extensions.sh +++ b/scripts/mysql_fix_extensions.sh @@ -1,4 +1,22 @@ #!/usr/bin/perl + +# Copyright (C) 2001 MySQL AB, 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # This is a utility for MySQL. It is not needed by any standard part # of MySQL. diff --git a/scripts/mysql_prepare_privilege_tables_for_5.sql b/scripts/mysql_prepare_privilege_tables_for_5.sql index a9b6d43aee0..5101ac3c6fb 100644 --- a/scripts/mysql_prepare_privilege_tables_for_5.sql +++ b/scripts/mysql_prepare_privilege_tables_for_5.sql @@ -1,3 +1,17 @@ +-- 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; version 2 of the License. +-- +-- 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 use mysql; diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh index 9b49345175a..d2a5a00cd3e 100644 --- a/scripts/mysql_setpermission.sh +++ b/scripts/mysql_setpermission.sh @@ -1,5 +1,23 @@ #!/usr/bin/perl ## Emacs, this is -*- perl -*- mode? :-) + +# Copyright (C) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + ## ## Permission setter for MySQL ## diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index aca87b01bc3..f3c1a0f7c61 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -1,3 +1,18 @@ +-- Copyright (C) 2007, 2008 MySQL AB, 2009 Sun Microsystems, Inc. +-- +-- 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; version 2 of the License. +-- +-- 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 + -- -- The system tables of MySQL Server -- diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index b70a8a13f6e..e934ff927cb 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -1,3 +1,18 @@ +-- Copyright (C) 2007, 2008 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; version 2 of the License. +-- +-- 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 + -- -- The inital data for system tables of MySQL Server -- diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index cfd03b7c45d..b390aa33385 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -1,3 +1,18 @@ +# Copyright (C) 2003, 2007 MySQL AB, 2009 Sun Microsystems, Inc. +# +# 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; version 2 of the License. +# +# 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 + # This part converts any old privilege tables to privilege tables suitable # for current version of MySQL diff --git a/scripts/mysql_tableinfo.sh b/scripts/mysql_tableinfo.sh index c90c410ca78..9bbb78a700e 100644 --- a/scripts/mysql_tableinfo.sh +++ b/scripts/mysql_tableinfo.sh @@ -1,5 +1,22 @@ #!/usr/bin/perl +# Copyright (C) 2002, 2007 MySQL AB +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + use strict; use Getopt::Long; use DBI; diff --git a/scripts/mysql_test_data_timezone.sql b/scripts/mysql_test_data_timezone.sql index e52df2149f2..6bf28148e5e 100644 --- a/scripts/mysql_test_data_timezone.sql +++ b/scripts/mysql_test_data_timezone.sql @@ -1,3 +1,18 @@ +-- Copyright (C) 2007 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; version 2 of the License. +-- +-- 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 + INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5); INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1) ,(1, -1663455600, 2) ,(1, -1650150000, 3) ,(1, -1632006000, 2) ,(1, -1618700400, 3) ,(1, -938905200, 2) ,(1, -857257200, 3) ,(1, -844556400, 2) ,(1, -828226800, 3) ,(1, -812502000, 2) ,(1, -796777200, 3) ,(1, 228877200, 2) ,(1, 243997200, 3) ,(1, 260326800, 2) ,(1, 276051600, 3) ,(1, 291776400, 2) ,(1, 307501200, 3) ,(1, 323830800, 2) ,(1, 338950800, 3) ,(1, 354675600, 2) ,(1, 370400400, 3) ,(1, 386125200, 2) ,(1, 401850000, 3) ,(1, 417574800, 2) ,(1, 433299600, 3) ,(1, 449024400, 2) ,(1, 465354000, 3) ,(1, 481078800, 2) ,(1, 496803600, 3) ,(1, 512528400, 2) ,(1, 528253200, 3) ,(1, 543978000, 2) ,(1, 559702800, 3) ,(1, 575427600, 2) ,(1, 591152400, 3) ,(1, 606877200, 2) ,(1, 622602000, 3) ,(1, 638326800, 2) ,(1, 654656400, 3) ,(1, 670381200, 2) ,(1, 686106000, 3) ,(1, 701830800, 2) ,(1, 717555600, 3) ,(1, 733280400, 2) ,(1, 749005200, 3) ,(1, 764730000, 2) ,(1, 780454800, 3) ,(1, 796179600, 2) ,(1, 811904400, 3) ,(1, 828234000, 2) ,(1, 846378000, 3) ,(1, 859683600, 2) ,(1, 877827600, 3) ,(1, 891133200, 2) ,(1, 909277200, 3) ,(1, 922582800, 2) ,(1, 941331600, 3) ,(1, 954032400, 2) ,(1, 972781200, 3) ,(1, 985482000, 2) ,(1, 1004230800, 3) ,(1, 1017536400, 2) ,(1, 1035680400, 3) ,(1, 1048986000, 2) ,(1, 1067130000, 3) ,(1, 1080435600, 2) ,(1, 1099184400, 3) ,(1, 1111885200, 2) ,(1, 1130634000, 3) ,(1, 1143334800, 2) ,(1, 1162083600, 3) ,(1, 1174784400, 2) ,(1, 1193533200, 3) ,(1, 1206838800, 2) ,(1, 1224982800, 3) ,(1, 1238288400, 2) ,(1, 1256432400, 3) ,(1, 1269738000, 2) ,(1, 1288486800, 3) ,(1, 1301187600, 2) ,(1, 1319936400, 3) ,(1, 1332637200, 2) ,(1, 1351386000, 3) ,(1, 1364691600, 2) ,(1, 1382835600, 3) ,(1, 1396141200, 2) ,(1, 1414285200, 3) ,(1, 1427590800, 2) ,(1, 1445734800, 3) ,(1, 1459040400, 2) ,(1, 1477789200, 3) ,(1, 1490490000, 2) ,(1, 1509238800, 3) ,(1, 1521939600, 2) ,(1, 1540688400, 3) ,(1, 1553994000, 2) ,(1, 1572138000, 3) ,(1, 1585443600, 2) ,(1, 1603587600, 3) ,(1, 1616893200, 2) ,(1, 1635642000, 3) ,(1, 1648342800, 2) ,(1, 1667091600, 3) ,(1, 1679792400, 2) ,(1, 1698541200, 3) ,(1, 1711846800, 2) ,(1, 1729990800, 3) ,(1, 1743296400, 2) ,(1, 1761440400, 3) ,(1, 1774746000, 2) ,(1, 1792890000, 3) ,(1, 1806195600, 2) ,(1, 1824944400, 3) ,(1, 1837645200, 2) ,(1, 1856394000, 3) ,(1, 1869094800, 2) ,(1, 1887843600, 3) ,(1, 1901149200, 2) ,(1, 1919293200, 3) ,(1, 1932598800, 2) ,(1, 1950742800, 3) ,(1, 1964048400, 2) ,(1, 1982797200, 3) ,(1, 1995498000, 2) ,(1, 2014246800, 3) ,(1, 2026947600, 2) ,(1, 2045696400, 3) ,(1, 2058397200, 2) ,(1, 2077146000, 3) ,(1, 2090451600, 2) ,(1, 2108595600, 3) ,(1, 2121901200, 2) ,(1, 2140045200, 3) ,(3, -1688265000, 2) ,(3, -1656819048, 1) ,(3, -1641353448, 2) ,(3, -1627965048, 3) ,(3, -1618716648, 1) ,(3, -1596429048, 3) ,(3, -1593829848, 5) ,(3, -1589860800, 4) ,(3, -1542427200, 5) ,(3, -1539493200, 6) ,(3, -1525323600, 5) ,(3, -1522728000, 4) ,(3, -1491188400, 7) ,(3, -1247536800, 4) ,(3, 354920400, 5) ,(3, 370728000, 4) ,(3, 386456400, 5) ,(3, 402264000, 4) ,(3, 417992400, 5) ,(3, 433800000, 4) ,(3, 449614800, 5) ,(3, 465346800, 8) ,(3, 481071600, 9) ,(3, 496796400, 8) ,(3, 512521200, 9) ,(3, 528246000, 8) ,(3, 543970800, 9) ,(3, 559695600, 8) ,(3, 575420400, 9) ,(3, 591145200, 8) ,(3, 606870000, 9) ,(3, 622594800, 8) ,(3, 638319600, 9) ,(3, 654649200, 8) ,(3, 670374000, 10) ,(3, 686102400, 11) ,(3, 695779200, 8) ,(3, 701812800, 5) ,(3, 717534000, 4) ,(3, 733273200, 9) ,(3, 748998000, 8) ,(3, 764722800, 9) ,(3, 780447600, 8) ,(3, 796172400, 9) ,(3, 811897200, 8) ,(3, 828226800, 9) ,(3, 846370800, 8) ,(3, 859676400, 9) ,(3, 877820400, 8) ,(3, 891126000, 9) ,(3, 909270000, 8) ,(3, 922575600, 9) ,(3, 941324400, 8) ,(3, 954025200, 9) ,(3, 972774000, 8) ,(3, 985474800, 9) ,(3, 1004223600, 8) ,(3, 1017529200, 9) ,(3, 1035673200, 8) ,(3, 1048978800, 9) ,(3, 1067122800, 8) ,(3, 1080428400, 9) ,(3, 1099177200, 8) ,(3, 1111878000, 9) ,(3, 1130626800, 8) ,(3, 1143327600, 9) ,(3, 1162076400, 8) ,(3, 1174777200, 9) ,(3, 1193526000, 8) ,(3, 1206831600, 9) ,(3, 1224975600, 8) ,(3, 1238281200, 9) ,(3, 1256425200, 8) ,(3, 1269730800, 9) ,(3, 1288479600, 8) ,(3, 1301180400, 9) ,(3, 1319929200, 8) ,(3, 1332630000, 9) ,(3, 1351378800, 8) ,(3, 1364684400, 9) ,(3, 1382828400, 8) ,(3, 1396134000, 9) ,(3, 1414278000, 8) ,(3, 1427583600, 9) ,(3, 1445727600, 8) ,(3, 1459033200, 9) ,(3, 1477782000, 8) ,(3, 1490482800, 9) ,(3, 1509231600, 8) ,(3, 1521932400, 9) ,(3, 1540681200, 8) ,(3, 1553986800, 9) ,(3, 1572130800, 8) ,(3, 1585436400, 9) ,(3, 1603580400, 8) ,(3, 1616886000, 9) ,(3, 1635634800, 8) ,(3, 1648335600, 9) ,(3, 1667084400, 8) ,(3, 1679785200, 9) ,(3, 1698534000, 8) ,(3, 1711839600, 9) ,(3, 1729983600, 8) ,(3, 1743289200, 9) ,(3, 1761433200, 8) ,(3, 1774738800, 9) ,(3, 1792882800, 8) ,(3, 1806188400, 9) ,(3, 1824937200, 8) ,(3, 1837638000, 9) ,(3, 1856386800, 8) ,(3, 1869087600, 9) ,(3, 1887836400, 8) ,(3, 1901142000, 9) ,(3, 1919286000, 8) ,(3, 1932591600, 9) ,(3, 1950735600, 8) ,(3, 1964041200, 9) ,(3, 1982790000, 8) ,(3, 1995490800, 9) ,(3, 2014239600, 8) ,(3, 2026940400, 9) ,(3, 2045689200, 8) ,(3, 2058390000, 9) ,(3, 2077138800, 8) ,(3, 2090444400, 9) ,(3, 2108588400, 8) ,(3, 2121894000, 9) ,(3, 2140038000, 8) ,(4, -1688265000, 2) ,(4, -1656819048, 1) ,(4, -1641353448, 2) ,(4, -1627965048, 3) ,(4, -1618716648, 1) ,(4, -1596429048, 3) ,(4, -1593829848, 5) ,(4, -1589860800, 4) ,(4, -1542427200, 5) ,(4, -1539493200, 6) ,(4, -1525323600, 5) ,(4, -1522728000, 4) ,(4, -1491188400, 7) ,(4, -1247536800, 4) ,(4, 354920409, 5) ,(4, 370728010, 4) ,(4, 386456410, 5) ,(4, 402264011, 4) ,(4, 417992411, 5) ,(4, 433800012, 4) ,(4, 449614812, 5) ,(4, 465346812, 8) ,(4, 481071612, 9) ,(4, 496796413, 8) ,(4, 512521213, 9) ,(4, 528246013, 8) ,(4, 543970813, 9) ,(4, 559695613, 8) ,(4, 575420414, 9) ,(4, 591145214, 8) ,(4, 606870014, 9) ,(4, 622594814, 8) ,(4, 638319615, 9) ,(4, 654649215, 8) ,(4, 670374016, 10) ,(4, 686102416, 11) ,(4, 695779216, 8) ,(4, 701812816, 5) ,(4, 717534017, 4) ,(4, 733273217, 9) ,(4, 748998018, 8) ,(4, 764722818, 9) ,(4, 780447619, 8) ,(4, 796172419, 9) ,(4, 811897219, 8) ,(4, 828226820, 9) ,(4, 846370820, 8) ,(4, 859676420, 9) ,(4, 877820421, 8) ,(4, 891126021, 9) ,(4, 909270021, 8) ,(4, 922575622, 9) ,(4, 941324422, 8) ,(4, 954025222, 9) ,(4, 972774022, 8) ,(4, 985474822, 9) ,(4, 1004223622, 8) ,(4, 1017529222, 9) ,(4, 1035673222, 8) ,(4, 1048978822, 9) ,(4, 1067122822, 8) ,(4, 1080428422, 9) ,(4, 1099177222, 8) ,(4, 1111878022, 9) ,(4, 1130626822, 8) ,(4, 1143327622, 9) ,(4, 1162076422, 8) ,(4, 1174777222, 9) ,(4, 1193526022, 8) ,(4, 1206831622, 9) ,(4, 1224975622, 8) ,(4, 1238281222, 9) ,(4, 1256425222, 8) ,(4, 1269730822, 9) ,(4, 1288479622, 8) ,(4, 1301180422, 9) ,(4, 1319929222, 8) ,(4, 1332630022, 9) ,(4, 1351378822, 8) ,(4, 1364684422, 9) ,(4, 1382828422, 8) ,(4, 1396134022, 9) ,(4, 1414278022, 8) ,(4, 1427583622, 9) ,(4, 1445727622, 8) ,(4, 1459033222, 9) ,(4, 1477782022, 8) ,(4, 1490482822, 9) ,(4, 1509231622, 8) ,(4, 1521932422, 9) ,(4, 1540681222, 8) ,(4, 1553986822, 9) ,(4, 1572130822, 8) ,(4, 1585436422, 9) ,(4, 1603580422, 8) ,(4, 1616886022, 9) ,(4, 1635634822, 8) ,(4, 1648335622, 9) ,(4, 1667084422, 8) ,(4, 1679785222, 9) ,(4, 1698534022, 8) ,(4, 1711839622, 9) ,(4, 1729983622, 8) ,(4, 1743289222, 9) ,(4, 1761433222, 8) ,(4, 1774738822, 9) ,(4, 1792882822, 8) ,(4, 1806188422, 9) ,(4, 1824937222, 8) ,(4, 1837638022, 9) ,(4, 1856386822, 8) ,(4, 1869087622, 9) ,(4, 1887836422, 8) ,(4, 1901142022, 9) ,(4, 1919286022, 8) ,(4, 1932591622, 9) ,(4, 1950735622, 8) ,(4, 1964041222, 9) ,(4, 1982790022, 8) ,(4, 1995490822, 9) ,(4, 2014239622, 8) ,(4, 2026940422, 9) ,(4, 2045689222, 8) ,(4, 2058390022, 9) ,(4, 2077138822, 8) ,(4, 2090444422, 9) ,(4, 2108588422, 8) ,(4, 2121894022, 9) ,(4, 2140038022, 8) ,(5, -1009875600, 1); diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index 0153a3afa7c..4e208e6c16e 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -1,4 +1,22 @@ #!/usr/bin/perl + +# Copyright (C) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # **************************** package MySQLaccess; #use strict; diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index a6330055f99..87eb35a52fc 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -1,5 +1,22 @@ #!/usr/bin/perl +# Copyright (C) 2000, 2007 MySQL AB, 2008, 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + use Getopt::Long; use POSIX qw(strftime getcwd); diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh index 009745fd896..d1bb23370b7 100644 --- a/scripts/mysqldumpslow.sh +++ b/scripts/mysqldumpslow.sh @@ -1,4 +1,22 @@ #!/usr/bin/perl + +# Copyright (C) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + # mysqldumpslow - parse and summarize the MySQL slow query log # Original version by Tim Bunce, sometime in 2000. diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 21fca0c0848..30359f4bb29 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -1,5 +1,22 @@ #!/usr/bin/perl +# Copyright (C) 2000, 2008 MySQL AB, 2009 Sun Microsystems, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA + use strict; use Getopt::Long; use Data::Dumper; diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 9eb148c4e3b..7c80b2e8b23 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2006 MySQL AB +/* Copyright (C) 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc. 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 @@ -185,7 +185,7 @@ static void usage() { version(); - printf("Copyright (C) 2003, 2004 MySQL AB\n" + printf("Copyright (C) 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc.\n" "This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to modify and redistribute it under the GPL license\n"); printf("Usage: %s [OPTIONS] \n", my_progname); diff --git a/sql/field.cc b/sql/field.cc index b61e5fd2d79..0b74f9e5a65 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index ef671ac7f9d..f59c7f0a4da 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (C) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc. 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 @@ -446,7 +446,7 @@ int main(int argc,char **argv) printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); printf("\ -/* Copyright (C) 2001-2004 MySQL AB\n\ +/* Copyright (C) 2000-2007 MySQL AB, 2008 Sun Microsystems, Inc.\n\ \n\ This program is free software; you can redistribute it and/or modify\n\ it under the terms of the GNU General Public License as published by\n\ diff --git a/sql/item.h b/sql/item.h index 31d501dc5c3..49adcc6c516 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 5c2fb9857d5..60c8cbdad45 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 233922fe2f8..3c9e976d0c3 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/item_func.cc b/sql/item_func.cc index cb0d6bdbe5f..579ef44b14f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/item_func.h b/sql/item_func.h index 47a13559e90..96af2602821 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 1822a7ced56..44d1378839b 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 244ea4c34b6..43102213b9b 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/message.h b/sql/message.h index 0e7c282d5a1..f2a2de5a8fb 100644 --- a/sql/message.h +++ b/sql/message.h @@ -1,3 +1,18 @@ +/* Copyright 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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 */ + /* To change or add messages mysqld writes to the Windows error log, run mc.exe message.mc diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bda4e796ce2..5f84d15588d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 1d1871e27a8..ddd57c8fb9a 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 @@ -15,9 +15,9 @@ /* This file is the net layer API for the MySQL client/server protocol, - which is a tightly coupled, proprietary protocol owned by MySQL AB. + which is a tightly coupled, proprietary protocol owned by Oracle. Any re-implementations of this protocol must also be under GPL - unless one has got an license from MySQL AB stating otherwise. + unless one has got an license from Oracle stating otherwise. */ /* diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 35d1216387c..e62fff8329c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/set_var.cc b/sql/set_var.cc index 16a22f129e6..9c327504577 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/set_var.h b/sql/set_var.h index 9945c69cac0..2c9745163e9 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2006 MySQL AB +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 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 diff --git a/sql/share/charsets/languages.html b/sql/share/charsets/languages.html index 6d1a8aafc5c..76af973113e 100644 --- a/sql/share/charsets/languages.html +++ b/sql/share/charsets/languages.html @@ -1,4 +1,20 @@ #!/bin/sh + +# 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; version 2 of the License. +# +# 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 + #
     (
     echo "DROP TABLE lang;"
    diff --git a/sql/sql_base.cc b/sql/sql_base.cc
    index 88d1e8879d1..4a1d3a96ef8 100644
    --- a/sql/sql_base.cc
    +++ b/sql/sql_base.cc
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2006 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_class.h b/sql/sql_class.h
    index c195c8be864..2f4af15c02d 100644
    --- a/sql/sql_class.h
    +++ b/sql/sql_class.h
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2006 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
    index b730e2585ae..1bd68e5424f 100644
    --- a/sql/sql_parse.cc
    +++ b/sql/sql_parse.cc
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2003 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
    index 9815acfe815..9492b2ae180 100644
    --- a/sql/sql_prepare.cc
    +++ b/sql/sql_prepare.cc
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 1995-2002 MySQL AB
    +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_select.cc b/sql/sql_select.cc
    index 53a6b699022..904610b9031 100644
    --- a/sql/sql_select.cc
    +++ b/sql/sql_select.cc
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2006 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_select.h b/sql/sql_select.h
    index 346d98aae58..a885507446e 100644
    --- a/sql/sql_select.h
    +++ b/sql/sql_select.h
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2006 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_show.cc b/sql/sql_show.cc
    index 1075e7f76d1..56f0ce78c8c 100644
    --- a/sql/sql_show.cc
    +++ b/sql/sql_show.cc
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2004 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/sql_update.cc b/sql/sql_update.cc
    index 8d666c771ec..661f3465696 100644
    --- a/sql/sql_update.cc
    +++ b/sql/sql_update.cc
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2006 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/sql/table.h b/sql/table.h
    index 0a89db8bbff..33bee9f659d 100644
    --- a/sql/table.h
    +++ b/sql/table.h
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2000-2006 MySQL AB
    +/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/strings/strtod.c b/strings/strtod.c
    index 5fe59d10bd2..4817be6fac0 100644
    --- a/strings/strtod.c
    +++ b/strings/strtod.c
    @@ -1,3 +1,25 @@
    +/* Copyright (C) 2000, 2007 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; version 2 of the License.
    +
    +   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 */
    +
    +/*
    +    strnmov(dst,src,length) moves length characters, or until end, of src to
    +    dst and appends a closing NUL to dst if src is shorter than length.
    +    The result is a pointer to the first NUL in dst, or is dst+n if dst was
    +    truncated.
    +*/
    +
     /*
       An alternative implementation of "strtod()" that is both
       simplier, and thread-safe.
    diff --git a/support-files/MacOSX/Description.plist.sh b/support-files/MacOSX/Description.plist.sh
    index 03212dfdeff..a41e5891ecc 100644
    --- a/support-files/MacOSX/Description.plist.sh
    +++ b/support-files/MacOSX/Description.plist.sh
    @@ -1,5 +1,21 @@
     
     
    +
     
     
     	IFPkgDescriptionDeleteWarning
    diff --git a/support-files/MacOSX/Info.plist.sh b/support-files/MacOSX/Info.plist.sh
    index 7df9c5ac710..c6ec1edeac4 100644
    --- a/support-files/MacOSX/Info.plist.sh
    +++ b/support-files/MacOSX/Info.plist.sh
    @@ -1,5 +1,21 @@
     
     
    +
     
     
     	CFBundleGetInfoString
    diff --git a/support-files/MacOSX/Makefile.am b/support-files/MacOSX/Makefile.am
    index 3f11107d714..4ee5b90263c 100644
    --- a/support-files/MacOSX/Makefile.am
    +++ b/support-files/MacOSX/Makefile.am
    @@ -1,11 +1,11 @@
     # Copyright (C) 2003-2006 MySQL AB
     #
    -# This library is free software; you can redistribute it and/or
    +# This program is free software; you can redistribute it and/or
     # modify it under the terms of the GNU Library General Public
     # License as published by the Free Software Foundation; version 2
     # of the License.
     #
    -# This library is distributed in the hope that it will be useful,
    +# 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
     # Library General Public License for more details.
    diff --git a/support-files/MacOSX/MySQLCOM b/support-files/MacOSX/MySQLCOM
    index 9be5edb56f7..4d55fb44ec0 100755
    --- a/support-files/MacOSX/MySQLCOM
    +++ b/support-files/MacOSX/MySQLCOM
    @@ -1,4 +1,20 @@
     #!/bin/sh
    +
    +# Copyright (C) 2003, 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
    +# the Free Software Foundation; version 2 of the License.
    +# 
    +# 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
    +
     #
     # /Library/StartupItems/MySQLCOM/MySQLCOM
     #
    diff --git a/support-files/MacOSX/StartupItem.Description.plist b/support-files/MacOSX/StartupItem.Description.plist
    index e8ceb1ee062..1e0d975e0f2 100644
    --- a/support-files/MacOSX/StartupItem.Description.plist
    +++ b/support-files/MacOSX/StartupItem.Description.plist
    @@ -1,5 +1,21 @@
     
     
    +
     
     
     	IFPkgDescriptionDeleteWarning
    diff --git a/support-files/MacOSX/StartupItem.Info.plist b/support-files/MacOSX/StartupItem.Info.plist
    index f403fbe7e84..7e348c4adec 100644
    --- a/support-files/MacOSX/StartupItem.Info.plist
    +++ b/support-files/MacOSX/StartupItem.Info.plist
    @@ -1,5 +1,21 @@
     
     
    +
     
     
     	CFBundleGetInfoString
    diff --git a/support-files/MacOSX/StartupItem.postinstall b/support-files/MacOSX/StartupItem.postinstall
    index f6f6f46f211..ddbd9732a5c 100755
    --- a/support-files/MacOSX/StartupItem.postinstall
    +++ b/support-files/MacOSX/StartupItem.postinstall
    @@ -1,4 +1,20 @@
     #!/bin/sh
    +
    +# 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # postinstall script for the MySQL Startup Item Installation package
     #
    diff --git a/support-files/MacOSX/StartupParameters.plist.sh b/support-files/MacOSX/StartupParameters.plist.sh
    index f5620c73f5f..35bc5a4f647 100644
    --- a/support-files/MacOSX/StartupParameters.plist.sh
    +++ b/support-files/MacOSX/StartupParameters.plist.sh
    @@ -1,5 +1,21 @@
     
     
    +
     
     
     	Description
    diff --git a/support-files/MacOSX/mwar-wrapper b/support-files/MacOSX/mwar-wrapper
    index 4bc5153e7ef..53624931b3b 100755
    --- a/support-files/MacOSX/mwar-wrapper
    +++ b/support-files/MacOSX/mwar-wrapper
    @@ -1,5 +1,20 @@
     #!/bin/sh
     
    +# Copyright (C) 2005 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; version 2 of the License.
    +# 
    +# 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
    +
     # This script can only create a library, not take it apart
     # again to AR files
     
    diff --git a/support-files/MacOSX/mwcc-wrapper b/support-files/MacOSX/mwcc-wrapper
    index 914578aca1d..162b2e24479 100755
    --- a/support-files/MacOSX/mwcc-wrapper
    +++ b/support-files/MacOSX/mwcc-wrapper
    @@ -1,5 +1,20 @@
     #!/bin/sh
     
    +# Copyright (C) 2005 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; version 2 of the License.
    +# 
    +# 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
    +
     if [ -z "$CWINSTALL" ] ; then
         echo "ERROR: You need to source 'mwvars' to set CWINSTALL and other variables"
         exit 1
    diff --git a/support-files/MacOSX/postflight.sh b/support-files/MacOSX/postflight.sh
    index 451eb65e0d7..1e55c542c89 100644
    --- a/support-files/MacOSX/postflight.sh
    +++ b/support-files/MacOSX/postflight.sh
    @@ -1,4 +1,22 @@
     #!/bin/sh
    +
    +# Copyright (C) 2003, 2005 MySQL AB
    +#
    +# This program is free software; you can redistribute it and/or
    +# modify it under the terms of the GNU Library General Public
    +# License as published by the Free Software Foundation; version 2
    +# of the License.
    +#
    +# 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
    +# Library General Public License for more details.
    +#
    +# You should have received a copy of the GNU Library General Public
    +# License along with this library; if not, write to the Free
    +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
    +# MA 02111-1307, USA
    +
     #
     # postflight - this script will be executed after the MySQL PKG
     # installation has been performed.
    diff --git a/support-files/MacOSX/preflight.sh b/support-files/MacOSX/preflight.sh
    index 700d0640a9e..a214008cf52 100644
    --- a/support-files/MacOSX/preflight.sh
    +++ b/support-files/MacOSX/preflight.sh
    @@ -1,4 +1,22 @@
     #!/bin/sh
    +
    +# Copyright (C) 2003, 2005 MySQL AB
    +#
    +# This program is free software; you can redistribute it and/or
    +# modify it under the terms of the GNU Library General Public
    +# License as published by the Free Software Foundation; version 2
    +# of the License.
    +#
    +# 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
    +# Library General Public License for more details.
    +#
    +# You should have received a copy of the GNU Library General Public
    +# License along with this library; if not, write to the Free
    +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
    +# MA 02111-1307, USA
    +
     #
     # preflight - this script will be executed before the MySQL PKG
     # installation will be performed.
    diff --git a/support-files/Makefile.am b/support-files/Makefile.am
    index 4cb8bb4645d..7371a6a53a2 100644
    --- a/support-files/Makefile.am
    +++ b/support-files/Makefile.am
    @@ -1,11 +1,11 @@
     # Copyright (C) 2000-2006 MySQL AB, 2008-2010 Sun Microsystems, Inc.
     #
    -# This library is free software; you can redistribute it and/or
    +# This program is free software; you can redistribute it and/or
     # modify it under the terms of the GNU Library General Public
     # License as published by the Free Software Foundation; version 2
     # of the License.
     #
    -# This library is distributed in the hope that it will be useful,
    +# 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
     # Library General Public License for more details.
    diff --git a/support-files/RHEL4-SElinux/Makefile.am b/support-files/RHEL4-SElinux/Makefile.am
    index 52292136877..960a1fea554 100644
    --- a/support-files/RHEL4-SElinux/Makefile.am
    +++ b/support-files/RHEL4-SElinux/Makefile.am
    @@ -1,11 +1,11 @@
     # Copyright (C) 2000-2001, 2003-2006 MySQL AB
     #
    -# This library is free software; you can redistribute it and/or
    +# This program is free software; you can redistribute it and/or
     # modify it under the terms of the GNU Library General Public
     # License as published by the Free Software Foundation; version 2
     # of the License.
     #
    -# This library is distributed in the hope that it will be useful,
    +# 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
     # Library General Public License for more details.
    diff --git a/support-files/RHEL4-SElinux/mysql.fc b/support-files/RHEL4-SElinux/mysql.fc
    index 0db0ccf6e68..b44795e6f8c 100644
    --- a/support-files/RHEL4-SElinux/mysql.fc
    +++ b/support-files/RHEL4-SElinux/mysql.fc
    @@ -1,3 +1,18 @@
    +# Copyright (C) 2007 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; version 2 of the License.
    +#
    +# 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
    +
     # MySQL Database Server
     
     #
    diff --git a/support-files/RHEL4-SElinux/mysql.te b/support-files/RHEL4-SElinux/mysql.te
    index b050fa7b1a6..922389305ea 100644
    --- a/support-files/RHEL4-SElinux/mysql.te
    +++ b/support-files/RHEL4-SElinux/mysql.te
    @@ -1,3 +1,17 @@
    +# Copyright (C) 2007 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; version 2 of the License.
    +#
    +# 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
     
     policy_module(mysql,1.0.0)
     
    diff --git a/support-files/SCO/INSTALL.sh b/support-files/SCO/INSTALL.sh
    deleted file mode 100755
    index 979f33f3f06..00000000000
    --- a/support-files/SCO/INSTALL.sh
    +++ /dev/null
    @@ -1,29 +0,0 @@
    -#!/bin/sh
    -
    -# search & check GNU patch
    -PATCH="gpatch"
    -$PATCH --version || PATCH="patch"
    -$PATCH --version || exit
    -
    -
    -if /usr/bin/test ! -e PKG/stamp-pre ; then
    -  grep VERSION configure | head -1 | sed 's/VERSION=//' > ./PKG/version
    -  touch PKG/stamp-pre
    -fi
    -
    -if /usr/bin/test ! -e PKG/stamp-patch ; then
    - ${PATCH} -p0 < ./PKG/patch
    - touch PKG/stamp-patch
    -fi
    -
    -if /usr/bin/test ! -e PKG/stamp-compile ; then
    -sh ./PKG/compile.sh ujis
    -touch PKG/stamp-compile
    -
    -sh ./PKG/doc.sh ujis
    -
    -fi
    -
    -
    -cd PKG
    -sh mkpkg.sh ujis
    diff --git a/support-files/SCO/compile.sh b/support-files/SCO/compile.sh
    deleted file mode 100644
    index 5281ccde02d..00000000000
    --- a/support-files/SCO/compile.sh
    +++ /dev/null
    @@ -1,102 +0,0 @@
    -#!/bin/sh
    -# GNU ncurses
    -
    -# search & check GNU make
    -GMAKE="gmake"
    -$GMAKE --version || GMAKE="make"
    -$GMAKE --version || exit
    -
    -MAKE=$GMAKE
    -export MAKE
    -
    -CC=gcc
    -CFLAGS="-O6 -fomit-frame-pointer"
    -CXX=gcc
    -CXXFLAGS="-O6 -fomit-frame-pointer -felide-constructors  -fno-exceptions -fno-rtti"
    -# LDFLAGS="-static"
    -LD=gcc
    -
    -export CC
    -export CXX
    -export LD
    -export CFLAGS
    -export CXXFLAGS
    -# export LDFLAGS
    -# Solaris don't have libpthread.a.
    -
    -if [ "x$1" = "x" ]; then
    -  echo " please set character set"
    -  exit
    -fi
    -
    -CHAR="$1"
    -case "$1" in
    - [uU]*)
    -   CHAR=ujis
    -   ;;
    - [sS]*)
    -   CHAR=sjis
    -   ;;
    -esac
    - 
    -#---------------
    -P=`pwd`
    -
    -if [ -f Makefile ] ; then
    -    ${GMAKE} distclean
    -fi
    -
    -for i in bin sbin include man share/doc/mysql mysql-data
    -do
    -  /usr/bin/mkdir -p PKG/tmp-${CHAR}/usr/local/${i}
    -done
    -/usr/bin/mkdir -p PKG/tmp-${CHAR}/etc/init.d
    -
    -#----------------------------
    -./configure \
    -   --prefix=/usr/local \
    -   --libexecdir=/usr/local/sbin \
    -   --sbindir=/usr/local/sbin \
    -   --localstatedir=/usr/local/mysql-data \
    -   --with-charset=${CHAR} \
    -   --with-extra-charsets=all \
    -   --with-raid \
    -   --without-docs \
    -   --without-bench \
    -   --without-perl \
    -   --with-gcc \
    -   --with-mysqld-ldflags="-static" \
    -   --with-client-ldflags="-static" \
    -   --with-named-curses-libs=/usr/local/lib/libncurses.a \
    -   --with-mysqld-user=mysql
    -
    -#   --with-berkeley-db-includes=/usr/local/include/db3 \
    -#   --with-berkeley-db-libs=/usr/local/lib/libdb3.a \
    -#   --with-low-memory
    -
    -${GMAKE}
    -${GMAKE} install DESTDIR=${P}/PKG/tmp-${CHAR}
    -
    -v=`grep '^SHARED_LIB_VERSION' configure.in | sed 's@SHARED_LIB_VERSION@@' | sed -e 's@=@@' -e 's@:@ @g' | awk '{print $1}'`
    -km="libmysqlclient.so.$v"
    -export km
    -
    -(cd ${P}/PKG/tmp-${CHAR}/usr/local/lib/mysql/ ; \
    -  for i in libmysqlclient* ; do \
    -    if /usr/bin/test ! -L $i ; then \
    -        mv $i ../ ; ln -sf ../$i ; \
    -    fi ; \
    -  done ; \
    -  k=`ls libmysqlclient.so.*.*.*` ; \
    -  cd .. ; \
    -  if /usr/bin/test ! -z libmysqlclient.so ; then \
    -      ln -sf $k libmysqlclient.so ;
    -  fi ; \
    -  if /usr/bin/test ! -z $km ; then \
    -      ln -sf $k $km ;
    -  fi ; \
    -)
    -
    -#
    -(cd ${P}/PKG/tmp-${CHAR}/usr/local/bin ; strip * )
    -(cd ${P}/PKG/tmp-${CHAR}/usr/local/sbin ; strip * )
    diff --git a/support-files/SCO/doc.sh b/support-files/SCO/doc.sh
    deleted file mode 100644
    index 9ef17166a6f..00000000000
    --- a/support-files/SCO/doc.sh
    +++ /dev/null
    @@ -1,17 +0,0 @@
    -#!/bin/sh
    -
    -CHAR="$1"
    -case "$1" in 
    - [uU]*) 
    -   CHAR=ujis 
    -   ;; 
    - [sS]*) 
    -   CHAR=sjis 
    -   ;; 
    -esac 
    -
    -cp -r Docs/* PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
    -cp INSTALL-SOURCE* COPYING* MIRRORS README* PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
    -
    -cd PKG/tmp-${CHAR}/usr/local/share/doc/mysql/
    -gzip *.txt *.texi *.info *.pdf
    diff --git a/support-files/SCO/mkpkg.sh b/support-files/SCO/mkpkg.sh
    deleted file mode 100644
    index 5a38113138d..00000000000
    --- a/support-files/SCO/mkpkg.sh
    +++ /dev/null
    @@ -1,47 +0,0 @@
    -#!/bin/sh
    -
    -if [ "x$1" = "x" ]; then
    -  echo " please set charset"
    -  exit
    -fi
    -
    -CHAR="$1"
    -case "$1" in
    - [uU]*)
    -   CHAR=ujis ; CH=uj
    -   ;;
    - [sS]*)
    -   CHAR=sjis ; CH=sj
    -   ;;
    -esac
    -
    -#-------------------
    -DIR=`pwd`
    -
    -VERSION=`cat version`
    -
    -T=`uname -p`
    -
    -sed -e "s/@CHAR1@/${CH}/" \
    -	 -e "s/@CHAR2@/${CHAR}/" \
    -	-e "s/@VERSION@/${VERSION}/" \
    -	-e "s/@TYPE@/${T}/" \
    -	pkginfo.ini > pkginfo.${CHAR}
    -
    -sed -e "s,@DIR@,${DIR},g" \
    -	-e "s,@PKGINFO@,${DIR}/pkginfo.${CHAR}," \
    -	prototype.ini > prototype.${CHAR}
    -
    -INIT="tmp-${CHAR}/etc/init.d/mysql"
    -cp ../support-files/mysql.server $INIT
    -chmod 755 $INIT
    -
    -(cd tmp-${CHAR}; \
    -chown root etc usr ; \
    -chgrp sys etc usr ;\
    -chmod 755 usr etc; \
    -chgrp sys etc/init.d ; \
    -chmod 755 etc/init.d ; \
    -find . -print|pkgproto >> ../prototype.${CHAR})
    -
    -pkgmk -o -f prototype.${CHAR} -r ${DIR}/tmp-${CHAR}
    diff --git a/support-files/SCO/patch b/support-files/SCO/patch
    deleted file mode 100644
    index 373eb8518c6..00000000000
    --- a/support-files/SCO/patch
    +++ /dev/null
    @@ -1,96 +0,0 @@
    ---- scripts/safe_mysqld.sh.orig	Sat Sep  2 17:28:26 2000
    -+++ scripts/safe_mysqld.sh	Sat Sep  2 17:31:19 2000
    -@@ -89,10 +89,10 @@
    - 
    - 
    - NOHUP_NICENESS=`nohup nice`
    --if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice --1 echo foo > /dev/null 2>&1; then
    -+if test $? -ne 0 || test x"$NOHUP_NICENESS" = x0 || test ! nice -1 echo foo > /dev/null 2>&1; then
    -   NOHUP_NICENESS="nohup"
    - else
    --  NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup"
    -+  NOHUP_NICENESS="nice -$NOHUP_NICENESS nohup"
    - fi
    - 
    - export MYSQL_UNIX_PORT
    -@@ -163,7 +163,8 @@
    -     # The only thing is ps x => redhat 5 gives warnings when using ps -x.
    -     # kill -9 is used or the process won't react on the kill.
    -     numofproces=`ps xa | grep -v "grep" | grep -c $ledir/mysqld`
    --    echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
    -+    echo | tee -a $err_log
    -+    echo "Number of processes running now: $numofproces" | tee -a $err_log
    -     I=1
    -     while test "$I" -le "$numofproces"
    -     do 
    -@@ -185,4 +186,6 @@
    -   echo "`date +'%y%m%d %H:%M:%S  mysqld restarted'`" | tee -a $err_log
    - done
    - 
    --echo -e "`date +'%y%m%d %H:%M:%S  mysqld ended\n'`" | tee -a $err_log
    -+echo | tee -a $err_log
    -+echo "`date +'%y%m%d %H:%M:%S  mysqld ended'`" | tee -a $err_log
    -+echo | tee -a $err_log
    ---- support-files/mysql.server.sh.orig	Sat Sep  2 17:35:56 2000
    -+++ support-files/mysql.server.sh	Sat Sep  2 17:36:35 2000
    -@@ -23,6 +23,9 @@
    - mysql_daemon_user=@MYSQLD_USER@
    - export PATH
    - 
    -+## your options...
    -+OPT=""
    -+
    - mode=$1
    - 
    - if test -w /             # determine if we should look at the root config file
    -@@ -82,8 +85,9 @@
    -     then
    -       # Give extra arguments to mysqld with the my.cnf file. This script may
    -       # be overwritten at next upgrade.
    --      $bindir/safe_mysqld \
    --	--user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file --log=$log_file  &
    -+      $bindir/safe_mysqld $OPT \
    -+	--user=$mysql_daemon_user --datadir=$datadir --pid-file=$pid_file &
    -+# --log=$log_file  &
    -     else
    -       echo "Can't execute $bindir/safe_mysqld"
    -     fi
    ---- configure.orig	Sat Sep  2 17:54:03 2000
    -+++ configure	Sat Sep  2 17:54:18 2000
    -@@ -202,7 +202,7 @@
    -   --with-charset=CHARSET  use CHARSET by default (one of: big5 cp1251 cp1257
    -                           croat czech danish dec8 dos estonia euc_kr gb2312 gbk
    -                           german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr
    --                          latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr
    -+                          latin1 latin2 swe7 usa7 win1250 win1251ukr
    -                           ujis sjis tis620; default is latin1)"
    - ac_help="$ac_help
    -   --with-extra-charsets=cs1,cs2
    -@@ -8843,7 +8843,7 @@
    - 
    - # Choose a character set
    - 
    --CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620"
    -+CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251ukr ujis sjis tis620"
    - DEFAULT_CHARSET=latin1
    - 
    - # Check whether --with-charset or --without-charset was given.
    ---- configure.in.orig	Sat Sep  2 17:53:57 2000
    -+++ configure.in	Sat Sep  2 17:54:36 2000
    -@@ -1517,14 +1517,14 @@
    - dnl or other special handling, you must also create
    - dnl strings/ctype-$charset_name.c
    - 
    --CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620"
    -+CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251ukr ujis sjis tis620"
    - DEFAULT_CHARSET=latin1
    - 
    - AC_ARG_WITH(charset,
    -   [  --with-charset=CHARSET  use CHARSET by default (one of: big5 cp1251 cp1257
    -                           croat czech danish dec8 dos estonia euc_kr gb2312 gbk
    -                           german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr
    --                          latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr
    -+                          latin1 latin2 swe7 usa7 win1250 win1251ukr
    -                           ujis sjis tis620; default is latin1)],
    -   [default_charset="$withval"],
    -   [default_charset="$DEFAULT_CHARSET"])
    diff --git a/support-files/SCO/pkginfo.ini b/support-files/SCO/pkginfo.ini
    deleted file mode 100644
    index 13b8b6adb09..00000000000
    --- a/support-files/SCO/pkginfo.ini
    +++ /dev/null
    @@ -1,8 +0,0 @@
    -PKG=MySQL
    -NAME=MySQL
    -ARCH=@TYPE@
    -VERSION=@VERSION@
    -CATEGORY=utility
    -VENDOR=TcX DataKonsult AB, Detron HB and MySQL AB
    -BASEDIR=/
    -CLASSES=none
    diff --git a/support-files/SCO/postinstall b/support-files/SCO/postinstall
    deleted file mode 100644
    index 2e199b9af82..00000000000
    --- a/support-files/SCO/postinstall
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -#!/bin/sh
    -
    -PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
    -LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
    -export PATH
    -export LD_LIBRARY_PATH
    -
    -D0="/usr/local/mysql-data"
    -D="${D0}/mysql"
    -
    -DOFIX=0
    -
    -if /usr/bin/test ! -f ${D}/tables_priv.frm -a -d ${D} ; then
    -  DOFIX=1
    -fi
    -
    -if [ ! -d ${D} ]; then
    -  DOFIX=2
    -  /usr/local/bin/mysql_install_db
    -fi
    -
    -  chown -R mysql $D0
    -  chgrp -R mysql $D0
    -
    -if /usr/bin/test $DOFIX -eq 1 ; then
    -  /etc/init.d/mysql start
    -  /usr/local/bin/mysql_fix_privilege_tables
    -else
    -  /etc/init.d/mysql start || true
    -fi
    diff --git a/support-files/SCO/preinstall b/support-files/SCO/preinstall
    deleted file mode 100644
    index c1175561a99..00000000000
    --- a/support-files/SCO/preinstall
    +++ /dev/null
    @@ -1,21 +0,0 @@
    -#!/bin/sh
    -
    -PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
    -LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
    -export PATH
    -export LD_LIBRARY_PATH
    -
    -if /usr/bin/test -x /etc/init.d/mysql ; then
    - /etc/init.d/mysql stop || true
    -fi
    -
    -#----- user check
    -P=`grep mysql /etc/passwd`
    -G=`grep mysql /etc/group`
    -
    -if /usr/bin/test "x$G" = "x" ; then
    -  /usr/sbin/groupadd mysql
    -fi
    -if /usr/bin/test "x$P" = "x" ; then
    -  /usr/sbin/useradd -g mysql -d /usr/local/mysql-data -s /bin/false mysql  
    -fi
    diff --git a/support-files/SCO/preremove b/support-files/SCO/preremove
    deleted file mode 100644
    index a89648431c1..00000000000
    --- a/support-files/SCO/preremove
    +++ /dev/null
    @@ -1,25 +0,0 @@
    -#!/bin/sh
    -
    -PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/ccs/bin
    -LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
    -export PATH
    -export LD_LIBRARY_PATH
    -
    -pid=`/usr/bin/ps -e | /usr/bin/grep mysqld |  /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
    -[ "$pid" != "" ] && /usr/local/bin/mysqladmin shutdown
    -
    -#---
    -#/usr/ucb/echo -n "Remove DATA Directory (All data expire) [Y/N]? "
    -#read I
    -I=No
    -
    -case "$I" in
    -Y*|y*)
    -	/usr/ucb/echo -n "Removing MySQL DATA ALL..."
    -	rm -rf /usr/local/mysql-data
    -	echo "done."
    -	;;
    -*)
    -	echo "not purge DATA directory"
    -	;;
    -esac;
    diff --git a/support-files/SCO/prototype.ini b/support-files/SCO/prototype.ini
    deleted file mode 100644
    index ca88bb67a90..00000000000
    --- a/support-files/SCO/prototype.ini
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -i pkginfo=@PKGINFO@
    -i postinstall=@DIR@/postinstall
    -i preinstall=@DIR@/preinstall
    -i preremove=@DIR@/preremove
    diff --git a/support-files/SCO/version b/support-files/SCO/version
    deleted file mode 100644
    index f9dc296b71b..00000000000
    --- a/support-files/SCO/version
    +++ /dev/null
    @@ -1 +0,0 @@
    -3.23.23-beta
    diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
    index 6c959daf754..bad66c77687 100644
    --- a/support-files/compiler_warnings.supp
    +++ b/support-files/compiler_warnings.supp
    @@ -1,3 +1,18 @@
    +# Copyright (C) 2007 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; version 2 of the License.
    +#
    +# 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
    +
     #
     # This file contains compiler warnings that can
     # be ignored for various reasons.
    diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
    index 6bf5fca60ab..3195318878c 100644
    --- a/support-files/mysql.spec.sh
    +++ b/support-files/mysql.spec.sh
    @@ -1,4 +1,4 @@
    -# Copyright (C) 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
    +# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     #
     # 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
    diff --git a/tests/Makefile.am b/tests/Makefile.am
    index 1c39a3630dd..8d5e7fb213b 100644
    --- a/tests/Makefile.am
    +++ b/tests/Makefile.am
    @@ -1,11 +1,11 @@
     # Copyright (C) 2000-2006 MySQL AB
     #
    -# This library is free software; you can redistribute it and/or
    +# This program is free software; you can redistribute it and/or
     # modify it under the terms of the GNU Library General Public
     # License as published by the Free Software Foundation; version 2
     # of the License.
     #
    -# This library is distributed in the hope that it will be useful,
    +# 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
     # Library General Public License for more details.
    diff --git a/tests/big_record.pl b/tests/big_record.pl
    index fbe94e3540f..77d1e613193 100755
    --- a/tests/big_record.pl
    +++ b/tests/big_record.pl
    @@ -1,5 +1,20 @@
     #!/usr/bin/perl
     
    +# Copyright (C) 2000, 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; version 2 of the License.
    +# 
    +# 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
    +
     # This is a test with stores big records in a blob.
     # Note that for the default test the mysql server should have been
     # started with at least 'mysqld -O max_allowed_packet=30M' and you should have
    diff --git a/tests/drop_test.pl b/tests/drop_test.pl
    index 9dcadf45c2e..272c4029e0f 100755
    --- a/tests/drop_test.pl
    +++ b/tests/drop_test.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2000 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test with uses processes to insert, select and drop tables.
     #
    diff --git a/tests/export.pl b/tests/export.pl
    index 29f0d1af8ff..d543ede8697 100755
    --- a/tests/export.pl
    +++ b/tests/export.pl
    @@ -1,5 +1,20 @@
     #!/usr/bin/perl
     
    +# Copyright (C) 2000, 2001 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; version 2 of the License.
    +# 
    +# 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
    +
     # This is a test with uses two processes to a database.
     # The other inserts records in two tables, the other does a lot of joins
     # on these.
    diff --git a/tests/fork2_test.pl b/tests/fork2_test.pl
    index 19fab5a67d6..64e3e060b09 100755
    --- a/tests/fork2_test.pl
    +++ b/tests/fork2_test.pl
    @@ -1,5 +1,20 @@
     #!/usr/bin/perl -w
     
    +# Copyright (C) 2000, 2001 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; version 2 of the License.
    +# 
    +# 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
    +
     # This is a test with uses 5 processes to insert, update and select from
     # two tables.
     # One inserts records in the tables, one updates some record in it and
    diff --git a/tests/fork_big.pl b/tests/fork_big.pl
    index c72eb59946b..9b45cb43f8e 100755
    --- a/tests/fork_big.pl
    +++ b/tests/fork_big.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2001 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test with uses many processes to test a MySQL server.
     #
    diff --git a/tests/fork_big2.pl b/tests/fork_big2.pl
    index 567cfafa176..b866998b3b4 100644
    --- a/tests/fork_big2.pl
    +++ b/tests/fork_big2.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2002, 2005 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test with uses many processes to test a MySQL server.
     #
    diff --git a/tests/grant.pl b/tests/grant.pl
    index 4f2bd1a61cb..368ce0b3254 100755
    --- a/tests/grant.pl
    +++ b/tests/grant.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl
    +
    +# Copyright (C) 2000, 2005 MySQL AB, 2009 Sun Microsystems, Inc.
    +# 
    +# 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # Testing of grants.
     # Note that this will delete all table and column grants !
    diff --git a/tests/index_corrupt.pl b/tests/index_corrupt.pl
    index 19bf54f5d11..fa4c8151277 100755
    --- a/tests/index_corrupt.pl
    +++ b/tests/index_corrupt.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2005 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test for a key cache bug (bug #10167)
     # To expose the bug mysqld should be started with --key-buffer-size=64K
    diff --git a/tests/insert_and_repair.pl b/tests/insert_and_repair.pl
    index 1c7186bb651..00ab20f051b 100755
    --- a/tests/insert_and_repair.pl
    +++ b/tests/insert_and_repair.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2000, 2001 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test of insert and repair/check.
     #
    diff --git a/tests/lock_test.pl b/tests/lock_test.pl
    index 5daeeddad8e..a40bec681f6 100755
    --- a/tests/lock_test.pl
    +++ b/tests/lock_test.pl
    @@ -1,5 +1,20 @@
     #!/usr/bin/perl
     
    +# Copyright (C) 2000 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; version 2 of the License.
    +# 
    +# 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
    +
     # This is a test with uses two processes to a database.
     # The other inserts records in two tables, the other does a lot of joins
     # on these.
    diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
    index 43a418c8300..82199781d74 100644
    --- a/tests/mysql_client_test.c
    +++ b/tests/mysql_client_test.c
    @@ -1,4 +1,4 @@
    -/* Copyright (C) 2003-2004 MySQL AB
    +/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     
        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
    diff --git a/tests/pmail.pl b/tests/pmail.pl
    index 02d5d60ac0f..38905832069 100755
    --- a/tests/pmail.pl
    +++ b/tests/pmail.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2000, 2005 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; version 2 of the License.
    +# 
    +# 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
    +
     #                                  
     # Prints mails to standard output  
     #                                  
    diff --git a/tests/rename_test.pl b/tests/rename_test.pl
    index edf3216a62f..23fc33c9095 100755
    --- a/tests/rename_test.pl
    +++ b/tests/rename_test.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2000, 2001 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test with uses processes to insert, select and drop tables.
     #
    diff --git a/tests/table_types.pl b/tests/table_types.pl
    index 4dbcdcb975c..23d26215abe 100755
    --- a/tests/table_types.pl
    +++ b/tests/table_types.pl
    @@ -1,5 +1,19 @@
     #!/usr/bin/perl
    -#
    +
    +# Copyright (C) 2000, 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; version 2 of the License.
    +# 
    +# 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
     
     use DBI;
     use Benchmark;
    diff --git a/tests/test_delayed_insert.pl b/tests/test_delayed_insert.pl
    index c7a8f0ca4b7..5046c4fb580 100755
    --- a/tests/test_delayed_insert.pl
    +++ b/tests/test_delayed_insert.pl
    @@ -1,5 +1,20 @@
     #!/usr/bin/perl -w
     
    +# Copyright (C) 2000, 2001 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; version 2 of the License.
    +# 
    +# 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
    +
     # This is a test for INSERT DELAYED
     #
     
    diff --git a/tests/truncate.pl b/tests/truncate.pl
    index 57b50cf96b6..85e826fd4cd 100755
    --- a/tests/truncate.pl
    +++ b/tests/truncate.pl
    @@ -1,4 +1,20 @@
     #!/usr/bin/perl -w
    +
    +# Copyright (C) 2002 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; version 2 of the License.
    +# 
    +# 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
    +
     #
     # This is a test with uses many processes to test a MySQL server.
     #
    diff --git a/win/create_manifest.js b/win/create_manifest.js
    index dbdd83588c5..d7b790fd0f8 100755
    --- a/win/create_manifest.js
    +++ b/win/create_manifest.js
    @@ -1,3 +1,18 @@
    +/* Copyright (C) 2007, 2008 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; version 2 of the License.
    +
    +   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 */
    +
     /* 
       manifest.js - Writes a custom XML manifest for each executable/library
       5 command line options must be supplied: 
    diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake
    index 0d429e438d6..a824457b5a7 100755
    --- a/win/mysql_manifest.cmake
    +++ b/win/mysql_manifest.cmake
    @@ -1,3 +1,17 @@
    +# Copyright (C) 2007 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; version 2 of the License.
    +# 
    +# 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
     
     # - MYSQL_EMBED_MANIFEST(target_name required_privs)
     # Create a manifest for target_name.  Set the execution level to require_privs
    -- 
    cgit v1.2.1