diff options
author | unknown <jimw@mysql.com> | 2006-04-18 12:12:46 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2006-04-18 12:12:46 -0700 |
commit | b709511e406552f8d8884e80befd78f98604eeeb (patch) | |
tree | e53c2d408d22d66f7260c608a71f2561220320bd | |
parent | 3e21b9d0dad908d1e0b0d414bf2186fa24e05616 (diff) | |
download | mariadb-git-b709511e406552f8d8884e80befd78f98604eeeb.tar.gz |
Nuke all of the old_* directories in the ndb tree.
BitKeeper/deleted/.del-Makefile~6c2778d2bf4954a2:
Delete: storage/ndb/src/old_files/client/Makefile
BitKeeper/deleted/.del-Extra.mk~eabbb28986ca817d:
Delete: storage/ndb/src/old_files/client/odbc/Extra.mk
BitKeeper/deleted/.del-Makefile~9bc928a18aa88d66:
Delete: storage/ndb/src/old_files/client/odbc/Makefile
BitKeeper/deleted/.del-NdbOdbc.cpp~aa491b06c9172d11:
Delete: storage/ndb/src/old_files/client/odbc/NdbOdbc.cpp
BitKeeper/deleted/.del-NdbOdbc.def~cd3eed2c4a0121e9:
Delete: storage/ndb/src/old_files/client/odbc/NdbOdbc.def
BitKeeper/deleted/.del-CodeGen.cpp~170c83c0765b9160:
Delete: storage/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp
BitKeeper/deleted/.del-CodeGen.hpp~738f834f80cceba8:
Delete: storage/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp
BitKeeper/deleted/.del-Code_base.cpp~96f8ceaac8138bfe:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_base.cpp
BitKeeper/deleted/.del-Code_base.hpp~794baaed32588409:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_base.hpp
BitKeeper/deleted/.del-Code_column.cpp~5dd0e5c1215bd8bf:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_column.cpp
BitKeeper/deleted/.del-Code_column.hpp~5d5816d1c496e588:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_column.hpp
BitKeeper/deleted/.del-Code_comp_op.cpp~6ab02cc3b1e08985:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp
BitKeeper/deleted/.del-Code_comp_op.hpp~37cf1e4cee3a6bf1:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp
BitKeeper/deleted/.del-Code_create_index.cpp~d1f95c5917afab9:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp
BitKeeper/deleted/.del-Code_create_index.hpp~12bcb33350fc35c1:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp
BitKeeper/deleted/.del-Code_create_row.cpp~33f73454f8ddf2d5:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp
BitKeeper/deleted/.del-Code_create_row.hpp~38cb00cc1baa9ee7:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp
BitKeeper/deleted/.del-Code_create_table.cpp~c25e7cc06414a927:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp
BitKeeper/deleted/.del-Code_create_table.hpp~9648f467f3f0418e:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp
BitKeeper/deleted/.del-Code_data_type.cpp~9e46a7ef85345d4:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp
BitKeeper/deleted/.del-Code_data_type.hpp~5e8928968d3c0107:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp
BitKeeper/deleted/.del-Code_ddl.cpp~c38ee5368efaf688:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp
BitKeeper/deleted/.del-Code_ddl.hpp~75482ddd87b65036:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp
BitKeeper/deleted/.del-Code_ddl_column.cpp~c524862773dd9f38:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp
BitKeeper/deleted/.del-Code_ddl_column.hpp~c9e534e381b21599:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp
BitKeeper/deleted/.del-Code_ddl_constr.cpp~80ae32f83a6c2f00:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp
BitKeeper/deleted/.del-Code_ddl_constr.hpp~bca16806c57bc97e:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp
BitKeeper/deleted/.del-Code_ddl_row.cpp~ec2fbc3b8ab08a52:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp
BitKeeper/deleted/.del-Code_ddl_row.hpp~c18a43b3770ad25a:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp
BitKeeper/deleted/.del-Code_delete.cpp~feac77b440d04327:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp
BitKeeper/deleted/.del-Code_delete.hpp~c852ee069a761aab:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp
BitKeeper/deleted/.del-Code_delete_index.cpp~17ed96eca90fe4e7:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp
BitKeeper/deleted/.del-Code_delete_index.hpp~18a9bb119b04636:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp
BitKeeper/deleted/.del-Code_delete_lookup.cpp~1a3728f8c896684:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp
BitKeeper/deleted/.del-Code_delete_lookup.hpp~1be71525ed9ee69:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp
BitKeeper/deleted/.del-Code_delete_scan.cpp~b040ad7670c24eb5:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp
BitKeeper/deleted/.del-Code_delete_scan.hpp~b9a11b4ec895d159:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp
BitKeeper/deleted/.del-Code_dml.cpp~6826ad60f0f566e7:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp
BitKeeper/deleted/.del-Code_dml.hpp~8fdbf19ad3174ca2:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp
BitKeeper/deleted/.del-Code_dml_column.cpp~b71ce6186edf1655:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp
BitKeeper/deleted/.del-Code_dml_column.hpp~a843b3418b30b7a3:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp
BitKeeper/deleted/.del-Code_dml_row.cpp~17c791507b36cc06:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp
BitKeeper/deleted/.del-Code_dml_row.hpp~33c4cffdd238728d:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp
BitKeeper/deleted/.del-Code_drop_index.cpp~fc5cab67ae58d9f6:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp
BitKeeper/deleted/.del-Code_drop_index.hpp~377c9eb280ec2ee2:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp
BitKeeper/deleted/.del-Code_drop_table.cpp~9637d93efa68996a:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp
BitKeeper/deleted/.del-Code_drop_table.hpp~d671379125e4bbbe:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp
BitKeeper/deleted/.del-Code_expr.cpp~fafd271880c70cf3:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp
BitKeeper/deleted/.del-Code_expr.hpp~9e8243e99e0ec84:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp
BitKeeper/deleted/.del-Code_expr_column.cpp~4c4fbcd5741cc8cf:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp
BitKeeper/deleted/.del-Code_expr_column.hpp~9c4cbbdf432dc475:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp
BitKeeper/deleted/.del-Code_expr_const.cpp~bdb29dcd94ac5e73:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp
BitKeeper/deleted/.del-Code_expr_const.hpp~9c8789cff376b832:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp
BitKeeper/deleted/.del-Code_expr_conv.cpp~d252fbfe8ef55fff:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp
BitKeeper/deleted/.del-Code_expr_conv.hpp~5cbea39eecb92a43:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp
BitKeeper/deleted/.del-Code_expr_func.cpp~5d3996f062fa3f52:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp
BitKeeper/deleted/.del-Code_expr_func.hpp~22aee1e4f92c49b9:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp
BitKeeper/deleted/.del-Code_expr_op.cpp~e1aaa0244f2efa4:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp
BitKeeper/deleted/.del-Code_expr_op.hpp~4eb8c02dd0602f:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp
BitKeeper/deleted/.del-Code_expr_param.cpp~a5e94ee7c5821611:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp
BitKeeper/deleted/.del-Code_expr_param.hpp~ec441ad8ef21aa2b:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp
BitKeeper/deleted/.del-Code_expr_row.cpp~bc73d8f9c681d418:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp
BitKeeper/deleted/.del-Code_expr_row.hpp~c541c49ea8c0c4f2:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp
BitKeeper/deleted/.del-Code_idx_column.cpp~7d4d074ce5daea0a:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp
BitKeeper/deleted/.del-Code_idx_column.hpp~caabaafa34722be7:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp
BitKeeper/deleted/.del-Code_insert.cpp~7d0ef7cc8f657fd5:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp
BitKeeper/deleted/.del-Code_insert.hpp~cc96fa9b81169471:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp
BitKeeper/deleted/.del-Code_pred.cpp~56faa755aa42ddfa:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp
BitKeeper/deleted/.del-Code_pred.hpp~eada43753e8b1e6c:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp
BitKeeper/deleted/.del-Code_pred_op.cpp~47d693dde1a6d907:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp
BitKeeper/deleted/.del-Code_pred_op.hpp~b42256983d2bda7b:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp
BitKeeper/deleted/.del-Code_query.cpp~4ac293821c9b4602:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query.cpp
BitKeeper/deleted/.del-Code_query.hpp~f86fbd9a108206c0:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query.hpp
BitKeeper/deleted/.del-Code_query_count.cpp~9fa96a57d2dde660:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp
BitKeeper/deleted/.del-Code_query_count.hpp~bdbe6e4734abc0c5:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp
BitKeeper/deleted/.del-Code_query_distinct.cpp~3ba18528aa67b9dd:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp
BitKeeper/deleted/.del-Code_query_distinct.hpp~c12b2b7ff6b2e7b3:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp
BitKeeper/deleted/.del-Code_query_filter.cpp~a3d067d5d8fb40c:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp
BitKeeper/deleted/.del-Code_query_filter.hpp~d0a341f2e40f0183:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp
BitKeeper/deleted/.del-Code_query_group.cpp~4443c844308f9a98:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp
BitKeeper/deleted/.del-Code_query_group.hpp~ba4691be942c6e2a:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp
BitKeeper/deleted/.del-Code_query_index.cpp~f0312c9e2f22daf6:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp
BitKeeper/deleted/.del-Code_query_index.hpp~6baaf1abbb704bb1:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp
BitKeeper/deleted/.del-Code_query_join.cpp~36e07422c67d6838:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp
BitKeeper/deleted/.del-Code_query_join.hpp~c4d17d18c4e3b4a0:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp
BitKeeper/deleted/.del-Code_query_lookup.cpp~3d80e3ddbdae531d:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp
BitKeeper/deleted/.del-Code_query_lookup.hpp~73332533e5196630:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp
BitKeeper/deleted/.del-Code_query_project.cpp~ebc22f71bb7ec98c:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp
BitKeeper/deleted/.del-Code_query_project.hpp~2734cdf1f907e0a4:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp
BitKeeper/deleted/.del-Code_query_range.cpp~62ddafd2d17063cc:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp
BitKeeper/deleted/.del-Code_query_range.hpp~81546843616efefa:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp
BitKeeper/deleted/.del-Code_query_repeat.cpp~ce8f2a065897d6e3:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp
BitKeeper/deleted/.del-Code_query_repeat.hpp~c20e10d0db9ad53c:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp
BitKeeper/deleted/.del-Code_query_scan.cpp~855e56d6f56de938:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp
BitKeeper/deleted/.del-Code_query_scan.hpp~b93c277da5b2509b:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp
BitKeeper/deleted/.del-Code_query_sort.cpp~c08fc07f739de097:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp
BitKeeper/deleted/.del-Code_query_sort.hpp~84edb5e128eda962:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp
BitKeeper/deleted/.del-Code_query_sys.cpp~1d6a4a1cec789001:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp
BitKeeper/deleted/.del-Code_query_sys.hpp~f5182823da25f097:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp
BitKeeper/deleted/.del-Code_root.cpp~4c26a01ced583e41:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_root.cpp
BitKeeper/deleted/.del-Code_root.hpp~de1fd878505d9e26:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_root.hpp
BitKeeper/deleted/.del-Code_select.cpp~75b2a39f282d8ef5:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_select.cpp
BitKeeper/deleted/.del-Code_select.hpp~f9fadc322d78033a:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_select.hpp
BitKeeper/deleted/.del-Code_set_row.cpp~1bda7e6f86f18aef:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp
BitKeeper/deleted/.del-Code_set_row.hpp~32ac3de384b91229:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp
BitKeeper/deleted/.del-Code_stmt.cpp~c0e9903aa90df90b:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp
BitKeeper/deleted/.del-Code_stmt.hpp~fab11fc487e74d05:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp
BitKeeper/deleted/.del-Code_table.cpp~c46b7a6e2ecf4f61:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_table.cpp
BitKeeper/deleted/.del-Code_table.hpp~a48d57a0375a6d56:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_table.hpp
BitKeeper/deleted/.del-Code_table_list.cpp~40948eccedfae7bb:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp
BitKeeper/deleted/.del-Code_table_list.hpp~c1e880e9949d3a:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp
BitKeeper/deleted/.del-Code_update.cpp~ed36f4a7a928a91b:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update.cpp
BitKeeper/deleted/.del-Code_update.hpp~c1de760c7b580b0c:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update.hpp
BitKeeper/deleted/.del-Code_update_index.cpp~a0c6ad33ffbbc00e:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp
BitKeeper/deleted/.del-Code_update_index.hpp~b57bbe5c8d927df9:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp
BitKeeper/deleted/.del-Code_update_lookup.cpp~3491782088e97384:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp
BitKeeper/deleted/.del-Code_update_lookup.hpp~ee335822c3496863:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp
BitKeeper/deleted/.del-Code_update_scan.cpp~35e5b7d4619b3e09:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp
BitKeeper/deleted/.del-Code_update_scan.hpp~287f193ad48fbefd:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp
BitKeeper/deleted/.del-Makefile~420b8378d374f069:
Delete: storage/ndb/src/old_files/client/odbc/codegen/Makefile
BitKeeper/deleted/.del-SimpleGram.ypp~6301cedf92524710:
Delete: storage/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp
BitKeeper/deleted/.del-SimpleParser.cpp~549f93e2a7fd01b5:
Delete: storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp
BitKeeper/deleted/.del-SimpleParser.hpp~4fdff7ee3839efc4:
Delete: storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp
BitKeeper/deleted/.del-SimpleScan.lpp~e11862b97fe39faf:
Delete: storage/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp
BitKeeper/deleted/.del-AttrArea.cpp~1570da617a1a6c4b:
Delete: storage/ndb/src/old_files/client/odbc/common/AttrArea.cpp
BitKeeper/deleted/.del-AttrArea.hpp~f3d78ccd37af4e6:
Delete: storage/ndb/src/old_files/client/odbc/common/AttrArea.hpp
BitKeeper/deleted/.del-CodeTree.cpp~1a4912632b0a61ee:
Delete: storage/ndb/src/old_files/client/odbc/common/CodeTree.cpp
BitKeeper/deleted/.del-CodeTree.hpp~dcb603cce390eafa:
Delete: storage/ndb/src/old_files/client/odbc/common/CodeTree.hpp
BitKeeper/deleted/.del-ConnArea.cpp~103182cf445f0bc3:
Delete: storage/ndb/src/old_files/client/odbc/common/ConnArea.cpp
BitKeeper/deleted/.del-ConnArea.hpp~ffe99deedf7dc1ee:
Delete: storage/ndb/src/old_files/client/odbc/common/ConnArea.hpp
BitKeeper/deleted/.del-Ctx.cpp~ce1c13ba8a312eba:
Delete: storage/ndb/src/old_files/client/odbc/common/Ctx.cpp
BitKeeper/deleted/.del-Ctx.hpp~bc88aba55ab71063:
Delete: storage/ndb/src/old_files/client/odbc/common/Ctx.hpp
BitKeeper/deleted/.del-DataField.cpp~6bb1fe1cb971c8f9:
Delete: storage/ndb/src/old_files/client/odbc/common/DataField.cpp
BitKeeper/deleted/.del-DataField.hpp~d324898a9a86463d:
Delete: storage/ndb/src/old_files/client/odbc/common/DataField.hpp
BitKeeper/deleted/.del-DataRow.cpp~8764a23cee4f9481:
Delete: storage/ndb/src/old_files/client/odbc/common/DataRow.cpp
BitKeeper/deleted/.del-DataRow.hpp~66a65eee1a1b2f23:
Delete: storage/ndb/src/old_files/client/odbc/common/DataRow.hpp
BitKeeper/deleted/.del-DataType.cpp~29b8ddd51fdd3a2f:
Delete: storage/ndb/src/old_files/client/odbc/common/DataType.cpp
BitKeeper/deleted/.del-DataType.hpp~adef26bc1dc940eb:
Delete: storage/ndb/src/old_files/client/odbc/common/DataType.hpp
BitKeeper/deleted/.del-DescArea.cpp~aab4edd7e336acdd:
Delete: storage/ndb/src/old_files/client/odbc/common/DescArea.cpp
BitKeeper/deleted/.del-DescArea.hpp~20ba9b6484762f0f:
Delete: storage/ndb/src/old_files/client/odbc/common/DescArea.hpp
BitKeeper/deleted/.del-DiagArea.cpp~e3662d8977947e67:
Delete: storage/ndb/src/old_files/client/odbc/common/DiagArea.cpp
BitKeeper/deleted/.del-DiagArea.hpp~1c6595b5fac06eb2:
Delete: storage/ndb/src/old_files/client/odbc/common/DiagArea.hpp
BitKeeper/deleted/.del-Makefile~8505f6b38fe5c219:
Delete: storage/ndb/src/old_files/client/odbc/common/Makefile
BitKeeper/deleted/.del-OdbcData.cpp~e557009c1ed1e017:
Delete: storage/ndb/src/old_files/client/odbc/common/OdbcData.cpp
BitKeeper/deleted/.del-OdbcData.hpp~2125814c1293c0b3:
Delete: storage/ndb/src/old_files/client/odbc/common/OdbcData.hpp
BitKeeper/deleted/.del-ResultArea.cpp~8bcc2a2d9a98b9b0:
Delete: storage/ndb/src/old_files/client/odbc/common/ResultArea.cpp
BitKeeper/deleted/.del-ResultArea.hpp~8d4646b94be475d1:
Delete: storage/ndb/src/old_files/client/odbc/common/ResultArea.hpp
BitKeeper/deleted/.del-Sqlstate.cpp~b844144af963c22c:
Delete: storage/ndb/src/old_files/client/odbc/common/Sqlstate.cpp
BitKeeper/deleted/.del-Sqlstate.hpp~60006ee1c27c6e5:
Delete: storage/ndb/src/old_files/client/odbc/common/Sqlstate.hpp
BitKeeper/deleted/.del-StmtArea.cpp~5c5f8613156e06b2:
Delete: storage/ndb/src/old_files/client/odbc/common/StmtArea.cpp
BitKeeper/deleted/.del-StmtArea.hpp~9662e56ae164eb7f:
Delete: storage/ndb/src/old_files/client/odbc/common/StmtArea.hpp
BitKeeper/deleted/.del-StmtInfo.cpp~54ee4040e5807214:
Delete: storage/ndb/src/old_files/client/odbc/common/StmtInfo.cpp
BitKeeper/deleted/.del-DictCatalog.cpp~9804b0ff3eac2f8:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp
BitKeeper/deleted/.del-DictCatalog.hpp~cace2fb2f6bb65e5:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp
BitKeeper/deleted/.del-StmtInfo.hpp~6698d657391692fc:
Delete: storage/ndb/src/old_files/client/odbc/common/StmtInfo.hpp
BitKeeper/deleted/.del-common.cpp~4792b9ecddd99482:
Delete: storage/ndb/src/old_files/client/odbc/common/common.cpp
BitKeeper/deleted/.del-common.hpp~25369fa6c80eff53:
Delete: storage/ndb/src/old_files/client/odbc/common/common.hpp
BitKeeper/deleted/.del-DictColumn.cpp~b69d90c53e5b618:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp
BitKeeper/deleted/.del-DictColumn.hpp~c2da1b7bd0408bd1:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp
BitKeeper/deleted/.del-DictIndex.cpp~a456d3039e6a39e3:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp
BitKeeper/deleted/.del-DictIndex.hpp~f53b91a41bb96663:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp
BitKeeper/deleted/.del-DictSchema.cpp~639403c84a47dfdd:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp
BitKeeper/deleted/.del-DictSchema.hpp~5aa7dc8ade17e94c:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp
BitKeeper/deleted/.del-DictSys.cpp~fb89465b10c32bb0:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp
BitKeeper/deleted/.del-DictSys.hpp~76583ba8aa88fd6f:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp
BitKeeper/deleted/.del-DictTable.cpp~8f4a9ee5a8038f87:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp
BitKeeper/deleted/.del-DictTable.hpp~cf99a9ac3dd49206:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp
BitKeeper/deleted/.del-Makefile~4c1a6148787bdc2f:
Delete: storage/ndb/src/old_files/client/odbc/dictionary/Makefile
BitKeeper/deleted/.del-class.fig~c0754ccad74d380a:
Delete: storage/ndb/src/old_files/client/odbc/docs/class.fig
BitKeeper/deleted/.del-descfield.pl~e0bd59c2824824cc:
Delete: storage/ndb/src/old_files/client/odbc/docs/descfield.pl
BitKeeper/deleted/.del-diag.txt~b66a7e227391335f:
Delete: storage/ndb/src/old_files/client/odbc/docs/diag.txt
BitKeeper/deleted/.del-getinfo.pl~2142ecf1567a66f6:
Delete: storage/ndb/src/old_files/client/odbc/docs/getinfo.pl
BitKeeper/deleted/.del-gettypeinfo.pl~2ea4c0589eac4e73:
Delete: storage/ndb/src/old_files/client/odbc/docs/gettypeinfo.pl
BitKeeper/deleted/.del-handleattr.pl~b0c2a2901b68342e:
Delete: storage/ndb/src/old_files/client/odbc/docs/handleattr.pl
BitKeeper/deleted/.del-main.hpp~7b15eb7ffad488a0:
Delete: storage/ndb/src/old_files/client/odbc/docs/main.hpp
BitKeeper/deleted/.del-ndbodbc.html~a2f14fdd978b62cc:
Delete: storage/ndb/src/old_files/client/odbc/docs/ndbodbc.html
BitKeeper/deleted/.del-select.fig~34f5222b5012e1d7:
Delete: storage/ndb/src/old_files/client/odbc/docs/select.fig
BitKeeper/deleted/.del-Func.data~9e75f15d921063f3:
Delete: storage/ndb/src/old_files/client/odbc/driver/Func.data
BitKeeper/deleted/.del-Func.pl~aefb901bc3941d32:
Delete: storage/ndb/src/old_files/client/odbc/driver/Func.pl
BitKeeper/deleted/.del-systables.pl~1fa2191648bdb629:
Delete: storage/ndb/src/old_files/client/odbc/docs/systables.pl
BitKeeper/deleted/.del-type.txt~feec700c81f5095f:
Delete: storage/ndb/src/old_files/client/odbc/docs/type.txt
BitKeeper/deleted/.del-Makefile~80d21270fc3ad931:
Delete: storage/ndb/src/old_files/client/odbc/driver/Makefile
BitKeeper/deleted/.del-SQLAllocConnect.cpp~246af836b028d810:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp
BitKeeper/deleted/.del-SQLAllocEnv.cpp~eaf36cf2285ec2ac:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp
BitKeeper/deleted/.del-SQLAllocHandle.cpp~c0921921e84d1a10:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp
BitKeeper/deleted/.del-SQLAllocHandleStd.cpp~7d145f6e3640d913:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp
BitKeeper/deleted/.del-SQLAllocStmt.cpp~362331ef456ec879:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp
BitKeeper/deleted/.del-SQLBindCol.cpp~fec3a78088d4951d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp
BitKeeper/deleted/.del-SQLBindParam.cpp~a50b619a23efaab:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp
BitKeeper/deleted/.del-SQLBindParameter.cpp~533b1992496e2775:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp
BitKeeper/deleted/.del-SQLBrowseConnect.cpp~120b61a1ff6edee3:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp
BitKeeper/deleted/.del-SQLBulkOperations.cpp~7a96be04250a388:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp
BitKeeper/deleted/.del-SQLCancel.cpp~27eab683f6fa6ec6:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp
BitKeeper/deleted/.del-SQLCloseCursor.cpp~6cbf193aadaf1058:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp
BitKeeper/deleted/.del-SQLColAttribute.cpp~f2c858b16a9360d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp
BitKeeper/deleted/.del-SQLColAttributes.cpp~d4007908ee1309d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp
BitKeeper/deleted/.del-SQLColumnPrivileges.cpp~39a3020da4c3485b:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp
BitKeeper/deleted/.del-SQLColumns.cpp~1c31107df60bb544:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp
BitKeeper/deleted/.del-SQLConnect.cpp~868e02a519b72743:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp
BitKeeper/deleted/.del-SQLCopyDesc.cpp~286522b25a029761:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp
BitKeeper/deleted/.del-SQLDataSources.cpp~12792108aac5b2ca:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp
BitKeeper/deleted/.del-SQLDescribeCol.cpp~1d1faafbcd3ecb3c:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp
BitKeeper/deleted/.del-SQLDescribeParam.cpp~70b016fa795ed275:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp
BitKeeper/deleted/.del-SQLDisconnect.cpp~9fb4c3d7a84db50a:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp
BitKeeper/deleted/.del-SQLDriverConnect.cpp~8dad42af7d17a9d9:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp
BitKeeper/deleted/.del-SQLDrivers.cpp~400e7453e70f6e99:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp
BitKeeper/deleted/.del-SQLEndTran.cpp~c37cce04cc303c01:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp
BitKeeper/deleted/.del-SQLError.cpp~593b81885c15187b:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLError.cpp
BitKeeper/deleted/.del-SQLExecDirect.cpp~5e6274e76315339d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp
BitKeeper/deleted/.del-SQLExecute.cpp~1692a85f8639f71:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp
BitKeeper/deleted/.del-SQLExtendedFetch.cpp~8b9d604580a83cfd:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp
BitKeeper/deleted/.del-SQLFetch.cpp~fa1606aa2dd901db:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp
BitKeeper/deleted/.del-SQLFetchScroll.cpp~cdb16803511963a1:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp
BitKeeper/deleted/.del-SQLForeignKeys.cpp~4b8a9af2f6bf92cb:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp
BitKeeper/deleted/.del-SQLFreeConnect.cpp~92359420501ebc5b:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp
BitKeeper/deleted/.del-SQLFreeEnv.cpp~64f1776817464807:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp
BitKeeper/deleted/.del-SQLFreeHandle.cpp~2dc029edf912c2d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp
BitKeeper/deleted/.del-SQLFreeStmt.cpp~8f8cb0a43c02a67:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp
BitKeeper/deleted/.del-SQLGetConnectAttr.cpp~b29ff18aeedd8966:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp
BitKeeper/deleted/.del-SQLGetConnectOption.cpp~3e0bc4e1af95c682:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp
BitKeeper/deleted/.del-SQLGetCursorName.cpp~8266b920671b6d01:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp
BitKeeper/deleted/.del-SQLGetData.cpp~3d837348460c219d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp
BitKeeper/deleted/.del-SQLGetDescField.cpp~62828192a7d1d954:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp
BitKeeper/deleted/.del-SQLGetDescRec.cpp~f54cc69bcd1238ad:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp
BitKeeper/deleted/.del-SQLGetDiagField.cpp~673e1ea0f9d5121f:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp
BitKeeper/deleted/.del-SQLGetDiagRec.cpp~bea0f68f5b940ab8:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp
BitKeeper/deleted/.del-SQLGetEnvAttr.cpp~e742277d8bdf234d:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp
BitKeeper/deleted/.del-SQLGetFunctions.cpp~72de050fbfb4a9bb:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp
BitKeeper/deleted/.del-SQLGetInfo.cpp~e4e09d6bedbf02b1:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp
BitKeeper/deleted/.del-SQLGetStmtAttr.cpp~de7dabc8c2acea7:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp
BitKeeper/deleted/.del-SQLGetStmtOption.cpp~2ff900ebdd167077:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp
BitKeeper/deleted/.del-SQLGetTypeInfo.cpp~333196b07473dff6:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp
BitKeeper/deleted/.del-SQLMoreResults.cpp~483d94cb57379e81:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp
BitKeeper/deleted/.del-SQLNativeSql.cpp~eeae6067f4a85c:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp
BitKeeper/deleted/.del-SQLNumParams.cpp~8921304c3bcf4835:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp
BitKeeper/deleted/.del-SQLNumResultCols.cpp~4d2b6527ffe81059:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp
BitKeeper/deleted/.del-SQLParamData.cpp~163b046513f1e4ae:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp
BitKeeper/deleted/.del-SQLParamOptions.cpp~bdcbccb961fff044:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp
BitKeeper/deleted/.del-SQLPrepare.cpp~1d339fe24888087:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp
BitKeeper/deleted/.del-SQLPrimaryKeys.cpp~5d7b2a0ae08a267:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp
BitKeeper/deleted/.del-SQLProcedureColumns.cpp~c7a0535e9f50ff39:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp
BitKeeper/deleted/.del-SQLProcedures.cpp~c59d025b22e2d1a6:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp
BitKeeper/deleted/.del-SQLPutData.cpp~9dbf69ea9d369dbd:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp
BitKeeper/deleted/.del-SQLRowCount.cpp~d4ac5b273afdb154:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp
BitKeeper/deleted/.del-SQLSetConnectAttr.cpp~c2c520c34c41bd88:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp
BitKeeper/deleted/.del-SQLSetConnectOption.cpp~dadc980d9f9cad1b:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp
BitKeeper/deleted/.del-SQLSetCursorName.cpp~ccfc33dd2cf6abeb:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp
BitKeeper/deleted/.del-SQLSetDescField.cpp~c4db694d1b9e8f77:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp
BitKeeper/deleted/.del-SQLSetDescRec.cpp~f8dd72467d5012ab:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp
BitKeeper/deleted/.del-SQLSetEnvAttr.cpp~7b50aeae6228c2db:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp
BitKeeper/deleted/.del-SQLSetParam.cpp~e0dd2d5e8d3ec450:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp
BitKeeper/deleted/.del-SQLSetPos.cpp~39a3e69960041aa7:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp
BitKeeper/deleted/.del-SQLSetScrollOptions.cpp~6f8250379bb0cac8:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp
BitKeeper/deleted/.del-SQLSetStmtAttr.cpp~e99b7e6025a1ae1f:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp
BitKeeper/deleted/.del-SQLSetStmtOption.cpp~87af3125a48c27fa:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp
BitKeeper/deleted/.del-SQLSpecialColumns.cpp~1877b4c368825de5:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp
BitKeeper/deleted/.del-SQLStatistics.cpp~87e0359f237aa66a:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp
BitKeeper/deleted/.del-SQLTablePrivileges.cpp~fa16ea0fffa4edeb:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp
BitKeeper/deleted/.del-SQLTables.cpp~c8b201068baec393:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLTables.cpp
BitKeeper/deleted/.del-SQLTransact.cpp~eb33c2f66ee85738:
Delete: storage/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp
BitKeeper/deleted/.del-Exec_comp_op.cpp~eacbd7512b32d68b:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp
BitKeeper/deleted/.del-Exec_create_index.cpp~c6b8e670198adfa9:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp
BitKeeper/deleted/.del-driver.cpp~f8f1eeec35b08f18:
Delete: storage/ndb/src/old_files/client/odbc/driver/driver.cpp
BitKeeper/deleted/.del-driver.hpp~f108f4eef34ec8ea:
Delete: storage/ndb/src/old_files/client/odbc/driver/driver.hpp
BitKeeper/deleted/.del-Exec_create_table.cpp~76904d417bc0a59a:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp
BitKeeper/deleted/.del-Exec_delete_index.cpp~1ffe5af6eb160a68:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp
BitKeeper/deleted/.del-Exec_delete_lookup.cpp~5d24028ce16b6623:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp
BitKeeper/deleted/.del-Exec_delete_scan.cpp~810aa4058f73c941:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp
BitKeeper/deleted/.del-Exec_drop_index.cpp~3a3871ec6ee48c28:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp
BitKeeper/deleted/.del-Exec_drop_table.cpp~639a2faba4da14f4:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp
BitKeeper/deleted/.del-Exec_expr_conv.cpp~b5452bd4fbd7c945:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp
BitKeeper/deleted/.del-Exec_expr_func.cpp~c78ab0e67d54f38c:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp
BitKeeper/deleted/.del-Exec_expr_op.cpp~5e341b2e63495ba4:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp
BitKeeper/deleted/.del-Exec_insert.cpp~71dd4bf2fb913f2e:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp
BitKeeper/deleted/.del-Exec_pred_op.cpp~ebe7b65ba81e5185:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp
BitKeeper/deleted/.del-Exec_query_index.cpp~4cada676fa178001:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp
BitKeeper/deleted/.del-Exec_query_lookup.cpp~79dfe29b088d832:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp
BitKeeper/deleted/.del-Exec_query_range.cpp~7c4e148e81a292d6:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp
BitKeeper/deleted/.del-Exec_query_scan.cpp~7c66194f7f93346f:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp
BitKeeper/deleted/.del-Exec_query_sys.cpp~d66abe07cd519163:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp
BitKeeper/deleted/.del-Exec_update_index.cpp~86140a945f790890:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp
BitKeeper/deleted/.del-Exec_update_lookup.cpp~b7a7387620cf42ab:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp
BitKeeper/deleted/.del-Exec_update_scan.cpp~2285c72106cffe0:
Delete: storage/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp
BitKeeper/deleted/.del-Executor.cpp~ccb54cc8ffe18bae:
Delete: storage/ndb/src/old_files/client/odbc/executor/Executor.cpp
BitKeeper/deleted/.del-Executor.hpp~c94d916ae5af2506:
Delete: storage/ndb/src/old_files/client/odbc/executor/Executor.hpp
BitKeeper/deleted/.del-AttrDbc.cpp~24a034fbb22cdb23:
Delete: storage/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp
BitKeeper/deleted/.del-AttrEnv.cpp~7d74bcba78e149d0:
Delete: storage/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp
BitKeeper/deleted/.del-AttrRoot.cpp~5def5d7e228eedf0:
Delete: storage/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp
BitKeeper/deleted/.del-Makefile~a08f437558c2d3b4:
Delete: storage/ndb/src/old_files/client/odbc/executor/Makefile
BitKeeper/deleted/.del-AttrStmt.cpp~5363ba63b35ff8f4:
Delete: storage/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp
BitKeeper/deleted/.del-DescSpec.cpp~cd50c1c855f1905:
Delete: storage/ndb/src/old_files/client/odbc/handles/DescSpec.cpp
BitKeeper/deleted/.del-FuncTab.cpp~e77abea11a532708:
Delete: storage/ndb/src/old_files/client/odbc/handles/FuncTab.cpp
BitKeeper/deleted/.del-HandleBase.cpp~2ba63dce2dfec07b:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleBase.cpp
BitKeeper/deleted/.del-HandleBase.hpp~8cf9a1e94d272328:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleBase.hpp
BitKeeper/deleted/.del-HandleDbc.cpp~2a79fea6477b2c63:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp
BitKeeper/deleted/.del-HandleDbc.hpp~9abc692ac6b0abb3:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp
BitKeeper/deleted/.del-HandleDesc.cpp~e77eb1d73d171a98:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp
BitKeeper/deleted/.del-HandleDesc.hpp~553aeb842b3da88e:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp
BitKeeper/deleted/.del-HandleEnv.cpp~6b96fc6b188f252b:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp
BitKeeper/deleted/.del-HandleEnv.hpp~572a7b4af6816f8b:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp
BitKeeper/deleted/.del-HandleRoot.cpp~aa5044f74554fa9c:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp
BitKeeper/deleted/.del-HandleRoot.hpp~2fcfca742c13cfb3:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp
BitKeeper/deleted/.del-HandleStmt.cpp~782f96bda9eaf13c:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp
BitKeeper/deleted/.del-HandleStmt.hpp~6508fc97f3c772e1:
Delete: storage/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp
BitKeeper/deleted/.del-InfoTab.cpp~f89104b9c6fe7489:
Delete: storage/ndb/src/old_files/client/odbc/handles/InfoTab.cpp
BitKeeper/deleted/.del-Makefile~3d8d1529ad26ce76:
Delete: storage/ndb/src/old_files/client/odbc/handles/Makefile
BitKeeper/deleted/.del-PoolNdb.cpp~793fa032699b7d98:
Delete: storage/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp
BitKeeper/deleted/.del-PoolNdb.hpp~db9e1a04d2fe705d:
Delete: storage/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp
BitKeeper/deleted/.del-handles.hpp~bfe0b6a7a95ac142:
Delete: storage/ndb/src/old_files/client/odbc/handles/handles.hpp
BitKeeper/deleted/.del-Makefile~4b92d5e5b416dd0:
Delete: storage/ndb/src/old_files/ndbbaseclient/Makefile
BitKeeper/deleted/.del-Makefile~f993f3afae0d4308:
Delete: storage/ndb/src/old_files/ndbclient/Makefile
BitKeeper/deleted/.del-ndbbaseclient_dummy.cpp~daee9eb6acbc94:
Delete: storage/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp
BitKeeper/deleted/.del-ndbclient_dummy.cpp~73154070f5d0bfbf:
Delete: storage/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp
BitKeeper/deleted/.del-Makefile~bcbd9a7282094cc:
Delete: storage/ndb/src/old_files/newtonapi/Makefile
BitKeeper/deleted/.del-dba_binding.cpp~dcc4fb57f9ab6cba:
Delete: storage/ndb/src/old_files/newtonapi/dba_binding.cpp
BitKeeper/deleted/.del-dba_bulkread.cpp~4ddfe02a93d2ba11:
Delete: storage/ndb/src/old_files/newtonapi/dba_bulkread.cpp
BitKeeper/deleted/.del-dba_config.cpp~38acf2ad3a932420:
Delete: storage/ndb/src/old_files/newtonapi/dba_config.cpp
BitKeeper/deleted/.del-dba_dac.cpp~4615e3d0d8a15bff:
Delete: storage/ndb/src/old_files/newtonapi/dba_dac.cpp
BitKeeper/deleted/.del-dba_error.cpp~a58b4a1628a2d4b9:
Delete: storage/ndb/src/old_files/newtonapi/dba_error.cpp
BitKeeper/deleted/.del-dba_init.cpp~80da7e3fa0775346:
Delete: storage/ndb/src/old_files/newtonapi/dba_init.cpp
BitKeeper/deleted/.del-dba_internal.hpp~54884404e30c8823:
Delete: storage/ndb/src/old_files/newtonapi/dba_internal.hpp
BitKeeper/deleted/.del-dba_process.cpp~509e54294bc7efd2:
Delete: storage/ndb/src/old_files/newtonapi/dba_process.cpp
BitKeeper/deleted/.del-ExtSender.cpp~1851d559cfddae43:
Delete: storage/ndb/src/old_files/rep/ExtSender.cpp
BitKeeper/deleted/.del-ExtSender.hpp~10ae62ec85ee6692:
Delete: storage/ndb/src/old_files/rep/ExtSender.hpp
BitKeeper/deleted/.del-dba_process.hpp~f0ddefb3b2d6a662:
Delete: storage/ndb/src/old_files/newtonapi/dba_process.hpp
BitKeeper/deleted/.del-dba_schema.cpp~1c3b8399853c108:
Delete: storage/ndb/src/old_files/newtonapi/dba_schema.cpp
BitKeeper/deleted/.del-Makefile~954f853c2d812c2c:
Delete: storage/ndb/src/old_files/rep/Makefile
BitKeeper/deleted/.del-NodeConnectInfo.hpp~9c4318dd55f3f84:
Delete: storage/ndb/src/old_files/rep/NodeConnectInfo.hpp
BitKeeper/deleted/.del-README~6939b06d192a6b99:
Delete: storage/ndb/src/old_files/rep/README
BitKeeper/deleted/.del-RepApiInterpreter.cpp~8ba561cb831ae353:
Delete: storage/ndb/src/old_files/rep/RepApiInterpreter.cpp
BitKeeper/deleted/.del-RepApiInterpreter.hpp~31be5af2ba72d263:
Delete: storage/ndb/src/old_files/rep/RepApiInterpreter.hpp
BitKeeper/deleted/.del-RepApiService.cpp~93d4005333167a0f:
Delete: storage/ndb/src/old_files/rep/RepApiService.cpp
BitKeeper/deleted/.del-RepApiService.hpp~42f5ffb7e3baa54e:
Delete: storage/ndb/src/old_files/rep/RepApiService.hpp
BitKeeper/deleted/.del-RepCommandInterpreter.cpp~f661a8ff312213f8:
Delete: storage/ndb/src/old_files/rep/RepCommandInterpreter.cpp
BitKeeper/deleted/.del-RepCommandInterpreter.hpp~fb6f22895e8c8679:
Delete: storage/ndb/src/old_files/rep/RepCommandInterpreter.hpp
BitKeeper/deleted/.del-RepComponents.cpp~fb067aee8e5a4a1f:
Delete: storage/ndb/src/old_files/rep/RepComponents.cpp
BitKeeper/deleted/.del-RepComponents.hpp~9e632beac4f8bbf8:
Delete: storage/ndb/src/old_files/rep/RepComponents.hpp
BitKeeper/deleted/.del-RepMain.cpp~de79cb7b6f3acd18:
Delete: storage/ndb/src/old_files/rep/RepMain.cpp
BitKeeper/deleted/.del-Requestor.cpp~c653fa987f84ce43:
Delete: storage/ndb/src/old_files/rep/Requestor.cpp
BitKeeper/deleted/.del-Requestor.hpp~a499054c9a128dbd:
Delete: storage/ndb/src/old_files/rep/Requestor.hpp
BitKeeper/deleted/.del-RequestorSubscriptions.cpp~f0643f7cc9aa9654:
Delete: storage/ndb/src/old_files/rep/RequestorSubscriptions.cpp
BitKeeper/deleted/.del-SignalQueue.cpp~6d32d876acc1a598:
Delete: storage/ndb/src/old_files/rep/SignalQueue.cpp
BitKeeper/deleted/.del-AppNDB.cpp~1db5eafacdeda3b7:
Delete: storage/ndb/src/old_files/rep/adapters/AppNDB.cpp
BitKeeper/deleted/.del-SignalQueue.hpp~b92204ff36f399d1:
Delete: storage/ndb/src/old_files/rep/SignalQueue.hpp
BitKeeper/deleted/.del-TODO~187896dd2e5dfd02:
Delete: storage/ndb/src/old_files/rep/TODO
BitKeeper/deleted/.del-dbug_hack.cpp~f090906a24103f0:
Delete: storage/ndb/src/old_files/rep/dbug_hack.cpp
BitKeeper/deleted/.del-rep_version.hpp~82a23fe4dbb13cab:
Delete: storage/ndb/src/old_files/rep/rep_version.hpp
BitKeeper/deleted/.del-AppNDB.hpp~2c3081224b4ff75f:
Delete: storage/ndb/src/old_files/rep/adapters/AppNDB.hpp
BitKeeper/deleted/.del-ExtAPI.cpp~d98f38669b10ca97:
Delete: storage/ndb/src/old_files/rep/adapters/ExtAPI.cpp
BitKeeper/deleted/.del-ExtAPI.hpp~32bcb96bcd2d60c:
Delete: storage/ndb/src/old_files/rep/adapters/ExtAPI.hpp
BitKeeper/deleted/.del-ExtNDB.cpp~38cccb80529c02c6:
Delete: storage/ndb/src/old_files/rep/adapters/ExtNDB.cpp
BitKeeper/deleted/.del-ExtNDB.hpp~ee245e7e2c707685:
Delete: storage/ndb/src/old_files/rep/adapters/ExtNDB.hpp
BitKeeper/deleted/.del-Makefile~25c4b35b84d945b4:
Delete: storage/ndb/src/old_files/rep/repapi/Makefile
BitKeeper/deleted/.del-Makefile~bcb9d87fd69a7911:
Delete: storage/ndb/src/old_files/rep/adapters/Makefile
BitKeeper/deleted/.del-TableInfoPs.hpp~56b1f8f75fe7cb1c:
Delete: storage/ndb/src/old_files/rep/adapters/TableInfoPs.hpp
BitKeeper/deleted/.del-Channel.cpp~1d5f62245962b839:
Delete: storage/ndb/src/old_files/rep/state/Channel.cpp
BitKeeper/deleted/.del-Channel.hpp~71c1d63ef4b2cbfe:
Delete: storage/ndb/src/old_files/rep/state/Channel.hpp
BitKeeper/deleted/.del-repapi.cpp~82b9b00c67cfdcf7:
Delete: storage/ndb/src/old_files/rep/repapi/repapi.cpp
BitKeeper/deleted/.del-repapi.h~6f8cf6b53a86a5ae:
Delete: storage/ndb/src/old_files/rep/repapi/repapi.h
BitKeeper/deleted/.del-Interval.cpp~3d079ca9cc21124d:
Delete: storage/ndb/src/old_files/rep/state/Interval.cpp
BitKeeper/deleted/.del-Interval.hpp~85aa46fc419bb109:
Delete: storage/ndb/src/old_files/rep/state/Interval.hpp
BitKeeper/deleted/.del-Makefile~6a9cedaeedcc4650:
Delete: storage/ndb/src/old_files/rep/state/Makefile
BitKeeper/deleted/.del-RepState.cpp~3d60b0a46e9477c1:
Delete: storage/ndb/src/old_files/rep/state/RepState.cpp
BitKeeper/deleted/.del-Makefile~e33e587a7947ac36:
Delete: storage/ndb/src/old_files/rep/state/testInterval/Makefile
BitKeeper/deleted/.del-RepState.hpp~94d7c472c8a7367:
Delete: storage/ndb/src/old_files/rep/state/RepState.hpp
BitKeeper/deleted/.del-RepStateEvent.cpp~f51d7eb7b7aca0b:
Delete: storage/ndb/src/old_files/rep/state/RepStateEvent.cpp
BitKeeper/deleted/.del-RepStateRequests.cpp~393882166df6929:
Delete: storage/ndb/src/old_files/rep/state/RepStateRequests.cpp
BitKeeper/deleted/.del-Makefile~f5a6d9415d7e0977:
Delete: storage/ndb/src/old_files/rep/state/testRepState/Makefile
BitKeeper/deleted/.del-testInterval.cpp~993f4118f616e80:
Delete: storage/ndb/src/old_files/rep/state/testInterval/testInterval.cpp
BitKeeper/deleted/.del-testRequestor.cpp~4a943fae5be63c79:
Delete: storage/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp
BitKeeper/deleted/.del-testRequestor.hpp~583208c83ff5b554:
Delete: storage/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp
BitKeeper/deleted/.del-GCIBuffer.cpp~6e8c6f38ab63d1d6:
Delete: storage/ndb/src/old_files/rep/storage/GCIBuffer.cpp
BitKeeper/deleted/.del-GCIBuffer.hpp~703e2016a7ec616f:
Delete: storage/ndb/src/old_files/rep/storage/GCIBuffer.hpp
BitKeeper/deleted/.del-GCIContainer.cpp~9c53acd16fc5ac74:
Delete: storage/ndb/src/old_files/rep/storage/GCIContainer.cpp
BitKeeper/deleted/.del-GCIContainer.hpp~ac28cea9114659fd:
Delete: storage/ndb/src/old_files/rep/storage/GCIContainer.hpp
BitKeeper/deleted/.del-GCIContainerPS.cpp~116168903a2c617a:
Delete: storage/ndb/src/old_files/rep/storage/GCIContainerPS.cpp
BitKeeper/deleted/.del-GCIContainerPS.hpp~9a801ffe939e192e:
Delete: storage/ndb/src/old_files/rep/storage/GCIContainerPS.hpp
BitKeeper/deleted/.del-GCIPage.cpp~42fa918fbf36828a:
Delete: storage/ndb/src/old_files/rep/storage/GCIPage.cpp
BitKeeper/deleted/.del-GCIPage.hpp~4197e2278326515e:
Delete: storage/ndb/src/old_files/rep/storage/GCIPage.hpp
BitKeeper/deleted/.del-LogRecord.hpp~11644fe7c5f5d36:
Delete: storage/ndb/src/old_files/rep/storage/LogRecord.hpp
BitKeeper/deleted/.del-Makefile~a955d34726662aba:
Delete: storage/ndb/src/old_files/rep/storage/Makefile
BitKeeper/deleted/.del-NodeConnectInfo.hpp~35a7682fd9dba464:
Delete: storage/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp
BitKeeper/deleted/.del-NodeGroup.cpp~adebbefb11cd1670:
Delete: storage/ndb/src/old_files/rep/storage/NodeGroup.cpp
BitKeeper/deleted/.del-NodeGroup.hpp~3fcddc2da5d10e45:
Delete: storage/ndb/src/old_files/rep/storage/NodeGroup.hpp
BitKeeper/deleted/.del-Makefile~6b43df78ea480db1:
Delete: storage/ndb/src/old_files/rep/transfer/Makefile
BitKeeper/deleted/.del-NodeGroupInfo.cpp~b1130e3c42777658:
Delete: storage/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp
BitKeeper/deleted/.del-NodeGroupInfo.hpp~7fd3b74f4b59a503:
Delete: storage/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp
BitKeeper/deleted/.del-TransPS.cpp~7a88ca746987ac10:
Delete: storage/ndb/src/old_files/rep/transfer/TransPS.cpp
BitKeeper/deleted/.del-TransPS.hpp~846b26eaa80632a1:
Delete: storage/ndb/src/old_files/rep/transfer/TransPS.hpp
BitKeeper/deleted/.del-TransSS.cpp~8f12a062b240eecf:
Delete: storage/ndb/src/old_files/rep/transfer/TransSS.cpp
BitKeeper/deleted/.del-TransSS.hpp~7718b5e4ce9a4007:
Delete: storage/ndb/src/old_files/rep/transfer/TransSS.hpp
BitKeeper/deleted/.del-TransSSSubscriptions.cpp~6bc55e474f33e023:
Delete: storage/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp
BitKeeper/deleted/.del-Makefile~4cef97177c0cd8d1:
Delete: storage/ndb/test/ndbapi/old_dirs/acid2/Makefile
BitKeeper/deleted/.del-Makefile~5823323f9308952b:
Delete: storage/ndb/test/ndbapi/old_dirs/acid/Makefile
BitKeeper/deleted/.del-Makefile~53e91df162e177a4:
Delete: storage/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile
BitKeeper/deleted/.del-Makefile~d86129c4e794eaaf:
Delete: storage/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile
BitKeeper/deleted/.del-TraceNdbApi.hpp~7a7f0ae5b70358bc:
Delete: storage/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp
BitKeeper/deleted/.del-VerifyNdbApi.hpp~f417f78f7cd05935:
Delete: storage/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp
BitKeeper/deleted/.del-Makefile~15b0005e7dc1fbf8:
Delete: storage/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile
BitKeeper/deleted/.del-Makefile~1bcf05f0a26d7d6f:
Delete: storage/ndb/test/ndbapi/old_dirs/create_tab/Makefile
BitKeeper/deleted/.del-Makefile~8ede26305d647424:
Delete: storage/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile
BitKeeper/deleted/.del-Makefile~e4f93944b8c44f09:
Delete: storage/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile
BitKeeper/deleted/.del-Makefile.am~ae6c03d81bf83c09:
Delete: storage/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am
BitKeeper/deleted/.del-Makefile~99efd87dd2a67e6:
Delete: storage/ndb/test/ndbapi/old_dirs/flexHammer/Makefile
BitKeeper/deleted/.del-README~d85a7f1125dc7a50:
Delete: storage/ndb/test/ndbapi/old_dirs/flexHammer/README
BitKeeper/deleted/.del-ndbplot.pl~ef4de5b461b880c1:
Delete: storage/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl
BitKeeper/deleted/.del-Makefile~c05a674b968916ec:
Delete: storage/ndb/test/ndbapi/old_dirs/flexTT/Makefile
BitKeeper/deleted/.del-Makefile~d36727b854d37c9:
Delete: storage/ndb/test/ndbapi/old_dirs/flexScan/Makefile
BitKeeper/deleted/.del-README~a6f5f72344539aae:
Delete: storage/ndb/test/ndbapi/old_dirs/flexScan/README
BitKeeper/deleted/.del-Makefile~d254d59f274b1d3:
Delete: storage/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile
BitKeeper/deleted/.del-Makefile~d280c4556dcab9cd:
Delete: storage/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile
BitKeeper/deleted/.del-Makefile~7cd666ff39dc1c5d:
Delete: storage/ndb/test/ndbapi/old_dirs/indexTest2/Makefile
BitKeeper/deleted/.del-Makefile~837866d85a01b2c:
Delete: storage/ndb/test/ndbapi/old_dirs/indexTest/Makefile
BitKeeper/deleted/.del-Makefile~b384a346d7cc0f3c:
Delete: storage/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile
BitKeeper/deleted/.del-Makefile~b77f2b2aa6db29a7:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile
BitKeeper/deleted/.del-Makefile~607887f555e1a07f:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile
BitKeeper/deleted/.del-Makefile~fe3f7192bcd1e342:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile
BitKeeper/deleted/.del-dbGenerator.h~63f1aeb98260bcb7:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h
BitKeeper/deleted/.del-testData.h~898b71d7c639319e:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h
BitKeeper/deleted/.del-Makefile~16dd9625cf816bed:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile
BitKeeper/deleted/.del-macros.h~742871fab0681964:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h
BitKeeper/deleted/.del-ndb_error.hpp~45a2fef922beae3:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp
BitKeeper/deleted/.del-userInterface.h~49139f029bbdaabc:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h
BitKeeper/deleted/.del-.empty~9401b7f68791202e:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty
BitKeeper/deleted/.del-.empty~f804b62cd167f0b3:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty
BitKeeper/deleted/.del-ndb_schema.hpp~de9c21185d6bfe4e:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp
BitKeeper/deleted/.del-testDefinitions.h~f18a4553579a3725:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h
BitKeeper/deleted/.del-Makefile~28e0b82e1322e47:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile
BitKeeper/deleted/.del-async-lmc-bench-l-p10.sh~8f06283d361eec9e:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh
BitKeeper/deleted/.del-async-lmc-bench-l.sh~9b204c8488dfdb86:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh
BitKeeper/deleted/.del-async-lmc-bench-p10.sh~45cfc4a130b43f6a:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh
BitKeeper/deleted/.del-Makefile~a3e9f0384cf8455d:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile
BitKeeper/deleted/.del-README~3c1d85ad9efb4a23:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/README
BitKeeper/deleted/.del-async-lmc-bench.sh~40ca1b63e69d2bdd:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh
BitKeeper/deleted/.del-makevars.linux~9a7c7e0df35184fa:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux
BitKeeper/deleted/.del-Makefile~e5ecf4cfa15f5316:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile
BitKeeper/deleted/.del-dbGenerator.c~7509c19f70cad0bf:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c
BitKeeper/deleted/.del-dbGenerator.h~e1aaa6725999d458:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h
BitKeeper/deleted/.del-mainGenerator.c~2d1c8016f72b2517:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c
BitKeeper/deleted/.del-makevars.sparc~42a7f929ba44ea5:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc
BitKeeper/deleted/.del-Makefile~c3c3d76f731f62:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile
BitKeeper/deleted/.del-testData.h~696038ea2623a90b:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h
BitKeeper/deleted/.del-userInterface.h~1f76ad2f28b283fd:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h
BitKeeper/deleted/.del-Makefile~548d94b487507bbf:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile
BitKeeper/deleted/.del-dbPopulate.c~5dcff1c99783d83b:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c
BitKeeper/deleted/.del-dbPopulate.h~229a894b59d4da73:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h
BitKeeper/deleted/.del-mainPopulate.c~37def9a44980b8ec:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c
BitKeeper/deleted/.del-localDbPrepare.c~33a2c46afc8fac9a:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c
BitKeeper/deleted/.del-macros.h~58097d584e29b5df:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h
BitKeeper/deleted/.del-ndb_error.hpp~24468bb7f20a0b41:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp
BitKeeper/deleted/.del-userHandle.h~ec22dc7a7ed2f81b:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h
BitKeeper/deleted/.del-Makefile~b6d0cd4d8c9d339b:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile
BitKeeper/deleted/.del-userHandle.h~3275bb415e1ca2c2:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h
BitKeeper/deleted/.del-userInterface.cpp~82ee612ab14b3d48:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp
BitKeeper/deleted/.del-userTransaction.c~438012ecc761b776:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c
BitKeeper/deleted/.del-Makefile~6a739ef75a821406:
Delete: storage/ndb/test/ndbapi/old_dirs/restarter2/Makefile
BitKeeper/deleted/.del-Makefile~c4a8d15a64d73ee8:
Delete: storage/ndb/test/ndbapi/old_dirs/restarter/Makefile
BitKeeper/deleted/.del-userInterface.c~92a20032f7d1e91:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c
BitKeeper/deleted/.del-userTransaction.c~f50661b4f54b0bdd:
Delete: storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c
BitKeeper/deleted/.del-Makefile~23f3806c8505ea8f:
Delete: storage/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile
BitKeeper/deleted/.del-Makefile~2fdd0e2bfef9eab7:
Delete: storage/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile
BitKeeper/deleted/.del-Makefile~d19ef6b3a02430e7:
Delete: storage/ndb/test/ndbapi/old_dirs/restarts/Makefile
BitKeeper/deleted/.del-Makefile~edc1824919a8e593:
Delete: storage/ndb/test/ndbapi/old_dirs/ronja/Makefile
BitKeeper/deleted/.del-Makefile~7246dc45283fec4f:
Delete: storage/ndb/test/ndbapi/old_dirs/testBasic/Makefile
BitKeeper/deleted/.del-Makefile~8f8a72ead5c0dcbe:
Delete: storage/ndb/test/ndbapi/old_dirs/testBackup/Makefile
BitKeeper/deleted/.del-Makefile~a8998c89d7ad17d0:
Delete: storage/ndb/test/ndbapi/old_dirs/telco/Makefile
BitKeeper/deleted/.del-readme~2bb11c8fe8e713de:
Delete: storage/ndb/test/ndbapi/old_dirs/telco/readme
BitKeeper/deleted/.del-Makefile~11a681d847711b20:
Delete: storage/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile
BitKeeper/deleted/.del-Makefile~7b08d94bc77f36b5:
Delete: storage/ndb/test/ndbapi/old_dirs/testDict/Makefile
BitKeeper/deleted/.del-Makefile~c72222538e5e4e48:
Delete: storage/ndb/test/ndbapi/old_dirs/testBlobs/Makefile
BitKeeper/deleted/.del-Makefile~13237b5015038e7b:
Delete: storage/ndb/test/ndbapi/old_dirs/testGrep/Makefile
BitKeeper/deleted/.del-Makefile~1e91adbf308b09:
Delete: storage/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile
BitKeeper/deleted/.del-Makefile~348a4f3067115b99:
Delete: storage/ndb/test/ndbapi/old_dirs/testIndex/Makefile
BitKeeper/deleted/.del-Makefile~4da89995b201a972:
Delete: storage/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile
BitKeeper/deleted/.del-Makefile~664fcd5e178e659a:
Delete: storage/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile
BitKeeper/deleted/.del-Makefile~79ba0e5994952ae9:
Delete: storage/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile
BitKeeper/deleted/.del-Makefile~b76c5fcf57c53a58:
Delete: storage/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile
BitKeeper/deleted/.del-Makefile~b90fa88b1071a3f3:
Delete: storage/ndb/test/ndbapi/old_dirs/testMgm/Makefile
BitKeeper/deleted/.del-Makefile~3a1d081f812432e3:
Delete: storage/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile
BitKeeper/deleted/.del-Makefile~3e916b320b0dc88:
Delete: storage/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile
BitKeeper/deleted/.del-Makefile~c9fac39964fe2f77:
Delete: storage/ndb/test/ndbapi/old_dirs/testOperations/Makefile
BitKeeper/deleted/.del-times.txt~76ffa76ca8708af1:
Delete: storage/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt
BitKeeper/deleted/.del-Makefile~8ec0ddece8d8bd18:
Delete: storage/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile
BitKeeper/deleted/.del-Makefile~b3c2cd57699a958c:
Delete: storage/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile
BitKeeper/deleted/.del-Makefile~c6f264b16640c32b:
Delete: storage/ndb/test/ndbapi/old_dirs/testScan/Makefile
BitKeeper/deleted/.del-Makefile~f5c05697b5c6a926:
Delete: storage/ndb/test/ndbapi/old_dirs/testTimeout/Makefile
BitKeeper/deleted/.del-Makefile~2e74033e6077aa3a:
Delete: storage/ndb/test/ndbapi/old_dirs/testTransactions/Makefile
BitKeeper/deleted/.del-Makefile~91dad370d76274be:
Delete: storage/ndb/test/ndbapi/old_dirs/vw_test/Makefile
BitKeeper/deleted/.del-Makefile~ddc74468722656bb:
Delete: storage/ndb/test/ndbapi/old_dirs/test_event/Makefile
BitKeeper/deleted/.del-bcd.h~81fbfcc1530534da:
Delete: storage/ndb/test/ndbapi/old_dirs/vw_test/bcd.h
BitKeeper/deleted/.del-client_start~1ecfaed180a75edd:
Delete: storage/ndb/test/ndbapi/old_dirs/vw_test/script/client_start
BitKeeper/deleted/.del-utv.h~f64af026b9705ebb:
Delete: storage/ndb/test/ndbapi/old_dirs/vw_test/utv.h
BitKeeper/deleted/.del-vcdrfunc.h~85803875180684cd:
Delete: storage/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h
BitKeeper/deleted/.del-Makefile~ae168985806f34e8:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/Makefile
BitKeeper/deleted/.del-Makefile~b50f189dfbc87d8a:
Delete: storage/ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile
BitKeeper/deleted/.del-Makefile~dcc8c444bf25ce41:
Delete: storage/ndb/src/common/portlib/old_dirs/memtest/Makefile
BitKeeper/deleted/.del-NdbCondition.c~ee56562abdd718cf:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbCondition.c
BitKeeper/deleted/.del-NdbConditionOSE.h~455dd2c29c2e6344:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h
BitKeeper/deleted/.del-NdbEnv.c~bb6fe7572d45288a:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbEnv.c
BitKeeper/deleted/.del-NdbHost.c~cf18d6b3c825180c:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbHost.c
BitKeeper/deleted/.del-NdbMem.c~6c2b317c1ce230ab:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbMem.c
BitKeeper/deleted/.del-NdbMem_SoftOse.cpp~9c61e311ec168d44:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp
BitKeeper/deleted/.del-NdbMutex.c~f4bdd19be08b84ab:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbMutex.c
BitKeeper/deleted/.del-NdbOut.cpp~8caa99a0d729540c:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp
BitKeeper/deleted/.del-NdbSleep.c~b88fbc5b140de10d:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbSleep.c
BitKeeper/deleted/.del-NdbTCP.c~1e9f416992352f6d:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbTCP.c
BitKeeper/deleted/.del-NdbThread.c~fe71a67b5c3a4724:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbThread.c
BitKeeper/deleted/.del-NdbTick.c~b76feba2cf1493d1:
Delete: storage/ndb/src/common/portlib/old_dirs/ose/NdbTick.c
BitKeeper/deleted/.del-Makefile~aa96712c481bc8e:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/Makefile
BitKeeper/deleted/.del-Makefile~d04b4a185b6e1071:
Delete: storage/ndb/src/common/portlib/old_dirs/test/Makefile
BitKeeper/deleted/.del-NdbCondition.c~ad83464328ab37af:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbCondition.c
BitKeeper/deleted/.del-NdbDaemon.c~3b8101f376b28df:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c
BitKeeper/deleted/.del-NdbEnv.c~207f9ce9754c9e8a:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbEnv.c
BitKeeper/deleted/.del-NdbHost.c~2c29816c77396d7b:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbHost.c
BitKeeper/deleted/.del-NdbMem.c~6285b159985d46da:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbMem.c
BitKeeper/deleted/.del-NdbMutex.c~768131269bccca10:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbMutex.c
BitKeeper/deleted/.del-NdbSleep.c~b643ea3e7103eb62:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbSleep.c
BitKeeper/deleted/.del-NdbTCP.c~b09cdcbef3ea2c57:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbTCP.c
BitKeeper/deleted/.del-NdbThread.c~2fe1fa5f47801772:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbThread.c
BitKeeper/deleted/.del-NdbTick.c~aa6385567216509d:
Delete: storage/ndb/src/common/portlib/old_dirs/win32/NdbTick.c
BitKeeper/deleted/.del-Makefile~62207a82b90e653:
Delete: storage/ndb/test/tools/old_dirs/hugoCalculator/Makefile
BitKeeper/deleted/.del-Makefile~54e6a2262bbe162a:
Delete: storage/ndb/test/tools/old_dirs/hugoLockRecords/Makefile
BitKeeper/deleted/.del-Makefile~79e81dfed9112c7:
Delete: storage/ndb/test/tools/old_dirs/hugoLoad/Makefile
BitKeeper/deleted/.del-Makefile~c2b94348137b633a:
Delete: storage/ndb/test/tools/old_dirs/hugoPkDelete/Makefile
BitKeeper/deleted/.del-Makefile~f90065821a932b3f:
Delete: storage/ndb/test/tools/old_dirs/hugoFill/Makefile
BitKeeper/deleted/.del-Makefile~3ae1e42a4d7b1d6a:
Delete: storage/ndb/test/tools/old_dirs/hugoPkRead/Makefile
BitKeeper/deleted/.del-Makefile~89557cc224193d4:
Delete: storage/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile
BitKeeper/deleted/.del-Makefile~a6a5bd72a2311773:
Delete: storage/ndb/test/tools/old_dirs/hugoScanRead/Makefile
BitKeeper/deleted/.del-Makefile~e918384f46b2aef0:
Delete: storage/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile
BitKeeper/deleted/.del-Makefile~2a7bcc03f802d4f:
Delete: storage/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile
BitKeeper/deleted/.del-Makefile~2f05dedf982dcd9:
Delete: storage/ndb/test/tools/old_dirs/transproxy/Makefile
BitKeeper/deleted/.del-Makefile~b9e514baf06145d5:
Delete: storage/ndb/test/tools/old_dirs/restart/Makefile
BitKeeper/deleted/.del-Makefile~f1d6329f42d0922d:
Delete: storage/ndb/test/tools/old_dirs/verify_index/Makefile
BitKeeper/deleted/.del-waiter.cpp~b188e4bfddf2cf98:
Delete: storage/ndb/test/tools/old_dirs/waiter/waiter.cpp
BitKeeper/deleted/.del-Makefile~65110e0a5cb381:
Delete: storage/ndb/tools/old_dirs/copy_tab/Makefile
BitKeeper/deleted/.del-Makefile~6dbecfdfc2878bb3:
Delete: storage/ndb/tools/old_dirs/cpcc/Makefile
BitKeeper/deleted/.del-Makefile~77a4d0f4c11f13b5:
Delete: storage/ndb/tools/old_dirs/create_index/Makefile
BitKeeper/deleted/.del-Makefile~57f187037bf9e65d:
Delete: storage/ndb/tools/old_dirs/desc/Makefile
BitKeeper/deleted/.del-Makefile~b25e897a378dd139:
Delete: storage/ndb/tools/old_dirs/delete_all/Makefile
BitKeeper/deleted/.del-Makefile~1b4547a47a5607:
Delete: storage/ndb/tools/old_dirs/drop_index/Makefile
BitKeeper/deleted/.del-Makefile~62140e0b68eb516c:
Delete: storage/ndb/tools/old_dirs/drop_tab/Makefile
BitKeeper/deleted/.del-Makefile~b95bfed632918157:
Delete: storage/ndb/tools/old_dirs/list_tables/Makefile
BitKeeper/deleted/.del-Makefile.PL~81be90388548652f:
Delete: storage/ndb/tools/old_dirs/ndbnet/Makefile.PL
BitKeeper/deleted/.del-ndbnet.pl~8f8f1b18f0458269:
Delete: storage/ndb/tools/old_dirs/ndbnet/ndbnet.pl
BitKeeper/deleted/.del-ndbnetd.pl~e44f1cfe7e8bbe14:
Delete: storage/ndb/tools/old_dirs/ndbnet/ndbnetd.pl
BitKeeper/deleted/.del-Base.pm~50a6f0d38fa1a57c:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Base.pm
BitKeeper/deleted/.del-ndbrun~5db549d7436ac81b:
Delete: storage/ndb/tools/old_dirs/ndbnet/ndbrun
BitKeeper/deleted/.del-Client.pm~45adb527c5cfdaf6:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Client.pm
BitKeeper/deleted/.del-Command.pm~a20dff1bfd06ea7a:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Command.pm
BitKeeper/deleted/.del-Config.pm~24456d4beba19604:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Config.pm
BitKeeper/deleted/.del-Database.pm~cc02e455b02c557:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Database.pm
BitKeeper/deleted/.del-Env.pm~ffeca4ab253818c3:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Env.pm
BitKeeper/deleted/.del-Node.pm~276106bf4000fe2b:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Node.pm
BitKeeper/deleted/.del-NodeApi.pm~3abf1d7bc947d3d0:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeApi.pm
BitKeeper/deleted/.del-NodeDb.pm~9e3055381da679ce:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeDb.pm
BitKeeper/deleted/.del-NodeMgmt.pm~5123fbffcfce73cb:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeMgmt.pm
BitKeeper/deleted/.del-Server.pm~70208c964371fd4d:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Server.pm
BitKeeper/deleted/.del-ServerINET.pm~fc72d28fedd17795:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerINET.pm
BitKeeper/deleted/.del-ServerUNIX.pm~ad3e25435fceb8d0:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerUNIX.pm
BitKeeper/deleted/.del-Base.pm~dd382c9eec2c38b1:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Base.pm
BitKeeper/deleted/.del-Database.pm~ec533cd5dd6a54a2:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Database.pm
BitKeeper/deleted/.del-Env.pm~a343841fae6d0514:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Env.pm
BitKeeper/deleted/.del-Net.pm~425c84165071d5f6:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net.pm
BitKeeper/deleted/.del-Node.pm~339139ded5fcf795:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Node.pm
BitKeeper/deleted/.del-Run.pm~9b414f2b4b76a4da:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run.pm
BitKeeper/deleted/.del-Base.pm~f39906f304e8a49:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Base.pm
BitKeeper/deleted/.del-Util.pm~9be64f1195ec502d:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util.pm
BitKeeper/deleted/.del-Dir.pm~4cbe8dd8c57149a7:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Dir.pm
BitKeeper/deleted/.del-Event.pm~f445c1c094f57cf:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Event.pm
BitKeeper/deleted/.del-File.pm~48da8e977f39bf7:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/File.pm
BitKeeper/deleted/.del-IO.pm~6c6a63ce63fe2ee5:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/IO.pm
BitKeeper/deleted/.del-Lock.pm~366e56786358b3d8:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Lock.pm
BitKeeper/deleted/.del-Log.pm~e0da9468a6f9213a:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Log.pm
BitKeeper/deleted/.del-Socket.pm~371ccd6c5a818fa0:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Socket.pm
BitKeeper/deleted/.del-SocketINET.pm~db8a45b1360b69f2:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketINET.pm
BitKeeper/deleted/.del-SocketUNIX.pm~9ffab2ada7f61530:
Delete: storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketUNIX.pm
BitKeeper/deleted/.del-Makefile~b15469c2fbde2dec:
Delete: storage/ndb/tools/old_dirs/ndbsql/Makefile
BitKeeper/deleted/.del-Makefile~3d1cd223b42a8fa0:
Delete: storage/ndb/tools/old_dirs/select_count/Makefile
BitKeeper/deleted/.del-Makefile~62f516a16a0cf773:
Delete: storage/ndb/tools/old_dirs/select_all/Makefile
BitKeeper/deleted/.del-CounterViewer.java~e83264ff6a5be97:
Delete: storage/ndb/tools/old_dirs/src/counterviewer/CounterViewer.java
storage/ndb/Makefile.am:
Remove reference to old_files directory
581 files changed, 0 insertions, 90603 deletions
diff --git a/storage/ndb/Makefile.am b/storage/ndb/Makefile.am index c4ebf5e7688..287368c5ae7 100644 --- a/storage/ndb/Makefile.am +++ b/storage/ndb/Makefile.am @@ -7,7 +7,6 @@ include $(top_srcdir)/storage/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 \ diff --git a/storage/ndb/src/common/portlib/old_dirs/memtest/Makefile b/storage/ndb/src/common/portlib/old_dirs/memtest/Makefile deleted file mode 100644 index 716cdbdea82..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/memtest/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CC=gcc -LD=$(CC) -SOURCES=memtest.c -OUTPUT=memtest -all: - $(CC) $(SOURCES) -o $(OUTPUT) - -debug: - $(CC) -g $(SOURCES) -o $(OUTPUT) - -clean: rm -rf *.o - rm -rf core* diff --git a/storage/ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile b/storage/ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile deleted file mode 100644 index ea8c5238d1c..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest -BIN_TARGET := munmaptest - - -SOURCES = munmaptest.cpp - -include $(NDB_TOP)/Epilogue.mk - - - - - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/Makefile b/storage/ndb/src/common/portlib/old_dirs/ose/Makefile deleted file mode 100644 index 4ef93b7824a..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -include .defs.mk - -TYPE := - -PIC_ARCHIVE := Y -ARCHIVE_TARGET := portlib - -SOURCES = NdbOut.cpp - -SOURCES.c = NdbCondition.c \ - NdbMutex.c \ - NdbSleep.c \ - NdbTick.c \ - NdbEnv.c \ - NdbThread.c \ - NdbHost.c \ - NdbTCP.c - -ifeq ($(NDB_OS), SOFTOSE) - SOURCES += NdbMem_SoftOse.cpp -else - SOURCES.c += NdbMem.c -endif - -include $(NDB_TOP)/Epilogue.mk - - - - - - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbCondition.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbCondition.c deleted file mode 100644 index 73a2dbc5d66..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbCondition.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; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 "NdbCondition.h" -#include <pthread.h> -#include <sys/types.h> -#include <malloc.h> - -#include <NdbMutex.h> - -#include "NdbConditionOSE.h" -struct NdbCondition -{ - PROCESS condserv_pid; -}; - - -OS_PROCESS(ndbcond_serv){ - - union SIGNAL* sig; - union SIGNAL* sig2; - - static const SIGSELECT sel_signal[] = {2, NDBCOND_SIGNAL, NDBCOND_BROADCAST}; - static const SIGSELECT sel_cond[] = {2, NDBCOND_WAIT, NDBCOND_WAITTIMEOUT}; - - for(;;){ - /* Receive condition wait signal */ - sig = receive((SIGSELECT*)sel_cond); - if (sig != NIL){ - switch (sig->sigNo){ - - case NDBCOND_WAIT: - /* Wait for a SIGNAL or BROADCAST from anyone */ - sig2 = receive((SIGSELECT*)sel_signal); - if (sig2 != NIL){ - switch(sig2->sigNo){ - - case NDBCOND_SIGNAL: - ((struct NdbCondWait*)sig)->status = NDBCOND_SIGNALED; - /* Send signal back to the one waiting for this condition */ - send(&sig, sender(&sig)); - break; - case NDBCOND_BROADCAST: - /* Not handled yet */ - assert(1==0); - break; - default: - assert(1==0); - break; - } - free_buf(&sig2); - } - break; - - case NDBCOND_WAITTIMEOUT: - /* Wait for a SIGNAL or BROADCAST from anyone */ - sig2 = receive_w_tmo(((struct NdbCondWaitTimeout*)sig)->timeout, (SIGSELECT*)sel_signal); - if (sig2 != NIL){ - switch(sig2->sigNo){ - - case NDBCOND_SIGNAL: - ((struct NdbCondWaitTimeout*)sig)->status = NDBCOND_SIGNALED; - /* Send signal back to the one waiting for this condition */ - send(&sig, sender(&sig)); - break; - case NDBCOND_BROADCAST: - /* Not handled yet */ - assert(1==0); - break; - default: - assert(1==0); - break; - } - free_buf(&sig2); - }else{ - ((struct NdbCondWaitTimeout*)sig)->status = NDBCOND_TIMEOUT; - send(&sig, sender(&sig)); - } - break; - - default: - assert(1==0); - break; - - } - } - - } -} - - -struct NdbCondition* -NdbCondition_Create(void) -{ - struct NdbCondition* tmpCond; - - - tmpCond = (struct NdbCondition*)malloc(sizeof(struct NdbCondition)); - - if (tmpCond == NULL) - return NULL; - - /** - * Start this process with a quite high - * priority, we want it to be responsive - */ - tmpCond->condserv_pid = create_process(OS_PRI_PROC, /* Process type */ - "ndbcond_serv", /* Name */ - ndbcond_serv, /* Entry point */ - 2048, /* Stack size */ - 10, /* Priority */ - 0, /* Time slice */ - get_bid(current_process()), /* Block */ - NULL, /* Redir table */ - 0, - 0); - - start(tmpCond->condserv_pid); - - return tmpCond; -} - - -int -NdbCondition_Wait(struct NdbCondition* p_cond, - NdbMutex* p_mutex) -{ - static const SIGSELECT sel_cond[] = {1, NDBCOND_WAIT}; - union SIGNAL* sig; - int result; - if (p_cond == NULL || p_mutex == NULL) - return 0; - - sig = alloc(sizeof(struct NdbCondWait), NDBCOND_WAIT); - send(&sig, p_cond->condserv_pid); - - NdbMutex_Unlock(p_mutex); - - result = 1; - while(NIL == (sig = receive_from((OSTIME)-1, (SIGSELECT*)sel_cond, p_cond->condserv_pid))); - if (sig != NIL){ - if (sig->sigNo == NDBCOND_WAIT){ - /* Condition is signaled */ - result = 0; - }else{ - assert(1==0); - } - free_buf(&sig); - - } - NdbMutex_Lock(p_mutex); - - return result; -} - - -int -NdbCondition_WaitTimeout(struct NdbCondition* p_cond, - NdbMutex* p_mutex, - int msecs){ - static const SIGSELECT sel_cond[] = {1, NDBCOND_WAITTIMEOUT}; - union SIGNAL* sig; - int result; - if (p_cond == NULL || p_mutex == NULL) - return 0; - - sig = alloc(sizeof(struct NdbCondWaitTimeout), NDBCOND_WAITTIMEOUT); - ((struct NdbCondWaitTimeout*)sig)->timeout = msecs; - send(&sig, p_cond->condserv_pid); - - NdbMutex_Unlock(p_mutex); - - result = 1; - while(NIL == (sig = receive_from((OSTIME)-1, (SIGSELECT*)sel_cond, p_cond->condserv_pid))); - if (sig != NIL){ - if (sig->sigNo == NDBCOND_WAITTIMEOUT){ - /* Condition is signaled */ - result = 0; - }else{ - assert(1==0); - } - free_buf(&sig); - - } - - NdbMutex_Lock(p_mutex); - - return result; -} - - -int -NdbCondition_Signal(struct NdbCondition* p_cond){ - - union SIGNAL* sig; - if (p_cond == NULL) - return 1; - - sig = alloc(sizeof(struct NdbCondSignal), NDBCOND_SIGNAL); - send(&sig, p_cond->condserv_pid); - - return 0; -} - - -int NdbCondition_Broadcast(struct NdbCondition* p_cond) -{ - union SIGNAL* sig; - if (p_cond == NULL) - return 1; - - sig = alloc(sizeof(struct NdbCondBroadcast), NDBCOND_BROADCAST); - send(&sig, p_cond->condserv_pid); - - return 0; -} - - -int NdbCondition_Destroy(struct NdbCondition* p_cond) -{ - if (p_cond == NULL) - return 1; - - kill_proc(p_cond->condserv_pid); - free(p_cond); - - return 0; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h b/storage/ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h deleted file mode 100644 index bd0306261cc..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h +++ /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 NDB_CONDITIONOSE_H -#define NDB_CONDITIONOSE_H - - -#ifdef __cplusplus -extern "C" { -#endif - - -#define NDBCOND_SIGBASE 4000 - -#define NDBCOND_WAIT (NDBCOND_SIGBASE + 1) /* !-SIGNO(struct NdbCondWait)-! */ -#define NDBCOND_WAITTIMEOUT (NDBCOND_SIGBASE + 2) /* !-SIGNO(struct NdbCondWaitTimeOut)-! */ -#define NDBCOND_SIGNAL (NDBCOND_SIGBASE + 3) /* !-SIGNO(struct NdbCondSignal)-! */ -#define NDBCOND_BROADCAST (NDBCOND_SIGBASE + 4) /* !-SIGNO(struct NdbCondBroadcast)-! */ - - -const char * -sigNo2String(SIGSELECT sigNo){ - switch(sigNo){ - case NDBCOND_WAIT: - return "NDBCOND_WAIT"; - break; - case NDBCOND_WAITTIMEOUT: - return "NDBCOND_WAITTIMEOUT"; - break; - case NDBCOND_SIGNAL: - return "NDBCOND_SIGNAL"; - break; - case NDBCOND_BROADCAST: - return "NDBCOND_BROADCAST"; - break; - } - return "UNKNOWN"; -} - -struct NdbCondWait -{ - SIGSELECT sigNo; - int status; -}; - -/** - * Signal received - */ -#define NDBCOND_SIGNALED 1 - -/** - * Timeout occured - */ -#define NDBCOND_TIMEOUT 2 - -struct NdbCondWaitTimeout -{ - SIGSELECT sigNo; - int timeout; - int status; - -}; - -struct NdbCondSignal -{ - SIGSELECT sigNo; -}; - -struct NdbCondBroadcast -{ - SIGSELECT sigNo; -}; - - -union SIGNAL -{ - SIGSELECT sigNo; - struct NdbCondWait condWait; - struct NdbCondWaitTimeout condWaitTimeout; - struct NdbCondSignal condSignal; - struct NdbCondBroadcast condBroadcast; -}; - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbEnv.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbEnv.c deleted file mode 100644 index e2ac4d879d2..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbEnv.c +++ /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 "NdbEnv.h" -#include <string.h> -#include <stdlib.h> - -const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) -{ - /** - * All environment variables are associated with a process - * it's important to read env from the correct process - * for now read from own process, own block and last the "ose_shell" process. - * - * TODO! What process should this be read from in the future? - * - */ - PROCESS proc_; - char* p = NULL; - /* Look in own process */ - p = get_env(current_process(), (char*)name); - if (p == NULL){ - /* Look in block process */ - p = get_env(get_bid(current_process()), (char*)name); - if (p == NULL){ - /* Look in ose_shell process */ - if (hunt("ose_shell", 0, &proc_, NULL)){ - p = get_env(proc_, (char*)name); - } - } - } - - if (p != NULL){ - strncpy(buf, p, buflen); - buf[buflen-1] = 0; - free_buf((union SIGNAL **)&p); - p = buf; - } - return p; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbHost.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbHost.c deleted file mode 100644 index f5e1e511c16..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbHost.c +++ /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 "NdbHost.h" -#include <unistd.h> - - -#include <inet.sig> -#include <string.h> - -union SIGNAL -{ - SIGSELECT sigNo; - struct InetIfUp inetIfUp; -}; - -int NdbHost_GetHostName(char* buf) -{ -#if 0 - extern PROCESS ose_inet_; - union SIGNAL *signal; - static const SIGSELECT select_if_up_reply[] = { 1, INET_IF_UP_REPLY }; - - signal = alloc(sizeof(struct InetIfUp), INET_IF_UP_REQUEST); - strcpy(signal->inetIfUp.ifName, "*"); - send((union SIGNAL **)&signal, ose_inet_); - signal = receive((SIGSELECT *)select_if_up_reply); - strcpy(buf, signal->inetIfUp.ifName); - free_buf(&signal); - return 0; -#else - return -1; -#endif -} - - -int NdbHost_GetProcessId(void) -{ - return current_process(); -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbMem.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbMem.c deleted file mode 100644 index 0e38024bbb4..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbMem.c +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 "NdbMem.h" - - -#if defined NDB_OSE -#include <ose.h> -#include <mms.sig> -#include <mms_err.h> -#include <string.h> -#include <stdio.h> -#include <NdbOut.hpp> - -// Page size for mp750 is 4096 bytes. -#define PAGE_SIZE 4096 - -/** - * NOTE: To use NdbMem from a OSE system ose_mms has to be defined - * as a "Required External Process"(see OSE Kernel User's Guide/R1.1(p. 148)), - * like this in osemain.con: - * EXT_PROC(ose_mms, ose_mms, 50000) - * This will create a global variable ose_mms_ that is used from here. - */ - -union SIGNAL -{ - SIGSELECT sigNo; - struct MmsAllocateRegionRequest mmsAllocateRegionRequest; - struct MmsAllocateRegionReply mmsAllocateRegionReply; - struct MmsFreeRegionRequest mmsFreeRegionRequest; - struct MmsFreeRegionReply mmsFreeRegionReply; -}; /* union SIGNAL */ - -extern PROCESS ose_mms_; - -void NdbMem_Create(void) -{ - /* Do nothing */ - return; -} - -void NdbMem_Destroy(void) -{ - /* Do nothing */ - return; -} - -void* NdbMem_Allocate(size_t size) -{ - static SIGSELECT allocate_sig[] = {1,MMS_ALLOCATE_REGION_REPLY}; - union SIGNAL *sig; - U32 allocatedAdress; - - assert(size > 0); - - // Only allowed to allocate multiples of the page size. - if(size % PAGE_SIZE != 0) { - size += PAGE_SIZE - size%PAGE_SIZE; - } - - /* Allocate a new region in the callers memory segment. */ - sig = alloc(sizeof(struct MmsAllocateRegionRequest), - MMS_ALLOCATE_REGION_REQUEST); - /* -1: The callers domain is used */ - sig->mmsAllocateRegionRequest.domain = (MemoryDomain)-1; - sig->mmsAllocateRegionRequest.useAddr = False; - sig->mmsAllocateRegionRequest.size = size; - sig->mmsAllocateRegionRequest.access = SuperRW_UserRW; - sig->mmsAllocateRegionRequest.resident = False; - sig->mmsAllocateRegionRequest.memory = CodeData; - sig->mmsAllocateRegionRequest.cache = CopyBack; - strcpy(sig->mmsAllocateRegionRequest.name, "NDB_DATA"); - send(&sig, ose_mms_); - sig = receive(allocate_sig); - - if (sig->mmsAllocateRegionReply.status != MMS_SUCCESS){ - /* Memory allocation failed, make sure this function returns NULL */ - allocatedAdress = NULL; - } - else{ - allocatedAdress = sig->mmsAllocateRegionReply.address; - } - free_buf(&sig); - return (void*)allocatedAdress; -} - -void* NdbMem_AllocateAlign(size_t size, size_t alignment) -{ - return NdbMem_Allocate(size); -} - - -void NdbMem_Free(void* ptr) -{ - static SIGSELECT free_sig[] = {1,MMS_FREE_REGION_REPLY}; - union SIGNAL *sig; - - /* Free a region in the callers domain. */ - sig = alloc(sizeof(struct MmsFreeRegionRequest), - MMS_FREE_REGION_REQUEST); - sig->mmsFreeRegionRequest.address = (U32)ptr; - send(&sig, ose_mms_); - sig = receive(free_sig); - - if (sig->mmsFreeRegionReply.status != MMS_SUCCESS){ - ndbout_c("The MMS Region could not be deallocated.\r\n"); - error(sig->mmsFreeRegionReply.status); - }; - free_buf(&sig); -} - -int NdbMem_MemLockAll(){ - return -1; -} - -int NdbMem_MemUnlockAll(){ - return -1; -} - -#else -#include <stdlib.h> - - -void NdbMem_Create() -{ - /* Do nothing */ - return; -} - -void NdbMem_Destroy() -{ - /* Do nothing */ - return; -} - -void* NdbMem_Allocate(size_t size) -{ - assert(size > 0); - return (void*)malloc(size); -} - -void* NdbMem_AllocateAlign(size_t size, size_t alignment) -{ - /* - return (void*)memalign(alignment, size); - TEMP fix - */ - return (void*)malloc(size); -} - - -void NdbMem_Free(void* ptr) -{ - free(ptr); -} - - -int NdbMem_MemLockAll(){ - return -1; -} - -int NdbMem_MemUnlockAll(){ - return -1; -} - -#endif diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp b/storage/ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp deleted file mode 100644 index cad22c0474b..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.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 "NdbMem.h" - -extern "C" -void NdbMem_Create() -{ -} -extern "C" -void NdbMem_Destroy() -{ -} - -extern "C" -void* NdbMem_Allocate(size_t size) -{ - return new char[size]; -} - -extern "C" -void* NdbMem_AllocateAlign(size_t size, size_t alignment) -{ - return NdbMem_Allocate(size); -} - -extern "C" -void NdbMem_Free(void* ptr) -{ - delete [] (char *)(ptr); -} - -int NdbMem_MemLockAll(){ - return -1; -} - -int NdbMem_MemUnlockAll(){ - return -1; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbMutex.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbMutex.c deleted file mode 100644 index 253c0e412ff..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbMutex.c +++ /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 */ - - -#include "NdbMutex.h" - -#include <pthread.h> -#include <stdlib.h> - - -NdbMutex* NdbMutex_Create(void) -{ - NdbMutex* pNdbMutex; - - pNdbMutex = create_sem(1); - - return pNdbMutex; -} - - -int NdbMutex_Destroy(NdbMutex* p_mutex) -{ - - if (p_mutex == NULL) - return -1; - - kill_sem(p_mutex); - - return 0; - -} - - -int NdbMutex_Lock(NdbMutex* p_mutex) -{ - if (p_mutex == NULL) - return -1; - - wait_sem(p_mutex); - - return 0; -} - - -int NdbMutex_Unlock(NdbMutex* p_mutex) -{ - - if (p_mutex == NULL) - return -1; - - signal_sem(p_mutex); - - return 0; -} - - -int NdbMutex_Trylock(NdbMutex* p_mutex) -{ - int result = -1; - - if (p_mutex != NULL) { - OSSEMVAL semvalue = get_sem(p_mutex); - if (semvalue > 0) { - wait_sem(p_mutex); - result = 0; - } - } - - return result; - -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp b/storage/ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp deleted file mode 100644 index eb81bc9d971..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbOut.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 <ndb_global.h> - -#include "NdbOut.hpp" - -#if defined NDB_SOFTOSE -#include <dbgprintf.h> -#define printfunc dbgprintf -#else -#define printfunc printf -#endif - -static char const* const endlineString = "\r\n"; - -static int CtrlC = 0; -NdbOut ndbout; - - -NdbOut& NdbOut::operator<<(int aVal) -{ - char* format; - char HexFormat[] = "0x%08x"; - char DecFormat[] = "%d"; - if (isHexFormat == 1) - format = HexFormat; - else - format = DecFormat; - - printfunc(format, aVal); - return *this; -} - -NdbOut& NdbOut::operator<<(char* pVal) -{ - printfunc("%s", pVal); - return *this; -} - -NdbOut& NdbOut::endline() -{ - isHexFormat = 0; // Reset hex to normal, if user forgot this - printfunc(endlineString); - return *this; -} - -NdbOut& NdbOut::flushline() -{ - isHexFormat = 0; // Reset hex to normal, if user forgot this - return *this; -} - -NdbOut& NdbOut::setHexFormat(int _format) -{ - isHexFormat = _format; - return *this; -} - -NdbOut::NdbOut() -{ - CtrlC = 0; - isHexFormat = 0; -} - -NdbOut::~NdbOut() -{ -} - - - -extern "C" -void -ndbout_c(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 << endl; - va_end(ap); -} diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbSleep.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbSleep.c deleted file mode 100644 index 70fd83117ef..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbSleep.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 "NdbSleep.h" - -#include <ose.h> - - -int -NdbSleep_MilliSleep(int milliseconds){ - const OSTIME millisecond_delay = milliseconds; - delay(millisecond_delay); - return 0; -} - -int -NdbSleep_SecSleep(int seconds){ - const OSTIME millisecond_delay = seconds*1000; - delay(millisecond_delay); - return 0; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbTCP.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbTCP.c deleted file mode 100644 index 9994697b3f8..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbTCP.c +++ /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 "NdbTCP.h" - - -int -Ndb_getInAddr(struct in_addr * dst, const char *address) { - struct hostent * host; - host = gethostbyname_r(address); - if(host != 0){ - dst->s_addr = ((struct in_addr *) *host->h_addr_list)->s_addr; - free_buf((union SIGNAL **)&host); - return 0; - } - /* Try it as aaa.bbb.ccc.ddd. */ - dst->s_addr = inet_addr(address); - if (dst->s_addr != INADDR_NONE) { - return 0; - } - return -1; -} - - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbThread.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbThread.c deleted file mode 100644 index e46903a5cce..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbThread.c +++ /dev/null @@ -1,183 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 "NdbThread.h" -#include <pthread.h> -#include <malloc.h> -#include <string.h> -#include <NdbOut.hpp> - -#define MAX_THREAD_NAME 16 - - -struct NdbThread -{ - PROCESS pid; - char thread_name[MAX_THREAD_NAME]; -}; - -#define NDBTHREAD_SIGBASE 4010 - -#define NDBTHREAD_START (NDBTHREAD_SIGBASE + 1) /* !-SIGNO(struct NdbThreadStart)-! */ - -struct NdbThreadStart -{ - SIGSELECT sigNo; - NDB_THREAD_FUNC* func; - NDB_THREAD_ARG arg; -}; - -struct NdbThreadStopped -{ - SIGSELECT sigNo; -}; - -union SIGNAL -{ - SIGSELECT sigNo; - struct NdbThreadStart threadStart; - struct NdbThreadStopped threadStopped; -}; - -OS_PROCESS(thread_starter){ - static const SIGSELECT sel_start[] = {1, NDBTHREAD_START}; - struct NdbThreadStart* sigstart; - union SIGNAL* sig; - - /* Receive function adress and params */ - sig = receive((SIGSELECT*)sel_start); - if (sig != NIL){ - if (sig->sigNo == NDBTHREAD_START){ - sigstart = ((struct NdbThreadStart*)sig); - /* Execute function with arg */ - (*sigstart->func)(sigstart->arg); - }else{ - assert(1==0); - } - free_buf(&sig); - } -} - -struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC* p_thread_func, - NDB_THREAD_ARG *p_thread_arg, - const NDB_THREAD_STACKSIZE thread_stack_size, - const char* p_thread_name, - NDB_THREAD_PRIO thread_prio) -{ - struct NdbThread* tmpThread; - union SIGNAL* sig; - int ose_prio; - - if (p_thread_func == NULL) - return 0; - - tmpThread = (struct NdbThread*)malloc(sizeof(struct NdbThread)); - if (tmpThread == NULL) - return NULL; - - strncpy((char*)&tmpThread->thread_name, p_thread_name, MAX_THREAD_NAME); - - switch(thread_prio){ - case NDB_THREAD_PRIO_HIGHEST: - ose_prio = 1; - break; - case NDB_THREAD_PRIO_HIGH: - ose_prio = 10; - break; - case NDB_THREAD_PRIO_MEAN: - ose_prio = 16; - break; - case NDB_THREAD_PRIO_LOW: - ose_prio = 23; - break; - case NDB_THREAD_PRIO_LOWEST: - ose_prio = 31; - break; - default: - return NULL; - break; - } - - /* Create process */ - tmpThread->pid = create_process(OS_PRI_PROC, /* Process type */ - (char*)p_thread_name, /* Name */ - thread_starter, /* Entry point */ - thread_stack_size, /* Stack size */ - ose_prio, /* Priority */ - 0, /* Time slice */ - get_bid(current_process()), /* Block */ - NULL, /* Redir table */ - 0, - 0); - - /* Send params to process */ - sig = alloc(sizeof(struct NdbThreadStart), NDBTHREAD_START); - ((struct NdbThreadStart*)sig)->func = p_thread_func; - ((struct NdbThreadStart*)sig)->arg = p_thread_arg; - send(&sig, tmpThread->pid); - - /* Enable NDB_HOME environment variable for the thread */ - { - /* Hardcoded NDB_HOME...*/ - char* ndb_home_env = get_env(current_process(), "NDB_HOME"); - if (ndb_home_env != NULL) - { - /* Set NDB_HOME */ - int rc = set_env(tmpThread->pid, "NDB_HOME", ndb_home_env); - if (rc != 0) - { - /* Not really a problem */ - } - } /* Enable NDB_HOME */ - } - - /* Start process */ - start(tmpThread->pid); - - return tmpThread; -} - - - -void NdbThread_Destroy(struct NdbThread** p_thread) -{ - free(* p_thread); * p_thread = 0; -} - - -int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status) -{ - while(hunt(p_wait_thread->thread_name, 0, NULL, NULL) != 0) - delay(1000); - - * status = 0; - - return 0; -} - - -void NdbThread_Exit(int a) -{ - kill_proc(current_process()); -} - - -int NdbThread_SetConcurrencyLevel(int level) -{ - return 0; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/ose/NdbTick.c b/storage/ndb/src/common/portlib/old_dirs/ose/NdbTick.c deleted file mode 100644 index c3deae2bec3..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/ose/NdbTick.c +++ /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 */ - - -#include "NdbTick.h" -#include <time.h> - -#define NANOSEC_PER_SEC 1000000000 -#define MICROSEC_PER_SEC 1000000 -#define MILLISEC_PER_SEC 1000 -#define MICROSEC_PER_MILLISEC 1000 -#define MILLISEC_PER_NANOSEC 1000000 - -#ifdef NDB_OSE -NDB_TICKS NdbTick_CurrentMillisecond(void) -{ - return get_ticks()*4; -} -#include <rtc.h> -int -NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){ - struct TimePair tvp; - rtc_get_time(&tvp); - * secs = tvp.seconds; - * micros = tvp.micros; - return 0; -} - -#endif - -#if defined NDB_SOFTOSE -NDB_TICKS NdbTick_CurrentMillisecond(void) -{ - /** - * Depends on the interval counter in solaris - * that means each "tick" in OSE is really 10 milliseconds - */ - return get_ticks()*10; -} - -#include <rtc.h> -int -NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){ - struct TimePair tvp; - rtc_get_time(&tvp); - * secs = tvp.seconds; - * micros = tvp.micros; - return 0; -} -#endif - diff --git a/storage/ndb/src/common/portlib/old_dirs/test/Makefile b/storage/ndb/src/common/portlib/old_dirs/test/Makefile deleted file mode 100644 index 4edc98ede75..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/test/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include .defs.mk - -TYPE := kernel - -BIN_TARGET := PortLibTest -BIN_TARGET_ARCHIVES := portlib general - -SOURCES = NdbPortLibTest.cpp - -include $(NDB_TOP)/Epilogue.mk - - - - - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/Makefile b/storage/ndb/src/common/portlib/old_dirs/win32/Makefile deleted file mode 100644 index bb29ac5547e..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include .defs.mk - -TYPE := util - -PIC_ARCHIVE := Y -ARCHIVE_TARGET := portlib - -SOURCES.c = NdbCondition.c \ - NdbMutex.c \ - NdbSleep.c \ - NdbTick.c \ - NdbEnv.c \ - NdbThread.c \ - NdbHost.c \ - NdbTCP.c \ - NdbDaemon.c - -ifeq ($(NDB_OS), SOFTOSE) - SOURCES += NdbMem_SoftOse.cpp -else - SOURCES.c += NdbMem.c -endif - -include $(NDB_TOP)/Epilogue.mk - - - - - - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbCondition.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbCondition.c deleted file mode 100644 index 77869b673de..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbCondition.c +++ /dev/null @@ -1,183 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <winsock2.h> -#include <ws2tcpip.h> -#include <windows.h> -#include <sys/types.h> - -#include "NdbCondition.h" -#include <NdbMutex.h> - - -struct NdbCondition -{ - long nWaiters; - NdbMutex* pNdbMutexWaitersLock; - HANDLE hSemaphore; - HANDLE hEventWaitersDone; - int bWasBroadcast; -}; - - -struct NdbCondition* -NdbCondition_Create(void) -{ - int result = 0; - struct NdbCondition* pNdbCondition = (struct NdbCondition*)malloc(sizeof(struct NdbCondition)); - if(!pNdbCondition) - return 0; - - pNdbCondition->nWaiters = 0; - pNdbCondition->bWasBroadcast = 0; - if(!(pNdbCondition->hSemaphore = CreateSemaphore(0, 0, MAXLONG, 0))) - result = -1; - else if(!(pNdbCondition->pNdbMutexWaitersLock = NdbMutex_Create())) - result = -1; - else if(!(pNdbCondition->hEventWaitersDone = CreateEvent(0, 0, 0, 0))) - result = -1; - - assert(!result); - return pNdbCondition; -} - - -int -NdbCondition_Wait(struct NdbCondition* p_cond, - NdbMutex* p_mutex) -{ - int result; - int bLastWaiter; - if(!p_cond || !p_mutex) - return 1; - - NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); - p_cond->nWaiters++; - NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); - - if(NdbMutex_Unlock(p_mutex)) - return -1; - result = WaitForSingleObject (p_cond->hSemaphore, INFINITE); - - NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); - p_cond->nWaiters--; - bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0); - NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); - - if(result==WAIT_OBJECT_0 && bLastWaiter) - SetEvent(p_cond->hEventWaitersDone); - - NdbMutex_Lock(p_mutex); - return result; -} - - -int -NdbCondition_WaitTimeout(struct NdbCondition* p_cond, - NdbMutex* p_mutex, - int msecs) -{ - int result; - int bLastWaiter; - if (!p_cond || !p_mutex) - return 1; - - NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); - p_cond->nWaiters++; - NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); - if(msecs<0) - msecs = 0; - - if(NdbMutex_Unlock(p_mutex)) - return -1; - result = WaitForSingleObject(p_cond->hSemaphore, msecs); - - NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); - p_cond->nWaiters--; - bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0); - NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); - - if(result!=WAIT_OBJECT_0) - result = -1; - - if(bLastWaiter) - SetEvent(p_cond->hEventWaitersDone); - - NdbMutex_Lock(p_mutex); - return result; -} - - -int -NdbCondition_Signal(struct NdbCondition* p_cond) -{ - int bHaveWaiters; - if(!p_cond) - return 1; - - NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); - bHaveWaiters = (p_cond->nWaiters > 0); - NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); - - if(bHaveWaiters) - return (ReleaseSemaphore(p_cond->hSemaphore, 1, 0) ? 0 : -1); - else - return 0; -} - - -int NdbCondition_Broadcast(struct NdbCondition* p_cond) -{ - int bHaveWaiters; - int result = 0; - if(!p_cond) - return 1; - - NdbMutex_Lock(p_cond->pNdbMutexWaitersLock); - bHaveWaiters = 0; - if(p_cond->nWaiters > 0) - { - p_cond->bWasBroadcast = !0; - bHaveWaiters = 1; - } - NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock); - if(bHaveWaiters) - { - if(!ReleaseSemaphore(p_cond->hSemaphore, p_cond->nWaiters, 0)) - result = -1; - else if(WaitForSingleObject (p_cond->hEventWaitersDone, INFINITE) != WAIT_OBJECT_0) - result = -1; - p_cond->bWasBroadcast = 0; - } - return result; -} - - -int NdbCondition_Destroy(struct NdbCondition* p_cond) -{ - int result; - if(!p_cond) - return 1; - - CloseHandle(p_cond->hEventWaitersDone); - NdbMutex_Destroy(p_cond->pNdbMutexWaitersLock); - result = (CloseHandle(p_cond->hSemaphore) ? 0 : -1); - - free(p_cond); - return 0; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c deleted file mode 100644 index 972fb1b88d8..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c +++ /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 <ndb_global.h> -#include "NdbDaemon.h" - -#define NdbDaemon_ErrorSize 500 -long NdbDaemon_DaemonPid; -int NdbDaemon_ErrorCode; -char NdbDaemon_ErrorText[NdbDaemon_ErrorSize]; - -int -NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) -{ - /* Fail */ - snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize, - "Daemon mode not implemented"); - return -1; -} - -#ifdef NDB_DAEMON_TEST - -int -main() -{ - if (NdbDaemon_Make("test.pid", "test.log", 0) == -1) { - fprintf(stderr, "NdbDaemon_Make: %s\n", NdbDaemon_ErrorText); - return 1; - } - sleep(10); - return 0; -} - -#endif diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbEnv.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbEnv.c deleted file mode 100644 index 0df703a5e97..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbEnv.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 "NdbEnv.h" -#include <string.h> -#include <stdlib.h> - -const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) -{ - char* p = NULL; - p = getenv(name); - - if (p != NULL && buf != NULL){ - strncpy(buf, p, buflen); - buf[buflen-1] = 0; - } - return p; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbHost.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbHost.c deleted file mode 100644 index f91dd1a531c..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbHost.c +++ /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 "NdbHost.h" -#include <windows.h> -#include <process.h> - - -int NdbHost_GetHostName(char* buf) -{ - /* We must initialize TCP/IP if we want to call gethostname */ - WORD wVersionRequested; - WSADATA wsaData; - int err; - - wVersionRequested = MAKEWORD( 2, 0 ); - err = WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) { - /** - * Tell the user that we couldn't find a usable - * WinSock DLL. - */ - return -1; - } - - /* Get host name */ - if(gethostname(buf, MAXHOSTNAMELEN)) - { - return -1; - } - return 0; -} - - -int NdbHost_GetProcessId(void) -{ - return _getpid(); -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbMem.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbMem.c deleted file mode 100644 index ab7123b0a29..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbMem.c +++ /dev/null @@ -1,235 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <windows.h> - -#include "NdbMem.h" - - -struct AWEINFO -{ - SIZE_T dwSizeInBytesRequested; - ULONG_PTR nNumberOfPagesRequested; - ULONG_PTR nNumberOfPagesActual; - ULONG_PTR nNumberOfPagesFreed; - ULONG_PTR* pnPhysicalMemoryPageArray; - void* pRegionReserved; -}; - -const size_t cNdbMem_nMaxAWEinfo = 256; -size_t gNdbMem_nAWEinfo = 0; - -struct AWEINFO* gNdbMem_pAWEinfo = 0; - - -void ShowLastError(const char* szContext, const char* szFunction) -{ - DWORD dwError = GetLastError(); - LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dwError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR)&lpMsgBuf, - 0, - NULL - ); - printf("%s : %s failed : %lu : %s\n", szContext, szFunction, dwError, (char*)lpMsgBuf); - LocalFree(lpMsgBuf); -} - - - -void NdbMem_Create() -{ - // Address Windowing Extensions - struct PRIVINFO - { - DWORD Count; - LUID_AND_ATTRIBUTES Privilege[1]; - } Info; - - HANDLE hProcess = GetCurrentProcess(); - HANDLE hToken; - if(!OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken)) - { - ShowLastError("NdbMem_Create", "OpenProcessToken"); - } - - Info.Count = 1; - Info.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED; - if(!LookupPrivilegeValue(0, SE_LOCK_MEMORY_NAME, &(Info.Privilege[0].Luid))) - { - ShowLastError("NdbMem_Create", "LookupPrivilegeValue"); - } - - if(!AdjustTokenPrivileges(hToken, FALSE, (PTOKEN_PRIVILEGES)&Info, 0, 0, 0)) - { - ShowLastError("NdbMem_Create", "AdjustTokenPrivileges"); - } - - if(!CloseHandle(hToken)) - { - ShowLastError("NdbMem_Create", "CloseHandle"); - } - - return; -} - -void NdbMem_Destroy() -{ - /* Do nothing */ - return; -} - -void* NdbMem_Allocate(size_t size) -{ - // Address Windowing Extensions - struct AWEINFO* pAWEinfo; - HANDLE hProcess; - SYSTEM_INFO sysinfo; - - if(!gNdbMem_pAWEinfo) - { - gNdbMem_pAWEinfo = VirtualAlloc(0, - sizeof(struct AWEINFO)*cNdbMem_nMaxAWEinfo, - MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); - } - - assert(gNdbMem_nAWEinfo < cNdbMem_nMaxAWEinfo); - pAWEinfo = gNdbMem_pAWEinfo+gNdbMem_nAWEinfo++; - - hProcess = GetCurrentProcess(); - GetSystemInfo(&sysinfo); - pAWEinfo->nNumberOfPagesRequested = (size+sysinfo.dwPageSize-1)/sysinfo.dwPageSize; - pAWEinfo->pnPhysicalMemoryPageArray = VirtualAlloc(0, - sizeof(ULONG_PTR)*pAWEinfo->nNumberOfPagesRequested, - MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); - pAWEinfo->nNumberOfPagesActual = pAWEinfo->nNumberOfPagesRequested; - if(!AllocateUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesActual), pAWEinfo->pnPhysicalMemoryPageArray)) - { - ShowLastError("NdbMem_Allocate", "AllocateUserPhysicalPages"); - return 0; - } - if(pAWEinfo->nNumberOfPagesRequested != pAWEinfo->nNumberOfPagesActual) - { - ShowLastError("NdbMem_Allocate", "nNumberOfPagesRequested != nNumberOfPagesActual"); - return 0; - } - - pAWEinfo->dwSizeInBytesRequested = size; - pAWEinfo->pRegionReserved = VirtualAlloc(0, pAWEinfo->dwSizeInBytesRequested, MEM_RESERVE | MEM_PHYSICAL, PAGE_READWRITE); - if(!pAWEinfo->pRegionReserved) - { - ShowLastError("NdbMem_Allocate", "VirtualAlloc"); - return 0; - } - - if(!MapUserPhysicalPages(pAWEinfo->pRegionReserved, pAWEinfo->nNumberOfPagesActual, pAWEinfo->pnPhysicalMemoryPageArray)) - { - ShowLastError("NdbMem_Allocate", "MapUserPhysicalPages"); - return 0; - } - - /* - printf("allocate AWE memory: %lu bytes, %lu pages, address %lx\n", - pAWEinfo->dwSizeInBytesRequested, - pAWEinfo->nNumberOfPagesActual, - pAWEinfo->pRegionReserved); - */ - return pAWEinfo->pRegionReserved; -} - - -void* NdbMem_AllocateAlign(size_t size, size_t alignment) -{ - /* - return (void*)memalign(alignment, size); - TEMP fix - */ - return NdbMem_Allocate(size); -} - - -void NdbMem_Free(void* ptr) -{ - // VirtualFree(ptr, 0, MEM_DECOMMIT|MEM_RELEASE); - - // Address Windowing Extensions - struct AWEINFO* pAWEinfo = 0; - size_t i; - HANDLE hProcess; - - for(i=0; i<gNdbMem_nAWEinfo; ++i) - { - if(ptr==gNdbMem_pAWEinfo[i].pRegionReserved) - { - pAWEinfo = gNdbMem_pAWEinfo+i; - } - } - if(!pAWEinfo) - { - ShowLastError("NdbMem_Free", "ptr is not AWE memory"); - } - - hProcess = GetCurrentProcess(); - if(!MapUserPhysicalPages(ptr, pAWEinfo->nNumberOfPagesActual, 0)) - { - ShowLastError("NdbMem_Free", "MapUserPhysicalPages"); - } - - if(!VirtualFree(ptr, 0, MEM_RELEASE)) - { - ShowLastError("NdbMem_Free", "VirtualFree"); - } - - pAWEinfo->nNumberOfPagesFreed = pAWEinfo->nNumberOfPagesActual; - if(!FreeUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesFreed), pAWEinfo->pnPhysicalMemoryPageArray)) - { - ShowLastError("NdbMem_Free", "FreeUserPhysicalPages"); - } - - VirtualFree(pAWEinfo->pnPhysicalMemoryPageArray, 0, MEM_DECOMMIT|MEM_RELEASE); -} - - -int NdbMem_MemLockAll() -{ - /* - HANDLE hProcess = GetCurrentProcess(); - SIZE_T nMinimumWorkingSetSize; - SIZE_T nMaximumWorkingSetSize; - GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize); - ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl; - - SetProcessWorkingSetSize(hProcess, 50000000, 100000000); - - GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize); - ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl; - */ - return -1; -} - -int NdbMem_MemUnlockAll() -{ - //VirtualUnlock(); - return -1; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbMutex.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbMutex.c deleted file mode 100644 index e797024d5bb..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbMutex.c +++ /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 */ - - -#include <winsock2.h> -#include <ws2tcpip.h> -#include <windows.h> -#include <time.h> - -#include "NdbMutex.h" - - -NdbMutex* NdbMutex_Create(void) -{ - NdbMutex* pNdbMutex = (NdbMutex*)malloc(sizeof(NdbMutex)); - if(!pNdbMutex) - return 0; - - InitializeCriticalSection(pNdbMutex); - return pNdbMutex; -} - - -int NdbMutex_Destroy(NdbMutex* p_mutex) -{ - if(!p_mutex) - return -1; - - DeleteCriticalSection(p_mutex); - free(p_mutex); - return 0; -} - - -int NdbMutex_Lock(NdbMutex* p_mutex) -{ - if(!p_mutex) - return -1; - - EnterCriticalSection (p_mutex); - return 0; -} - - -int NdbMutex_Unlock(NdbMutex* p_mutex) -{ - if(!p_mutex) - return -1; - - LeaveCriticalSection(p_mutex); - return 0; -} - - -int NdbMutex_Trylock(NdbMutex* p_mutex) -{ - int result = -1; - if(p_mutex) - { - result = (TryEnterCriticalSection(p_mutex) ? 0 : -1); - } - return result; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbSleep.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbSleep.c deleted file mode 100644 index ac0f44dd07f..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbSleep.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 "NdbSleep.h" - -#include <windows.h> - - -int -NdbSleep_MilliSleep(int milliseconds) -{ - Sleep(milliseconds); - return 0; -} - -int -NdbSleep_SecSleep(int seconds) -{ - return NdbSleep_MilliSleep(seconds*1000); -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbTCP.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbTCP.c deleted file mode 100644 index 483a53bd606..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbTCP.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - -#include "NdbTCP.h" - -int -Ndb_getInAddr(struct in_addr * dst, const char *address) -{ - struct hostent * hostPtr; - - /* Try it as aaa.bbb.ccc.ddd. */ - dst->s_addr = inet_addr(address); - if (dst->s_addr != -1) { - return 0; - } - - hostPtr = gethostbyname(address); - if (hostPtr != NULL) { - dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; - return 0; - } - - return -1; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbThread.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbThread.c deleted file mode 100644 index 1f052f034e8..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbThread.c +++ /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 */ - - -#include <windows.h> -#include <process.h> - -#include "NdbThread.h" - - -#define MAX_THREAD_NAME 16 - -typedef unsigned (WINAPI* NDB_WIN32_THREAD_FUNC)(void*); - - -struct NdbThread -{ - HANDLE hThread; - unsigned nThreadId; - char thread_name[MAX_THREAD_NAME]; -}; - - -struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func, - NDB_THREAD_ARG *p_thread_arg, - const NDB_THREAD_STACKSIZE thread_stack_size, - const char* p_thread_name, - NDB_THREAD_PRIO thread_prio) -{ - struct NdbThread* tmpThread; - unsigned initflag; - int nPriority = 0; - - if(!p_thread_func) - return 0; - - tmpThread = (struct NdbThread*)malloc(sizeof(struct NdbThread)); - if(!tmpThread) - return 0; - - strncpy((char*)&tmpThread->thread_name, p_thread_name, MAX_THREAD_NAME); - - switch(thread_prio) - { - case NDB_THREAD_PRIO_HIGHEST: nPriority=THREAD_PRIORITY_HIGHEST; break; - case NDB_THREAD_PRIO_HIGH: nPriority=THREAD_PRIORITY_ABOVE_NORMAL; break; - case NDB_THREAD_PRIO_MEAN: nPriority=THREAD_PRIORITY_NORMAL; break; - case NDB_THREAD_PRIO_LOW: nPriority=THREAD_PRIORITY_BELOW_NORMAL; break; - case NDB_THREAD_PRIO_LOWEST: nPriority=THREAD_PRIORITY_LOWEST; break; - } - initflag = (nPriority ? CREATE_SUSPENDED : 0); - - tmpThread->hThread = (HANDLE)_beginthreadex(0, thread_stack_size, - (NDB_WIN32_THREAD_FUNC)p_thread_func, p_thread_arg, - initflag, &tmpThread->nThreadId); - - if(nPriority && tmpThread->hThread) - { - SetThreadPriority(tmpThread->hThread, nPriority); - ResumeThread (tmpThread->hThread); - } - - assert(tmpThread->hThread); - return tmpThread; -} - - -void NdbThread_Destroy(struct NdbThread** p_thread) -{ - CloseHandle((*p_thread)->hThread); - (*p_thread)->hThread = 0; - free(*p_thread); - *p_thread = 0; -} - - -int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status) -{ - void *local_status = 0; - if (status == 0) - status = &local_status; - - if(WaitForSingleObject(p_wait_thread->hThread, INFINITE) == WAIT_OBJECT_0 - && GetExitCodeThread(p_wait_thread->hThread, (LPDWORD)status)) - { - CloseHandle(p_wait_thread->hThread); - p_wait_thread->hThread = 0; - return 0; - } - return -1; -} - - -void NdbThread_Exit(int status) -{ - _endthreadex((DWORD) status); -} - - -int NdbThread_SetConcurrencyLevel(int level) -{ - return 0; -} - diff --git a/storage/ndb/src/common/portlib/old_dirs/win32/NdbTick.c b/storage/ndb/src/common/portlib/old_dirs/win32/NdbTick.c deleted file mode 100644 index e3a67d8437d..00000000000 --- a/storage/ndb/src/common/portlib/old_dirs/win32/NdbTick.c +++ /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 */ - - -#include <windows.h> -#include "NdbTick.h" - -/* -#define FILETIME_PER_MICROSEC 10 -#define FILETIME_PER_MILLISEC 10000 -#define FILETIME_PER_SEC 10000000 - - -NDB_TICKS NdbTick_CurrentMillisecond(void) -{ - ULONGLONG ullTime; - GetSystemTimeAsFileTime((LPFILETIME)&ullTime); - return (ullTime / FILETIME_PER_MILLISEC); -} - -int -NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros) -{ - ULONGLONG ullTime; - GetSystemTimeAsFileTime((LPFILETIME)&ullTime); - *secs = (ullTime / FILETIME_PER_SEC); - *micros = (Uint32)((ullTime % FILETIME_PER_SEC) / FILETIME_PER_MICROSEC); - return 0; -} -*/ - - -NDB_TICKS NdbTick_CurrentMillisecond(void) -{ - LARGE_INTEGER liCount, liFreq; - QueryPerformanceCounter(&liCount); - QueryPerformanceFrequency(&liFreq); - return (liCount.QuadPart*1000) / liFreq.QuadPart; -} - -int -NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros) -{ - LARGE_INTEGER liCount, liFreq; - QueryPerformanceCounter(&liCount); - QueryPerformanceFrequency(&liFreq); - *secs = liCount.QuadPart / liFreq.QuadPart; - liCount.QuadPart -= *secs * liFreq.QuadPart; - *micros = (liCount.QuadPart*1000000) / liFreq.QuadPart; - return 0; -} diff --git a/storage/ndb/src/old_files/client/Makefile b/storage/ndb/src/old_files/client/Makefile deleted file mode 100644 index 1751a98bdfe..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/Extra.mk b/storage/ndb/src/old_files/client/odbc/Extra.mk deleted file mode 100644 index 762fb0bedd0..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/Makefile b/storage/ndb/src/old_files/client/odbc/Makefile deleted file mode 100644 index 2da683e7d86..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/NdbOdbc.cpp b/storage/ndb/src/old_files/client/odbc/NdbOdbc.cpp deleted file mode 100755 index 67c6b5e0004..00000000000 --- a/storage/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 <NdbUnistd.h> -#include <odbcinst.h> - -#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/storage/ndb/src/old_files/client/odbc/NdbOdbc.def b/storage/ndb/src/old_files/client/odbc/NdbOdbc.def deleted file mode 100755 index 85619b91915..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp b/storage/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp deleted file mode 100644 index 6be78b62bd9..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <common/CodeTree.hpp> -#include <executor/Executor.hpp> -#include "CodeGen.hpp" -#include "Code_root.hpp" - -#include <FlexLexer.h> -#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<Plan_root*>(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<Plan_root*>(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<Plan_root*>(m_stmtArea.m_planTree); - ctx_assert(planRoot != 0); - Plan_base::Ctl ctl(0); - Exec_root* execRoot = static_cast<Exec_root*>(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<Exec_root*>(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<Exec_root*>(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<Plan_root*>(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<Exec_root*>(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<Exec_root*>(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<Exec_root*>(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<Exec_root*>(m_stmtArea.m_execTree); - ctx_assert(execRoot != 0); - execRoot->sqlPutData(ctx, data, strlen_or_Ind); -} diff --git a/storage/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp b/storage/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp deleted file mode 100644 index ae61dab0c2a..00000000000 --- a/storage/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 <common/common.hpp> - -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/storage/ndb/src/old_files/client/odbc/codegen/Code_base.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_base.cpp deleted file mode 100644 index dc02e071156..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_base.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_base.hpp deleted file mode 100644 index c67c0ca7adb..00000000000 --- a/storage/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 <set> -#include <list> -#include <vector> -#include <common/common.hpp> -#include <common/CodeTree.hpp> -#include <common/DescArea.hpp> - -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<Plan_table*> TableVector; - typedef std::vector<Plan_column*> ColumnVector; - typedef std::vector<Plan_dml_column*> DmlColumnVector; - typedef std::vector<Plan_ddl_column*> DdlColumnVector; - typedef std::vector<Plan_ddl_constr*> DdlConstrVector; - typedef std::vector<Plan_idx_column*> IdxColumnVector; - typedef std::vector<Plan_expr*> ExprVector; - typedef std::list<Plan_expr*> ExprList; - typedef std::vector<ExprList> ExprListVector; - typedef std::list<Plan_pred*> PredList; - typedef std::set<Plan_table*> TableSet; - typedef std::vector<Plan_expr_param*> 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<Exec_expr*> ExprVector; - typedef std::vector<Exec_expr_param*> 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/storage/ndb/src/old_files/client/odbc/codegen/Code_column.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_column.cpp deleted file mode 100644 index c4c0480a5e7..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <dictionary/DictSchema.hpp> -#include <dictionary/DictColumn.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_column.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_column.hpp deleted file mode 100644 index af0dcea690d..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataType.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp deleted file mode 100644 index 7782ed1ea2a..00000000000 --- a/storage/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 <dictionary/DictColumn.hpp> -#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<Plan_expr*>(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<Plan_expr_column*>(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<Plan_expr_column*>(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<Plan_expr_column*>(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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp deleted file mode 100644 index 0585ab1dabf..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_comp_op::Data& -Exec_comp_op::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp deleted file mode 100644 index 84f319338a4..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp deleted file mode 100644 index ebd757e1118..00000000000 --- a/storage/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 <vector> -#include <NdbApi.hpp> -#include <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_create_index::Data& -Exec_create_index::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp deleted file mode 100644 index 5b90b658ed7..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp deleted file mode 100644 index f03455ff28e..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp deleted file mode 100644 index 14e4abbd7fe..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp deleted file mode 100644 index cbb2189d8ce..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_create_table::Data& -Exec_create_table::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp deleted file mode 100644 index 1ff0fcebcbe..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp deleted file mode 100644 index 735dc05014f..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataType.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp deleted file mode 100644 index 2ba4291a0e8..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp deleted file mode 100644 index 1ceca62d55d..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp deleted file mode 100644 index ee037e54c1f..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#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<Plan_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp deleted file mode 100644 index 7d089d37440..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp deleted file mode 100644 index 78c23e38d97..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp deleted file mode 100644 index ea7808b37cb..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp deleted file mode 100644 index 87589ebbaa0..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp deleted file mode 100644 index ac3eded1b2e..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp deleted file mode 100644 index 35b3daa1aca..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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<Plan_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp deleted file mode 100644 index c7fa245497b..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp deleted file mode 100644 index 8f2c3be2848..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#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<Exec_query*>(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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp deleted file mode 100644 index 1aaaa18abcb..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_delete_index::Data& -Exec_delete_index::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp deleted file mode 100644 index 4a6dec64654..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#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<Exec_query*>(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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp deleted file mode 100644 index 4138baefa4c..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_delete_lookup::Data& -Exec_delete_lookup::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp deleted file mode 100644 index fed7244a026..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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<Exec_query*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp deleted file mode 100644 index eb013a8257e..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_delete_scan::Data& -Exec_delete_scan::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp deleted file mode 100644 index 44fd4478646..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp deleted file mode 100644 index 0618f583984..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/ResultArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp deleted file mode 100644 index 808e2ac8c4b..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp deleted file mode 100644 index 0fb33944a3a..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp deleted file mode 100644 index ceb63a9f7b9..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp deleted file mode 100644 index 6c7e46ba9af..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#include <common/DataRow.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp deleted file mode 100644 index b6bae88e270..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp deleted file mode 100644 index 99891c9a52f..00000000000 --- a/storage/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 <vector> -#include <NdbApi.hpp> -#include <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_drop_index::Data& -Exec_drop_index::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp deleted file mode 100644 index f20bf9fdae0..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp deleted file mode 100644 index 849a472ed94..00000000000 --- a/storage/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 <vector> -#include <NdbApi.hpp> -#include <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_drop_table::Data& -Exec_drop_table::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp deleted file mode 100644 index 4afa75986a0..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp deleted file mode 100644 index b6f07471b4d..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<SqlField> 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<const Code*>(m_code); - return *code; -} - -inline Exec_expr::Data& -Exec_expr::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp deleted file mode 100644 index 17a9a502d4c..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <dictionary/DictSchema.hpp> -#include <dictionary/DictColumn.hpp> -#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<const Plan_expr_column*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp deleted file mode 100644 index 2ce7c441e45..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_column::Data& -Exec_expr_column::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp deleted file mode 100644 index 564d307a4f8..00000000000 --- a/storage/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<const Plan_expr_const*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp deleted file mode 100644 index 2e26c637a23..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_const::Data& -Exec_expr_const::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp deleted file mode 100644 index bc89482fedc..00000000000 --- a/storage/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<Exec_expr*>(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<const Plan_expr_conv*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp deleted file mode 100644 index 3294960c7b3..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_conv::Data& -Exec_expr_conv::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp deleted file mode 100644 index 96b461a72d9..00000000000 --- a/storage/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<Plan_expr*>(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<Plan_expr*>(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<Exec_expr*>(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<const Plan_expr_func*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp deleted file mode 100644 index 856d7529875..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<Acc> 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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_func::Data& -Exec_expr_func::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp deleted file mode 100644 index 7e8314c1741..00000000000 --- a/storage/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<Plan_expr*>(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<Exec_expr*>(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<const Plan_expr_op*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp deleted file mode 100644 index f9686cad151..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_op::Data& -Exec_expr_op::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp deleted file mode 100644 index 93892cae5e6..00000000000 --- a/storage/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<const Plan_expr_param*>(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<ExtType::Type>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp deleted file mode 100644 index 783e5c087b4..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_param::Data& -Exec_expr_param::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp deleted file mode 100644 index da1751d41d1..00000000000 --- a/storage/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 <common/DataType.hpp> -#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<Plan_expr*>(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<Plan_expr*>(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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp deleted file mode 100644 index 94527931dba..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#include <common/DataRow.hpp> -#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<BaseString> AliasList; - AliasList m_aliasList; - typedef std::vector<bool> 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<const Code*>(m_code); - return *code; -} - -inline Exec_expr_row::Data& -Exec_expr_row::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp deleted file mode 100644 index 584ffef3e01..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp deleted file mode 100644 index 209ed705b48..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp deleted file mode 100644 index c442186c181..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Plan_query*>(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<Exec_query*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp deleted file mode 100644 index 748b092e33a..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_insert::Data& -Exec_insert::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp deleted file mode 100644 index fe7cac7606e..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp deleted file mode 100644 index a77c1161fa1..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<Pred_value> 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<const Code*>(m_code); - return *code; -} - -inline Exec_pred::Data& -Exec_pred::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp deleted file mode 100644 index 29736e45818..00000000000 --- a/storage/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<Exec_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp deleted file mode 100644 index 9130bc3cb81..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataField.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_pred_op::Data& -Exec_pred_op::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query.cpp deleted file mode 100644 index 9e983942601..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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<ExtType::Type>(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<ExtType::Type>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query.hpp deleted file mode 100644 index 97f98f859ff..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataRow.hpp> -#include <common/ResultArea.hpp> -#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<const SqlRow&>(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<const Code*>(m_code); - return *code; -} - -inline Exec_query::Data& -Exec_query::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp deleted file mode 100644 index f52c41df802..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_query*>(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<Exec_expr_row*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp deleted file mode 100644 index a094eba4519..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_count::Data& -Exec_query_count::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp deleted file mode 100644 index 4cbfbfe812d..00000000000 --- a/storage/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 <algorithm> -#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<Exec_query*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp deleted file mode 100644 index 62c46bda901..00000000000 --- a/storage/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 <functional> -#include <common/common.hpp> -#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<row> = index and vector<index> = row (index >= 0). - */ - -class Exec_query_distinct; - -struct DistinctLess : std::binary_function<const SqlRow*, const SqlRow*, bool> { - bool operator()(const SqlRow* s1, const SqlRow* s2) const; -}; - -typedef std::map<const SqlRow*, unsigned, DistinctLess> DistinctList; - -typedef std::vector<const SqlRow*> 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<const Code*>(m_code); - return *code; -} - -inline Exec_query_distinct::Data& -Exec_query_distinct::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp deleted file mode 100644 index 934a24d182d..00000000000 --- a/storage/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<Exec_query*>(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<Exec_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp deleted file mode 100644 index 60cbf0f86a7..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_filter::Data& -Exec_query_filter::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp deleted file mode 100644 index c3019efaa85..00000000000 --- a/storage/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 <algorithm> -#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<Exec_query*>(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<Exec_expr_row*>(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<Exec_expr_row*>(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<Exec_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp deleted file mode 100644 index e79022c5284..00000000000 --- a/storage/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 <functional> -#include <common/common.hpp> -#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<const SqlRow*, const SqlRow*, bool> { - bool operator()(const SqlRow* s1, const SqlRow* s2) const; -}; - -typedef std::map<const SqlRow*, unsigned, GroupLess> 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<const Code*>(m_code); - return *code; -} - -inline Exec_query_group::Data& -Exec_query_group::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp deleted file mode 100644 index ee19d6123cc..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp deleted file mode 100644 index 87affd50580..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_index::Data& -Exec_query_index::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp deleted file mode 100644 index 89aafe13610..00000000000 --- a/storage/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<Exec_query*>(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<Exec_query*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp deleted file mode 100644 index f6ac9205329..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_join::Data& -Exec_query_join::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp deleted file mode 100644 index bad4199190b..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp deleted file mode 100644 index e66623d4030..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_lookup::Data& -Exec_query_lookup::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp deleted file mode 100644 index 54043ce3d5d..00000000000 --- a/storage/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<Exec_query*>(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<Exec_expr_row*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp deleted file mode 100644 index 545685ab9df..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_project::Data& -Exec_query_project::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp deleted file mode 100644 index 5d29c5af315..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_expr*>(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<Exec_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp deleted file mode 100644 index 4438189522c..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_range::Data& -Exec_query_range::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -inline void -Exec_query_range::setInterp(Exec_pred* interp) -{ - ctx_assert(interp != 0); - m_interp = interp; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp deleted file mode 100644 index 8b295a97916..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp deleted file mode 100644 index 90d6ef55104..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_repeat::Data& -Exec_query_repeat::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp deleted file mode 100644 index 1c0f58980e5..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Plan_pred*>(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<Exec_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp deleted file mode 100644 index d6d1630ddf8..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_scan::Data& -Exec_query_scan::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -inline void -Exec_query_scan::setInterp(Exec_pred* interp) -{ - ctx_assert(interp != 0); - m_interp = interp; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp deleted file mode 100644 index 4ea6db8c4e2..00000000000 --- a/storage/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 <algorithm> -#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<Exec_query*>(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<Exec_expr_row*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp deleted file mode 100644 index d1aa03d9aef..00000000000 --- a/storage/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 <functional> -#include <common/common.hpp> -#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<SortItem> SortList; - -class Exec_query_sort; - -struct SortLess : std::binary_function<SortItem, SortItem, bool> { - 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<const Code*>(m_code); - return *code; -} - -inline Exec_query_sort::Data& -Exec_query_sort::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp deleted file mode 100644 index affe3dc1264..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp deleted file mode 100644 index 8eb069d0413..00000000000 --- a/storage/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 <common/common.hpp> -#include <dictionary/DictSys.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_query_sys::Data& -Exec_query_sys::getData() const -{ - Data* data = static_cast<Data*>(m_data); - return *data; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/codegen/Code_root.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_root.cpp deleted file mode 100644 index 4f45bdffdaf..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#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<Plan_stmt*>(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<Exec_stmt*>(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<Exec_expr_param*>(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<Exec_query*>(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<Exec_query*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_root.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_root.hpp deleted file mode 100644 index 4f0f96725e3..00000000000 --- a/storage/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 <list> -#include <common/common.hpp> -#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<Plan_base*> 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<Exec_base*> 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<const Code*>(m_code); - return *code; -} - -inline Exec_root::Data& -Exec_root::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_select.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_select.cpp deleted file mode 100644 index 611b491968d..00000000000 --- a/storage/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 <algorithm> -#include <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#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<Plan_expr_row*>(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<Plan_expr_row*>(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<Plan_pred*>(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<Plan_expr_row*>(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<Plan_pred*>(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<Plan_expr_row*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_select.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_select.hpp deleted file mode 100644 index eaa9b801f29..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp deleted file mode 100644 index dd13ba0c3f7..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp deleted file mode 100644 index 10d62826ac7..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#include <common/DataRow.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp deleted file mode 100644 index d790f667b84..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp deleted file mode 100644 index 20b7fb965fb..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataType.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_table.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_table.cpp deleted file mode 100644 index ee3c2a2ed07..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <dictionary/DictSchema.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_table.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_table.hpp deleted file mode 100644 index 8a95b8fa26c..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#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<Index> 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/storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp deleted file mode 100644 index ea9f4fdc26e..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp deleted file mode 100644 index 47989166cac..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_update.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update.cpp deleted file mode 100644 index 0b33cd628b4..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Plan_pred*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_update.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update.hpp deleted file mode 100644 index 380b651518b..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp deleted file mode 100644 index 6f74db0d913..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_query*>(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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp deleted file mode 100644 index bbad822650a..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_update_index::Data& -Exec_update_index::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp deleted file mode 100644 index 7525fb72692..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_query*>(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<Exec_expr*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp deleted file mode 100644 index fc4341880dd..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_update_lookup::Data& -Exec_update_lookup::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp deleted file mode 100644 index 9fac1728469..00000000000 --- a/storage/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 <common/StmtArea.hpp> -#include <dictionary/DictTable.hpp> -#include <dictionary/DictColumn.hpp> -#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<Exec_query*>(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/storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp b/storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp deleted file mode 100644 index d742883e561..00000000000 --- a/storage/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 <common/common.hpp> -#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<const Code*>(m_code); - return *code; -} - -inline Exec_update_scan::Data& -Exec_update_scan::getData() const -{ - Data* data = static_cast<Data*>(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/storage/ndb/src/old_files/client/odbc/codegen/Makefile b/storage/ndb/src/old_files/client/odbc/codegen/Makefile deleted file mode 100644 index 49e5439556d..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp b/storage/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp deleted file mode 100644 index 07d8017e5ed..00000000000 --- a/storage/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp +++ /dev/null @@ -1,1649 +0,0 @@ -%{ - -#include <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/DataRow.hpp> -#include "CodeGen.hpp" -#include <FlexLexer.h> -#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<SimpleParser*>(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 - <m_string> T_IDENTIFIER - <m_string> T_LINTEGER - <m_string> T_LDECIMAL - <m_string> T_LREAL - <m_string> 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 <m_root> root -%type <m_stmt> stmt -%type <m_select> stmt_select -%type <m_insert> stmt_insert -%type <m_insert_op> insert_op -%type <m_update> stmt_update -%type <m_delete> stmt_delete -%type <m_create_table> create_table -%type <m_create_index> create_index -%type <m_index_type> index_type -%type <m_create_row> create_row -%type <m_ddl_column> create_column -%type <m_ddl_constr> create_constr -%type <m_idx_column> idx_column -%type <m_data_type> data_type -%type <m_ddl_row> ddl_row -%type <m_ddl_column> ddl_column -%type <m_drop_table> drop_table -%type <m_drop_index> drop_index -%type <m_asc_desc> asc_desc -%type <m_set_row> set_row -%type <m_expr_row> expr_row -%type <m_expr_row> sort_row -%type <m_pred> where_clause -%type <m_expr_row> order_clause -%type <m_pred> pred -%type <m_pred> pred1 -%type <m_pred_opcode> pred1_op -%type <m_pred> pred2 -%type <m_pred_opcode> pred2_op -%type <m_pred> pred3 -%type <m_pred_opcode> pred3_op -%type <m_pred> pred4 -%type <m_comp_opcode> comp_op -%type <m_expr> expr -%type <m_expr> expr1 -%type <m_expr_opcode> expr1_op -%type <m_expr> expr2 -%type <m_expr_opcode> expr2_op -%type <m_expr> expr3 -%type <m_expr_opcode> expr3_op -%type <m_expr> expr4 -%type <m_expr> expr_column -%type <m_dml_row> dml_row -%type <m_dml_column> dml_column -%type <m_expr_row> value_row -%type <m_expr> value_expr -%type <m_table> table -%type <m_table_list> table_list -%type <m_string> dot_identifier -%type <m_limit> limit_clause -%type <m_signed_integer> signed_integer -%type <m_distinct> distinct_clause -%type <m_expr_row> group_clause -%type <m_pred> having_clause -%type <m_phys_attr> phys_attr -%type <m_phys_attr> phys_attr2 -%type <m_storage_attr> storage_attr -%type <m_logging_attr> logging_attr -%type <m_sql_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/storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp b/storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp deleted file mode 100644 index a2418f49e37..00000000000 --- a/storage/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 <common/common.hpp> -#include <NdbMutex.h> -#include <common/StmtArea.hpp> -#include <FlexLexer.h> -#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/storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp b/storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp deleted file mode 100644 index abadae8f905..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp b/storage/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp deleted file mode 100644 index 29aa876f669..00000000000 --- a/storage/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp +++ /dev/null @@ -1,243 +0,0 @@ -%{ -#include <ctype.h> -#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; - } - } -<StateEval>{ -"+" 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(""); - } -<StateString>{ -[^']* { - 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(""); - } -<StateQuoted>{ -[^"]* { - 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/storage/ndb/src/old_files/client/odbc/common/AttrArea.cpp b/storage/ndb/src/old_files/client/odbc/common/AttrArea.cpp deleted file mode 100644 index ff9e085a7f6..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/AttrArea.hpp b/storage/ndb/src/old_files/client/odbc/common/AttrArea.hpp deleted file mode 100644 index 050cce719bf..00000000000 --- a/storage/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 <map> -#include <common/common.hpp> -#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<int, AttrField> Fields; - Fields m_fields; -}; - -inline void -AttrArea::setHandle(HandleBase* handle) -{ - ctx_assert(handle != 0); - m_handle = handle; -} - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/common/CodeTree.cpp b/storage/ndb/src/old_files/client/odbc/common/CodeTree.cpp deleted file mode 100644 index ebe4840c5f6..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/CodeTree.hpp b/storage/ndb/src/old_files/client/odbc/common/CodeTree.hpp deleted file mode 100644 index 1b0ae3199af..00000000000 --- a/storage/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 <common/common.hpp> - -/* - * 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/storage/ndb/src/old_files/client/odbc/common/ConnArea.cpp b/storage/ndb/src/old_files/client/odbc/common/ConnArea.cpp deleted file mode 100644 index d4d3be52a3c..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <dictionary/DictCatalog.hpp> -#include <dictionary/DictSchema.hpp> -#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/storage/ndb/src/old_files/client/odbc/common/ConnArea.hpp b/storage/ndb/src/old_files/client/odbc/common/ConnArea.hpp deleted file mode 100644 index 36367a39bae..00000000000 --- a/storage/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 <common/common.hpp> - -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/storage/ndb/src/old_files/client/odbc/common/Ctx.cpp b/storage/ndb/src/old_files/client/odbc/common/Ctx.cpp deleted file mode 100644 index d6faa5cba77..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/common/Ctx.hpp b/storage/ndb/src/old_files/client/odbc/common/Ctx.hpp deleted file mode 100644 index d25d45ff0c7..00000000000 --- a/storage/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 <NdbDictionary.hpp> - -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/storage/ndb/src/old_files/client/odbc/common/DataField.cpp b/storage/ndb/src/old_files/client/odbc/common/DataField.cpp deleted file mode 100644 index 11aae7d893b..00000000000 --- a/storage/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<SqlBigint>(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<SqlDouble>(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<const void*>(u_data.m_sqlChar); - } - return static_cast<const void*>(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<const void*>(u_data.m_sqlChar); - } - return static_cast<const void*>(u_data.m_sqlCharSmall); - } - if (sqlType.type() == SqlType::Smallint) { - return static_cast<const void*>(&u_data.m_sqlSmallint); - } - if (sqlType.type() == SqlType::Integer) { - return static_cast<const void*>(&u_data.m_sqlInteger); - } - if (sqlType.type() == SqlType::Bigint) { - return static_cast<const void*>(&u_data.m_sqlBigint); - } - if (sqlType.type() == SqlType::Real) { - return static_cast<const void*>(&u_data.m_sqlReal); - } - if (sqlType.type() == SqlType::Double) { - return static_cast<const void*>(&u_data.m_sqlDouble); - } - if (sqlType.type() == SqlType::Datetime) { - return static_cast<const void*>(&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<void*>(u_data.m_sqlChar); - } - return static_cast<void*>(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<void*>(u_data.m_sqlChar); - } - return static_cast<void*>(u_data.m_sqlCharSmall); - } - if (sqlType.type() == SqlType::Smallint) { - return static_cast<void*>(&u_data.m_sqlSmallint); - } - if (sqlType.type() == SqlType::Integer) { - return static_cast<void*>(&u_data.m_sqlInteger); - } - if (sqlType.type() == SqlType::Bigint) { - return static_cast<void*>(&u_data.m_sqlBigint); - } - if (sqlType.type() == SqlType::Real) { - return static_cast<void*>(&u_data.m_sqlReal); - } - if (sqlType.type() == SqlType::Double) { - return static_cast<void*>(&u_data.m_sqlDouble); - } - if (sqlType.type() == SqlType::Datetime) { - return static_cast<void*>(&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<SqlInteger>(x1); - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast<SqlBigint>(x1); - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast<SqlReal>(x1); - f2.sqlReal(x2); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast<SqlDouble>(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<SqlUinteger>(x1); - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlUbigint x2 = static_cast<SqlUbigint>(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<SqlSmallint>(x1); - if (x1 != static_cast<SqlInteger>(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<SqlBigint>(x1); - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast<SqlReal>(x1); - f2.sqlReal(x2); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast<SqlDouble>(x1); - f2.sqlDouble(x2); - return true; - } - } else { - SqlUinteger x1 = f1.sqlInteger(); - if (t2.type() == SqlType::Smallint) { - SqlUsmallint x2 = static_cast<SqlUsmallint>(x1); - if (x1 != static_cast<SqlUinteger>(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<SqlUbigint>(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<SqlSmallint>(x1); - if (x1 != static_cast<SqlBigint>(x2)) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast<SqlInteger>(x1); - if (x1 != static_cast<SqlBigint>(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<SqlReal>(x1); - f2.sqlReal(x2); - return true; - } - if (t2.type() == SqlType::Double) { - SqlDouble x2 = static_cast<SqlDouble>(x1); - f2.sqlDouble(x2); - return true; - } - } else { - SqlUbigint x1 = f1.sqlBigint(); - if (t2.type() == SqlType::Smallint) { - SqlUsmallint x2 = static_cast<SqlUsmallint>(x1); - if (x1 != static_cast<SqlUbigint>(x2)) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlUinteger x2 = static_cast<SqlUinteger>(x1); - if (x1 != static_cast<SqlUbigint>(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<SqlSmallint>(x1) + off; - if (fabs(x1 - static_cast<SqlReal>(x2)) >= 1.0) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast<SqlInteger>(x1) + off; - if (fabs(x1 - static_cast<SqlReal>(x2)) >= 1.0) - return false; - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast<SqlBigint>(x1) + off; - if (fabs(x1 - static_cast<SqlReal>(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<SqlDouble>(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<SqlSmallint>(x1) + off; - if (fabs(x1 - static_cast<SqlDouble>(x2)) >= 1.0) - return false; - f2.sqlSmallint(x2); - return true; - } - if (t2.type() == SqlType::Integer) { - SqlInteger x2 = static_cast<SqlInteger>(x1) + off; - if (fabs(x1 - static_cast<SqlDouble>(x2)) >= 1.0) - return false; - f2.sqlInteger(x2); - return true; - } - if (t2.type() == SqlType::Bigint) { - SqlBigint x2 = static_cast<SqlBigint>(x1) + off; - if (fabs(x1 - static_cast<SqlDouble>(x2)) >= 1.0) - return false; - f2.sqlBigint(x2); - return true; - } - if (t2.type() == SqlType::Real) { - SqlReal x2 = static_cast<SqlReal>(x1); - if (fabs(x1 - static_cast<SqlDouble>(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<SqlBigint>(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<char *>(u_data.m_sqlChar); - else - value = reinterpret_cast<char *>(u_data.m_sqlCharSmall); - laddr = 0; - } else { -#if NDB_VERSION_MAJOR >= 3 - length = sqlType.length(); - if (2 + length > SqlField_CharSmall) - value = reinterpret_cast<char *>(u_data.m_sqlChar + 2); - else - value = reinterpret_cast<char *>(u_data.m_sqlCharSmall + 2); - laddr = (SqlChar*)value - 2; -#else - length = sqlType.length(); - if (length + 2 > SqlField_CharSmall) - value = reinterpret_cast<char *>(u_data.m_sqlChar); - else - value = reinterpret_cast<char *>(u_data.m_sqlCharSmall); - laddr = (SqlChar*)value + length; -#endif - } - if (extType.type() == ExtType::Char) { - const char* dataPtr = static_cast<char*>(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<short*>(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<unsigned short*>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<double*>(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<char *>(u_data.m_sqlChar); - else - value = reinterpret_cast<char *>(u_data.m_sqlCharSmall); - laddr = 0; - } else { -#if NDB_VERSION_MAJOR >= 3 - length = sqlType.length(); - if (2 + length > SqlField_CharSmall) - value = reinterpret_cast<char *>(u_data.m_sqlChar + 2); - else - value = reinterpret_cast<char *>(u_data.m_sqlCharSmall + 2); - laddr = (SqlChar*)value - 2; -#else - length = sqlType.length(); - if (length + 2 > SqlField_CharSmall) - value = reinterpret_cast<char *>(u_data.m_sqlChar); - else - value = reinterpret_cast<char *>(u_data.m_sqlCharSmall); - laddr = (SqlChar*)value + length; -#endif - } - if (extType.type() == ExtType::Binary) { - const char* dataPtr = static_cast<char*>(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<char*>(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<short*>(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<unsigned short*>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<double*>(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<char*>(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<short*>(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<unsigned short*>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<double*>(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<char*>(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<short*>(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<unsigned short*>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<double*>(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<char*>(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<short*>(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<unsigned short*>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<double*>(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<char*>(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<short*>(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<unsigned short*>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<double*>(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<char*>(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<SQL_TIMESTAMP_STRUCT*>(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<long>(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<long>(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<unsigned long>(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<unsigned long>(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<const char*>(sqlChar()); - } else { - value = reinterpret_cast<const char*>(sqlVarchar(&n)); - } - if (extType.type() == ExtType::Char) { - char* dataPtr = static_cast<char*>(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<short*>(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<short>(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<unsigned short*>(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<unsigned short>(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<long*>(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<unsigned long*>(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<SQLBIGINT*>(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<SQLUBIGINT*>(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<float*>(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<float>(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<double*>(extField.m_dataPtr); - double x; - if (! copyout_char_double(ctx, value, n, &x)) - return; - *dataPtr = static_cast<double>(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<const char*>(sqlBinary()); - } else { - value = reinterpret_cast<const char*>(sqlVarbinary(&n)); - } - if (extType.type() == ExtType::Binary) { - char* dataPtr = static_cast<char*>(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<char*>(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<short*>(extField.m_dataPtr); - *dataPtr = static_cast<short>(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<unsigned short*>(extField.m_dataPtr); - *dataPtr = static_cast<unsigned short>(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<long*>(extField.m_dataPtr); - *dataPtr = static_cast<long>(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<unsigned long*>(extField.m_dataPtr); - *dataPtr = static_cast<unsigned long>(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<SQLBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLBIGINT>(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<SQLUBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLUBIGINT>(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<float*>(extField.m_dataPtr); - *dataPtr = static_cast<float>(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<double*>(extField.m_dataPtr); - *dataPtr = static_cast<double>(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<char*>(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<short*>(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<short>(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<unsigned short*>(extField.m_dataPtr); - if (uvalue > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %u overflow", uvalue); - return; - } - *dataPtr = static_cast<unsigned short>(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<long*>(extField.m_dataPtr); - *dataPtr = static_cast<long>(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<unsigned long*>(extField.m_dataPtr); - *dataPtr = static_cast<unsigned long>(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<SQLBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLBIGINT>(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<SQLUBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLUBIGINT>(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<float*>(extField.m_dataPtr); - *dataPtr = static_cast<float>(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<double*>(extField.m_dataPtr); - *dataPtr = static_cast<double>(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<char*>(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<short*>(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<short>(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<unsigned short*>(extField.m_dataPtr); - if (uvalue > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value " FMT_U64 " overflow", (Uint64)uvalue); - return; - } - *dataPtr = static_cast<short>(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<long*>(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<long>(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<unsigned long*>(extField.m_dataPtr); - if (uvalue > UINT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value " FMT_U64 " overflow", (Uint64)uvalue); - return; - } - *dataPtr = static_cast<unsigned long>(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<SQLBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLBIGINT>(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<SQLUBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLUBIGINT>(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<float*>(extField.m_dataPtr); - *dataPtr = static_cast<float>(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<double*>(extField.m_dataPtr); - *dataPtr = static_cast<double>(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<char*>(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<short*>(extField.m_dataPtr); - *dataPtr = static_cast<short>(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<unsigned short*>(extField.m_dataPtr); - if (value < 0 || value > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %g overflow", (double)value); - return; - } - *dataPtr = static_cast<short>(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<long*>(extField.m_dataPtr); - *dataPtr = static_cast<long>(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<unsigned long*>(extField.m_dataPtr); - *dataPtr = static_cast<unsigned long>(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<SQLBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLBIGINT>(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<SQLUBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLUBIGINT>(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<float*>(extField.m_dataPtr); - *dataPtr = static_cast<float>(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<double*>(extField.m_dataPtr); - *dataPtr = static_cast<double>(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<char*>(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<short*>(extField.m_dataPtr); - *dataPtr = static_cast<short>(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<unsigned short*>(extField.m_dataPtr); - if (value < 0 || value > USHRT_MAX) { - ctx.pushStatus(Sqlstate::_22003, Error::Gen, "value %g overflow", (double)value); - return; - } - *dataPtr = static_cast<short>(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<long*>(extField.m_dataPtr); - *dataPtr = static_cast<long>(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<unsigned long*>(extField.m_dataPtr); - *dataPtr = static_cast<unsigned long>(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<SQLBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLBIGINT>(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<SQLUBIGINT*>(extField.m_dataPtr); - *dataPtr = static_cast<SQLUBIGINT>(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<float*>(extField.m_dataPtr); - *dataPtr = static_cast<float>(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<double*>(extField.m_dataPtr); - *dataPtr = static_cast<double>(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<char*>(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<SQL_TIMESTAMP_STRUCT*>(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/storage/ndb/src/old_files/client/odbc/common/DataField.hpp b/storage/ndb/src/old_files/client/odbc/common/DataField.hpp deleted file mode 100644 index 65138df25f1..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/common.hpp> -#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<const SqlChar*>(value), length); -} - -inline void -SqlField::sqlVarchar(const char* value, int length) -{ - sqlVarchar(reinterpret_cast<const SqlChar*>(value), length); -} - -inline void -SqlField::sqlBinary(const char* value, int length) -{ - sqlBinary(reinterpret_cast<const SqlChar*>(value), length); -} - -inline void -SqlField::sqlVarbinary(const char* value, int length) -{ - sqlVarbinary(reinterpret_cast<const SqlChar*>(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/storage/ndb/src/old_files/client/odbc/common/DataRow.cpp b/storage/ndb/src/old_files/client/odbc/common/DataRow.cpp deleted file mode 100644 index 509f2673e0d..00000000000 --- a/storage/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<void*>(&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<void*>(&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<void*>(&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<void*>(&m_extField[i]); - new (place) ExtField(extRow.getEntry(i)); - } -} - -ExtRow::~ExtRow() -{ - delete[] m_extField; -} diff --git a/storage/ndb/src/old_files/client/odbc/common/DataRow.hpp b/storage/ndb/src/old_files/client/odbc/common/DataRow.hpp deleted file mode 100644 index 4a5a1e905b9..00000000000 --- a/storage/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 <new> -#include <common/common.hpp> -#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<void*>(&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<void*>(&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<void*>(&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<void*>(&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/storage/ndb/src/old_files/client/odbc/common/DataType.cpp b/storage/ndb/src/old_files/client/odbc/common/DataType.cpp deleted file mode 100644 index 96f6a6e0877..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/DataType.hpp b/storage/ndb/src/old_files/client/odbc/common/DataType.hpp deleted file mode 100644 index e03e445cf05..00000000000 --- a/storage/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 <map> -#include <ndb_types.h> -#include <AttrType.hpp> -#include <NdbDictionary.hpp> -#include <common/common.hpp> - -/** - * 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/storage/ndb/src/old_files/client/odbc/common/DescArea.cpp b/storage/ndb/src/old_files/client/odbc/common/DescArea.cpp deleted file mode 100644 index bad9f23d3ef..00000000000 --- a/storage/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 <vector> -#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<SQLSMALLINT>(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/storage/ndb/src/old_files/client/odbc/common/DescArea.hpp b/storage/ndb/src/old_files/client/odbc/common/DescArea.hpp deleted file mode 100644 index e9f552d758d..00000000000 --- a/storage/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 <map> -#include <vector> -#include <common/common.hpp> -#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<int, DescField> 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<DescRec> 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/storage/ndb/src/old_files/client/odbc/common/DiagArea.cpp b/storage/ndb/src/old_files/client/odbc/common/DiagArea.cpp deleted file mode 100644 index 06e8da89495..00000000000 --- a/storage/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 <stdio.h> -#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/storage/ndb/src/old_files/client/odbc/common/DiagArea.hpp b/storage/ndb/src/old_files/client/odbc/common/DiagArea.hpp deleted file mode 100644 index 79c03de6623..00000000000 --- a/storage/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 <map> -#include <vector> -#include <common/common.hpp> -#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<int, DiagField> 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<DiagRec> 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/storage/ndb/src/old_files/client/odbc/common/Makefile b/storage/ndb/src/old_files/client/odbc/common/Makefile deleted file mode 100644 index 7ee29738d86..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/OdbcData.cpp b/storage/ndb/src/old_files/client/odbc/common/OdbcData.cpp deleted file mode 100644 index 32400e07c7a..00000000000 --- a/storage/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<SQLSMALLINT*>(buf); - *ptr = m_smallint; - break; - } - case Usmallint: { - SQLUSMALLINT* ptr = static_cast<SQLUSMALLINT*>(buf); - *ptr = m_usmallint; - break; - } - case Integer: { - SQLINTEGER* ptr = static_cast<SQLINTEGER*>(buf); - *ptr = m_integer; - break; - } - case Uinteger: { - SQLUINTEGER* ptr = static_cast<SQLUINTEGER*>(buf); - *ptr = m_uinteger; - break; - } - case Pointer: { - SQLPOINTER* ptr = static_cast<SQLPOINTER*>(buf); - *ptr = m_pointer; - break; - } - case Sqlchar: { - char* ptr = static_cast<char*>(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<char*>(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/storage/ndb/src/old_files/client/odbc/common/OdbcData.hpp b/storage/ndb/src/old_files/client/odbc/common/OdbcData.hpp deleted file mode 100644 index c1884507cfe..00000000000 --- a/storage/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 <ndb_types.h> -#include <common/common.hpp> - -/** - * @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/storage/ndb/src/old_files/client/odbc/common/ResultArea.cpp b/storage/ndb/src/old_files/client/odbc/common/ResultArea.cpp deleted file mode 100644 index 79d7fb0ccc4..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/ResultArea.hpp b/storage/ndb/src/old_files/client/odbc/common/ResultArea.hpp deleted file mode 100644 index d4890c44d99..00000000000 --- a/storage/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 <common/common.hpp> -#include <codegen/Code_base.hpp> - -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/storage/ndb/src/old_files/client/odbc/common/Sqlstate.cpp b/storage/ndb/src/old_files/client/odbc/common/Sqlstate.cpp deleted file mode 100644 index 2d625a7c159..00000000000 --- a/storage/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 <common/common.hpp> - -// 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/storage/ndb/src/old_files/client/odbc/common/Sqlstate.hpp b/storage/ndb/src/old_files/client/odbc/common/Sqlstate.hpp deleted file mode 100644 index 3b4665dc6ca..00000000000 --- a/storage/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 <string.h> - -/** - * 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/storage/ndb/src/old_files/client/odbc/common/StmtArea.cpp b/storage/ndb/src/old_files/client/odbc/common/StmtArea.cpp deleted file mode 100644 index 5ce2d47d31a..00000000000 --- a/storage/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 <codegen/CodeGen.hpp> - -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<SQLUINTEGER>(m_rowCount); - } - } - // diagnostic - SQLINTEGER count = static_cast<SQLINTEGER>(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/storage/ndb/src/old_files/client/odbc/common/StmtArea.hpp b/storage/ndb/src/old_files/client/odbc/common/StmtArea.hpp deleted file mode 100644 index a88c6d36e6d..00000000000 --- a/storage/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 <common/common.hpp> -#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/storage/ndb/src/old_files/client/odbc/common/StmtInfo.cpp b/storage/ndb/src/old_files/client/odbc/common/StmtInfo.cpp deleted file mode 100644 index 3467fb5023e..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/StmtInfo.hpp b/storage/ndb/src/old_files/client/odbc/common/StmtInfo.hpp deleted file mode 100644 index 9cd489be6da..00000000000 --- a/storage/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 <common/common.hpp> - -// 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/storage/ndb/src/old_files/client/odbc/common/common.cpp b/storage/ndb/src/old_files/client/odbc/common/common.cpp deleted file mode 100644 index 73d14c82efe..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/common/common.hpp b/storage/ndb/src/old_files/client/odbc/common/common.hpp deleted file mode 100644 index d2f243b6437..00000000000 --- a/storage/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 <ndb_global.h> -#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 <windows.h> -#endif - -extern "C" { -#include <sqlext.h> -} -// 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 <ndb_types.h> -// this info not yet on api side -#include <kernel/ndb_limits.h> -#include <ndb_version.h> - -#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 <BaseString.hpp> -#include <common/Sqlstate.hpp> -#include <common/Ctx.hpp> - -#undef assert - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp deleted file mode 100644 index 433347c9a70..00000000000 --- a/storage/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 <common/ConnArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp deleted file mode 100644 index 5452990a51b..00000000000 --- a/storage/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 <list> -#include <common/common.hpp> -#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<DictSchema*> 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/storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp deleted file mode 100644 index fa0128f1ddb..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp deleted file mode 100644 index 945fb86367b..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataType.hpp> - -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<NdbAttrId>(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/storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp deleted file mode 100644 index 95d93318902..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp deleted file mode 100644 index 7ba46daaae3..00000000000 --- a/storage/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 <vector> -#include <common/common.hpp> -#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<DictColumn*> 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/storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp deleted file mode 100644 index 91939cb2f26..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/ConnArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp deleted file mode 100644 index 099352edbb9..00000000000 --- a/storage/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 <list> -#include <common/common.hpp> -#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<DictTable*> 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/storage/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp deleted file mode 100644 index 1ceef66ee57..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/ConnArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp deleted file mode 100644 index e6fa661fd59..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DataType.hpp> - -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/storage/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp deleted file mode 100644 index 4db7d3b3aec..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/common.hpp> -#include <common/Ctx.hpp> -#include <common/ConnArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp b/storage/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp deleted file mode 100644 index 5cecfff9562..00000000000 --- a/storage/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 <vector> -#include <list> -#include <common/common.hpp> -#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<DictColumn*> 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<DictIndex*> 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/storage/ndb/src/old_files/client/odbc/dictionary/Makefile b/storage/ndb/src/old_files/client/odbc/dictionary/Makefile deleted file mode 100644 index cdfd3b6ea0c..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/docs/class.fig b/storage/ndb/src/old_files/client/odbc/docs/class.fig deleted file mode 100644 index 38c24c1fba4..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/docs/descfield.pl b/storage/ndb/src/old_files/client/odbc/docs/descfield.pl deleted file mode 100644 index 80fef22f303..00000000000 --- a/storage/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 = { -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLSetDescField</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlsetdescfield"></A>SQLSetDescField</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 3.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLSetDescField</B> sets the value of a single field of a descriptor record.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLSetDescField</B>( -# SQLHDESC <I>DescriptorHandle</I>, -# SQLSMALLINT <I>RecNumber</I>, -# SQLSMALLINT <I>FieldIdentifier</I>, -# SQLPOINTER <I>ValuePtr</I>, -# SQLINTEGER <I>BufferLength</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>DescriptorHandle</I></DT> -# -# <DD>[Input]<BR> -# Descriptor handle.</dd> -# -# <DT><I>RecNumber</I></DT> -# -# <DD>[Input]<BR> -# 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 <I>RecNumber</I> argument is ignored for header fields.</dd> -# -# <DT><I>FieldIdentifier</I></DT> -# -# <DD>[Input]<BR> -# Indicates the field of the descriptor whose value is to be set. For more information, see "<I>FieldIdentifier</I> Argument" in the "Comments" section.</dd> -# -# <DT><I>ValuePtr</I></DT> -# -# <DD>[Input]<BR> -# Pointer to a buffer containing the descriptor information, or a 4-byte value. The data type depends on the value of <I>FieldIdentifier</I>. If <I>ValuePtr</I> 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 <I>FieldIdentifier</I> argument.</dd> -# -# <DT><I>BufferLength</I></DT> -# -# <DD>[Input]<BR> -# If <I>FieldIdentifier</I> is an ODBC-defined field and <I>ValuePtr</I> points to a character string or a binary buffer, this argument should be the length of *<I>ValuePtr</I>. If <I>FieldIdentifier</I> is an ODBC-defined field and <I>ValuePtr</I> is an integer, <I>BufferLength</I> is ignored. -# -# <P>If <I>FieldIdentifier</I> is a driver-defined field, the application indicates the nature of the field to the Driver Manager by setting the <I>BufferLength</I> argument. <I>BufferLength</I> can have the following values: -# -# -# <UL type=disc> -# <LI>If <I>ValuePtr</I> is a pointer to a character string, then <I>BufferLength</I> is the length of the string or SQL_NTS.</li> -# -# <LI>If <I>ValuePtr</I> is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(<I>length</I>) macro in <I>BufferLength</I>. This places a negative value in <I>BufferLength</I>.</li> -# -# <LI>If <I>ValuePtr</I> is a pointer to a value other than a character string or a binary string, then <I>BufferLength</I> should have the value SQL_IS_POINTER. </li> -# -# <LI>If <I>ValuePtr</I> contains a fixed-length value, then <I>BufferLength</I> is either SQL_IS_INTEGER, SQL_IS_UINTEGER, SQL_IS_SMALLINT, or SQL_IS_USMALLINT, as appropriate.</li> -# </UL> -# </dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLSetDescField</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_DESC and a <I>Handle</I> of <I>DescriptorHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLSetDescField</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=16%>SQLSTATE</TH> -# <TH width=30%>Error</TH> -# <TH width=54%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>01000</TD> -# <TD width=30%>General warning</TD> -# <TD width=54%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>01S02</TD> -# <TD width=30%>Option value changed</TD> -# <TD width=54%>The driver did not support the value specified in <I>*ValuePtr</I> (if <I>ValuePtr</I> was a pointer) or the value in <I>ValuePtr</I> (if <I>ValuePtr </I>was a 4-byte value), or <I>*ValuePtr</I> was invalid because of implementation working conditions, so the driver substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>07009</TD> -# <TD width=30%>Invalid descriptor index</TD> -# <TD width=54%>The <I>FieldIdentifier</I> argument was a record field, the <I>RecNumber</I> argument was 0, and the <I>DescriptorHandle</I> argument referred to an IPD handle. -# <P>The <I>RecNumber</I> argument was less than 0, and the <I>DescriptorHandle</I> argument referred to an ARD or an APD.</P> -# -# <P>The <I>RecNumber</I> argument was greater than the maximum number of columns or parameters that the data source can support, and the <I>DescriptorHandle</I> argument referred to an APD or ARD.</P> -# -# <P>(DM) The <I>FieldIdentifier</I> argument was SQL_DESC_COUNT, and <I>*ValuePtr</I> argument was less than 0.</P> -# -# <P>The <I>RecNumber</I> argument was equal to 0, and the <I>DescriptorHandle</I> 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.)</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>08S01</TD> -# <TD width=30%>Communication link failure</TD> -# <TD width=54%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>22001</TD> -# <TD width=30%>String data, right <BR> -# truncated</TD> -# <TD width=54%>The <I>FieldIdentifier</I> argument was SQL_DESC_NAME, and the <I>BufferLength</I> argument was a value larger than SQL_MAX_IDENTIFIER_LEN.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY000</TD> -# <TD width=30%>General error</TD> -# <TD width=54%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY001</TD> -# <TD width=30%>Memory allocation <BR> -# error</TD> -# <TD width=54%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY010</TD> -# <TD width=30%>Function sequence error</TD> -# <TD width=54%>(DM) The <I>DescriptorHandle</I> was associated with a <I>StatementHandle</I> for which an asynchronously executing function (not this one) was called and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> with which the <I>DescriptorHandle</I> was associated and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY013</TD> -# <TD width=30%>Memory management error</TD> -# <TD width=54%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY016</TD> -# <TD width=30%>Cannot modify an implementation row descriptor</TD> -# <TD width=54%>The <I>DescriptorHandle</I> argument was associated with an IRD, and the <I>FieldIdentifier</I> argument was not SQL_DESC_ARRAY_STATUS_PTR or SQL_DESC_ROWS_PROCESSED_PTR.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY021</TD> -# <TD width=30%>Inconsistent descriptor information</TD> -# <TD width=54%>The 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). -# <P>Descriptor information checked during a consistency check was not consistent. (See "Consistency Check" in <B>SQLSetDescRec</B>.)</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY090</TD> -# <TD width=30%>Invalid string or buffer length</TD> -# <TD width=54%>(DM) <I>*ValuePtr</I> is a character string, and <I>BufferLength</I> was less than zero but was not equal to SQL_NTS. -# <P>(DM) The driver was an ODBC 2<I>.x</I> driver, the descriptor was an ARD, the <I>ColumnNumber</I> argument was set to 0, and the value specified for the argument <I>BufferLength</I> was not equal to 4. </P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY091</TD> -# <TD width=30%>Invalid descriptor field identifier</TD> -# <TD width=54%>The value specified for the <I>FieldIdentifier</I> argument was not an ODBC-defined field and was not an implementation-defined value. -# <P>The <I>FieldIdentifier</I> argument was invalid for the <I>DescriptorHandle</I> argument.</P> -# -# <P>The <I>FieldIdentifier</I> argument was a read-only, ODBC-defined field.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY092</TD> -# <TD width=30%>Invalid attribute/option identifier</TD> -# <TD width=54%>The value in <I>*ValuePtr</I> was not valid for the <I>FieldIdentifier</I> argument. -# <P>The <I>FieldIdentifier</I> argument was SQL_DESC_UNNAMED, and <I>ValuePtr</I> was SQL_NAMED.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HY105</TD> -# <TD width=30%>Invalid parameter type</TD> -# <TD width=54%>(DM) The value specified for the SQL_DESC_PARAMETER_TYPE field was invalid. (For more information, see the "<I>InputOutputType</I> Argument" section in <B>SQLBindParameter</B>.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>HYT01</TD> -# <TD width=30%>Connection timeout expired</TD> -# <TD width=54%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=16%>IM001</TD> -# <TD width=30%>Driver does not support this function</TD> -# <TD width=54%>(DM) The driver associated with the <I>DescriptorHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P>An application can call <B>SQLSetDescField</B> to set any descriptor field one at a time. One call to <B>SQLSetDescField</B> 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.)</P> -# -# <P class="indent"><b class="le">Note</b> If a call to <B>SQLSetDescField</B> fails, the contents of the descriptor record identified by the <I>RecNumber</I> argument are undefined.</P> -# -# <P>Other functions can be called to set multiple descriptor fields with a single call of the function. The <B>SQLSetDescRec</B> 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). <B>SQLBindCol </B>or <B>SQLBindParameter</B> 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.</P> -# -# <P><B>SQLSetDescField</B> 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 <B>SQLBindCol </B>or <B>SQLBindParameter</B>, which allows an application to change SQL_DESC_DATA_PTR without changing other fields, such as SQL_DESC_DATA_TYPE.</P> -# -# <P>If an application calls <B>SQLSetDescField</B> 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.</P> -# -# <P>Descriptor header fields are set by calling <B>SQLSetDescField </B>with the appropriate <I>FieldIdentifier</I>. Many header fields are also statement attributes, so they can also be set by a call to <B>SQLSetStmtAttr</B>. This allows applications to set a descriptor field without first obtaining a descriptor handle. When <B>SQLSetDescField</B> is called to set a header field, the <I>RecNumber</I> argument is ignored.</P> -# -# <P>A <I>RecNumber</I> of 0 is used to set bookmark fields.</P> -# -# <P class="indent"><b class="le">Note</b> The statement attribute SQL_ATTR_USE_BOOKMARKS should always be set before calling <B>SQLSetDescField</B> to set bookmark fields. While this is not mandatory, it is strongly recommended.</P> -# -# <H1>Sequence of Setting Descriptor Fields</H1> -# -# <P>When setting descriptor fields by calling <B>SQLSetDescField</B>, the application must follow a specific sequence: -# -# <OL type=1> -# <LI>The application must first set the SQL_DESC_TYPE, SQL_DESC_CONCISE_TYPE, or SQL_DESC_DATETIME_INTERVAL_CODE field. </li> -# -# <LI>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.</li> -# -# <LI>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.</li> -# </OL> -# -# <H1>Initialization of Descriptor Fields</H1> -# -# <P>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). </P> -# -# <P>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.</P> -# -# <P>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.</P> -# -# <P>The fields that can be accessed by <B>SQLGetDescField</B> cannot necessarily be set by <B>SQLSetDescField</B>. Fields that can be set by <B>SQLSetDescField</B> are listed in the following tables.</P> -# -# <P>The initialization of header fields is outlined in the table that follows.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=27%>Header field name</TH> -# <TH width=21%>Type</TH> -# <TH width=19%>R/W</TH> -# <TH width=33%>Default</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_ALLOC_TYPE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R<BR> -# APD: R<BR> -# IRD: R<BR> -# IPD: R </TD> -# <TD width=33%>ARD: SQL_DESC_ALLOC_AUTO for implicit or SQL_DESC_ALLOC_USER for explicit -# <P>APD: SQL_DESC_ALLOC_AUTO for implicit or SQL_DESC_ALLOC_USER for explicit</P> -# -# <P>IRD: SQL_DESC_ALLOC_AUTO</P> -# -# <P>IPD: SQL_DESC_ALLOC_AUTO</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_ARRAY_SIZE</TD> -# <TD width=21%>SQLUINTEGER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD:<SUP>[1]</SUP><BR> -# APD:<SUP>[1]</SUP><BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_ARRAY_STATUS_PTR</TD> -# <TD width=21%>SQLUSMALLINT*</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R/W<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: Null ptr<BR> -# APD: Null ptr<BR> -# IRD: Null ptr<BR> -# IPD: Null ptr</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_BIND_OFFSET_PTR</TD> -# <TD width=21%>SQLINTEGER*</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Null ptr<BR> -# APD: Null ptr<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_BIND_TYPE</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: SQL_BIND_BY_COLUMN -# <P>APD: SQL_BIND_BY_COLUMN</P> -# -# <P>IRD: Unused</P> -# -# <P>IPD: Unused</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_COUNT</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: 0<BR> -# APD: 0<BR> -# IRD: D<BR> -# IPD: 0</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_ROWS_PROCESSED_PTR</TD> -# <TD width=21%>SQLUINTEGER*</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R/W<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: Null ptr<BR> -# IPD: Null ptr</TD> -# </TR> -# </table></div> -# -# <P class="fineprint">[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.</p> -# <P>The initialization of record fields is as shown in the following table.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=27%>Record field name</TH> -# <TH width=21%>Type</TH> -# <TH width=19%>R/W</TH> -# <TH width=33%>Default</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_AUTO_UNIQUE_VALUE</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_BASE_COLUMN_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_BASE_TABLE_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_CASE_SENSITIVE</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: D<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_CATALOG_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_CONCISE_TYPE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: SQL_C_<BR> -# DEFAULT<BR> -# APD: SQL_C_<BR> -# DEFAULT<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_DATA_PTR</TD> -# <TD width=21%>SQLPOINTER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Null ptr<BR> -# APD: Null ptr<BR> -# IRD: Unused<BR> -# IPD: Unused<SUP>[2]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_DATETIME_INTERVAL_CODE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_DATETIME_INTERVAL_PRECISION</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_DISPLAY_SIZE</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_FIXED_PREC_SCALE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: D<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_INDICATOR_PTR</TD> -# <TD width=21%>SQLINTEGER *</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Null ptr<BR> -# APD: Null ptr<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_LABEL</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_LENGTH</TD> -# <TD width=21%>SQLUINTEGER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_LITERAL_PREFIX</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_LITERAL_SUFFIX</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_LOCAL_TYPE_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: D<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_NULLABLE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_NUM_PREC_RADIX</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_OCTET_LENGTH</TD> -# <TD width=21%>SQLINTEGER</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_OCTET_LENGTH_PTR</TD> -# <TD width=21%>SQLINTEGER *</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Null ptr<BR> -# APD: Null ptr<BR> -# IRD: Unused<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_PARAMETER_TYPE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: Unused<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: Unused<BR> -# IPD: D=SQL_PARAM_INPUT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_PRECISION</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_ROWVER</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused -# <P>APD: Unused</P> -# -# <P>IRD: R</P> -# -# <P>IPD: R</P> -# </TD> -# <TD width=33%>ARD: Unused -# <P>APD: Unused</P> -# -# <P>IRD: ND</P> -# -# <P>IPD: ND</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_SCALE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_SCHEMA_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_SEARCHABLE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_TABLE_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_TYPE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: R/W<BR> -# APD: R/W<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: SQL_C_DEFAULT<BR> -# APD: SQL_C_DEFAULT<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_TYPE_NAME</TD> -# <TD width=21%>SQLCHAR *</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: D<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_UNNAMED</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R/W</TD> -# <TD width=33%>ARD: ND<BR> -# APD: ND<BR> -# IRD: D<BR> -# IPD: ND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_UNSIGNED</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: R</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: D<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>SQL_DESC_UPDATABLE</TD> -# <TD width=21%>SQLSMALLINT</TD> -# <TD width=19%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: R<BR> -# IPD: Unused</TD> -# <TD width=33%>ARD: Unused<BR> -# APD: Unused<BR> -# IRD: D<BR> -# IPD: Unused</TD> -# </TR> -# </table></div> -# -# <P class="fineprint">[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.</p> -# <P class="fineprint">[2] The SQL_DESC_DATA_PTR field in the IPD can be set to force a consistency check. In a subsequent call to <B>SQLGetDescField</B> or <B>SQLGetDescRec</B>, the driver is not required to return the value that SQL_DESC_DATA_PTR was set to.</p> -# <P class="label"><B><I>FieldIdentifier</I> Argument</B></P> -# -# <P>The <I>FieldIdentifier</I> argument indicates the descriptor field to be set. A descriptor contains the <I>descriptor header,</I> consisting of the header fields described in the next section, "Header Fields," and zero or more <I>descriptor records,</I> consisting of the record fields described in the section following the "Header Fields" section.</P> -# -# <H1>Header Fields</H1> -# -# <P>Each descriptor has a header consisting of the following fields: -# -# <DL> -# <DT><B>SQL_DESC_ALLOC_TYPE [All]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_ARRAY_SIZE [Application descriptors]</B></DT> -# -# <DD>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 <B>SQLFetch</B> or <B>SQLFetchScroll</B> or to be operated on by a call to <B>SQLBulkOperations</B> or <B>SQLSetPos</B>. -# -# <P>In APDs, this SQLUINTEGER header field specifies the number of values for each parameter. -# -# -# <P>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. -# -# -# <P>This field in the ARD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_ROW_ARRAY_SIZE attribute. This field in the APD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_PARAMSET_SIZE attribute. -# </dd> -# -# <DT><B>SQL_DESC_ARRAY_STATUS_PTR [All]</B></DT> -# -# <DD>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). -# -# <P>In the IRD, this header field points to a row status array containing status values after a call to <B>SQLBulkOperations</B>, <B>SQLFetch</B>, <B>SQLFetchScroll</B>, or <B>SQLSetPos</B>. 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. -# -# -# <P class="indent"><b class="le">Caution</b> 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. -# -# -# <P>The array is initially populated by a call to <B>SQLBulkOperations</B>, <B>SQLFetch</B>, <B>SQLFetchScroll</B>, or <B>SQLSetPos</B>. 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: -# -# -# <UL type=disc> -# <LI>SQL_ROW_SUCCESS: The row was successfully fetched and has not changed since it was last fetched.</li> -# -# <LI>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.</li> -# -# <LI>SQL_ROW_ERROR: An error occurred while fetching the row.</li> -# -# <LI>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.</li> -# -# <LI>SQL_ROW_DELETED: The row has been deleted since it was last fetched.</li> -# -# <LI>SQL_ROW_ADDED: The row was inserted by <B>SQLBulkOperations</B>. If the row is fetched again, its status is SQL_ROW_SUCCESS.</li> -# -# <LI>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.</li> -# </UL> -# -# -# <P>This field in the IRD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_ROW_STATUS_PTR attribute. -# -# -# <P>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. -# -# -# <P>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 <B>SQLExecute</B> or <B>SQLExecDirect</B>. If the call to <B>SQLExecute</B> or <B>SQLExecDirect</B> 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: -# -# -# <UL type=disc> -# <LI>SQL_PARAM_SUCCESS: The SQL statement was successfully executed for this set of parameters.</li> -# -# <LI>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.</li> -# -# <LI>SQL_PARAM_ERROR: An error occurred in processing this set of parameters. Additional error information is available in the diagnostics data structure.</li> -# -# <LI>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.</li> -# -# <LI>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.</li> -# </UL> -# -# -# <P>This field in the IPD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_PARAM_STATUS_PTR attribute. -# -# -# <P>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 <B>SQLSetPos</B> operations. The elements in the array can contain the following values: -# -# -# <UL type=disc> -# <LI>SQL_ROW_PROCEED: The row is included in the bulk operation using <B>SQLSetPos</B>. (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.)</li> -# -# <LI>SQL_ROW_IGNORE: The row is excluded from the bulk operation using <B>SQLSetPos</B>.</li> -# </UL> -# -# -# <P>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. -# -# -# <P>This field in the ARD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_ROW_OPERATION_PTR attribute. -# -# -# <P>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 <B>SQLExecute</B> or<B> SQLExecDirect</B> is called. The elements in the array can contain the following values: -# -# -# <UL type=disc> -# <LI>SQL_PARAM_PROCEED: The set of parameters is included in the <B>SQLExecute</B> or <B>SQLExecDirect</B> call.</li> -# -# <LI>SQL_PARAM_IGNORE: The set of parameters is excluded from the <B>SQLExecute</B> or <B>SQLExecDirect</B> call.</li> -# </UL> -# -# -# <P>If no elements of the array are set, all sets of parameters in the array are used in the <B>SQLExecute</B> or <B>SQLExecDirect</B> 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. -# -# -# <P>This field in the APD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_PARAM_OPERATION_PTR attribute. -# </dd> -# -# <DT><B>SQL_DESC_BIND_OFFSET_PTR [Application descriptors]</B></DT> -# -# <DD>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. -# -# <P>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. -# -# -# <P>This field is a <I>deferred field</I>: 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. -# -# -# <P>This field in the ARD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_ROW_BIND_OFFSET_PTR attribute. This field in the ARD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_PARAM_BIND_OFFSET_PTR attribute. -# -# -# <P>For more information, see the description of row-wise binding in <A HREF="odbcsqlfetchscroll.htm">SQLFetchScroll</A> and <A HREF="odbcsqlbindparameter.htm">SQLBindParameter</A>. -# </dd> -# -# <DT><B>SQL_DESC_BIND_TYPE [Application descriptors]</B></DT> -# -# <DD>This SQLUINTEGER header field sets the binding orientation to be used for binding either columns or parameters. -# -# <P>In ARDs, this field specifies the binding orientation when <B>SQLFetchScroll</B> or <B>SQLFetch</B> is called on the associated statement handle. -# -# -# <P>To select column-wise binding for columns, this field is set to SQL_BIND_BY_COLUMN (the default). -# -# -# <P>This field in the ARD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_ROW_BIND_TYPE <I>Attribute</I>. -# -# -# <P>In APDs, this field specifies the binding orientation to be used for dynamic parameters. -# -# -# <P>To select column-wise binding for parameters, this field is set to SQL_BIND_BY_COLUMN (the default). -# -# -# <P>This field in the APD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_PARAM_BIND_TYPE <I>Attribute</I>. -# </dd> -# -# <DT><B>SQL_DESC_COUNT [All]</B></DT> -# -# <DD>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. -# -# <P>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 <B>SQLBindCol</B> with the <I>TargetValuePtr</I> argument set to a null pointer, or <B>SQLBindParameter</B> with the <I>ParameterValuePtr</I> 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 <B>SQLFreeStmt</B> with the SQL_UNBIND option, the SQL_DESC_COUNT fields in the ARD and IRD are set to 0. If <B>SQLFreeStmt</B> is called with the SQL_RESET_PARAMS option, the SQL_DESC_COUNT fields in the APD and IPD are set to 0. -# -# -# <P>The value in SQL_DESC_COUNT can be set explicitly by an application by calling <B>SQLSetDescField</B>. 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. -# -# -# <P>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. -# </dd> -# -# <DT><B>SQL_DESC_ROWS_PROCESSED_PTR [Implementation descriptors]</B></DT> -# -# <DD>In an IRD, this SQLUINTEGER * header field points to a buffer containing the number of rows fetched after a call to <B>SQLFetch</B> or <B>SQLFetchScroll</B>, or the number of rows affected in a bulk operation performed by a call to <B>SQLBulkOperations</B> or <B>SQLSetPos</B>, including error rows. -# -# <P>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. -# -# -# <P>SQL_DESC_ROWS_PROCESSED_PTR is valid only after SQL_SUCCESS or SQL_SUCCESS_WITH_INFO has been returned after a call to <B>SQLFetch</B> or <B>SQLFetchScroll </B>(for an IRD field) or <B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLParamData</B> (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. -# -# -# <P>This field in the ARD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_ROWS_FETCHED_PTR attribute. This field in the APD can also be set by calling <B>SQLSetStmtAttr</B> with the SQL_ATTR_PARAMS_PROCESSED_PTR attribute. -# -# -# <P>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. -# </dd> -# </DL> -# -# <H1>Record Fields</H1> -# -# <P>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. -# -# <DL> -# <DT><B>SQL_DESC_AUTO_UNIQUE_VALUE [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_BASE_COLUMN_NAME [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_BASE_TABLE_NAME [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_CASE_SENSITIVE [Implementation descriptors]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_CATALOG_NAME [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_CONCISE_TYPE [All]</B></DT> -# -# <DD>This SQLSMALLINT header field specifies the concise data type for all data types, including the datetime and interval data types. -# -# <P>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 <B>SQLBindCol</B> or <B>SQLBindParameter</B>, or <B>SQLSetDescField</B>. SQL_DESC_TYPE can be set by a call to <B>SQLSetDescField</B> or <B>SQLSetDescRec</B>. -# -# -# <P>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. -# -# -# <P>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. -# </dd> -# -# <DT><B>SQL_DESC_DATA_PTR [Application descriptors and IPDs]</B></DT> -# -# <DD>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 <I>deferred field</I>. It is not used at the time it is set but is used at a later time by the driver to retrieve data. -# -# <P>The column specified by the SQL_DESC_DATA_PTR field of the ARD is unbound if the <I>TargetValuePtr</I> argument in a call to <B>SQLBindCol</B> is a null pointer or if the SQL_DESC_DATA_PTR field in the ARD is set by a call to <B>SQLSetDescField</B> or <B>SQLSetDescRec</B> to a null pointer. Other fields are not affected if the SQL_DESC_DATA_PTR field is set to a null pointer. -# -# -# <P>If the call to <B>SQLFetch</B> or <B>SQLFetchScroll </B>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. -# -# -# <P>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 <B>SQLGetDescField</B> on this field, it is not necessarily returned the value that it had set. For more information, see "Consistency Checks" in <A HREF="odbcsqlsetdescrec.htm">SQLSetDescRec</A>. -# </dd> -# -# <DT><B>SQL_DESC_DATETIME_INTERVAL_CODE [All]</B></DT> -# -# <DD>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). -# -# <P>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. -# -# -# <P>This field can be set for the datetime data types listed in the following table. -# -# <!--TS:--> -# <div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>Datetime types</TH> -# <TH width=50%>DATETIME_INTERVAL_CODE</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TYPE_DATE/SQL_C_TYPE_DATE</TD> -# <TD width=50%>SQL_CODE_DATE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TYPE_TIME/SQL_C_TYPE_TIME</TD> -# <TD width=50%>SQL_CODE_TIME</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TYPE_TIMESTAMP/<BR> -# SQL_C_TYPE_TIMESTAMP</TD> -# <TD width=50%>SQL_CODE_TIMESTAMP</TD> -# </TR> -# </table></div> -# -# <!--TS:--> -# -# <P>This field can be set for the interval data types listed in the following table. -# -# <!--TS:--> -# <div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>Interval type</TH> -# <TH width=50%>DATETIME_INTERVAL_CODE</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_DAY/<BR> -# SQL_C_INTERVAL_DAY</TD> -# <TD width=50%>SQL_CODE_DAY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_DAY_TO_HOUR/<BR> -# SQL_C_INTERVAL_DAY_TO_HOUR</TD> -# <TD width=50%>SQL_CODE_DAY_TO_HOUR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_DAY_TO_MINUTE/<BR> -# SQL_C_INTERVAL_DAY_TO_MINUTE</TD> -# <TD width=50%>SQL_CODE_DAY_TO_MINUTE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_DAY_TO_SECOND/<BR> -# SQL_C_INTERVAL_DAY_TO_SECOND</TD> -# <TD width=50%>SQL_CODE_DAY_TO_SECOND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_HOUR/<BR> -# SQL_C_INTERVAL_HOUR</TD> -# <TD width=50%>SQL_CODE_HOUR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_HOUR_TO_MINUTE/<BR> -# SQL_C_INTERVAL_HOUR_TO_MINUTE</TD> -# <TD width=50%>SQL_CODE_HOUR_TO_MINUTE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_HOUR_TO_SECOND/<BR> -# SQL_C_INTERVAL_HOUR_TO_SECOND</TD> -# <TD width=50%>SQL_CODE_HOUR_TO_SECOND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_MINUTE/<BR> -# SQL_C_INTERVAL_MINUTE</TD> -# <TD width=50%>SQL_CODE_MINUTE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_MINUTE_TO_SECOND/<BR> -# SQL_C_INTERVAL_MINUTE_TO_SECOND</TD> -# <TD width=50%>SQL_CODE_MINUTE_TO_SECOND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_MONTH/<BR> -# SQL_C_INTERVAL_MONTH</TD> -# <TD width=50%>SQL_CODE_MONTH</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_SECOND/<BR> -# SQL_C_INTERVAL_SECOND</TD> -# <TD width=50%>SQL_CODE_SECOND</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_YEAR/<BR> -# SQL_C_INTERVAL_YEAR</TD> -# <TD width=50%>SQL_CODE_YEAR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTERVAL_YEAR_TO_MONTH/<BR> -# SQL_C_INTERVAL_YEAR_TO_MONTH</TD> -# <TD width=50%>SQL_CODE_YEAR_TO_MONTH</TD> -# </TR> -# </table></div> -# -# <!--TS:--> -# -# <P>For more information about the data intervals and this field, see "<A HREF="odbcdata_type_identifiers_and_descriptors.htm">Data Type Identifiers and Descriptors</A>" in Appendix D: Data Types. -# </dd> -# -# <DT><B>SQL_DESC_DATETIME_INTERVAL_PRECISION [All]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_DISPLAY_SIZE [IRDs]</B></DT> -# -# <DD>This read-only SQLINTEGER record field contains the maximum number of characters required to display the data from the column. </dd> -# -# <DT><B>SQL_DESC_FIXED_PREC_SCALE [Implementation descriptors]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_INDICATOR_PTR [Application descriptors]</B></DT> -# -# <DD>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). -# -# <P>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 <B>SQLFetch</B> or <B>SQLFetchScroll</B>. If the call to <B>SQLFetch</B> or <B>SQLFetchScroll </B>did not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO, the contents of the buffer are undefined. -# -# -# <P>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. -# -# -# <P>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. -# -# -# <P>This field is a <I>deferred field</I>: 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). -# </dd> -# -# <DT><B>SQL_DESC_LABEL [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_LENGTH [All]</B></DT> -# -# <DD>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. -# -# <P>The value in this field may be different from the value for "length" as defined in ODBC 2<I>.x</I>. For more information, see <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>. -# </dd> -# -# <DT><B>SQL_DESC_LITERAL_PREFIX [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_LITERAL_SUFFIX [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_LOCAL_TYPE_NAME [Implementation descriptors]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_NAME [Implementation descriptors]</B></DT> -# -# <DD>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. -# -# <P>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 "<A HREF="odbcbinding_parameters_by_name__named_parameters_.htm">Binding Parameters by Name (Named Parameters)</A>" 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. -# -# -# <P>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. -# </dd> -# -# <DT><B>SQL_DESC_NULLABLE [Implementation descriptors]</B></DT> -# -# <DD>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. -# -# <P>In IPDs, this field is always set to SQL_NULLABLE because dynamic parameters are always nullable and cannot be set by an application. -# </dd> -# -# <DT><B>SQL_DESC_NUM_PREC_RADIX [All]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_OCTET_LENGTH [All]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_OCTET_LENGTH_PTR [Application descriptors]</B></DT> -# -# <DD>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). -# -# <P>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. -# -# -# <P>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.) -# -# -# <P>If the call to <B>SQLFetch</B> or <B>SQLFetchScroll</B> 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 <I>deferred field</I>. 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. -# </dd> -# -# <DT><B>SQL_DESC_PARAMETER_TYPE [IPDs]</B></DT> -# -# <DD>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. -# -# <P>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. -# </dd> -# -# <DT><B>SQL_DESC_PRECISION [All]</B></DT> -# -# <DD>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. -# -# <P>The value in this field may be different from the value for "precision" as defined in ODBC 2<I>.x</I>. For more information, see <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>. -# </dd> -# -# <DT><B>SQL_DESC_ROWVER [Implementation descriptors]</B></DT> -# -# <DD>This SQLSMALLINT<B> </B>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 <B>SQLSpecialColumns</B> with IdentifierType of SQL_ROWVER to determine whether a column is automatically updated.</dd> -# -# <DT><B>SQL_DESC_SCALE [All]</B></DT> -# -# <DD>This SQLSMALLINT record field contains the defined scale for decimal and numeric data types. The field is undefined for all other data types. -# -# <P>The value in this field may be different from the value for "scale" as defined in ODBC 2<I>.x</I>. For more information, see <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>. -# </dd> -# -# <DT><B>SQL_DESC_SCHEMA_NAME [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_SEARCHABLE [IRDs]</B></DT> -# -# <DD>This read-only SQLSMALLINT record field is set to one of the following values: -# -# <UL type=disc> -# <LI>SQL_PRED_NONE if the column cannot be used in a <B>WHERE</B> clause. (This is the same as the SQL_UNSEARCHABLE value in ODBC 2<I>.x</I>.)</li> -# -# <LI>SQL_PRED_CHAR if the column can be used in a <B>WHERE</B> clause but only with the <B>LIKE</B> predicate. (This is the same as the SQL_LIKE_ONLY value in ODBC 2<I>.x</I>.)</li> -# -# <LI>SQL_PRED_BASIC if the column can be used in a <B>WHERE</B> clause with all the comparison operators except <B>LIKE</B>. (This is the same as the SQL_EXCEPT_LIKE value in ODBC 2<I>.x</I>.)</li> -# -# <LI>SQL_PRED_SEARCHABLE if the column can be used in a <B>WHERE</B> clause with any comparison operator.</li> -# </UL> -# </dd> -# -# <DT><B>SQL_DESC_TABLE_NAME [IRDs]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_TYPE [All]</B></DT> -# -# <DD>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. -# -# <P>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. -# -# -# <P>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 <B>SQLSetDescField</B> or <B>SQLSetDescRec</B>. SQL_DESC_CONCISE_TYPE can be set by a call to <B>SQLBindCol</B> or <B>SQLBindParameter</B>, or <B>SQLSetDescField</B>. -# -# -# <P>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. -# -# -# <P>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). -# -# -# <P>When the SQL_DESC_TYPE field is set by a call to <B>SQLBindCol</B>, <B>SQLBindParameter</B>, or <B>SQLSetDescField</B>, 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. -# -# <!--TS:--> -# <div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>Value of SQL_DESC_TYPE</TH> -# <TH width=52%>Other fields implicitly set</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>SQL_CHAR, SQL_VARCHAR, SQL_C_CHAR, SQL_C_VARCHAR</TD> -# <TD width=52%>SQL_DESC_LENGTH is set to 1. SQL_DESC_PRECISION is set to 0.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>SQL_DATETIME</TD> -# <TD width=52%>When 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.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>SQL_DECIMAL, SQL_NUMERIC,<BR> -# SQL_C_NUMERIC</TD> -# <TD width=52%>SQL_DESC_SCALE is set to 0. SQL_DESC_PRECISION is set to the implementation-defined precision for the respective data type.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>SQL_FLOAT, SQL_C_FLOAT</TD> -# <TD width=52%>SQL_DESC_PRECISION is set to the implementation-defined default precision for SQL_FLOAT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>SQL_INTERVAL</TD> -# <TD width=52%>When 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).</TD> -# </TR> -# </table></div> -# -# <!--TS:--> -# -# <P>When an application calls <B>SQLSetDescField</B> to set fields of a descriptor rather than calling <B>SQLSetDescRec</B>, 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 <B>SQLSetDescField</B> or <B>SQLSetDescRec</B> to set the unacceptable value explicitly. -# </dd> -# -# <DT><B>SQL_DESC_TYPE_NAME [Implementation descriptors]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_UNNAMED [Implementation descriptors]</B></DT> -# -# <DD>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. -# -# <P>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. -# </dd> -# -# <DT><B>SQL_DESC_UNSIGNED [Implementation descriptors]</B></DT> -# -# <DD>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.</dd> -# -# <DT><B>SQL_DESC_UPDATABLE [IRDs]</B></DT> -# -# <DD>This read-only SQLSMALLINT record field is set to one of the following values: -# -# <UL type=disc> -# <LI>SQL_ATTR_READ_ONLY if the result set column is read-only.</li> -# -# <LI>SQL_ATTR_WRITE if the result set column is read-write.</li> -# -# <LI>SQL_ATTR_READWRITE_UNKNOWN if it is not known whether the result set column is updatable or not.</li> -# </UL> -# -# -# <P>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. -# </dd> -# </DL> -# -# <H1>Consistency Checks</H1> -# -# <P>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, <B>SQLSetDescField</B> will return SQLSTATE HY021 (Inconsistent descriptor information). For more information, see "Consistency Check" in <A HREF="odbcsqlsetdescrec.htm">SQLSetDescRec</A>.</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>For information about</TH> -# <TH width=52%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Binding a column</TD> -# <TD width=52%><A HREF="odbcsqlbindcol.htm">SQLBindCol</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Binding a parameter</TD> -# <TD width=52%><A HREF="odbcsqlbindparameter.htm">SQLBindParameter</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Getting a descriptor field</TD> -# <TD width=52%><A HREF="odbcsqlgetdescfield.htm">SQLGetDescField</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Getting multiple descriptor fields</TD> -# <TD width=52%><A HREF="odbcsqlgetdescrec.htm">SQLGetDescRec</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Setting multiple descriptor fields</TD> -# <TD width=52%><A HREF="odbcsqlsetdescrec.htm">SQLSetDescRec</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -}; diff --git a/storage/ndb/src/old_files/client/odbc/docs/diag.txt b/storage/ndb/src/old_files/client/odbc/docs/diag.txt deleted file mode 100644 index a9a0e0f42d0..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/docs/getinfo.pl b/storage/ndb/src/old_files/client/odbc/docs/getinfo.pl deleted file mode 100644 index 34e26b47bab..00000000000 --- a/storage/ndb/src/old_files/client/odbc/docs/getinfo.pl +++ /dev/null @@ -1,3676 +0,0 @@ -# -use strict; - -# -# odbcsqlgetinfo.htm -# -my $info = { -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLGetInfo</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlgetinfo"></A>SQLGetInfo</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 1.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLGetInfo</B> returns general information about the driver and data source associated with a connection.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLGetInfo</B>( -# SQLHDBC <I>ConnectionHandle</I>, -# SQLUSMALLINT <I>InfoType</I>, -# SQLPOINTER <I>InfoValuePtr</I>, -# SQLSMALLINT <I>BufferLength</I>, -# SQLSMALLINT * <I>StringLengthPtr</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>ConnectionHandle</I></DT> -# -# <DD>[Input]<BR> -# Connection handle.</dd> -# -# <DT><I>InfoType</I></DT> -# -# <DD>[Input]<BR> -# Type of information.</dd> -# -# <DT><I>InfoValuePtr</I></DT> -# -# <DD>[Output]<BR> -# Pointer to a buffer in which to return the information. Depending on the <I>InfoType</I> 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. -# -# <P>If the <I>InfoType</I> argument is SQL_DRIVER_HDESC or SQL_DRIVER_HSTMT, the <I>InfoValuePtr</I> argument is both input and output. (See the SQL_DRIVER_HDESC or SQL_DRIVER_HSTMT descriptors later in this function description for more information.) -# </dd> -# -# <DT><I>BufferLength</I></DT> -# -# <DD>[Input]<BR> -# Length of the *<I>InfoValuePtr</I> buffer. If the value in <I>*InfoValuePtr</I> is not a character string or if <I>InfoValuePtr</I> is a null pointer,<I> </I>the <I>BufferLength</I> argument is ignored. The driver assumes that the size of <I>*InfoValuePtr</I> is SQLUSMALLINT or SQLUINTEGER, based on the <I>InfoType</I>. If <I>*InfoValuePtr</I> is a Unicode string (when calling <B>SQLGetInfoW</B>), the <I>BufferLength</I> argument must be an even number; if not, SQLSTATE HY090 (Invalid string or buffer length) is returned. </dd> -# -# <DT><I>StringLengthPtr</I></DT> -# -# <DD>[Output]<BR> -# 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 *<I>InfoValuePtr</I>. -# -# <P>For character data, if the number of bytes available to return is greater than or equal to <I>BufferLength</I>, the information in *<I>InfoValuePtr</I> is truncated to <I>BufferLength</I> bytes minus the length of a null-termination character and is null-terminated by the driver. -# -# -# <P>For all other types of data, the value of <I>BufferLength</I> is ignored and the driver assumes the size of *<I>InfoValuePtr</I> is SQLUSMALLINT or SQLUINTEGER, depending on the <I>InfoType</I>. -# </dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLGetInfo</B> returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_DBC and a <I>Handle</I> of <I>ConnectionHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLGetInfo</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=23%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=51%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=51%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>01004</TD> -# <TD width=26%>String data, right truncated</TD> -# <TD width=51%>The buffer *<I>InfoValuePtr</I> 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 *<I>StringLengthPtr</I>. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>08003</TD> -# <TD width=26%>Connection does not exist</TD> -# <TD width=51%>(DM) The type of information requested in <I>InfoType</I> requires an open connection. Of the information types reserved by ODBC, only SQL_ODBC_VER can be returned without an open connection.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=51%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=51%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HY001</TD> -# <TD width=26%>Memory allocation <BR> -# error</TD> -# <TD width=51%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=51%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HY024</TD> -# <TD width=26%>Invalid attribute value</TD> -# <TD width=51%>(DM) The <I>InfoType</I> argument was SQL_DRIVER_HSTMT, and the value pointed to by <I>InfoValuePtr</I> was not a valid statement handle. -# <P>(DM) The <I>InfoType</I> argument was SQL_DRIVER_HDESC, and the value pointed to by <I>InfoValuePtr</I> was not a valid descriptor handle.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=51%>(DM) The value specified for argument <I>BufferLength</I> was less than 0. -# <P>(DM) The value specified for <I>BufferLength</I> was an odd number, and <I>*InfoValuePtr </I>was of a Unicode data type.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HY096</TD> -# <TD width=26%>Information type out of range</TD> -# <TD width=51%>The value specified for the argument <I>InfoType</I> was not valid for the version of ODBC supported by the driver.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HYC00</TD> -# <TD width=26%>Optional field not implemented</TD> -# <TD width=51%>The value specified for the argument <I>InfoType</I> was a driver-specific value that is not supported by the driver.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=51%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=23%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=51%>(DM) The driver corresponding to the <I>ConnectionHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P>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. <B>SQLGetInfo</B> performs no Unicode conversion or <I>thunking</I> (see <A HREF="odbcodbc_error_codes.htm">Appendix A</A> of the <I>ODBC Programmer's Reference</I>) for driver-defined <I>InfoTypes</I>. For more information, see "<A HREF="odbcdriver_specific_data_types__descriptor_types__information_types.htm">Driver-Specific Data Types, Descriptor Types, Information Types, Diagnostic Types, and Attributes</A>" in Chapter 17: Programming Considerations. The format of the information returned in *<I>InfoValuePtr</I> depends on the <I>InfoType</I> requested. <B>SQLGetInfo</B> will return information in one of five different formats: -# -# <UL type=disc> -# <LI>A null-terminated character string</li> -# -# <LI>An SQLUSMALLINT value</li> -# -# <LI>An SQLUINTEGER bitmask</li> -# -# <LI>An SQLUINTEGER value</li> -# -# <LI>A SQLUINTEGER binary value</li> -# </UL> -# -# <P>The format of each of the following information types is noted in the type's description. The application must cast the value returned in *<I>InfoValuePtr</I> accordingly. For an example of how an application could retrieve data from a SQLUINTEGER bitmask, see "Code Example."</P> -# -# <P>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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=49%>Format of *<I>InfoValuePtr</I></TH> -# <TH width=51%>Returned value</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>Character string ("Y" or "N")</TD> -# <TD width=51%>"N"</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>Character string (not "Y" or "N")</TD> -# <TD width=51%>Empty string</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQLUSMALLINT</TD> -# <TD width=51%>0</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQLUINTEGER bitmask or SQLUINTEGER binary value</TD> -# <TD width=51%>0L</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>For example, if a data source does not support procedures, <B>SQLGetInfo</B> returns the values listed in the following table for the values of <I>InfoType</I> that are related to procedures.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=49%><I>InfoType</I></TH> -# <TH width=51%>Returned value</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_PROCEDURES</TD> -# <TD width=51%>"N"</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ACCESSIBLE_PROCEDURES</TD> -# <TD width=51%>"N"</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_PROCEDURE_NAME_LEN</TD> -# <TD width=51%>0</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_PROCEDURE_TERM</TD> -# <TD width=51%>Empty string</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P><B>SQLGetInfo</B> returns SQLSTATE HY096 (Invalid argument value) for values of <I>InfoType</I> 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 <B>SQLGetInfo</B> with the SQL_DRIVER_ODBC_VER information type. <B>SQLGetInfo</B> returns SQLSTATE HYC00 (Optional feature not implemented) for values of <I>InfoType</I> that are in the range of information types reserved for driver-specific use but are not supported by the driver.</P> -# -# <P>All calls to <B>SQLGetInfo</B> require an open connection, except when the <I>InfoType</I> is SQL_ODBC_VER, which returns the version of the Driver Manager.</P> -# -# <H1>Information Types</H1> -# -# <P>This section lists the information types supported by <B>SQLGetInfo</B>. Information types are grouped categorically and listed alphabetically. Information types that were added or renamed for ODBC 3<I>.x</I> are also listed.</P> -# -# <H2>Driver Information</H2> -# -# <P>The following values of the <I>InfoType</I> argument return information about the ODBC driver, such as the number of active statements, the data source name, and the interface standards compliance level:</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_ACTIVE_ENVIRONMENTS</TD> -# <TD width=57%>SQL_GETDATA_EXTENSIONS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_ASYNC_MODE</TD> -# <TD width=57%>SQL_INFO_SCHEMA_VIEWS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_BATCH_ROW_COUNT</TD> -# <TD width=57%>SQL_KEYSET_CURSOR_ATTRIBUTES1</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_BATCH_SUPPORT</TD> -# <TD width=57%>SQL_KEYSET_CURSOR_ATTRIBUTES2</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DATA_SOURCE_NAME</TD> -# <TD width=57%>SQL_MAX_ASYNC_CONCURRENT_STATEMENTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_HDBC</TD> -# <TD width=57%>SQL_MAX_CONCURRENT_ACTIVITIES</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_HDESC</TD> -# <TD width=57%>SQL_MAX_DRIVER_CONNECTIONS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_HENV</TD> -# <TD width=57%>SQL_ODBC_INTERFACE_CONFORMANCE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_HLIB</TD> -# <TD width=57%>SQL_ODBC_STANDARD_CLI_CONFORMANCE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_HSTMT</TD> -# <TD width=57%>SQL_ODBC_VER</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_NAME</TD> -# <TD width=57%>SQL_PARAM_ARRAY_ROW_COUNTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_ODBC_VER</TD> -# <TD width=57%>SQL_PARAM_ARRAY_SELECTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DRIVER_VER</TD> -# <TD width=57%>SQL_ROW_UPDATES</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DYNAMIC_CURSOR_ATTRIBUTES1</TD> -# <TD width=57%>SQL_SEARCH_PATTERN_ESCAPE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_DYNAMIC_CURSOR_ATTRIBUTES2</TD> -# <TD width=57%>SQL_SERVER_NAME</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1</TD> -# <TD width=57%>SQL_STATIC_CURSOR_ATTRIBUTES1</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2</TD> -# <TD width=57%>SQL_STATIC_CURSOR_ATTRIBUTES2</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>SQL_FILE_USAGE</TD> -# <TD width=57%> </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <H2>DBMS Product Information</H2> -# -# <P>The following values of the <I>InfoType</I> argument return information about the DBMS product, such as the DBMS name and version:</P> -# -# <P>SQL_DATABASE_NAME<BR> -# SQL_DBMS_NAME<BR> -# SQL_DBMS_VER</P> -# -# <H2>Data Source Information</H2> -# -# <P>The following values of the <I>InfoType</I> argument return information about the data source, such as cursor characteristics and transaction capabilities:</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_ACCESSIBLE_PROCEDURES</TD> -# <TD width=46%>SQL_MULT_RESULT_SETS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_ACCESSIBLE_TABLES</TD> -# <TD width=46%>SQL_MULTIPLE_ACTIVE_TXN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_BOOKMARK_PERSISTENCE</TD> -# <TD width=46%>SQL_NEED_LONG_DATA_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_CATALOG_TERM</TD> -# <TD width=46%>SQL_NULL_COLLATION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_COLLATION_SEQ</TD> -# <TD width=46%>SQL_PROCEDURE_TERM</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_CONCAT_NULL_BEHAVIOR</TD> -# <TD width=46%>SQL_SCHEMA_TERM</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_CURSOR_COMMIT_BEHAVIOR</TD> -# <TD width=46%>SQL_SCROLL_OPTIONS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_CURSOR_ROLLBACK_BEHAVIOR</TD> -# <TD width=46%>SQL_TABLE_TERM</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_CURSOR_SENSITIVITY</TD> -# <TD width=46%>SQL_TXN_CAPABLE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_DATA_SOURCE_READ_ONLY</TD> -# <TD width=46%>SQL_TXN_ISOLATION_OPTION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_DEFAULT_TXN_ISOLATION</TD> -# <TD width=46%>SQL_USER_NAME</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=54%>SQL_DESCRIBE_PARAMETER</TD> -# <TD width=46%> </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <H2>Supported SQL</H2> -# -# <P>The following values of the <I>InfoType</I> 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.</P> -# -# <P>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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_AGGREGATE_FUNCTIONS</TD> -# <TD width=51%>SQL_DROP_TABLE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ALTER_DOMAIN</TD> -# <TD width=51%>SQL_DROP_TRANSLATION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ALTER_SCHEMA</TD> -# <TD width=51%>SQL_DROP_VIEW</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ALTER_TABLE</TD> -# <TD width=51%>SQL_EXPRESSIONS_IN_ORDERBY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ANSI_SQL_DATETIME_LITERALS</TD> -# <TD width=51%>SQL_GROUP_BY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CATALOG_LOCATION </TD> -# <TD width=51%>SQL_IDENTIFIER_CASE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CATALOG_NAME</TD> -# <TD width=51%>SQL_IDENTIFIER_QUOTE_CHAR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CATALOG_NAME_SEPARATOR</TD> -# <TD width=51%>SQL_INDEX_KEYWORDS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CATALOG_USAGE</TD> -# <TD width=51%>SQL_INSERT_STATEMENT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_COLUMN_ALIAS</TD> -# <TD width=51%>SQL_INTEGRITY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CORRELATION_NAME</TD> -# <TD width=51%>SQL_KEYWORDS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_ASSERTION</TD> -# <TD width=51%>SQL_LIKE_ESCAPE_CLAUSE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_CHARACTER_SET</TD> -# <TD width=51%>SQL_NON_NULLABLE_COLUMNS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_COLLATION</TD> -# <TD width=51%>SQL_SQL_CONFORMANCE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_DOMAIN</TD> -# <TD width=51%>SQL_OJ_CAPABILITIES</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_SCHEMA</TD> -# <TD width=51%>SQL_ORDER_BY_COLUMNS_IN_SELECT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_TABLE</TD> -# <TD width=51%>SQL_OUTER_JOINS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_TRANSLATION</TD> -# <TD width=51%>SQL_PROCEDURES</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DDL_INDEX</TD> -# <TD width=51%>SQL_QUOTED_IDENTIFIER_CASE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DROP_ASSERTION</TD> -# <TD width=51%>SQL_SCHEMA_USAGE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DROP_CHARACTER_SET</TD> -# <TD width=51%>SQL_SPECIAL_CHARACTERS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DROP_COLLATION</TD> -# <TD width=51%>SQL_SUBQUERIES</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DROP_DOMAIN</TD> -# <TD width=51%>SQL_UNION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DROP_SCHEMA</TD> -# <TD width=51%> </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>SQL Limits</B></P> -# -# <P>The following values of the <I>InfoType</I> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_BINARY_LITERAL_LEN</TD> -# <TD width=51%>SQL_MAX_IDENTIFIER_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_CATALOG_NAME_LEN</TD> -# <TD width=51%>SQL_MAX_INDEX_SIZE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_CHAR_LITERAL_LEN</TD> -# <TD width=51%>SQL_MAX_PROCEDURE_NAME_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_COLUMN_NAME_LEN</TD> -# <TD width=51%>SQL_MAX_ROW_SIZE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_COLUMNS_IN_GROUP_BY</TD> -# <TD width=51%>SQL_MAX_ROW_SIZE_INCLUDES_LONG</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_COLUMNS_IN_INDEX</TD> -# <TD width=51%>SQL_MAX_SCHEMA_NAME_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_COLUMNS_IN_ORDER_BY</TD> -# <TD width=51%>SQL_MAX_STATEMENT_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_COLUMNS_IN_SELECT</TD> -# <TD width=51%>SQL_MAX_TABLE_NAME_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_COLUMNS_IN_TABLE</TD> -# <TD width=51%>SQL_MAX_TABLES_IN_SELECT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_MAX_CURSOR_NAME_LEN</TD> -# <TD width=51%>SQL_MAX_USER_NAME_LEN</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Scalar Function Information</B></P> -# -# <P>The following values of the <I>InfoType</I> argument return information about the scalar functions supported by the data source and the driver. For more information about scalar functions, see <A HREF="odbcscalar_functions.htm">Appendix E: Scalar Functions</A>.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CONVERT_FUNCTIONS</TD> -# <TD width=51%>SQL_TIMEDATE_ADD_INTERVALS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_NUMERIC_FUNCTIONS</TD> -# <TD width=51%>SQL_TIMEDATE_DIFF_INTERVALS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_STRING_FUNCTIONS</TD> -# <TD width=51%>SQL_TIMEDATE_FUNCTIONS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_SYSTEM_FUNCTIONS</TD> -# <TD width=51%> </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Conversion Information</B></P> -# -# <P>The following values of the <I>InfoType</I> argument return a list of the SQL data types to which the data source can convert the specified SQL data type with the <B>CONVERT</B> scalar function:</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_BIGINT</TD> -# <TD width=47%>SQL_CONVERT_LONGVARBINARY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_BINARY</TD> -# <TD width=47%>SQL_CONVERT_LONGVARCHAR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_BIT</TD> -# <TD width=47%>SQL_CONVERT_NUMERIC</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_CHAR</TD> -# <TD width=47%>SQL_CONVERT_REAL</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_DATE</TD> -# <TD width=47%>SQL_CONVERT_SMALLINT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_DECIMAL</TD> -# <TD width=47%>SQL_CONVERT_TIME</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_DOUBLE</TD> -# <TD width=47%>SQL_CONVERT_TIMESTAMP</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_FLOAT</TD> -# <TD width=47%>SQL_CONVERT_TINYINT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_INTEGER</TD> -# <TD width=47%>SQL_CONVERT_VARBINARY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_INTERVAL_YEAR_MONTH</TD> -# <TD width=47%>SQL_CONVERT_VARCHAR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=53%>SQL_CONVERT_INTERVAL_DAY_TIME</TD> -# <TD width=47%> </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Information Types Added for ODBC 3<I>.x</I></B></P> -# -# <P>The following values of the <I>InfoType</I> argument have been added for ODBC 3<I>.x</I>:</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ACTIVE_ENVIRONMENTS</TD> -# <TD width=51%>SQL_DROP_ASSERTION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_AGGREGATE_FUNCTIONS</TD> -# <TD width=51%>SQL_DROP_CHARACTER_SET</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ALTER_DOMAIN</TD> -# <TD width=51%>SQL_DROP_COLLATION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ALTER_SCHEMA</TD> -# <TD width=51%>SQL_DROP_DOMAIN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ANSI_SQL_DATETIME_LITERALS</TD> -# <TD width=51%>SQL_DROP_SCHEMA</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_ASYNC_MODE</TD> -# <TD width=51%>SQL_DROP_TABLE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_BATCH_ROW_COUNT</TD> -# <TD width=51%>SQL_DROP_TRANSLATION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_BATCH_SUPPORT</TD> -# <TD width=51%>SQL_DROP_VIEW</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CATALOG_NAME</TD> -# <TD width=51%>SQL_DYNAMIC_CURSOR_ATTRIBUTES1</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_COLLATION_SEQ</TD> -# <TD width=51%>SQL_DYNAMIC_CURSOR_ATTRIBUTES2</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CONVERT_INTERVAL_YEAR_MONTH</TD> -# <TD width=51%>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CONVERT_INTERVAL_DAY_TIME</TD> -# <TD width=51%>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_ASSERTION</TD> -# <TD width=51%>SQL_INFO_SCHEMA_VIEWS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_CHARACTER_SET</TD> -# <TD width=51%>SQL_INSERT_STATEMENT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_COLLATION</TD> -# <TD width=51%>SQL_KEYSET_CURSOR_ATTRIBUTES1</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_DOMAIN</TD> -# <TD width=51%>SQL_KEYSET_CURSOR_ATTRIBUTES2</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_SCHEMA</TD> -# <TD width=51%>SQL_MAX_ASYNC_CONCURRENT_STATEMENTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_TABLE</TD> -# <TD width=51%>SQL_MAX_IDENTIFIER_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CREATE_TRANSLATION</TD> -# <TD width=51%>SQL_PARAM_ARRAY_ROW_COUNTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_CURSOR_SENSITIVITY</TD> -# <TD width=51%>SQL_PARAM_ARRAY_SELECTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DDL_INDEX</TD> -# <TD width=51%>SQL_STATIC_CURSOR_ATTRIBUTES1</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DESCRIBE_PARAMETER</TD> -# <TD width=51%>SQL_STATIC_CURSOR_ATTRIBUTES2</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DM_VER</TD> -# <TD width=51%>SQL_XOPEN_CLI_YEAR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=49%>SQL_DRIVER_HDESC</TD> -# <TD width=51%> </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Information Types Renamed for ODBC 3<I>.x</I></B></P> -# -# <P>The following values of the <I>InfoType</I> argument have been renamed for ODBC 3<I>.x</I>.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=55%>ODBC 2.0 <I>InfoType</I></TH> -# <TH width=45%>ODBC 3<I>.x</I> <I>InfoType</I></TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_ACTIVE_CONNECTIONS</TD> -# <TD width=45%>SQL_MAX_DRIVER_CONNECTIONS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_ACTIVE_STATEMENTS</TD> -# <TD width=45%>SQL_MAX_CONCURRENT_ACTIVITIES</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_MAX_OWNER_NAME_LEN</TD> -# <TD width=45%>SQL_MAX_SCHEMA_NAME_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_MAX_QUALIFIER_NAME_LEN</TD> -# <TD width=45%>SQL_MAX_CATALOG_NAME_LEN</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_ODBC_SQL_OPT_IEF</TD> -# <TD width=45%>SQL_INTEGRITY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_OWNER_TERM</TD> -# <TD width=45%>SQL_SCHEMA_TERM</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_OWNER_USAGE</TD> -# <TD width=45%>SQL_SCHEMA_USAGE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_QUALIFIER_LOCATION</TD> -# <TD width=45%>SQL_CATALOG_LOCATION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_QUALIFIER_NAME_SEPARATOR</TD> -# <TD width=45%>SQL_CATALOG_NAME_SEPARATOR</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_QUALIFIER_TERM</TD> -# <TD width=45%>SQL_CATALOG_TERM</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=55%>SQL_QUALIFIER_USAGE</TD> -# <TD width=45%>SQL_CATALOG_USAGE</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Information Types Deprecated in ODBC 3<I>.x</I></B></P> -# -# <P>The following values of the <I>InfoType</I> argument have been deprecated in ODBC 3<I>.x</I>. ODBC 3<I>.x</I> drivers must continue to support these information types for backward compatibility with ODBC 2<I>.x</I> applications. (For more information on these types, see "<A HREF="odbcsqlgetinfo_support.htm">SQLGetInfo Support</A>" in Appendix G: Driver Guidelines for Backward Compatibility.)</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=51%>SQL_FETCH_DIRECTION</TD> -# <TD width=49%>SQL_POS_OPERATIONS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=51%>SQL_LOCK_TYPES</TD> -# <TD width=49%>SQL_POSITIONED_STATEMENTS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=51%>SQL_ODBC_API_CONFORMANCE</TD> -# <TD width=49%>SQL_SCROLL_CONCURRENCY</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=51%>SQL_ODBC_SQL_CONFORMANCE</TD> -# <TD width=49%>SQL_STATIC_SENSITIVITY</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <H2>Information Type Descriptions</H2> -# -# <P>The following table alphabetically lists each information type, the version of ODBC in which it was introduced, and its description.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%><I>InfoType</I></TH> -# <TH width=50%>Returns</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ACCESSIBLE_PROCEDURES<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string: "Y" if the user can execute all procedures returned by <B>SQLProcedures</B>; "N" if there may be procedures returned that the user cannot execute.</TD> -# </TR> - SQL_ACCESSIBLE_PROCEDURES => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ACCESSIBLE_TABLES<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string: "Y" if the user is guaranteed <B>SELECT</B> privileges to all tables returned by <B>SQLTables</B>; "N" if there may be tables returned that the user cannot access.</TD> -# </TR> - SQL_ACCESSIBLE_TABLES => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ACTIVE_ENVIRONMENTS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_ACTIVE_ENVIRONMENTS => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_AGGREGATE_FUNCTIONS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating support for aggregation functions: -# <P>SQL_AF_ALL<BR> -# SQL_AF_AVG<BR> -# SQL_AF_COUNT<BR> -# SQL_AF_DISTINCT<BR> -# SQL_AF_MAX<BR> -# SQL_AF_MIN<BR> -# SQL_AF_SUM </P> -# -# <P>An SQL-92 Entry level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_AGGREGATE_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ALTER_DOMAIN<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>ALTER DOMAIN</B> 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 <B>ALTER DOMAIN</B> statement is not supported. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_AD_ADD_DOMAIN_CONSTRAINT = Adding a domain constraint is supported (Full level)</P> -# -# <P>SQL_AD_ADD_DOMAIN_DEFAULT = <alter domain> <set domain default clause> is supported (Full level)</P> -# -# <P>SQL_AD_CONSTRAINT_NAME_DEFINITION = <constraint name definition clause> is supported for naming domain constraint (Intermediate level)</P> -# -# <P>SQL_AD_DROP_DOMAIN_CONSTRAINT = <drop domain constraint clause> is supported (Full level)</P> -# -# <P>SQL_AD_DROP_DOMAIN_DEFAULT = <alter domain> <drop domain default clause> is supported (Full level)</P> -# -# <P>The following bits specify the supported <constraint attributes> if <add domain constraint> is supported (the SQL_AD_ADD_DOMAIN_CONSTRAINT bit is set):</P> -# -# <P>SQL_AD_ADD_CONSTRAINT_DEFERRABLE (Full level)<BR> -# SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE (Full level)<BR> -# SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED (Full level)<BR> -# SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE (Full level)</P> -# </TD> -# </TR> - SQL_ALTER_DOMAIN => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ALTER_TABLE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>ALTER TABLE</B> statement supported by the data source. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_AT_ADD_COLUMN_COLLATION = <add column> clause is supported, with facility to specify column collation (Full level) (ODBC 3.0)</P> -# -# <P>SQL_AT_ADD_COLUMN_DEFAULT = <add column> clause is supported, with facility to specify column defaults (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_ADD_COLUMN_SINGLE = <add column> is supported (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_ADD_CONSTRAINT = <add column> clause is supported, with facility to specify column constraints (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_ADD_TABLE_CONSTRAINT = <add table constraint> clause is supported (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_CONSTRAINT_NAME_DEFINITION = <constraint name definition> is supported for naming column and table constraints (Intermediate level) (ODBC 3.0)</P> -# -# <P>SQL_AT_DROP_COLUMN_CASCADE = <drop column> CASCADE is supported (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_DROP_COLUMN_DEFAULT = <alter column> <drop column default clause> is supported (Intermediate level) (ODBC 3.0)</P> -# -# <P>SQL_AT_DROP_COLUMN_RESTRICT = <drop column> RESTRICT is supported (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE (ODBC 3.0)</P> -# -# <P>SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT = <drop column> RESTRICT is supported (FIPS Transitional level) (ODBC 3.0)</P> -# -# <P>SQL_AT_SET_COLUMN_DEFAULT = <alter column> <set column default clause> is supported (Intermediate level) (ODBC 3.0)</P> -# -# <P>The following bits specify the support <constraint attributes> if specifying column or table constraints is supported (the SQL_AT_ADD_CONSTRAINT bit is set):</P> -# -# <P>SQL_AT_CONSTRAINT_INITIALLY_DEFERRED (Full level) (ODBC 3.0)<BR> -# SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE (Full level) (ODBC 3.0)<BR> -# SQL_AT_CONSTRAINT_DEFERRABLE (Full level) (ODBC 3.0)<BR> -# SQL_AT_CONSTRAINT_NON_DEFERRABLE (Full level) (ODBC 3.0)</P> -# </TD> -# </TR> - SQL_ALTER_TABLE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ASYNC_MODE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER value indicating the level of asynchronous support in the driver: -# <P>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.</P> -# -# <P>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.</P> -# -# <P>SQL_AM_NONE = Asynchronous mode is not supported.</P> -# </TD> -# </TR> - SQL_ASYNC_MODE => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_BATCH_ROW_COUNT <BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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: -# <P>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.</P> -# -# <P>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.</P> -# -# <P>SQL_BRC_EXPLICIT = Row counts, if any, are available when a batch is executed directly by calling <B>SQLExecute</B> or <B>SQLExecDirect</B>. If row counts are available, they can be rolled up or individually available, depending on the SQL_BRC_ROLLED_UP bit.</P> -# </TD> -# </TR> - SQL_BATCH_ROW_COUNT => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_BATCH_SUPPORT <BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the driver's support for batches. The following bitmasks are used to determine which level is supported: -# <P>SQL_BS_SELECT_EXPLICIT = The driver supports explicit batches that can have result-set generating statements.</P> -# -# <P>SQL_BS_ROW_COUNT_EXPLICIT = The driver supports explicit batches that can have row-count generating statements.</P> -# -# <P>SQL_BS_SELECT_PROC = The driver supports explicit procedures that can have result-set generating statements.</P> -# -# <P>SQL_BS_ROW_COUNT_PROC = The driver supports explicit procedures that can have row-count generating statements.</P> -# </TD> -# </TR> - SQL_BATCH_SUPPORT => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_BOOKMARK_PERSISTENCE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the operations through which bookmarks persist. -# <P>The following bitmasks are used in conjunction with the flag to determine through which options bookmarks persist:</P> -# -# <P>SQL_BP_CLOSE = Bookmarks are valid after an application calls <B>SQLFreeStmt</B> with the SQL_CLOSE option, or <B>SQLCloseCursor</B> to close the cursor associated with a statement.</P> -# -# <P>SQL_BP_DELETE = The bookmark for a row is valid after that row has been deleted.</P> -# -# <P>SQL_BP_DROP = Bookmarks are valid after an application calls <B>SQLFreeHandle</B> with a <I>HandleType</I> of SQL_HANDLE_STMT to drop a statement.</P> -# -# <P>SQL_BP_TRANSACTION = Bookmarks are valid after an application commits or rolls back a transaction.</P> -# -# <P>SQL_BP_UPDATE = The bookmark for a row is valid after any column in that row has been updated, including key columns.</P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_BOOKMARK_PERSISTENCE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CATALOG_LOCATION<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value indicating the position of the catalog in a qualified table name: -# <P>SQL_CL_START<BR> -# SQL_CL_END</P> -# -# <P>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.</P> -# -# <P>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 <B>SQLGetInfo</B> with the SQL_CATALOG_NAME information type.</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_QUALIFIER_LOCATION.</P> -# </TD> -# </TR> - SQL_CATALOG_LOCATION => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CATALOG_NAME<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>A character string: "Y" if the server supports catalog names, or "N" if it does not. -# <P>An SQL-92 Full level–conformant driver will always return "Y".</P> -# </TD> -# </TR> - SQL_CATALOG_NAME => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CATALOG_NAME_SEPARATOR<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An empty string is returned if catalogs are not supported by the data source. To find out whether catalogs are supported, an application calls <B>SQLGetInfo</B> with the SQL_CATALOG_NAME information type. An SQL-92 Full level–conformant driver will always return ".".</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_QUALIFIER_NAME_SEPARATOR.</P> -# </TD> -# </TR> - SQL_CATALOG_NAME_SEPARATOR => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CATALOG_TERM<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An empty string is returned if catalogs are not supported by the data source. To find out whether catalogs are supported, an application calls <B>SQLGetInfo</B> with the SQL_CATALOG_NAME information type. An SQL-92 Full level–conformant driver will always return "catalog".</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_QUALIFIER_TERM.</P> -# </TD> -# </TR> - SQL_CATALOG_TERM => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CATALOG_USAGE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the statements in which catalogs can be used. -# <P>The following bitmasks are used to determine where catalogs can be used:</P> -# -# <P>SQL_CU_DML_STATEMENTS = Catalogs are supported in all Data Manipulation Language statements: <B>SELECT</B>, <B>INSERT</B>, <B>UPDATE</B>, <B>DELETE</B>, and if supported, <B>SELECT FOR UPDATE</B> and positioned update and delete statements.</P> -# -# <P>SQL_CU_PROCEDURE_INVOCATION = Catalogs are supported in the ODBC procedure invocation statement.</P> -# -# <P>SQL_CU_TABLE_DEFINITION = Catalogs are supported in all table definition statements: <B>CREATE TABLE</B>, <B>CREATE VIEW</B>, <B>ALTER TABLE</B>, <B>DROP TABLE</B>, and <B>DROP VIEW</B>.</P> -# -# <P>SQL_CU_INDEX_DEFINITION = Catalogs are supported in all index definition statements: <B>CREATE INDEX</B> and <B>DROP INDEX</B>.</P> -# -# <P>SQL_CU_PRIVILEGE_DEFINITION = Catalogs are supported in all privilege definition statements: <B>GRANT</B> and <B>REVOKE</B>. </P> -# -# <P>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 <B>SQLGetInfo</B> 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.</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_QUALIFIER_USAGE.</P> -# </TD> -# </TR> - SQL_CATALOG_USAGE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_COLLATION_SEQ<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_COLLATION_SEQ => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_COLUMN_ALIAS<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>A character string: "Y" if the data source supports column aliases; otherwise, "N". -# <P>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".</P> -# </TD> -# </TR> - SQL_COLUMN_ALIAS => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CONCAT_NULL_BEHAVIOR<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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: -# <P>SQL_CB_NULL = Result is NULL valued.</P> -# -# <P>SQL_CB_NON_NULL = Result is concatenation of non-NULL valued column or columns. </P> -# -# <P>An SQL-92 Entry level–conformant driver will always return SQL_CB_NULL.</P> -# </TD> -# </TR> - SQL_CONCAT_NULL_BEHAVIOR => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CONVERT_BIGINT<BR> - SQL_CONVERT_BIGINT => { - type => q(Bitmask), - }, -# SQL_CONVERT_BINARY<BR> - SQL_CONVERT_BINARY => { - type => q(Bitmask), - }, -# SQL_CONVERT_BIT <BR> - SQL_CONVERT_BIT => { - type => q(Bitmask), - }, -# SQL_CONVERT_CHAR <BR> - SQL_CONVERT_CHAR => { - type => q(Bitmask), - }, -# SQL_CONVERT_GUID<BR> - SQL_CONVERT_GUID => { - type => q(Bitmask), - omit => 1, - }, -# SQL_CONVERT_DATE<BR> - SQL_CONVERT_DATE => { - type => q(Bitmask), - }, -# SQL_CONVERT_DECIMAL<BR> - SQL_CONVERT_DECIMAL => { - type => q(Bitmask), - }, -# SQL_CONVERT_DOUBLE<BR> - SQL_CONVERT_DOUBLE => { - type => q(Bitmask), - }, -# SQL_CONVERT_FLOAT<BR> - SQL_CONVERT_FLOAT => { - type => q(Bitmask), - }, -# SQL_CONVERT_INTEGER<BR> - SQL_CONVERT_INTEGER => { - type => q(Bitmask), - }, -# SQL_CONVERT_INTERVAL_YEAR_MONTH<BR> - SQL_CONVERT_INTERVAL_YEAR_MONTH => { - type => q(Bitmask), - }, -# SQL_CONVERT_INTERVAL_DAY_TIME<BR> - SQL_CONVERT_INTERVAL_DAY_TIME => { - type => q(Bitmask), - }, -# SQL_CONVERT_LONGVARBINARY<BR> - SQL_CONVERT_LONGVARBINARY => { - type => q(Bitmask), - }, -# SQL_CONVERT_LONGVARCHAR<BR> - SQL_CONVERT_LONGVARCHAR => { - type => q(Bitmask), - }, -# SQL_CONVERT_NUMERIC<BR> - SQL_CONVERT_NUMERIC => { - type => q(Bitmask), - }, -# SQL_CONVERT_REAL<BR> - SQL_CONVERT_REAL => { - type => q(Bitmask), - }, -# SQL_CONVERT_SMALLINT<BR> - SQL_CONVERT_SMALLINT => { - type => q(Bitmask), - }, -# SQL_CONVERT_TIME<BR> - SQL_CONVERT_TIME => { - type => q(Bitmask), - }, -# SQL_CONVERT_TIMESTAMP<BR> - SQL_CONVERT_TIMESTAMP => { - type => q(Bitmask), - }, -# SQL_CONVERT_TINYINT<BR> - SQL_CONVERT_TINYINT => { - type => q(Bitmask), - }, -# SQL_CONVERT_VARBINARY<BR> - SQL_CONVERT_VARBINARY => { - type => q(Bitmask), - }, -# SQL_CONVERT_VARCHAR <BR> - SQL_CONVERT_VARCHAR => { - type => q(Bitmask), - }, -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask. The bitmask indicates the conversions supported by the data source with the <B>CONVERT</B> scalar function for data of the type named in the <I>InfoType</I>. 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. -# <P>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 <B>SQLGetInfo</B> with the <I>InfoType</I> of SQL_CONVERT_INTEGER. The application performs an <B>AND</B> operation with the returned bitmask and SQL_CVT_BIGINT. If the resulting value is nonzero, the conversion is supported. </P> -# -# <P>The following bitmasks are used to determine which conversions are supported:</P> -# -# <P>SQL_CVT_BIGINT (ODBC 1.0)<BR> -# SQL_CVT_BINARY (ODBC 1.0)<BR> -# SQL_CVT_BIT (ODBC 1.0) <BR> -# SQL_CVT_GUID (ODBC 3.5)<BR> -# SQL_CVT_CHAR (ODBC 1.0) <BR> -# SQL_CVT_DATE (ODBC 1.0)<BR> -# SQL_CVT_DECIMAL (ODBC 1.0)<BR> -# SQL_CVT_DOUBLE (ODBC 1.0)<BR> -# SQL_CVT_FLOAT (ODBC 1.0)<BR> -# SQL_CVT_INTEGER (ODBC 1.0)<BR> -# SQL_CVT_INTERVAL_YEAR_MONTH (ODBC 3.0)<BR> -# SQL_CVT_INTERVAL_DAY_TIME (ODBC 3.0)<BR> -# SQL_CVT_LONGVARBINARY (ODBC 1.0)<BR> -# SQL_CVT_LONGVARCHAR (ODBC 1.0)<BR> -# SQL_CVT_NUMERIC (ODBC 1.0)<BR> -# SQL_CVT_REAL ODBC 1.0)<BR> -# SQL_CVT_SMALLINT (ODBC 1.0)<BR> -# SQL_CVT_TIME (ODBC 1.0)<BR> -# SQL_CVT_TIMESTAMP (ODBC 1.0)<BR> -# SQL_CVT_TINYINT (ODBC 1.0)<BR> -# SQL_CVT_VARBINARY (ODBC 1.0)<BR> -# SQL_CVT_VARCHAR (ODBC 1.0)</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CONVERT_FUNCTIONS<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the scalar conversion functions supported by the driver and associated data source. -# <P>The following bitmask is used to determine which conversion functions are supported:</P> -# -# <P>SQL_FN_CVT_CAST<BR> -# SQL_FN_CVT_CONVERT</P> -# </TD> -# </TR> - SQL_CONVERT_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CORRELATION_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUSMALLINT value indicating whether table correlation names are supported: -# <P>SQL_CN_NONE = Correlation names are not supported.</P> -# -# <P>SQL_CN_DIFFERENT = Correlation names are supported but must differ from the names of the tables they represent.</P> -# -# <P>SQL_CN_ANY = Correlation names are supported and can be any valid user-defined name. </P> -# -# <P>An SQL-92 Entry level–conformant driver will always return SQL_CN_ANY.</P> -# </TD> -# </TR> - SQL_CORRELATION_NAME => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_ASSERTION<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE ASSERTION</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_CA_CREATE_ASSERTION</P> -# -# <P>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):</P> -# -# <P>SQL_CA_CONSTRAINT_INITIALLY_DEFERRED<BR> -# SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE<BR> -# SQL_CA_CONSTRAINT_DEFERRABLE<BR> -# SQL_CA_CONSTRAINT_NON_DEFERRABLE</P> -# -# <P>An SQL-92 Full level–conformant driver will always return all of these options as supported. A return value of "0" means that the <B>CREATE ASSERTION</B> statement is not supported.</P> -# </TD> -# </TR> - SQL_CREATE_ASSERTION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_CHARACTER_SET<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE CHARACTER SET</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_CCS_CREATE_CHARACTER_SET<BR> -# SQL_CCS_COLLATE_CLAUSE<BR> -# SQL_CCS_LIMITED_COLLATION</P> -# -# <P>An SQL-92 Full level–conformant driver will always return all of these options as supported. A return value of "0" means that the <B>CREATE CHARACTER SET</B> statement is not supported.</P> -# </TD> -# </TR> - SQL_CREATE_CHARACTER_SET => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_COLLATION<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE COLLATION</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmask is used to determine which clauses are supported:</P> -# -# <P>SQL_CCOL_CREATE_COLLATION </P> -# -# <P>An SQL-92 Full level–conformant driver will always return this option as supported. A return value of "0" means that the <B>CREATE COLLATION</B> statement is not supported.</P> -# </TD> -# </TR> - SQL_CREATE_COLLATION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_DOMAIN<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE DOMAIN</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_CDO_CREATE_DOMAIN = The CREATE DOMAIN statement is supported (Intermediate level).</P> -# -# <P>SQL_CDO_CONSTRAINT_NAME_DEFINITION = <constraint name definition> is supported for naming domain constraints (Intermediate level).</P> -# -# <P>The following bits specify the ability to create column constraints:<BR> -# SQL_CDO_DEFAULT = Specifying domain constraints is supported (Intermediate level)<BR> -# SQL_CDO_CONSTRAINT = Specifying domain defaults is supported (Intermediate level)<BR> -# SQL_CDO_COLLATION = Specifying domain collation is supported (Full level)</P> -# -# <P>The following bits specify the supported constraint attributes if specifying domain constraints is supported (SQL_CDO_DEFAULT is set):</P> -# -# <P>SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED (Full level)<BR> -# SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE (Full level)<BR> -# SQL_CDO_CONSTRAINT_DEFERRABLE (Full level)<BR> -# SQL_CDO_CONSTRAINT_NON_DEFERRABLE (Full level)</P> -# -# <P>A return value of "0" means that the <B>CREATE DOMAIN</B> statement is not supported.</P> -# </TD> -# </TR> - SQL_CREATE_DOMAIN => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_SCHEMA<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE SCHEMA</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_CS_CREATE_SCHEMA<BR> -# SQL_CS_AUTHORIZATION<BR> -# SQL_CS_DEFAULT_CHARACTER_SET </P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_CREATE_SCHEMA => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_TABLE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE TABLE</B> statement, as defined in SQL-92, supported by the data source. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_CT_CREATE_TABLE = The CREATE TABLE statement is supported. (Entry level)</P> -# -# <P>SQL_CT_TABLE_CONSTRAINT = Specifying table constraints is supported (FIPS Transitional level)</P> -# -# <P>SQL_CT_CONSTRAINT_NAME_DEFINITION = The <constraint name definition> clause is supported for naming column and table constraints (Intermediate level)</P> -# -# <P>The following bits specify the ability to create temporary tables:</P> -# -# <P>SQL_CT_COMMIT_PRESERVE = Deleted rows are preserved on commit. (Full level)<BR> -# SQL_CT_COMMIT_DELETE = Deleted rows are deleted on commit. (Full level)<BR> -# SQL_CT_GLOBAL_TEMPORARY = Global temporary tables can be created. (Full level)<BR> -# SQL_CT_LOCAL_TEMPORARY = Local temporary tables can be created. (Full level)</P> -# -# <P>The following bits specify the ability to create column constraints:</P> -# -# <P>SQL_CT_COLUMN_CONSTRAINT = Specifying column constraints is supported (FIPS Transitional level)<BR> -# SQL_CT_COLUMN_DEFAULT = Specifying column defaults is supported (FIPS Transitional level)<BR> -# SQL_CT_COLUMN_COLLATION = Specifying column collation is supported (Full level)</P> -# -# <P>The following bits specify the supported constraint attributes if specifying column or table constraints is supported:</P> -# -# <P>SQL_CT_CONSTRAINT_INITIALLY_DEFERRED (Full level)<BR> -# SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE (Full level)<BR> -# SQL_CT_CONSTRAINT_DEFERRABLE (Full level)<BR> -# SQL_CT_CONSTRAINT_NON_DEFERRABLE (Full level)</P> -# </TD> -# </TR> - SQL_CREATE_TABLE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_TRANSLATION<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE TRANSLATION</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmask is used to determine which clauses are supported:</P> -# -# <P>SQL_CTR_CREATE_TRANSLATION</P> -# -# <P>An SQL-92 Full level–conformant driver will always return these options as supported. A return value of "0" means that the <B>CREATE TRANSLATION</B> statement is not supported.</P> -# </TD> -# </TR> - SQL_CREATE_TRANSLATION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CREATE_VIEW<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>CREATE VIEW</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_CV_CREATE_VIEW<BR> -# SQL_CV_CHECK_OPTION<BR> -# SQL_CV_CASCADED<BR> -# SQL_CV_LOCAL </P> -# -# <P>A return value of "0" means that the <B>CREATE VIEW</B> statement is not supported.</P> -# -# <P>An SQL-92 Entry level–conformant driver will always return the SQL_CV_CREATE_VIEW and SQL_CV_CHECK_OPTION options as supported. </P> -# -# <P>An SQL-92 Full level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_CREATE_VIEW => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CURSOR_COMMIT_BEHAVIOR<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUSMALLINT value indicating how a <B>COMMIT</B> operation affects cursors and prepared statements in the data source: -# <P>SQL_CB_DELETE = Close cursors and delete prepared statements. To use the cursor again, the application must reprepare and reexecute the statement.</P> -# -# <P>SQL_CB_CLOSE = Close cursors. For prepared statements, the application can call <B>SQLExecute</B> on the statement without calling <B>SQLPrepare</B> again.</P> -# -# <P>SQL_CB_PRESERVE = Preserve cursors in the same position as before the <B>COMMIT</B> operation. The application can continue to fetch data, or it can close the cursor and reexecute the statement without repreparing it.</P> -# </TD> -# </TR> - SQL_CURSOR_COMMIT_BEHAVIOR => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CURSOR_ROLLBACK_BEHAVIOR<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUSMALLINT value indicating how a <B>ROLLBACK</B> operation affects cursors and prepared statements in the data source: -# <P>SQL_CB_DELETE = Close cursors and delete prepared statements. To use the cursor again, the application must reprepare and reexecute the statement.</P> -# -# <P>SQL_CB_CLOSE = Close cursors. For prepared statements, the application can call <B>SQLExecute</B> on the statement without calling <B>SQLPrepare</B> again.</P> -# -# <P>SQL_CB_PRESERVE = Preserve cursors in the same position as before the <B>ROLLBACK</B> operation. The application can continue to fetch data, or it can close the cursor and reexecute the statement without repreparing it.</P> -# </TD> -# </TR> - SQL_CURSOR_ROLLBACK_BEHAVIOR => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_CURSOR_ROLLBACK_SQL_CURSOR_SENSITIVITY<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER value indicating the support for cursor sensitivity: -# <P>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.</P> -# -# <P>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.</P> -# -# <P>SQL_SENSITIVE = Cursors are sensitive to changes made by other cursors within the same transaction.</P> -# -# <P>An SQL-92 Entry level–conformant driver will always return the SQL_UNSPECIFIED option as supported. </P> -# -# <P>An SQL-92 Full level–conformant driver will always return the SQL_INSENSITIVE option as supported.</P> -# </TD> -# </TR> - SQL_CURSOR_SENSITIVITY => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DATA_SOURCE_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the data source name used during connection. If the application called <B>SQLConnect</B>, this is the value of the <I>szDSN</I> argument. If the application called <B>SQLDriverConnect</B> or <B>SQLBrowseConnect</B>, this is the value of the DSN keyword in the connection string passed to the driver. If the connection string did not contain the <B>DSN</B> keyword (such as when it contains the <B>DRIVER</B> keyword), this is an empty string.</TD> -# </TR> - SQL_DATA_SOURCE_NAME => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DATA_SOURCE_READ_ONLY<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string. "Y" if the data source is set to READ ONLY mode, "N" if it is otherwise. -# <P>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.</P> -# </TD> -# </TR> - SQL_DATA_SOURCE_READ_ONLY => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DATABASE_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the name of the current database in use, if the data source defines a named object called "database". -# <P class="indent"><b class="le">Note</b> In ODBC 3<I>.x</I>, the value returned for this <I>InfoType</I> can also be returned by calling <B>SQLGetConnectAttr</B> with an <I>Attribute</I> argument of SQL_ATTR_CURRENT_CATALOG.</P> -# </TD> -# </TR> - SQL_DATABASE_NAME => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DATETIME_LITERALS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>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.</P> -# -# <P>The following bitmasks are used to determine which literals are supported:</P> -# -# <P>SQL_DL_SQL92_DATE<BR> -# SQL_DL_SQL92_TIME<BR> -# SQL_DL_SQL92_TIMESTAMP<BR> -# SQL_DL_SQL92_INTERVAL_YEAR<BR> -# SQL_DL_SQL92_INTERVAL_MONTH<BR> -# SQL_DL_SQL92_INTERVAL_DAY<BR> -# SQL_DL_SQL92_INTERVAL_HOUR<BR> -# SQL_DL_SQL92_INTERVAL_MINUTE<BR> -# SQL_DL_SQL92_INTERVAL_SECOND<BR> -# SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH<BR> -# SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR</P> -# -# <P>SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE<BR> -# SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND<BR> -# SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE<BR> -# SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND<BR> -# SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND</P> -# </TD> -# </TR> - SQL_DATETIME_LITERALS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DBMS_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the name of the DBMS product accessed by the driver.</TD> -# </TR> - SQL_DBMS_NAME => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DBMS_VER<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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".</TD> -# </TR> - SQL_DBMS_VER => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DDL_INDEX<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER value that indicates support for creation and dropping of indexes: -# <P>SQL_DI_CREATE_INDEX<BR> -# SQL_DI_DROP_INDEX </P> -# </TD> -# </TR> - SQL_DDL_INDEX => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DEFAULT_TXN_ISOLATION<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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: -# <P><B>Dirty Read </B>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.</P> -# -# <P><B>Nonrepeatable Read </B>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.</P> -# -# <P><B>Phantom </B>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.</P> -# -# <P>If the data source supports transactions, the driver returns one of the following bitmasks:</P> -# -# <P>SQL_TXN_READ_UNCOMMITTED = Dirty reads, nonrepeatable reads, and phantoms are possible.</P> -# -# <P>SQL_TXN_READ_COMMITTED = Dirty reads are not possible. Nonrepeatable reads and phantoms are possible.</P> -# -# <P>SQL_TXN_REPEATABLE_READ = Dirty reads and nonrepeatable reads are not possible. Phantoms are possible.</P> -# -# <P>SQL_TXN_SERIALIZABLE = Transactions are serializable. Serializable transactions do not allow dirty reads, nonrepeatable reads, or phantoms.</P> -# </TD> -# </TR> - SQL_DEFAULT_TXN_ISOLATION => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DESCRIBE_PARAMETER<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>A character string: "Y" if parameters can be described; "N", if not. -# <P>An SQL-92 Full level–conformant driver will usually return "Y" because it will support the <B>DESCRIBE INPUT</B> 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.</P> -# </TD> -# </TR> - SQL_DESCRIBE_PARAMETER => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DM_VER<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>A character string with the version of the Driver Manager. The version is of the form ##.##.####.####, where: -# <P>The first set of two digits is the major ODBC version, as given by the constant SQL_SPEC_MAJOR.</P> -# -# <P>The second set of two digits is the minor ODBC version, as given by the constant SQL_SPEC_MINOR.</P> -# -# <P>The third set of four digits is the Driver Manager major build number.</P> -# -# <P>The last set of four digits is the Driver Manager minor build number.</P> -# </TD> -# </TR> - SQL_DM_VER => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_HDBC<BR> -# SQL_DRIVER_HENV<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUINTEGER value, the driver's environment handle or connection handle, determined by the argument <I>InfoType</I>. -# <P>These information types are implemented by the Driver Manager alone.</P> -# </TD> -# </TR> - SQL_DRIVER_HDBC => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_HDESC<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER value, the driver's descriptor handle determined by the Driver Manager's descriptor handle, which must be passed on input in *<I>InfoValuePtr</I> from the application. In this case, <I>InfoValuePtr</I> is both an input and output argument. The input descriptor handle passed in *<I>InfoValuePtr</I> must have been either explicitly or implicitly allocated on the <I>ConnectionHandle</I>. -# <P>The application should make a copy of the Driver Manager's descriptor handle before calling <B>SQLGetInfo</B> with this information type, to ensure that the handle is not overwritten on output.</P> -# -# <P>This information type is implemented by the Driver Manager alone.</P> -# </TD> -# </TR> - SQL_DRIVER_HDESC => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_HLIB<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER value, the <I>hinst</I> 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 <B>SQLGetInfo</B>. -# <P>This information type is implemented by the Driver Manager alone.</P> -# </TD> -# </TR> - SQL_DRIVER_HLIB => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_HSTMT<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUINTEGER value, the driver's statement handle determined by the Driver Manager statement handle, which must be passed on input in *<I>InfoValuePtr</I> from the application. In this case, <I>InfoValuePtr</I> is both an input and an output argument. The input statement handle passed in *<I>InfoValuePtr</I> must have been allocated on the argument <I>ConnectionHandle</I>. -# <P>The application should make a copy of the Driver Manager's statement handle before calling <B>SQLGetInfo</B> with this information type, to ensure that the handle is not overwritten on output.</P> -# -# <P>This information type is implemented by the Driver Manager alone.</P> -# </TD> -# </TR> - SQL_DRIVER_HSTMT => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the file name of the driver used to access the data source.</TD> -# </TR> - SQL_DRIVER_NAME => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_ODBC_VER<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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".</TD> -# </TR> - SQL_DRIVER_ODBC_VER => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DRIVER_VER<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_DRIVER_VER => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_ASSERTION<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP ASSERTION</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmask is used to determine which clauses are supported:</P> -# -# <P>SQL_DA_DROP_ASSERTION </P> -# -# <P>An SQL-92 Full level–conformant driver will always return this option as supported.</P> -# </TD> -# </TR> - SQL_DROP_ASSERTION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_CHARACTER_SET<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP CHARACTER SET</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmask is used to determine which clauses are supported:</P> -# -# <P>SQL_DCS_DROP_CHARACTER_SET </P> -# -# <P>An SQL-92 Full level–conformant driver will always return this option as supported.</P> -# </TD> -# </TR> - SQL_DROP_CHARACTER_SET => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_COLLATION<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP COLLATION</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmask is used to determine which clauses are supported:</P> -# -# <P>SQL_DC_DROP_COLLATION </P> -# -# <P>An SQL-92 Full level–conformant driver will always return this option as supported.</P> -# </TD> -# </TR> - SQL_DROP_COLLATION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_DOMAIN<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP DOMAIN</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_DD_DROP_DOMAIN<BR> -# SQL_DD_CASCADE<BR> -# SQL_DD_RESTRICT </P> -# -# <P>An SQL-92 Intermediate level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_DROP_DOMAIN => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_SCHEMA<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP SCHEMA</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_DS_DROP_SCHEMA<BR> -# SQL_DS_CASCADE<BR> -# SQL_DS_RESTRICT </P> -# -# <P>An SQL-92 Intermediate level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_DROP_SCHEMA => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_TABLE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP TABLE</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_DT_DROP_TABLE<BR> -# SQL_DT_CASCADE<BR> -# SQL_DT_RESTRICT </P> -# -# <P>An FIPS Transitional level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_DROP_TABLE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_TRANSLATION<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP TRANSLATION</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmask is used to determine which clauses are supported:</P> -# -# <P>SQL_DTR_DROP_TRANSLATION </P> -# -# <P>An SQL-92 Full level–conformant driver will always return this option as supported.</P> -# </TD> -# </TR> - SQL_DROP_TRANSLATION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DROP_VIEW<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses in the <B>DROP VIEW</B> statement, as defined in SQL-92, supported by the data source. -# <P>The following bitmasks are used to determine which clauses are supported:</P> -# -# <P>SQL_DV_DROP_VIEW<BR> -# SQL_DV_CASCADE<BR> -# SQL_DV_RESTRICT </P> -# -# <P>An FIPS Transitional level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_DROP_VIEW => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DYNAMIC_CURSOR_ATTRIBUTES1<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>SQL_CA1_NEXT = A <I>FetchOrientation</I> argument of SQL_FETCH_NEXT is supported in a call to <B>SQLFetchScroll</B> when the cursor is a dynamic cursor.</P> -# -# <P>SQL_CA1_ABSOLUTE = <I>FetchOrientation</I> arguments of SQL_FETCH_FIRST, SQL_FETCH_LAST, and SQL_FETCH_ABSOLUTE are supported in a call to <B>SQLFetchScroll</B> when the cursor is a dynamic cursor. (The rowset that will be fetched is independent of the current cursor position.) </P> -# -# <P>SQL_CA1_RELATIVE = <I>FetchOrientation</I> arguments of SQL_FETCH_PRIOR and SQL_FETCH_RELATIVE are supported in a call to <B>SQLFetchScroll</B> 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.) </P> -# -# <P>SQL_CA1_BOOKMARK = A <I>FetchOrientation</I> argument of SQL_FETCH_BOOKMARK is supported in a call to <B>SQLFetchScroll</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_LOCK_EXCLUSIVE = A <I>LockType</I> argument of SQL_LOCK_EXCLUSIVE is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor.</P> -# -# <P>SQL_CA1_LOCK_NO_CHANGE = A <I>LockType</I> argument of SQL_LOCK_NO_CHANGE is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_LOCK_UNLOCK = A <I>LockType</I> argument of SQL_LOCK_UNLOCK is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor.</P> -# -# <P>SQL_CA1_POS_POSITION = An <I>Operation</I> argument of SQL_POSITION is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor.</P> -# -# <P>SQL_CA1_POS_UPDATE = An <I>Operation</I> argument of SQL_UPDATE is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_POS_DELETE = An <I>Operation</I> argument of SQL_DELETE is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_POS_REFRESH = An <I>Operation</I> argument of SQL_REFRESH is supported in a call to <B>SQLSetPos</B> when the cursor is a dynamic cursor. </P> -# -# <P>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.)</P> -# -# <P>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.)</P> -# -# <P>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.)</P> -# -# <P>SQL_CA1_BULK_ADD = An <I>Operation</I> argument of SQL_ADD is supported in a call to <B>SQLBulkOperations</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_BULK_UPDATE_BY_BOOKMARK = An <I>Operation</I> argument of SQL_UPDATE_BY_BOOKMARK is supported in a call to <B>SQLBulkOperations</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_BULK_DELETE_BY_BOOKMARK = An <I>Operation</I> argument of SQL_DELETE_BY_BOOKMARK is supported in a call to <B>SQLBulkOperations</B> when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA1_BULK_FETCH_BY_BOOKMARK = An <I>Operation</I> argument of SQL_FETCH_BY_BOOKMARK is supported in a call to <B>SQLBulkOperations</B> when the cursor is a dynamic cursor. </P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_DYNAMIC_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_DYNAMIC_CURSOR_ATTRIBUTES2<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>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). </P> -# -# <P>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.</P> -# -# <P>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.) </P> -# -# <P>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.) </P> -# -# <P>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.) </P> -# -# <P>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. </P> -# -# <P>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. </P> -# -# <P>SQL_CA2_MAX_ROWS_SELECT = The SQL_ATTR_MAX_ROWS statement attribute affects <B>SELECT</B> statements when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA2_MAX_ROWS_INSERT = The SQL_ATTR_MAX_ROWS statement attribute affects <B>INSERT</B> statements when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA2_MAX_ROWS_DELETE = The SQL_ATTR_MAX_ROWS statement attribute affects <B>DELETE</B> statements when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA2_MAX_ROWS_UPDATE = The SQL_ATTR_MAX_ROWS statement attribute affects <B>UPDATE</B> statements when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA2_MAX_ROWS_CATALOG = The SQL_ATTR_MAX_ROWS statement attribute affects <B>CATALOG</B> result sets when the cursor is a dynamic cursor. </P> -# -# <P>SQL_CA2_MAX_ROWS_AFFECTS_ALL = The SQL_ATTR_MAX_ROWS statement attribute affects <B>SELECT</B>, <B>INSERT</B>, <B>DELETE</B>, and <B>UPDATE</B> statements, and <B>CATALOG</B> result sets, when the cursor is a dynamic cursor. </P> -# -# <P>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. </P> -# -# <P>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. </P> -# -# <P>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, <B>SQLExecute</B> or <B>SQLExecDirect</B> returns SQLSTATE 01001 [Cursor operation conflict].) To set this behavior, the application calls <B>SQLSetStmtAttr</B> with the SQL_ATTR_SIMULATE_CURSOR attribute set to SQL_SC_NON_UNIQUE. </P> -# -# <P>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, <B>SQLExecute</B> or <B>SQLExecDirect</B> returns SQLSTATE 01001 [Cursor operation conflict].) To set this behavior, the application calls <B>SQLSetStmtAttr</B> with the SQL_ATTR_SIMULATE_CURSOR attribute set to SQL_SC_TRY_UNIQUE. </P> -# -# <P>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, <B>SQLExecDirect</B> or <B>SQLPrepare</B> return SQLSTATE 01001 (Cursor operation conflict). To set this behavior, the application calls <B>SQLSetStmtAttr</B> with the SQL_ATTR_SIMULATE_CURSOR attribute set to SQL_SC_UNIQUE.</P> -# </TD> -# </TR> - SQL_DYNAMIC_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_EXPRESSIONS_IN_ORDERBY<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string: "Y" if the data source supports expressions in the <B>ORDER BY</B> list; "N" if it does not.</TD> -# </TR> - SQL_EXPRESSIONS_IN_ORDERBY => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_FILE_USAGE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value indicating how a single-tier driver directly treats files in a data source: -# <P>SQL_FILE_NOT_SUPPORTED = The driver is not a single-tier driver. For example, an ORACLE driver is a two-tier driver.</P> -# -# <P>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.</P> -# -# <P>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.</P> -# -# <P>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.</P> -# -# <P>When a user selects an Xbase data source, the application could display the Windows <B>File Open</B> common dialog box; when the user selects a Microsoft Access or ORACLE data source, the application could display a custom <B>Select Table</B> dialog box.</P> -# </TD> -# </TR> - SQL_FILE_USAGE => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>SQL_CA1_NEXT<BR> -# SQL_CA1_LOCK_EXCLUSIVE<BR> -# SQL_CA1_LOCK_NO_CHANGE<BR> -# SQL_CA1_LOCK_UNLOCK<BR> -# SQL_CA1_POS_POSITION<BR> -# SQL_CA1_POS_UPDATE<BR> -# SQL_CA1_POS_DELETE<BR> -# SQL_CA1_POS_REFRESH<BR> -# SQL_CA1_POSITIONED_UPDATE<BR> -# SQL_CA1_POSITIONED_DELETE<BR> -# SQL_CA1_SELECT_FOR_UPDATE<BR> -# SQL_CA1_BULK_ADD<BR> -# SQL_CA1_BULK_UPDATE_BY_BOOKMARK<BR> -# SQL_CA1_BULK_DELETE_BY_BOOKMARK<BR> -# SQL_CA1_BULK_FETCH_BY_BOOKMARK</P> -# -# <P>For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "forward-only cursor" for "dynamic cursor" in the descriptions). </P> -# </TD> -# </TR> - SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>SQL_CA2_READ_ONLY_CONCURRENCY<BR> -# SQL_CA2_LOCK_CONCURRENCY<BR> -# SQL_CA2_OPT_ROWVER_CONCURRENCY<BR> -# SQL_CA2_OPT_VALUES_CONCURRENCY<BR> -# SQL_CA2_SENSITIVITY_ADDITIONS<BR> -# SQL_CA2_SENSITIVITY_DELETIONS<BR> -# SQL_CA2_SENSITIVITY_UPDATES<BR> -# SQL_CA2_MAX_ROWS_SELECT<BR> -# SQL_CA2_MAX_ROWS_INSERT<BR> -# SQL_CA2_MAX_ROWS_DELETE<BR> -# SQL_CA2_MAX_ROWS_UPDATE<BR> -# SQL_CA2_MAX_ROWS_CATALOG<BR> -# SQL_CA2_MAX_ROWS_AFFECTS_ALL<BR> -# SQL_CA2_CRC_EXACT<BR> -# SQL_CA2_CRC_APPROXIMATE<BR> -# SQL_CA2_SIMULATE_NON_UNIQUE<BR> -# SQL_CA2_SIMULATE_TRY_UNIQUE<BR> -# SQL_CA2_SIMULATE_UNIQUE </P> -# -# <P>For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES2 (and substitute "forward-only cursor" for "dynamic cursor" in the descriptions).</P> -# </TD> -# </TR> - SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_GETDATA_EXTENSIONS<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating extensions to <B>SQLGetData</B>. -# <P>The following bitmasks are used in conjunction with the flag to determine what common extensions the driver supports for <B>SQLGetData</B>:</P> -# -# <P>SQL_GD_ANY_COLUMN = <B>SQLGetData</B> 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.</P> -# -# <P>SQL_GD_ANY_ORDER = <B>SQLGetData</B> can be called for unbound columns in any order. Note that <B>SQLGetData</B> can be called only for columns after the last bound column unless SQL_GD_ANY_COLUMN is also returned.</P> -# -# <P>SQL_GD_BLOCK = <B>SQLGetData</B> 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 <B>SQLSetPos</B>.</P> -# -# <P>SQL_GD_BOUND = <B>SQLGetData</B> 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.</P> -# -# <P><B>SQLGetData</B> 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.</P> -# -# <P>If a driver supports bookmarks (either fixed-length or variable-length), it must support calling <B>SQLGetData</B> on column 0. This support is required regardless of what the driver returns for a call to <B>SQLGetInfo</B> with the SQL_GETDATA_EXTENSIONS <I>InfoType</I>.</P> -# </TD> -# </TR> - SQL_GETDATA_EXTENSIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_GROUP_BY<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value specifying the relationship between the columns in the <B>GROUP BY</B> clause and the nonaggregated columns in the select list: -# <P>SQL_GB_COLLATE = A <B>COLLATE</B> clause can be specified at the end of each grouping column. (ODBC 3.0)</P> -# -# <P>SQL_GB_NOT_SUPPORTED = <B>GROUP BY</B> clauses are not supported. (ODBC 2.0)</P> -# -# <P>SQL_GB_GROUP_BY_EQUALS_SELECT = The <B>GROUP BY</B> clause must contain all nonaggregated columns in the select list. It cannot contain any other columns. For example, <B>SELECT DEPT, MAX(SALARY) FROM EMPLOYEE GROUP BY DEPT</B>. (ODBC 2.0)</P> -# -# <P>SQL_GB_GROUP_BY_CONTAINS_SELECT = The <B>GROUP BY</B> clause must contain all nonaggregated columns in the select list. It can contain columns that are not in the select list. For example, <B>SELECT DEPT, MAX(SALARY) FROM EMPLOYEE GROUP BY DEPT, AGE</B>. (ODBC 2.0)</P> -# -# <P>SQL_GB_NO_RELATION = The columns in the <B>GROUP BY</B> clause and the select list are not related. The meaning of nongrouped, nonaggregated columns in the select list is data source–dependent. For example, <B>SELECT DEPT, SALARY FROM EMPLOYEE GROUP BY DEPT, AGE</B>. (ODBC 2.0)</P> -# -# <P>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 <B>GROUP BY</B> clause is not supported by the data source.</P> -# </TD> -# </TR> - SQL_GROUP_BY => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_IDENTIFIER_CASE<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUSMALLINT value as follows: -# <P>SQL_IC_UPPER = Identifiers in SQL are not case-sensitive and are stored in uppercase in system catalog.</P> -# -# <P>SQL_IC_LOWER = Identifiers in SQL are not case-sensitive and are stored in lowercase in system catalog.</P> -# -# <P>SQL_IC_SENSITIVE = Identifiers in SQL are case-sensitive and are stored in mixed case in system catalog.</P> -# -# <P>SQL_IC_MIXED = Identifiers in SQL are not case-sensitive and are stored in mixed case in system catalog. </P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_IDENTIFIER_CASE => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_IDENTIFIER_QUOTE_CHAR<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>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.</P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_IDENTIFIER_QUOTE_CHAR => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INDEX_KEYWORDS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask that enumerates keywords in the CREATE INDEX statement that are supported by the driver: -# <P>SQL_IK_NONE = None of the keywords is supported.</P> -# -# <P>SQL_IK_ASC = ASC keyword is supported.</P> -# -# <P>SQL_IK_DESC = DESC keyword is supported.</P> -# -# <P>SQL_IK_ALL = All keywords are supported.</P> -# -# <P>To see if the CREATE INDEX statement is supported, an application calls <B>SQLGetInfo</B> with the SQL_DLL_INDEX information type.</P> -# </TD> -# </TR> - SQL_INDEX_KEYWORDS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INFO_SCHEMA_VIEWS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which views are supported:</P> -# -# <P>SQL_ISV_ASSERTIONS = Identifies the catalog's assertions that are owned by a given user. (Full level)</P> -# -# <P>SQL_ISV_CHARACTER_SETS = Identifies the catalog's character sets that are accessible to a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_CHECK_CONSTRAINTS = Identifies the CHECK constraints that are owned by a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_COLLATIONS = Identifies the character collations for the catalog that are accessible to a given user. (Full level)</P> -# -# <P>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)</P> -# -# <P>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)</P> -# -# <P>SQL_ISV_COLUMNS = Identifies the columns of persistent tables that are accessible to a given user. (FIPS Transitional level)</P> -# -# <P>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)</P> -# -# <P>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)</P> -# -# <P>SQL_ISV_DOMAIN_CONSTRAINTS = Identifies the domain constraints (of the domains in the catalog) that are accessible to a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_DOMAINS = Identifies the domains defined in a catalog that are accessible to the user. (Intermediate level)</P> -# -# <P>SQL_ISV_KEY_COLUMN_USAGE = Identifies columns defined in the catalog that are constrained as keys by a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_REFERENTIAL_CONSTRAINTS = Identifies the referential constraints that are owned by a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_SCHEMATA = Identifies the schemas that are owned by a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_SQL_LANGUAGES = Identifies the SQL conformance levels, options, and dialects supported by the SQL implementation. (Intermediate level)</P> -# -# <P>SQL_ISV_TABLE_CONSTRAINTS = Identifies the table constraints that are owned by a given user. (Intermediate level)</P> -# -# <P>SQL_ISV_TABLE_PRIVILEGES = Identifies the privileges on persistent tables that are available to or granted by a given user. (FIPS Transitional level)</P> -# -# <P>SQL_ISV_TABLES = Identifies the persistent tables defined in a catalog that are accessible to a given user. (FIPS Transitional level)</P> -# -# <P>SQL_ISV_TRANSLATIONS = Identifies character translations for the catalog that are accessible to a given user. (Full level) </P> -# -# <P>SQL_ISV_USAGE_PRIVILEGES = Identifies the USAGE privileges on catalog objects that are available to or owned by a given user. (FIPS Transitional level)</P> -# -# <P>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)</P> -# -# <P>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) </P> -# -# <P>SQL_ISV_VIEWS = Identifies the viewed tables defined in this catalog that are accessible to a given user. (FIPS Transitional level)</P> -# </TD> -# </TR> - SQL_INFO_SCHEMA_VIEWS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INSERT_STATEMENT<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask that indicates support for <B>INSERT</B> statements: -# <P>SQL_IS_INSERT_LITERALS</P> -# -# <P>SQL_IS_INSERT_SEARCHED</P> -# -# <P>SQL_IS_SELECT_INTO </P> -# -# <P>An SQL-92 Entry level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_INSERT_STATEMENT => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_INTEGRITY<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string: "Y" if the data source supports the Integrity Enhancement Facility; "N" if it does not. -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_ODBC_SQL_OPT_IEF.</P> -# </TD> -# </TR> - SQL_INTEGRITY => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_KEYSET_CURSOR_ATTRIBUTES1<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported: </P> -# -# <P>SQL_CA1_NEXT<BR> -# SQL_CA1_ABSOLUTE<BR> -# SQL_CA1_RELATIVE<BR> -# SQL_CA1_BOOKMARK<BR> -# SQL_CA1_LOCK_EXCLUSIVE<BR> -# SQL_CA1_LOCK_NO_CHANGE<BR> -# SQL_CA1_LOCK_UNLOCK<BR> -# SQL_CA1_POS_POSITION<BR> -# SQL_CA1_POS_UPDATE<BR> -# SQL_CA1_POS_DELETE<BR> -# SQL_CA1_POS_REFRESH<BR> -# SQL_CA1_POSITIONED_UPDATE<BR> -# SQL_CA1_POSITIONED_DELETE<BR> -# SQL_CA1_SELECT_FOR_UPDATE<BR> -# SQL_CA1_BULK_ADD<BR> -# SQL_CA1_BULK_UPDATE_BY_BOOKMARK<BR> -# SQL_CA1_BULK_DELETE_BY_BOOKMARK<BR> -# SQL_CA1_BULK_FETCH_BY_BOOKMARK</P> -# -# <P>For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "keyset-driven cursor" for "dynamic cursor" in the descriptions).</P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_KEYSET_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_KEYSET_CURSOR_ATTRIBUTES2<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>SQL_CA2_READ_ONLY_CONCURRENCY<BR> -# SQL_CA2_LOCK_CONCURRENCY<BR> -# SQL_CA2_OPT_ROWVER_CONCURRENCY<BR> -# SQL_CA2_OPT_VALUES_CONCURRENCY<BR> -# SQL_CA2_SENSITIVITY_ADDITIONS<BR> -# SQL_CA2_SENSITIVITY_DELETIONS<BR> -# SQL_CA2_SENSITIVITY_UPDATES<BR> -# SQL_CA2_MAX_ROWS_SELECT<BR> -# SQL_CA2_MAX_ROWS_INSERT<BR> -# SQL_CA2_MAX_ROWS_DELETE<BR> -# SQL_CA2_MAX_ROWS_UPDATE<BR> -# SQL_CA2_MAX_ROWS_CATALOG<BR> -# SQL_CA2_MAX_ROWS_AFFECTS_ALL<BR> -# SQL_CA2_CRC_EXACT<BR> -# SQL_CA2_CRC_APPROXIMATE<BR> -# SQL_CA2_SIMULATE_NON_UNIQUE<BR> -# SQL_CA2_SIMULATE_TRY_UNIQUE<BR> -# SQL_CA2_SIMULATE_UNIQUE</P> -# -# <P>For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "keyset-driven cursor" for "dynamic cursor" in the descriptions).</P> -# </TD> -# </TR> - SQL_KEYSET_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_KEYWORDS<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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. -# <P>For a list of ODBC keywords, see "<A HREF="odbclist_of_reserved_keywords.htm">List of Reserved Keywords</A>" in Appendix C, "SQL Grammar." The <B>#define</B> value SQL_ODBC_KEYWORDS contains a comma-separated list of ODBC keywords.</P> -# </TD> -# </TR> - SQL_KEYWORDS => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_LIKE_ESCAPE_CLAUSE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>A character string: "Y" if the data source supports an escape character for the percent character (%) and underscore character (_) in a <B>LIKE</B> predicate and the driver supports the ODBC syntax for defining a <B>LIKE</B> predicate escape character; "N" otherwise.</TD> -# </TR> - SQL_LIKE_ESCAPE_CLAUSE => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_ASYNC_CONCURRENT_STATEMENTS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_ASYNC_CONCURRENT_STATEMENTS => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_BINARY_LITERAL_LEN<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER value specifying the maximum length (number of hexadecimal characters, excluding the literal prefix and suffix returned by <B>SQLGetTypeInfo</B>) 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.</TD> -# </TR> - SQL_MAX_BINARY_LITERAL_LEN => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_CATALOG_NAME_LEN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Full level–conformant driver will return at least 128.</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_MAX_QUALIFIER_NAME_LEN.</P> -# </TD> -# </TR> - SQL_MAX_CATALOG_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_CHAR_LITERAL_LEN<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER value specifying the maximum length (number of characters, excluding the literal prefix and suffix returned by <B>SQLGetTypeInfo</B>) 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.</TD> -# </TR> - SQL_MAX_CHAR_LITERAL_LEN => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_COLUMN_NAME_LEN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.</P> -# </TD> -# </TR> - SQL_MAX_COLUMN_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_COLUMNS_IN_GROUP_BY<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value specifying the maximum number of columns allowed in a <B>GROUP BY</B> clause. If there is no specified limit or the limit is unknown, this value is set to zero. -# <P>An FIPS Entry level–conformant driver will return at least 6. An FIPS Intermediate level–conformant driver will return at least 15.</P> -# </TD> -# </TR> - SQL_MAX_COLUMNS_IN_GROUP_BY => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_COLUMNS_IN_INDEX<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_COLUMNS_IN_INDEX => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_COLUMNS_IN_ORDER_BY<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value specifying the maximum number of columns allowed in an <B>ORDER BY</B> clause. If there is no specified limit or the limit is unknown, this value is set to zero. -# <P>An FIPS Entry level–conformant driver will return at least 6. An FIPS Intermediate level–conformant driver will return at least 15.</P> -# </TD> -# </TR> - SQL_MAX_COLUMNS_IN_ORDER_BY => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_COLUMNS_IN_SELECT<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 100. An FIPS Intermediate level–conformant driver will return at least 250.</P> -# </TD> -# </TR> - SQL_MAX_COLUMNS_IN_SELECT => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_COLUMNS_IN_TABLE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 100. An FIPS Intermediate level–conformant driver will return at least 250.</P> -# </TD> -# </TR> - SQL_MAX_COLUMNS_IN_TABLE => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_CONCURRENT_ACTIVITIES<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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 <B>SELECT</B> operation or rows affected by an <B>INSERT</B>, <B>UPDATE</B>, or <B>DELETE</B> 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. -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_ACTIVE_STATEMENTS.</P> -# </TD> -# </TR> - SQL_MAX_CONCURRENT_ACTIVITIES => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_CURSOR_NAME_LEN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.</P> -# </TD> -# </TR> - SQL_MAX_CURSOR_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_DRIVER_CONNECTIONS<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_ACTIVE_CONNECTIONS.</P> -# </TD> -# </TR> - SQL_MAX_DRIVER_CONNECTIONS => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_IDENTIFIER_LEN<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUSMALLINT that indicates the maximum size in characters that the data source supports for user-defined names. -# <P>An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.</P> -# </TD> -# </TR> - SQL_MAX_IDENTIFIER_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_INDEX_SIZE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_INDEX_SIZE => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_PROCEDURE_NAME_LEN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_PROCEDURE_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_ROW_SIZE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 2,000. An FIPS Intermediate level–conformant driver will return at least 8,000.</P> -# </TD> -# </TR> - SQL_MAX_ROW_SIZE => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_ROW_SIZE_INCLUDES_LONG<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_ROW_SIZE_INCLUDES_LONG => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_SCHEMA_NAME_LEN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_MAX_OWNER_NAME_LEN.</P> -# </TD> -# </TR> - SQL_MAX_SCHEMA_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_STATEMENT_LEN<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_STATEMENT_LEN => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_TABLE_NAME_LEN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>An FIPS Entry level–conformant driver will return at least 18. An FIPS Intermediate level–conformant driver will return at least 128.</P> -# </TD> -# </TR> - SQL_MAX_TABLE_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_TABLES_IN_SELECT<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value specifying the maximum number of tables allowed in the <B>FROM</B> clause of a <B>SELECT </B>statement. If there is no specified limit or the limit is unknown, this value is set to zero. -# <P>An FIPS Entry level–conformant driver will return at least 15. An FIPS Intermediate level–conformant driver will return at least 50.</P> -# </TD> -# </TR> - SQL_MAX_TABLES_IN_SELECT => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MAX_USER_NAME_LEN<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_MAX_USER_NAME_LEN => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MULT_RESULT_SETS<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string: "Y" if the data source supports multiple result sets, "N" if it does not. -# <P>For more information on multiple result sets, see "<A HREF="odbcmultiple_results.htm">Multiple Results</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# </TD> -# </TR> - SQL_MULT_RESULT_SETS => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_MULTIPLE_ACTIVE_TXN<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>The information returned for this information type does not apply in the case of distributed transactions.</P> -# </TD> -# </TR> - SQL_MULTIPLE_ACTIVE_TXN => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_NEED_LONG_DATA_LEN<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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 <B>SQLBindParameter</B> and <B>SQLSetPos</B>.</TD> -# </TR> - SQL_NEED_LONG_DATA_LEN => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_NON_NULLABLE_COLUMNS<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUSMALLINT value specifying whether the data source supports NOT NULL in columns: -# <P>SQL_NNC_NULL = All columns must be nullable.</P> -# -# <P>SQL_NNC_NON_NULL = Columns cannot be nullable. (The data source supports the <B>NOT NULL</B> column constraint in <B>CREATE TABLE</B> statements.) </P> -# -# <P>An SQL-92 Entry level–conformant driver will return SQL_NNC_NON_NULL.</P> -# </TD> -# </TR> - SQL_NON_NULLABLE_COLUMNS => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_NULL_COLLATION<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value specifying where NULLs are sorted in a result set: -# <P>SQL_NC_END = NULLs are sorted at the end of the result set, regardless of the ASC or DESC keywords.</P> -# -# <P>SQL_NC_HIGH = NULLs are sorted at the high end of the result set, depending on the ASC or DESC keywords.</P> -# -# <P>SQL_NC_LOW = NULLs are sorted at the low end of the result set, depending on the ASC or DESC keywords.</P> -# -# <P>SQL_NC_START = NULLs are sorted at the start of the result set, regardless of the ASC or DESC keywords.</P> -# </TD> -# </TR> - SQL_NULL_COLLATION => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_NUMERIC_FUNCTIONS<BR> -# (ODBC 1.0) -# <P>The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.</P> -# </TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the scalar numeric functions supported by the driver and associated data source. -# <P>The following bitmasks are used to determine which numeric functions are supported:</P> -# -# <P>SQL_FN_NUM_ABS (ODBC 1.0)<BR> -# SQL_FN_NUM_ACOS (ODBC 1.0)<BR> -# SQL_FN_NUM_ASIN (ODBC 1.0)<BR> -# SQL_FN_NUM_ATAN (ODBC 1.0)<BR> -# SQL_FN_NUM_ATAN2 (ODBC 1.0)<BR> -# SQL_FN_NUM_CEILING (ODBC 1.0)<BR> -# SQL_FN_NUM_COS (ODBC 1.0)<BR> -# SQL_FN_NUM_COT (ODBC 1.0)<BR> -# SQL_FN_NUM_DEGREES (ODBC 2.0)<BR> -# SQL_FN_NUM_EXP (ODBC 1.0)<BR> -# SQL_FN_NUM_FLOOR (ODBC 1.0)<BR> -# SQL_FN_NUM_LOG (ODBC 1.0)<BR> -# SQL_FN_NUM_LOG10 (ODBC 2.0)<BR> -# SQL_FN_NUM_MOD (ODBC 1.0)<BR> -# SQL_FN_NUM_PI (ODBC 1.0)<BR> -# SQL_FN_NUM_POWER (ODBC 2.0)<BR> -# SQL_FN_NUM_RADIANS (ODBC 2.0)<BR> -# SQL_FN_NUM_RAND (ODBC 1.0)<BR> -# SQL_FN_NUM_ROUND (ODBC 2.0)<BR> -# SQL_FN_NUM_SIGN (ODBC 1.0)<BR> -# SQL_FN_NUM_SIN (ODBC 1.0)<BR> -# SQL_FN_NUM_SQRT (ODBC 1.0)<BR> -# SQL_FN_NUM_TAN (ODBC 1.0)<BR> -# SQL_FN_NUM_TRUNCATE (ODBC 2.0)</P> -# </TD> -# </TR> - SQL_NUMERIC_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ODBC_INTERFACE_CONFORMANCE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER value indicating the level of the ODBC 3<I>.x</I> interface that the driver conforms to. -# <P>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.</P> -# -# <P>SQL_OIC_LEVEL1: A level including the core standards compliance level functionality, plus scrollable cursors, bookmarks, positioned updates and deletes, and so on.</P> -# -# <P>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.</P> -# -# <P>For more information, see "<A HREF="odbcinterface_conformance_levels.htm">Interface Conformance Levels</A>" in Chapter 4: ODBC Fundamentals.</P> -# </TD> -# </TR> - SQL_ODBC_INTERFACE_CONFORMANCE => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ODBC_VER<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_ODBC_VER => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_OJ_CAPABILITIES<BR> -# (ODBC 2.01)</TD> -# <TD width=50%>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: -# <P>SQL_OJ_LEFT = Left outer joins are supported.</P> -# -# <P>SQL_OJ_RIGHT = Right outer joins are supported.</P> -# -# <P>SQL_OJ_FULL = Full outer joins are supported.</P> -# -# <P>SQL_OJ_NESTED = Nested outer joins are supported.</P> -# -# <P>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 <B>OUTER JOIN </B>clause.</P> -# -# <P>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.</P> -# -# <P>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.</P> -# -# <P>If none of these options is returned as supported, no outer join clause is supported.</P> -# -# <P>For information on the support of relational join operators in a SELECT statement, as defined by SQL-92, see SQL_SQL92_RELATIONAL_JOIN_OPERATORS.</P> -# </TD> -# </TR> - SQL_OJ_CAPABILITIES => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ORDER_BY_COLUMNS_IN_SELECT<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>A character string: "Y" if the columns in the <B>ORDER BY</B> clause must be in the select list; otherwise, "N".</TD> -# </TR> - SQL_ORDER_BY_COLUMNS_IN_SELECT => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_PARAM_ARRAY_ROW_COUNTS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER enumerating the driver's properties regarding the availability of row counts in a parameterized execution. Has the following values: -# <P>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.</P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_PARAM_ARRAY_ROW_COUNTS => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_PARAM_ARRAY_SELECTS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER enumerating the driver's properties regarding the availability of result sets in a parameterized execution. Has the following values: -# <P>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.</P> -# -# <P>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.</P> -# -# <P>SQL_PAS_NO_SELECT = A driver does not allow a result-set generating statement to be executed with an array of parameters.</P> -# </TD> -# </TR> - SQL_PARAM_ARRAY_SELECTS => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_PROCEDURE_TERM<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the data source vendor's name for a procedure; for example, "database procedure", "stored procedure", "procedure", "package", or "stored query".</TD> -# </TR> - SQL_PROCEDURE_TERM => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_PROCEDURES<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string: "Y" if the data source supports procedures and the driver supports the ODBC procedure invocation syntax; "N" otherwise.</TD> -# </TR> - SQL_PROCEDURES => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_POS_OPERATIONS (ODBC 2.0)</TD> -# <TD width=50%>An SQLINTEGER bitmask enumerating the support operations in <B>SQLSetPos</B>. -# <P>The following bitmasks are used in conjunction with the flag to determine which options are supported.</P> -# -# <P>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) </P> -# </TD> -# </TR> - SQL_POS_OPERATIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_QUOTED_IDENTIFIER_CASE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUSMALLINT value as follows: -# <P>SQL_IC_UPPER = Quoted identifiers in SQL are not case-sensitive and are stored in uppercase in the system catalog.</P> -# -# <P>SQL_IC_LOWER = Quoted identifiers in SQL are not case-sensitive and are stored in lowercase in the system catalog.</P> -# -# <P>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.)</P> -# -# <P>SQL_IC_MIXED = Quoted identifiers in SQL are not case-sensitive and are stored in mixed case in the system catalog.</P> -# -# <P>An SQL-92 Entry level–conformant driver will always return SQL_IC_SENSITIVE.</P> -# </TD> -# </TR> - SQL_QUOTED_IDENTIFIER_CASE => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ROW_UPDATES<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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 <B>SQLFetchScroll</B> is called. Otherwise, "N".</TD> -# </TR> - SQL_ROW_UPDATES => { - type => q(YesNo), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SCHEMA_TERM<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the data source vendor's name for an schema; for example, "owner", "Authorization ID", or "Schema". -# <P>The character string can be returned in upper, lower, or mixed case.</P> -# -# <P>An SQL-92 Entry level–conformant driver will always return "schema".</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_OWNER_TERM.</P> -# </TD> -# </TR> - SQL_SCHEMA_TERM => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SCHEMA_USAGE<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the statements in which schemas can be used: -# <P>SQL_SU_DML_STATEMENTS = Schemas are supported in all Data Manipulation Language statements: <B>SELECT</B>, <B>INSERT</B>, <B>UPDATE</B>, <B>DELETE</B>, and if supported, <B>SELECT FOR UPDATE</B> and positioned update and delete statements.</P> -# -# <P>SQL_SU_PROCEDURE_INVOCATION = Schemas are supported in the ODBC procedure invocation statement.</P> -# -# <P>SQL_SU_TABLE_DEFINITION = Schemas are supported in all table definition statements: <B>CREATE TABLE</B>, <B>CREATE VIEW</B>, <B>ALTER TABLE</B>, <B>DROP TABLE</B>, and <B>DROP VIEW</B>.</P> -# -# <P>SQL_SU_INDEX_DEFINITION = Schemas are supported in all index definition statements: <B>CREATE INDEX</B> and <B>DROP INDEX</B>.</P> -# -# <P>SQL_SU_PRIVILEGE_DEFINITION = Schemas are supported in all privilege definition statements: <B>GRANT</B> and <B>REVOKE</B>. </P> -# -# <P>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.</P> -# -# <P>This <I>InfoType</I> has been renamed for ODBC 3.0 from the ODBC 2.0 <I>InfoType</I> SQL_OWNER_USAGE.</P> -# </TD> -# </TR> - SQL_SCHEMA_USAGE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SCROLL_OPTIONS<BR> -# (ODBC 1.0) -# <P>The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.</P> -# </TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the scroll options supported for scrollable cursors. -# <P>The following bitmasks are used to determine which options are supported:</P> -# -# <P>SQL_SO_FORWARD_ONLY = The cursor only scrolls forward. (ODBC 1.0)</P> -# -# <P>SQL_SO_STATIC = The data in the result set is static. (ODBC 2.0)</P> -# -# <P>SQL_SO_KEYSET_DRIVEN = The driver saves and uses the keys for every row in the result set. (ODBC 1.0)</P> -# -# <P>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)</P> -# -# <P>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)</P> -# -# <P>For information about scrollable cursors, see "<A HREF="odbcscrollable_cursors.htm">Scrollable Cursors</A>" in Chapter 11: Retrieving Results (Advanced)</P> -# </TD> -# </TR> - SQL_SCROLL_OPTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SEARCH_PATTERN_ESCAPE<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>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. -# <P>Because this information type does not indicate general support of the escape character in the <B>LIKE</B> predicate, SQL-92 does not include requirements for this character string.</P> -# -# <P>This <I>InfoType</I> is limited to catalog functions. For a description of the use of the escape character in search pattern strings, see "<A HREF="odbcpattern_value_arguments.htm">Pattern Value Arguments</A>" in Chapter 7: Catalog Functions.</P> -# </TD> -# </TR> - SQL_SEARCH_PATTERN_ESCAPE => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SERVER_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the actual data source–specific server name; useful when a data source name is used during <B>SQLConnect</B>, <B>SQLDriverConnect</B>, and<B> SQLBrowseConnect</B>.</TD> -# </TR> - SQL_SERVER_NAME => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SPECIAL_CHARACTERS<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_SPECIAL_CHARACTERS => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL_CONFORMANCE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER value indicating the level of SQL-92 supported by the driver: -# <P>SQL_SC_SQL92_ENTRY = Entry level SQL-92 compliant.</P> -# -# <P>SQL_SC_FIPS127_2_TRANSITIONAL = FIPS 127-2 transitional level compliant.</P> -# -# <P>SQL_SC_SQL92_FULL = Full level SQL-92 compliant.</P> -# -# <P>SQL_SC_ SQL92_INTERMEDIATE = Intermediate level SQL-92 compliant.</P> -# </TD> -# </TR> - SQL_SQL_CONFORMANCE => { - type => q(Long), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_DATETIME_FUNCTIONS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the datetime scalar functions that are supported by the driver and the associated data source, as defined in SQL-92. -# <P>The following bitmasks are used to determine which datetime functions are supported:</P> -# -# <P>SQL_SDF_CURRENT_DATE<BR> -# SQL_SDF_CURRENT_TIME<BR> -# SQL_SDF_CURRENT_TIMESTAMP</P> -# </TD> -# </TR> - SQL_SQL92_DATETIME_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_FOREIGN_KEY_DELETE_RULE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the rules supported for a foreign key in a <B>DELETE</B> statement, as defined in SQL-92. -# <P>The following bitmasks are used to determine which clauses are supported by the data source:</P> -# -# <P>SQL_SFKD_CASCADE<BR> -# SQL_SFKD_NO_ACTION<BR> -# SQL_SFKD_SET_DEFAULT<BR> -# SQL_SFKD_SET_NULL</P> -# -# <P>An FIPS Transitional level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_SQL92_FOREIGN_KEY_DELETE_RULE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_FOREIGN_KEY_UPDATE_RULE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the rules supported for a foreign key in an <B>UPDATE</B> statement, as defined in SQL-92. -# <P>The following bitmasks are used to determine which clauses are supported by the data source:</P> -# -# <P>SQL_SFKU_CASCADE<BR> -# SQL_SFKU_NO_ACTION<BR> -# SQL_SFKU_SET_DEFAULT<BR> -# SQL_SFKU_SET_NULL </P> -# -# <P>An SQL-92 Full level–conformant driver will always return all of these options as supported.</P> -# </TD> -# </TR> - SQL_SQL92_FOREIGN_KEY_UPDATE_RULE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_GRANT<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses supported in the <B>GRANT</B> statement, as defined in SQL-92. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which clauses are supported by the data source:</P> -# -# <P>SQL_SG_DELETE_TABLE (Entry level)<BR> -# SQL_SG_INSERT_COLUMN (Intermediate level)<BR> -# SQL_SG_INSERT_TABLE (Entry level) <BR> -# SQL_SG_REFERENCES_TABLE (Entry level)<BR> -# SQL_SG_REFERENCES_COLUMN (Entry level)<BR> -# SQL_SG_SELECT_TABLE (Entry level)<BR> -# SQL_SG_UPDATE_COLUMN (Entry level)<BR> -# SQL_SG_UPDATE_TABLE (Entry level) <BR> -# SQL_SG_USAGE_ON_DOMAIN (FIPS Transitional level)<BR> -# SQL_SG_USAGE_ON_CHARACTER_SET (FIPS Transitional level)<BR> -# SQL_SG_USAGE_ON_COLLATION (FIPS Transitional level)<BR> -# SQL_SG_USAGE_ON_TRANSLATION (FIPS Transitional level)<BR> -# SQL_SG_WITH_GRANT_OPTION (Entry level)</P> -# </TD> -# </TR> - SQL_SQL92_GRANT => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_NUMERIC_VALUE_FUNCTIONS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which numeric functions are supported:</P> -# -# <P>SQL_SNVF_BIT_LENGTH<BR> -# SQL_SNVF_CHAR_LENGTH<BR> -# SQL_SNVF_CHARACTER_LENGTH<BR> -# SQL_SNVF_EXTRACT<BR> -# SQL_SNVF_OCTET_LENGTH<BR> -# SQL_SNVF_POSITION</P> -# </TD> -# </TR> - SQL_SQL92_NUMERIC_VALUE_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_PREDICATES<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the predicates supported in a <B>SELECT</B> statement, as defined in SQL-92. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which options are supported by the data source:</P> -# -# <P>SQL_SP_BETWEEN (Entry level)<BR> -# SQL_SP_COMPARISON (Entry level)<BR> -# SQL_SP_EXISTS (Entry level)<BR> -# SQL_SP_IN (Entry level)<BR> -# SQL_SP_ISNOTNULL (Entry level)<BR> -# SQL_SP_ISNULL (Entry level)<BR> -# SQL_SP_LIKE (Entry level)<BR> -# SQL_SP_MATCH_FULL (Full level)<BR> -# SQL_SP_MATCH_PARTIAL(Full level)<BR> -# SQL_SP_MATCH_UNIQUE_FULL (Full level)<BR> -# SQL_SP_MATCH_UNIQUE_PARTIAL (Full level)<BR> -# SQL_SP_OVERLAPS (FIPS Transitional level)<BR> -# SQL_SP_QUANTIFIED_COMPARISON (Entry level)<BR> -# SQL_SP_UNIQUE (Entry level)</P> -# </TD> -# </TR> - SQL_SQL92_PREDICATES => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_RELATIONAL_JOIN_OPERATORS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the relational join operators supported in a <B>SELECT</B> statement, as defined in SQL-92. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which options are supported by the data source:</P> -# -# <P>SQL_SRJO_CORRESPONDING_CLAUSE (Intermediate level)<BR> -# SQL_SRJO_CROSS_JOIN (Full level)<BR> -# SQL_SRJO_EXCEPT_JOIN (Intermediate level)<BR> -# SQL_SRJO_FULL_OUTER_JOIN (Intermediate level) <BR> -# SQL_SRJO_INNER_JOIN (FIPS Transitional level)<BR> -# SQL_SRJO_INTERSECT_JOIN (Intermediate level)<BR> -# SQL_SRJO_LEFT_OUTER_JOIN (FIPS Transitional level)<BR> -# SQL_SRJO_NATURAL_JOIN (FIPS Transitional level)<BR> -# SQL_SRJO_RIGHT_OUTER_JOIN (FIPS Transitional level)<BR> -# SQL_SRJO_UNION_JOIN (Full level)</P> -# -# <P>SQL_SRJO_INNER_JOIN indicates support for the <B>INNER JOIN </B>syntax, not for the inner join capability. Support for the <B>INNER JOIN</B> syntax is FIPS TRANSITIONAL, while support for the inner join capability is <B>ENTRY</B>.</P> -# </TD> -# </TR> - SQL_SQL92_RELATIONAL_JOIN_OPERATORS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_REVOKE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the clauses supported in the <B>REVOKE</B> statement, as defined in SQL-92, supported by the data source. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which clauses are supported by the data source:</P> -# -# <P>SQL_SR_CASCADE (FIPS Transitional level) <BR> -# SQL_SR_DELETE_TABLE (Entry level)<BR> -# SQL_SR_GRANT_OPTION_FOR (Intermediate level) <BR> -# SQL_SR_INSERT_COLUMN (Intermediate level)<BR> -# SQL_SR_INSERT_TABLE (Entry level)<BR> -# SQL_SR_REFERENCES_COLUMN (Entry level)<BR> -# SQL_SR_REFERENCES_TABLE (Entry level)<BR> -# SQL_SR_RESTRICT (FIPS Transitional level)<BR> -# SQL_SR_SELECT_TABLE (Entry level)<BR> -# SQL_SR_UPDATE_COLUMN (Entry level)<BR> -# SQL_SR_UPDATE_TABLE (Entry level)<BR> -# SQL_SR_USAGE_ON_DOMAIN (FIPS Transitional level)<BR> -# SQL_SR_USAGE_ON_CHARACTER_SET (FIPS Transitional level)<BR> -# SQL_SR_USAGE_ON_COLLATION (FIPS Transitional level)<BR> -# SQL_SR_USAGE_ON_TRANSLATION (FIPS Transitional level)</P> -# </TD> -# </TR> - SQL_SQL92_REVOKE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_ROW_VALUE_CONSTRUCTOR<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the row value constructor expressions supported in a <B>SELECT</B> statement, as defined in SQL-92. The following bitmasks are used to determine which options are supported by the data source: -# <P>SQL_SRVC_VALUE_EXPRESSION <BR> -# SQL_SRVC_NULL <BR> -# SQL_SRVC_DEFAULT <BR> -# SQL_SRVC_ROW_SUBQUERY</P> -# </TD> -# </TR> - SQL_SQL92_ROW_VALUE_CONSTRUCTOR => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_STRING_FUNCTIONS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the string scalar functions that are supported by the driver and the associated data source, as defined in SQL-92. -# <P>The following bitmasks are used to determine which string functions are supported:</P> -# -# <P>SQL_SSF_CONVERT<BR> -# SQL_SSF_LOWER<BR> -# SQL_SSF_UPPER<BR> -# SQL_SSF_SUBSTRING<BR> -# SQL_SSF_TRANSLATE<BR> -# SQL_SSF_TRIM_BOTH<BR> -# SQL_SSF_TRIM_LEADING<BR> -# SQL_SSF_TRIM_TRAILING</P> -# </TD> -# </TR> - SQL_SQL92_STRING_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SQL92_VALUE_EXPRESSIONS<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the value expressions supported, as defined in SQL-92. -# <P>The SQL-92 or FIPS conformance level at which this feature needs to be supported is shown in parentheses next to each bitmask.</P> -# -# <P>The following bitmasks are used to determine which options are supported by the data source:</P> -# -# <P>SQL_SVE_CASE (Intermediate level)<BR> -# SQL_SVE_CAST (FIPS Transitional level)<BR> -# SQL_SVE_COALESCE (Intermediate level)<BR> -# SQL_SVE_NULLIF (Intermediate level)</P> -# </TD> -# </TR> - SQL_SQL92_VALUE_EXPRESSIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_STANDARD_CLI_CONFORMANCE<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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: -# <P>SQL_SCC_XOPEN_CLI_VERSION1: The driver conforms to the X/Open CLI version 1.</P> -# -# <P>SQL_SCC_ISO92_CLI: The driver conforms to the ISO 92 CLI.</P> -# </TD> -# </TR> - SQL_STANDARD_CLI_CONFORMANCE => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_STATIC_CURSOR_ATTRIBUTES1<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>SQL_CA1_NEXT<BR> -# SQL_CA1_ABSOLUTE<BR> -# SQL_CA1_RELATIVE<BR> -# SQL_CA1_BOOKMARK<BR> -# SQL_CA1_LOCK_NO_CHANGE<BR> -# SQL_CA1_LOCK_EXCLUSIVE<BR> -# SQL_CA1_LOCK_UNLOCK<BR> -# SQL_CA1_POS_POSITION<BR> -# SQL_CA1_POS_UPDATE<BR> -# SQL_CA1_POS_DELETE<BR> -# SQL_CA1_POS_REFRESH<BR> -# SQL_CA1_POSITIONED_UPDATE<BR> -# SQL_CA1_POSITIONED_DELETE<BR> -# SQL_CA1_SELECT_FOR_UPDATE<BR> -# SQL_CA1_BULK_ADD<BR> -# SQL_CA1_BULK_UPDATE_BY_BOOKMARK<BR> -# SQL_CA1_BULK_DELETE_BY_BOOKMARK<BR> -# SQL_CA1_BULK_FETCH_BY_BOOKMARK</P> -# -# <P>For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (and substitute "static cursor" for "dynamic cursor" in the descriptions).</P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_STATIC_CURSOR_ATTRIBUTES1 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_STATIC_CURSOR_ATTRIBUTES2<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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. -# <P>The following bitmasks are used to determine which attributes are supported:</P> -# -# <P>SQL_CA2_READ_ONLY_CONCURRENCY<BR> -# SQL_CA2_LOCK_CONCURRENCY<BR> -# SQL_CA2_OPT_ROWVER_CONCURRENCY<BR> -# SQL_CA2_OPT_VALUES_CONCURRENCY<BR> -# SQL_CA2_SENSITIVITY_ADDITIONS<BR> -# SQL_CA2_SENSITIVITY_DELETIONS<BR> -# SQL_CA2_SENSITIVITY_UPDATES<BR> -# SQL_CA2_MAX_ROWS_SELECT<BR> -# SQL_CA2_MAX_ROWS_INSERT<BR> -# SQL_CA2_MAX_ROWS_DELETE<BR> -# SQL_CA2_MAX_ROWS_UPDATE<BR> -# SQL_CA2_MAX_ROWS_CATALOG<BR> -# SQL_CA2_MAX_ROWS_AFFECTS_ALL<BR> -# SQL_CA2_CRC_EXACT<BR> -# SQL_CA2_CRC_APPROXIMATE<BR> -# SQL_CA2_SIMULATE_NON_UNIQUE<BR> -# SQL_CA2_SIMULATE_TRY_UNIQUE<BR> -# SQL_CA2_SIMULATE_UNIQUE</P> -# -# <P>For descriptions of these bitmasks, see SQL_DYNAMIC_CURSOR_ATTRIBUTES2 (and substitute "static cursor" for "dynamic cursor" in the descriptions).</P> -# </TD> -# </TR> - SQL_STATIC_CURSOR_ATTRIBUTES2 => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_STRING_FUNCTIONS<BR> -# (ODBC 1.0) -# <P>The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.</P> -# </TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the scalar string functions supported by the driver and associated data source. -# <P>The following bitmasks are used to determine which string functions are supported:</P> -# -# <P>SQL_FN_STR_ASCII (ODBC 1.0)<BR> -# SQL_FN_STR_BIT_LENGTH (ODBC 3.0)<BR> -# SQL_FN_STR_CHAR (ODBC 1.0)<BR> -# SQL_FN_STR_CHAR_<BR> -# LENGTH (ODBC 3.0)<BR> -# SQL_FN_STR_CHARACTER_<BR> -# LENGTH (ODBC 3.0)<BR> -# SQL_FN_STR_CONCAT (ODBC 1.0)<BR> -# SQL_FN_STR_DIFFERENCE (ODBC 2.0)<BR> -# SQL_FN_STR_INSERT (ODBC 1.0)<BR> -# SQL_FN_STR_LCASE (ODBC 1.0)<BR> -# SQL_FN_STR_LEFT (ODBC 1.0)<BR> -# SQL_FN_STR_LENGTH (ODBC 1.0)<BR> -# SQL_FN_STR_LOCATE (ODBC 1.0)<BR> -# SQL_FN_STR_LTRIM (ODBC 1.0) <BR> -# SQL_FN_STR_OCTET_<BR> -# LENGTH (ODBC 3.0) <BR> -# SQL_FN_STR_POSITION (ODBC 3.0)<BR> -# SQL_FN_STR_REPEAT (ODBC 1.0)<BR> -# SQL_FN_STR_REPLACE (ODBC 1.0)<BR> -# SQL_FN_STR_RIGHT (ODBC 1.0)<BR> -# SQL_FN_STR_RTRIM (ODBC 1.0)<BR> -# SQL_FN_STR_SOUNDEX (ODBC 2.0)<BR> -# SQL_FN_STR_SPACE (ODBC 2.0)<BR> -# SQL_FN_STR_SUBSTRING (ODBC 1.0)<BR> -# SQL_FN_STR_UCASE (ODBC 1.0)</P> -# -# <P>If an application can call the <B>LOCATE</B> scalar function with the <I>string_exp1</I>, <I>string_exp2</I>, and <I>start</I> arguments, the driver returns the SQL_FN_STR_LOCATE bitmask. If an application can call the LOCATE scalar function with only the <I>string_exp1</I> and <I>string_exp2</I> arguments, the driver returns the SQL_FN_STR_LOCATE_2 bitmask. Drivers that fully support the <B>LOCATE</B> scalar function return both bitmasks.</P> -# -# <P>(For more information, see <A HREF="odbcstring_functions.htm">String Functions</A> in Appendix E, "Scalar Functions.")</P> -# </TD> -# </TR> - SQL_STRING_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SUBQUERIES<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the predicates that support subqueries: -# <P>SQL_SQ_CORRELATED_SUBQUERIES<BR> -# SQL_SQ_COMPARISON<BR> -# SQL_SQ_EXISTS<BR> -# SQL_SQ_IN<BR> -# SQL_SQ_QUANTIFIED</P> -# -# <P>The SQL_SQ_CORRELATED_SUBQUERIES bitmask indicates that all predicates that support subqueries support correlated subqueries.</P> -# -# <P>An SQL-92 Entry level–conformant driver will always return a bitmask in which all of these bits are set.</P> -# </TD> -# </TR> - SQL_SUBQUERIES => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_SYSTEM_FUNCTIONS<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the scalar system functions supported by the driver and associated data source. -# <P>The following bitmasks are used to determine which system functions are supported:</P> -# -# <P>SQL_FN_SYS_DBNAME<BR> -# SQL_FN_SYS_IFNULL<BR> -# SQL_FN_SYS_USERNAME</P> -# </TD> -# </TR> - SQL_SYSTEM_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TABLE_TERM<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the data source vendor's name for a table; for example, "table" or "file". -# <P>This character string can be in upper, lower, or mixed case. </P> -# -# <P>An SQL-92 Entry level–conformant driver will always return "table".</P> -# </TD> -# </TR> - SQL_TABLE_TERM => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TIMEDATE_ADD_INTERVALS<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the timestamp intervals supported by the driver and associated data source for the TIMESTAMPADD scalar function. -# <P>The following bitmasks are used to determine which intervals are supported:</P> -# -# <P>SQL_FN_TSI_FRAC_SECOND<BR> -# SQL_FN_TSI_SECOND<BR> -# SQL_FN_TSI_MINUTE<BR> -# SQL_FN_TSI_HOUR<BR> -# SQL_FN_TSI_DAY<BR> -# SQL_FN_TSI_WEEK<BR> -# SQL_FN_TSI_MONTH<BR> -# SQL_FN_TSI_QUARTER<BR> -# SQL_FN_TSI_YEAR</P> -# -# <P>An FIPS Transitional level–conformant driver will always return a bitmask in which all of these bits are set.</P> -# </TD> -# </TR> - SQL_TIMEDATE_ADD_INTERVALS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TIMEDATE_DIFF_INTERVALS<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the timestamp intervals supported by the driver and associated data source for the TIMESTAMPDIFF scalar function. -# <P>The following bitmasks are used to determine which intervals are supported:</P> -# -# <P>SQL_FN_TSI_FRAC_SECOND<BR> -# SQL_FN_TSI_SECOND<BR> -# SQL_FN_TSI_MINUTE<BR> -# SQL_FN_TSI_HOUR<BR> -# SQL_FN_TSI_DAY<BR> -# SQL_FN_TSI_WEEK<BR> -# SQL_FN_TSI_MONTH<BR> -# SQL_FN_TSI_QUARTER<BR> -# SQL_FN_TSI_YEAR </P> -# -# <P>An FIPS Transitional level–conformant driver will always return a bitmask in which all of these bits are set.</P> -# </TD> -# </TR> - SQL_TIMEDATE_DIFF_INTERVALS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TIMEDATE_FUNCTIONS<BR> -# (ODBC 1.0) -# <P>The information type was introduced in ODBC 1.0; each bitmask is labeled with the version in which it was introduced.</P> -# </TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the scalar date and time functions supported by the driver and associated data source. -# <P>The following bitmasks are used to determine which date and time functions are supported:</P> -# -# <P>SQL_FN_TD_CURRENT_DATE ODBC 3.0)<BR> -# SQL_FN_TD_CURRENT_TIME (ODBC 3.0)<BR> -# SQL_FN_TD_CURRENT_TIMESTAMP (ODBC 3.0)<BR> -# SQL_FN_TD_CURDATE (ODBC 1.0)<BR> -# SQL_FN_TD_CURTIME (ODBC 1.0) <BR> -# SQL_FN_TD_DAYNAME (ODBC 2.0)<BR> -# SQL_FN_TD_DAYOFMONTH (ODBC 1.0)<BR> -# SQL_FN_TD_DAYOFWEEK (ODBC 1.0)<BR> -# SQL_FN_TD_DAYOFYEAR (ODBC 1.0) <BR> -# SQL_FN_TD_EXTRACT (ODBC 3.0)<BR> -# SQL_FN_TD_HOUR (ODBC 1.0)<BR> -# SQL_FN_TD_MINUTE (ODBC 1.0)<BR> -# SQL_FN_TD_MONTH (ODBC 1.0)<BR> -# SQL_FN_TD_MONTHNAME (ODBC 2.0)<BR> -# SQL_FN_TD_NOW (ODBC 1.0)<BR> -# SQL_FN_TD_QUARTER (ODBC 1.0)<BR> -# SQL_FN_TD_SECOND (ODBC 1.0)<BR> -# SQL_FN_TD_TIMESTAMPADD (ODBC 2.0)<BR> -# SQL_FN_TD_TIMESTAMPDIFF (ODBC 2.0)<BR> -# SQL_FN_TD_WEEK (ODBC 1.0)<BR> -# SQL_FN_TD_YEAR (ODBC 1.0)</P> -# </TD> -# </TR> - SQL_TIMEDATE_FUNCTIONS => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TXN_CAPABLE<BR> -# (ODBC 1.0) -# <P>The information type was introduced in ODBC 1.0; each return value is labeled with the version in which it was introduced.</P> -# </TD> -# <TD width=50%>An SQLUSMALLINT value describing the transaction support in the driver or data source: -# <P>SQL_TC_NONE = Transactions not supported. (ODBC 1.0)</P> -# -# <P>SQL_TC_DML = Transactions can contain only Data Manipulation Language (DML) statements (<B>SELECT</B>, <B>INSERT</B>, <B>UPDATE</B>, <B>DELETE</B>). Data Definition Language (DDL) statements encountered in a transaction cause an error. (ODBC 1.0)</P> -# -# <P>SQL_TC_DDL_COMMIT = Transactions can contain only DML statements. DDL statements (<B>CREATE TABLE</B>, <B>DROP INDEX</B>, and so on) encountered in a transaction cause the transaction to be committed. (ODBC 2.0)</P> -# -# <P>SQL_TC_DDL_IGNORE = Transactions can contain only DML statements. DDL statements encountered in a transaction are ignored. (ODBC 2.0)</P> -# -# <P>SQL_TC_ALL = Transactions can contain DDL statements and DML statements in any order. (ODBC 1.0) </P> -# -# <P>(Because support of transactions is mandatory in SQL-92, an SQL-92 conformant driver [any level] will never return SQL_TC_NONE.)</P> -# </TD> -# </TR> - SQL_TXN_CAPABLE => { - type => q(Short), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_TXN_ISOLATION_OPTION<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the transaction isolation levels available from the driver or data source. -# <P>The following bitmasks are used in conjunction with the flag to determine which options are supported:</P> -# -# <P>SQL_TXN_READ_UNCOMMITTED<BR> -# SQL_TXN_READ_COMMITTED<BR> -# SQL_TXN_REPEATABLE_READ<BR> -# SQL_TXN_SERIALIZABLE</P> -# -# <P>For descriptions of these isolation levels, see the description of SQL_DEFAULT_TXN_ISOLATION.</P> -# -# <P>To set the transaction isolation level, an application calls <B>SQLSetConnectAttr</B> to set the SQL_ATTR_TXN_ISOLATION attribute. For more information, see <B>SQLSetConnectAttr</B>. </P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_TXN_ISOLATION_OPTION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_UNION<BR> -# (ODBC 2.0)</TD> -# <TD width=50%>An SQLUINTEGER bitmask enumerating the support for the <B>UNION</B> clause: -# <P>SQL_U_UNION = The data source supports the <B>UNION</B> clause.</P> -# -# <P>SQL_U_UNION_ALL = The data source supports the <B>ALL</B> keyword in the <B>UNION</B> clause. (<B>SQLGetInfo</B> returns both SQL_U_UNION and SQL_U_UNION_ALL in this case.)</P> -# -# <P>An SQL-92 Entry level–conformant driver will always return both of these options as supported.</P> -# </TD> -# </TR> - SQL_UNION => { - type => q(Bitmask), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_USER_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=50%>A character string with the name used in a particular database, which can be different from the login name.</TD> -# </TR> - SQL_USER_NAME => { - type => q(Char), - }, -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_XOPEN_CLI_YEAR<BR> -# (ODBC 3.0)</TD> -# <TD width=50%>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.</TD> -# </TR> - SQL_XOPEN_CLI_YEAR => { - type => q(Char), - }, -# </table></div> -# <!--TS:--> -# <P class="label"><B>Code Example</B></P> -# -# <P><B>SQLGetInfo</B> returns lists of supported options as an SQLUINTEGER bitmask in *<I>InfoValuePtr</I>. The bitmask for each option is used in conjunction with the flag to determine whether the option is supported.</P> -# -# <P>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:</P> -# -# <PRE class="code">SQLUINTEGER fFuncs; -# -# SQLGetInfo(hdbc, -# SQL_STRING_FUNCTIONS, -# (SQLPOINTER)&fFuncs, -# sizeof(fFuncs), -# NULL); -# -# if (fFuncs & SQL_FN_STR_SUBSTRING) /* SUBSTRING supported */ -# ; -# else /* SUBSTRING not supported */ -# ;</PRE> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>For information about</TH> -# <TH width=50%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning the setting of a connection attribute</TD> -# <TD width=50%><A HREF="odbcsqlgetconnectattr.htm">SQLGetConnectAttr</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Determining whether a driver supports a function</TD> -# <TD width=50%><A HREF="odbcsqlgetfunctions.htm">SQLGetFunctions</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning the setting of a statement attribute</TD> -# <TD width=50%><A HREF="odbcsqlgetstmtattr.htm">SQLGetStmtAttr</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning information about a data source's data types</TD> -# <TD width=50%><A HREF="odbcsqlgettypeinfo.htm">SQLGetTypeInfo</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -}; - -print <<END; -#include "HandleDbc.hpp" - -HandleDbc::InfoTab -HandleDbc::m_infoTab[] = { -END - -my @name = sort keys %$info; -for my $name (@name) { - my $p = $info->{$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 = <<END; - { $name, - InfoTab\::$type, - 0L, - $defstr - }, -END - if ($p->{omit}) { - $s ="#if 0\n" . $s . "#endif\n"; - } - print $s; -}; - -print <<END; - { 0, - InfoTab::End, - 0L, - 0 - } -}; -END - -# vim: set sw=4: diff --git a/storage/ndb/src/old_files/client/odbc/docs/gettypeinfo.pl b/storage/ndb/src/old_files/client/odbc/docs/gettypeinfo.pl deleted file mode 100644 index 0a999fd7249..00000000000 --- a/storage/ndb/src/old_files/client/odbc/docs/gettypeinfo.pl +++ /dev/null @@ -1,645 +0,0 @@ -# usage: perl TypeInfo.data -# prints template for typeinfo -use strict; -my $position = 0; - -# -# odbcsqlgettypeinfo.htm -# -my @typeinfo = ( - { name => "UNDEF", - type => q(Undef), - nullable => q(true), - position => 0, - }, -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLGetTypeInfo</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlgettypeinfo"></A>SQLGetTypeInfo</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 1.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLGetTypeInfo</B> 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.</P> -# -# <P class="indent"><b class="le">Important </b>Applications must use the type names returned in the TYPE_NAME column of the <B>SQLGetTypeInfo</B> result set in <B>ALTER TABLE</B> and <B>CREATE TABLE</B> statements. <B>SQLGetTypeInfo</B> may return more than one row with the same value in the DATA_TYPE column.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLGetTypeInfo</B>( -# SQLHSTMT <I>StatementHandle</I>, -# SQLSMALLINT <I>DataType</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>StatementHandle</I></DT> -# -# <DD>[Input]<BR> -# Statement handle for the result set.</dd> -# -# <DT><I>DataType</I></DT> -# -# <DD>[Input]<BR> -# The SQL data type. This must be one of the values in the "<A HREF="odbcsql_data_types.htm">SQL Data Types</A>" 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.</dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLGetTypeInfo</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_STMT and a <I>Handle</I> of <I>StatementHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLGetTypeInfo </B>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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01S02</TD> -# <TD width=26%>Option value changed</TD> -# <TD width=52%>A specified statement attribute was invalid because of implementation working conditions, so a similar value was temporarily substituted. (Call <B>SQLGetStmtAttr</B> to determine the temporarily substituted value.) The substitute value is valid for the <I>StatementHandle</I> 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.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>A cursor was open on the <I>StatementHandle,</I> and <B>SQLFetch</B> or <B>SQLFetchScroll</B> had been called. This error is returned by the Driver Manager if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has not returned SQL_NO_DATA, and is returned by the driver if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has returned SQL_NO_DATA. -# <P>A result set was open on the <I>StatementHandle</I>, but <B>SQLFetch</B> or <B>SQLFetchScroll</B> had not been called.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40001</TD> -# <TD width=26%>Serialization failure</TD> -# <TD width=52%>The transaction was rolled back due to a resource deadlock with another transaction.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40003</TD> -# <TD width=26%>Statement completion unknown</TD> -# <TD width=52%>The associated connection failed during the execution of this function and the state of the transaction cannot be determined.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause. </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY004</TD> -# <TD width=26%>Invalid SQL data type</TD> -# <TD width=52%>The value specified for the argument <I>DataType</I> was neither a valid ODBC SQL data type identifier nor a driver-specific data type identifier supported by the driver.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY008</TD> -# <TD width=26%>Operation canceled</TD> -# <TD width=52%>Asynchronous processing was enabled for the <I>StatementHandle</I>, then the function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I>. Then the function was called again on the <I>StatementHandle</I>. -# <P>The function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I> from a different thread in a multithread application.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function (not this one) was called for the <I>StatementHandle</I> and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>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. -# <P>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.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT00</TD> -# <TD width=26%>Timeout expired</TD> -# <TD width=52%>The query timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtAttr</B>, SQL_ATTR_QUERY_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver corresponding to the <I>StatementHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P><B>SQLGetTypeInfo</B> 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 "<A HREF="odbcddl_statements.htm">DDL Statements</A>" in Chapter 8: SQL Statements.</P> -# -# <P>If the <I>DataType</I> 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. </P> -# -# <P class="indent"><b class="le">Note </b>For more information about the general use, arguments, and returned data of ODBC catalog functions, see <A HREF="odbccatalog_functions.htm">Chapter 7: Catalog Functions</A>.</P> -# -# <P>The following columns have been renamed for ODBC 3.<I>x</I>. The column name changes do not affect backward compatibility because applications bind by column number.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>ODBC 2.0 column</TH> -# <TH width=52%>ODBC 3.<I>x</I> column</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>PRECISION</TD> -# <TD width=52%>COLUMN_SIZE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>MONEY</TD> -# <TD width=52%>FIXED_PREC_SCALE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>AUTO_INCREMENT</TD> -# <TD width=52%>AUTO_UNIQUE_VALUE</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>The following columns have been added to the results set returned by <B>SQLGetTypeInfo</B> for ODBC 3.<I>x</I>: -# -# <UL type=disc> -# <LI>SQL_DATA_TYPE</li> -# -# <LI>INTERVAL_PRECISION</li> -# -# <LI>SQL_DATETIME_SUB</li> -# -# <LI>NUM_PREC_RADIX</li> -# </UL> -# -# <P>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 "<A HREF="odbcdata_returned_by_catalog_functions.htm">Data Returned by Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# -# <P class="indent"><b class="le">Note</b> <B>SQLGetTypeInfo</B> 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 <B>SQLGetTypeInfo</B>.</P> -# -# <P class="indent">The data types returned by <B>SQLGetTypeInfo</B> 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 <B>SQLGetTypeInfo</B>. In creating the result set for a catalog function, the driver might use a data type that is not supported by the data source. </P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=33%><BR> -# Column name</TH> -# <TH width=14%>Column <BR> -# number</TH> -# <TH width=15%><BR> -# Data type</TH> -# <TH width=38%><BR> -# Comments</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=33%>TYPE_NAME<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>1</TD> -# <TD width=15%>Varchar<BR> -# not NULL</TD> -# <TD width=38%>Data source–dependent data-type name; for example, "CHAR()", "VARCHAR()", "MONEY", "LONG VARBINARY", or "CHAR ( ) FOR BIT DATA". Applications must use this name in <B>CREATE TABLE</B> and <B>ALTER TABLE</B> statements.</TD> -# </TR> - { name => "TYPE_NAME", - type => q(Varchar), - length => 20, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>DATA_TYPE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>2</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>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 "<A HREF="odbcsql_data_types.htm">SQL Data Types</A>" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver’s documentation.</TD> -# </TR> - { name => "DATA_TYPE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>COLUMN_SIZE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>3</TD> -# <TD width=15%>Integer</TD> -# <TD width=38%>The 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 "<A HREF="odbcinterval_data_type_length.htm">Interval Data Type Length</A>" in Appendix D: Data Types). -# <P>For more information on column size, see "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</P> -# </TD> -# </TR> - { name => "COLUMN_SIZE", - type => q(Integer), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>LITERAL_PREFIX<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>4</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>Character 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.</TD> -# </TR> - { name => "LITERAL_PREFIX", - type => q(Varchar), - length => 1, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>LITERAL_SUFFIX<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>5</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>Character 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.</TD> -# </TR> - { name => "LITERAL_SUFFIX", - type => q(Varchar), - length => 1, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>CREATE_PARAMS<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>6</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>A 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. -# <P>The driver supplies the CREATE_PARAMS text in the language of the country where it is used.</P> -# </TD> -# </TR> - { name => "CREATE_PARAMS", - type => q(Varchar), - length => 20, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>NULLABLE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>7</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>Whether the data type accepts a NULL value: -# <P>SQL_NO_NULLS if the data type does not accept NULL values.</P> -# -# <P>SQL_NULLABLE if the data type accepts NULL values.</P> -# -# <P>SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values.</P> -# </TD> -# </TR> - { name => "NULLABLE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>CASE_SENSITIVE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>8</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>Whether a character data type is case-sensitive in collations and comparisons: -# <P>SQL_TRUE if the data type is a character data type and is case-sensitive.</P> -# -# <P>SQL_FALSE if the data type is not a character data type or is not case-sensitive.</P> -# </TD> -# </TR> - { name => "CASE_SENSITIVE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>SEARCHABLE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>9</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>How the data type is used in a <B>WHERE</B> clause: -# <P>SQL_PRED_NONE if the column cannot be used in a <B>WHERE</B> clause. (This is the same as the SQL_UNSEARCHABLE value in ODBC 2.<I>x</I>.)</P> -# -# <P>SQL_PRED_CHAR if the column can be used in a <B>WHERE</B> clause, but only with the <B>LIKE</B> predicate. (This is the same as the SQL_LIKE_ONLY value in ODBC 2.<I>x</I>.)</P> -# -# <P>SQL_PRED_BASIC if the column can be used in a <B>WHERE</B> clause with all the comparison operators except <B>LIKE</B> (comparison, quantified comparison, <B>BETWEEN</B>, <B>DISTINCT</B>, <B>IN</B>, <B>MATCH</B>, and <B>UNIQUE</B>). (This is the same as the SQL_ALL_EXCEPT_LIKE value in ODBC 2.<I>x</I>.)</P> -# -# <P>SQL_SEARCHABLE if the column can be used in a <B>WHERE</B> clause with any comparison operator.</P> -# </TD> -# </TR> - { name => "SEARCHABLE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>UNSIGNED_ATTRIBUTE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>10</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>Whether the data type is unsigned: -# <P>SQL_TRUE if the data type is unsigned.</P> -# -# <P>SQL_FALSE if the data type is signed.</P> -# -# <P>NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.</P> -# </TD> -# </TR> - { name => "UNSIGNED_ATTRIBUTE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>FIXED_PREC_SCALE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>11</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>Whether the data type has predefined fixed precision and scale (which are data source–specific), such as a money data type: -# <P>SQL_TRUE if it has predefined fixed precision and scale.</P> -# -# <P>SQL_FALSE if it does not have predefined fixed precision and scale.</P> -# </TD> -# </TR> - { name => "FIXED_PREC_SCALE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>AUTO_UNIQUE_VALUE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>12</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>Whether the data type is autoincrementing: -# <P>SQL_TRUE if the data type is autoincrementing.</P> -# -# <P>SQL_FALSE if the data type is not autoincrementing.</P> -# -# <P>NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.</P> -# -# <P>An application can insert values into a column having this attribute, but typically cannot update the values in the column. </P> -# -# <P>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.</P> -# </TD> -# </TR> - { name => "AUTO_UNIQUE_VALUE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>LOCAL_TYPE_NAME<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>13</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>Localized 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.</TD> -# </TR> - { name => "LOCAL_TYPE_NAME", - type => q(Varchar), - length => 20, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>MINIMUM_SCALE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>14</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>The 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 "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</TD> -# </TR> - { name => "MINIMUM_SCALE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>MAXIMUM_SCALE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>15</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>The 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 "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</TD> -# </TR> - { name => "MAXIMUM_SCALE", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>SQL_DATA_TYPE<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>16</TD> -# <TD width=15%>Smallint NOT NULL</TD> -# <TD width=38%>The 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. -# <P>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 <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>.) </P> -# </TD> -# </TR> - { name => "SQL_DATA_TYPE", - type => q(Smallint), - length => undef, - nullable => q(false), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>SQL_DATETIME_SUB<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>17</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>When 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. -# <P>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 <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>.)</P> -# </TD> -# </TR> - { name => "SQL_DATETIME_SUB", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>NUM_PREC_RADIX<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>18</TD> -# <TD width=15%>Integer</TD> -# <TD width=38%>If 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.</TD> -# </TR> - { name => "NUM_PREC_RADIX", - type => q(Integer), - length => undef, - nullable => q(true), - position => ++$position, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>INTERVAL_PRECISION<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>19</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>If the data type is an interval data type, then this column contains the value of the interval leading precision. (See "<A HREF="odbcinterval_data_type_precision.htm">Interval Data Type Precision</A>" in Appendix D: Data Types.) Otherwise, this column is NULL.</TD> -# </TR> - { name => "INTERVAL_PRECISION", - type => q(Smallint), - length => undef, - nullable => q(true), - position => ++$position, - }, -# </table></div> -# <!--TS:--> -# <P>Attribute information can apply to data types or to specific columns in a result set. <B>SQLGetTypeInfo</B> returns information about attributes associated with data types; <B>SQLColAttribute</B> returns information about attributes associated with columns in a result set.</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>For information about</TH> -# <TH width=50%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Binding a buffer to a column in a result set</TD> -# <TD width=50%><A HREF="odbcsqlbindcol.htm">SQLBindCol</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Canceling statement processing</TD> -# <TD width=50%><A HREF="odbcsqlcancel.htm">SQLCancel</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning information about a column in a result set</TD> -# <TD width=50%><A HREF="odbcsqlcolattribute.htm">SQLColAttribute</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a block of data or scrolling through a result set</TD> -# <TD width=50%><A HREF="odbcsqlfetchscroll.htm">SQLFetchScroll</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a single row or a block of data in a forward-only direction</TD> -# <TD width=50%><A HREF="odbcsqlfetch.htm">SQLFetch</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning information about a driver or data source</TD> -# <TD width=50%><A HREF="odbcsqlgetinfo.htm">SQLGetInfo</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -); - -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/storage/ndb/src/old_files/client/odbc/docs/handleattr.pl b/storage/ndb/src/old_files/client/odbc/docs/handleattr.pl deleted file mode 100644 index 892d34b105b..00000000000 --- a/storage/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 = { -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLSetEnvAttr</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlsetenvattr"></A>SQLSetEnvAttr</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 3.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLSetEnvAttr</B> sets attributes that govern aspects of environments.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLSetEnvAttr</B>( -# SQLHENV <I>EnvironmentHandle</I>, -# SQLINTEGER <I>Attribute</I>, -# SQLPOINTER <I>ValuePtr</I>, -# SQLINTEGER <I>StringLength</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>EnvironmentHandle</I></DT> -# -# <DD>[Input]<BR> -# Environment handle.</dd> -# -# <DT><I>Attribute</I></DT> -# -# <DD>[Input]<BR> -# Attribute to set, listed in "Comments."</dd> -# -# <DT><I>ValuePtr</I></DT> -# -# <DD>[Input]<BR> -# Pointer to the value to be associated with <I>Attribute</I>. Depending on the value of <I>Attribute</I>, <I>ValuePtr</I> will be a 32-bit integer value or point to a null-terminated character string.</dd> -# -# <DT><I>StringLength</I></DT> -# -# <DD>[Input] If <I>ValuePtr</I> points to a character string or a binary buffer, this argument should be the length of *<I>ValuePtr</I>. If <I>ValuePtr</I> is an integer, <I>StringLength</I> is ignored.</dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLSetEnvAttr</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_ENV and a <I>Handle</I> of <I>EnvironmentHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLSetEnvAttr</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01S02</TD> -# <TD width=26%>Option value changed</TD> -# <TD width=52%>The driver did not support the value specified in <I>ValuePtr</I> and substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation <BR> -# error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY009</TD> -# <TD width=26%>Invalid use of null pointer</TD> -# <TD width=52%>The Attribute argument identified an environment attribute that required a string value, and the <I>ValuePtr</I> argument was a null pointer.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) A connection handle has been allocated on <I>EnvironmentHandle</I>. </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY024</TD> -# <TD width=26%>Invalid attribute value</TD> -# <TD width=52%>Given the specified <I>Attribute</I> value, an invalid value was specified in <I>ValuePtr</I>.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=52%>The <I>StringLength</I> argument was less than 0 but was not SQL_NTS.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY092</TD> -# <TD width=26%>Invalid attribute/option identifier</TD> -# <TD width=52%>(DM) The value specified for the argument <I>Attribute</I> was not valid for the version of ODBC supported by the driver.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>The value specified for the argument <I>Attribute</I> was a valid ODBC environment attribute for the version of ODBC supported by the driver, but was not supported by the driver. -# <P>(DM) The <I>Attribute</I> argument was SQL_ATTR_OUTPUT_NTS, and <I>ValuePtr</I> was SQL_FALSE.</P> -# </TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P>An application can call <B>SQLSetEnvAttr</B> only if no connection handle is allocated on the environment. All environment attributes successfully set by the application for the environment persist until <B>SQLFreeHandle</B> is called on the environment. More than one environment handle can be allocated simultaneously in ODBC 3<I>.x</I>.</P> -# -# <P>The format of information set through <I>ValuePtr</I> depends on the specified <I>Attribute</I>. <B>SQLSetEnvAttr</B> 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.</P> -# -# <P>There are no driver-specific environment attributes.</P> -# -# <P>Connection attributes cannot be set by a call to <B>SQLSetEnvAttr</B>. Attempting to do so will return SQLSTATE HY092 (Invalid attribute/option identifier).</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=35%><I>Attribute</I></TH> -# <TH width=65%><I>ValuePtr</I> contents</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=35%>SQL_ATTR_CONNECTION_POOLING<BR> -# (ODBC 3.0)</TD> -# <TD width=65%>A 32-bit SQLUINTEGER value that enables or disables connection pooling at the environment level. The following values are used: -# <P>SQL_CP_OFF = Connection pooling is turned off. This is the default.</P> -# -# <P>SQL_CP_ONE_PER_DRIVER = A single connection pool is supported for each driver. Every connection in a pool is associated with one driver.</P> -# -# <P>SQL_CP_ONE_PER_HENV = A single connection pool is supported for each environment. Every connection in a pool is associated with one environment.</P> -# -# <P>Connection pooling is enabled by calling <B>SQLSetEnvAttr</B> 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 <B>SQLSetEnvAttr</B> 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 <B>SQLAllocHandle</B> with the <I>InputHandle</I> argument set to SQL_HANDLE_ENV.</P> -# -# <P>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 <B>SQLSetEnvAttr</B> 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.</P> -# -# <P>For more information, see "<A HREF="odbcodbc_connection_pooling.htm">ODBC Connection Pooling</A>" in Chapter 6: Connecting to a Data Source or Driver.</P> -# </TD> -# </TR> - 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, - }, -# <TR VALIGN="top"> -# <TD width=35%>SQL_ATTR_CP_MATCH<BR> -# (ODBC 3.0)</TD> -# <TD width=65%>A 32-bit SQLUINTEGER value that determines how a connection is chosen from a connection pool. When <B>SQLConnect</B> or <B>SQLDriverConnect</B> 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. -# <P>The following values are used to set the value of this attribute:</P> -# -# <P>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.</P> -# -# <P>SQL_CP_RELAXED_MATCH = Connections with matching connection string keywords can be used. Keywords must match, but not all connection attributes must match.</P> -# -# <P>For more information on how the Driver Manager performs the match in connecting to a pooled connection, see <A HREF="odbcsqlconnect.htm">SQLConnect</A>. For more information on connection pooling, see "<A HREF="odbcodbc_connection_pooling.htm">ODBC Connection Pooling</A>" in Chapter 6: Connecting to a Data Source or Driver.</P> -# </TD> -# </TR> - 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, - }, -# <TR VALIGN="top"> -# <TD width=35%>SQL_ATTR_ODBC_VERSION<BR> -# (ODBC 3.0)</TD> -# <TD width=65%>A 32-bit integer that determines whether certain functionality exhibits ODBC 2<I>.x</I> behavior or ODBC 3<I>.x</I> behavior. The following values are used to set the value of this attribute: -# <P>SQL_OV_ODBC3 = The Driver Manager and driver exhibit the following ODBC 3<I>.x</I> behavior: -# -# <UL type=disc> -# <LI>The driver returns and expects ODBC 3<I>.x</I> codes for date, time, and timestamp.</li> -# -# <LI>The driver returns ODBC 3<I>.x</I> SQLSTATE codes when <B>SQLError</B>, <B>SQLGetDiagField</B>, or <B>SQLGetDiagRec</B> is called.</li> -# -# <LI>The <I>CatalogName</I> argument in a call to <B>SQLTables</B> accepts a search pattern.</li> -# </UL> -# -# <P>SQL_OV_ODBC2 = The Driver Manager and driver exhibit the following ODBC 2<I>.x </I>behavior. This is especially useful for an ODBC 2<I>.x</I> application working with an ODBC 3<I>.x</I> driver. -# -# <UL type=disc> -# <LI>The driver returns and expects ODBC 2<I>.x</I> codes for date, time, and timestamp.</li> -# -# <LI>The driver returns ODBC 2<I>.x</I> SQLSTATE codes when <B>SQLError</B>, <B>SQLGetDiagField</B>, or <B>SQLGetDiagRec</B> is called.</li> -# -# <LI>The <I>CatalogName</I> argument in a call to <B>SQLTables</B> does not accept a search pattern.</li> -# </UL> -# -# <P>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. -# -# <UL type=disc> -# <LI>For more information, see "<A HREF="odbcdeclaring_the_application_s_odbc_version.htm">Declaring the Application's ODBC Version</A>" in Chapter 6: Connecting to a Data Source or Driver and "<A HREF="odbcbehavioral_changes.htm">Behavioral Changes</A>" in Chapter 17: Programming Considerations.</li> -# </UL> -# </TD> -# </TR> - SQL_ATTR_ODBC_VERSION => { - type => q(SQLINTEGER), - ptr => 0, - value => [ qw(SQL_OV_ODBC3 SQL_OV_ODBC2) ], - default => undef, - mode => 'rw', - order => ++$order, - }, -# <TR VALIGN="top"> -# <TD width=35%>SQL_ATTR_OUTPUT_NTS<BR> -# (ODBC 3.0)</TD> -# <TD width=65%>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. -# <P>This attribute defaults to SQL_TRUE. A call to <B>SQLSetEnvAttr</B> to set it to SQL_TRUE returns SQL_SUCCESS. A call to <B>SQLSetEnvAttr</B> to set it to SQL_FALSE returns SQL_ERROR and SQLSTATE HYC00 (Optional feature not implemented).</P> -# </TD> -# </TR> - SQL_ATTR_OUTPUT_NTS => { - type => q(SQLINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_TRUE), - mode => 'rw', - order => ++$order, - } -# </table></div> -# <!--TS:--> -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>For information about</TH> -# <TH width=52%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Allocating a handle</TD> -# <TD width=52%><A HREF="odbcsqlallochandle.htm">SQLAllocHandle</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Returning the setting of an environment attribute</TD> -# <TD width=52%><A HREF="odbcsqlgetenvattr.htm">SQLGetEnvAttr</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -}; - -# -# odbcsqlsetconnectattr.htm -# -my $attrDbc = { -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLSetConnectAttr</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlsetconnectattr"></A>SQLSetConnectAttr</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 3.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLSetConnectAttr</B> sets attributes that govern aspects of connections.</P> -# -# <P class="indent"><b class="le">Note</b> For more information about what the Driver Manager maps this function to when an ODBC 3<I>.x</I> application is working with an ODBC 2<I>.x</I> driver, see "<A HREF="odbcmapping_replacement_functions_for_backward_compatibility_of_applications.htm">Mapping Replacement Functions for Backward Compatibility of Applications</A>" in Chapter 17: Programming Considerations.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLSetConnectAttr</B>( -# SQLHDBC <I>ConnectionHandle</I>, -# SQLINTEGER <I>Attribute</I>, -# SQLPOINTER <I>ValuePtr</I>, -# SQLINTEGER <I>StringLength</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>ConnectionHandle</I></DT> -# -# <DD>[Input]<BR> -# Connection handle.</dd> -# -# <DT><I>Attribute</I></DT> -# -# <DD>[Input]<BR> -# Attribute to set, listed in "Comments."</dd> -# -# <DT><I>ValuePtr</I></DT> -# -# <DD>[Input]<BR> -# Pointer to the value to be associated with <I>Attribute</I>. Depending on the value of <I>Attribute</I>, <I>ValuePtr</I> will be a 32-bit unsigned integer value or will point to a null-terminated character string. Note that if the <I>Attribute</I> argument is a driver-specific value, the value in <I>ValuePtr</I> may be a signed integer.</dd> -# -# <DT><I>StringLength</I></DT> -# -# <DD>[Input]<BR> -# If <I>Attribute</I> is an ODBC-defined attribute and <I>ValuePtr</I> points to a character string or a binary buffer, this argument should be the length of *<I>ValuePtr</I>. If <I>Attribute</I> is an ODBC-defined attribute and <I>ValuePtr</I> is an integer, <I>StringLength</I> is ignored. -# -# <P>If <I>Attribute</I> is a driver-defined attribute, the application indicates the nature of the attribute to the Driver Manager by setting the <I>StringLength</I> argument. <I>StringLength</I> can have the following values: -# -# -# <UL type=disc> -# <LI>If <I>ValuePtr</I> is a pointer to a character string, then <I>StringLength</I> is the length of the string or SQL_NTS.</li> -# -# <LI>If <I>ValuePtr</I> is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(<I>length</I>) macro in <I>StringLength</I>. This places a negative value in <I>StringLength</I>.</li> -# -# <LI>If <I>ValuePtr</I> is a pointer to a value other than a character string or a binary string, then <I>StringLength</I> should have the value SQL_IS_POINTER.</li> -# -# <LI>If <I>ValuePtr</I> contains a fixed-length value, then <I>StringLength</I> is either SQL_IS_INTEGER or SQL_IS_UINTEGER, as appropriate.</li> -# </UL> -# </dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLSetConnectAttr</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_DBC and a <I>Handle</I> of <I>ConnectionHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLSetConnectAttr</B> 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.</P> -# -# <P>The driver can return SQL_SUCCESS_WITH_INFO to provide information about the result of setting an option.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01S02</TD> -# <TD width=26%>Option value changed</TD> -# <TD width=52%>The driver did not support the value specified in <I>ValuePtr</I> and substituted a similar value. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08002</TD> -# <TD width=26%>Connection name in use</TD> -# <TD width=52%>The <I>Attribute</I> argument was SQL_ATTR_ODBC_CURSORS, and the driver was already connected to the data source.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08003</TD> -# <TD width=26%>Connection does not exist</TD> -# <TD width=52%>(DM) An <I>Attribute</I> value was specified that required an open connection, but the <I>ConnectionHandle</I> was not in a connected state.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>The <I>Attribute</I> argument was SQL_ATTR_CURRENT_CATALOG, and a result set was pending.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>3D000</TD> -# <TD width=26%>Invalid catalog name</TD> -# <TD width=52%>The <I>Attribute</I> argument was SQL_CURRENT_CATALOG, and the specified catalog name was invalid.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY009</TD> -# <TD width=26%>Invalid use of null pointer</TD> -# <TD width=52%>The <I>Attribute</I> argument identified a connection attribute that required a string value, and the <I>ValuePtr </I>argument was a null pointer.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function was called for a <I>StatementHandle</I> associated with the <I>ConnectionHandle</I> and was still executing when <B>SQLSetConnectAttr</B> was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for a <I>StatementHandle</I> associated with the <I>ConnectionHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# -# <P>(DM) <B>SQLBrowseConnect</B> was called for the <I>ConnectionHandle</I> and returned SQL_NEED_DATA. This function was called before <B>SQLBrowseConnect</B> returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY011</TD> -# <TD width=26%>Attribute cannot be set now</TD> -# <TD width=52%>The <I>Attribute</I> argument was SQL_ATTR_TXN_ISOLATION, and a transaction was open.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY024</TD> -# <TD width=26%>Invalid attribute value</TD> -# <TD width=52%>Given the specified <I>Attribute</I> value, an invalid value was specified in <I>ValuePtr</I>. (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 <I>ValuePtr</I>.) -# <P>The <I>Attribute</I> argument was SQL_ATTR_TRACEFILE or SQL_ATTR_TRANSLATE_LIB, and <I>ValuePtr</I> was an empty string.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=52%><I>(DM) *ValuePtr </I>is a character string, and the <I>StringLength</I> argument was less than 0 but was not SQL_NTS.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY092</TD> -# <TD width=26%>Invalid attribute/option identifier</TD> -# <TD width=52%>(DM) The value specified for the argument <I>Attribute</I> was not valid for the version of ODBC supported by the driver. -# <P>(DM) The value specified for the argument <I>Attribute</I> was a read-only attribute.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>The value specified for the argument <I>Attribute</I> was a valid ODBC connection or statement attribute for the version of ODBC supported by the driver but was not supported by the driver.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver associated with the <I>ConnectionHandle</I> does not support the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM009</TD> -# <TD width=26%>Unable to load translation DLL</TD> -# <TD width=52%>The driver was unable to load the translation DLL that was specified for the connection. This error can be returned only when <I>Attribute</I> is SQL_ATTR_TRANSLATE_LIB.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>When <I>Attribute</I> is a statement attribute, <B>SQLSetConnectAttr</B> can return any SQLSTATEs returned by <B>SQLSetStmtAttr</B>.</P> -# -# <P class="label"><B>Comments</B></P> -# -# <P>For general information about connection attributes, see "<A HREF="odbcconnection_attributes.htm">Connection Attributes</A>" in Chapter 6: Connecting to a Data Source or Driver.</P> -# -# <P>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.</P> -# -# <P class="indent"><b class="le">Note</b> The ability to set statement attributes at the connection level by calling <B>SQLSetConnectAttr</B> has been deprecated in ODBC 3<I>.x</I>. ODBC 3<I>.x</I> applications should never set statement attributes at the connection level. ODBC 3<I>.x</I> 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.</P> -# -# <P class="indent">ODBC 3<I>.x</I> drivers need only support this functionality if they should work with ODBC 2<I>.x</I> applications that set ODBC 2<I>.x</I> statement options at the connection level. For more information, see "<A HREF="odbcsqlsetconnectoption_mapping.htm">SQLSetConnectOption Mapping</A>" in Appendix G: Driver Guidelines for Backward Compatibility.</P> -# -# <P>An application can call <B>SQLSetConnectAttr</B> 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 <B>SQLFreeHandle</B> is called on the connection. For example, if an application calls <B>SQLSetConnectAttr</B> before connecting to a data source, the attribute persists even if <B>SQLSetConnectAttr</B> 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.</P> -# -# <P>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. <I>Either</I> indicates that the attribute can be set either before or after connection.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>Attribute</TH> -# <TH width=50%>Set before or after connection?</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_ACCESS_MODE</TD> -# <TD width=50%>Either<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_ASYNC_ENABLE</TD> -# <TD width=50%>Either<SUP>[2]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_AUTOCOMMIT</TD> -# <TD width=50%>Either</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_CONNECTION_TIMEOUT</TD> -# <TD width=50%>Either</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_CURRENT_CATALOG</TD> -# <TD width=50%>Either<SUP>[1]</SUP></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_LOGIN_TIMEOUT</TD> -# <TD width=50%>Before</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_METADATA_ID</TD> -# <TD width=50%>Either</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_ODBC_CURSORS</TD> -# <TD width=50%>Before</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_PACKET_SIZE</TD> -# <TD width=50%>Before</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_QUIET_MODE</TD> -# <TD width=50%>Either</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_TRACE</TD> -# <TD width=50%>Either</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_TRACEFILE</TD> -# <TD width=50%>Either</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_TRANSLATE_LIB</TD> -# <TD width=50%>After</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_TRANSLATE_OPTION</TD> -# <TD width=50%>After</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>SQL_ATTR_TXN_ISOLATION</TD> -# <TD width=50%>Either<SUP>[3]</SUP></TD> -# </TR> -# </table></div> -# -# <P class="fineprint">[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.</p> -# <P class="fineprint">[2] SQL_ATTR_ASYNC_ENABLE must be set before there is an active statement.</p> -# <P class="fineprint">[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 *<I>ValuePtr</I>. In such cases, the driver returns SQL_SUCCESS_WITH_INFO and SQLSTATE 01S02 (Option value changed). For example, if <I>Attribute</I> is SQL_ATTR_PACKET_SIZE and *<I>ValuePtr</I> exceeds the maximum packet size, the driver substitutes the maximum size. To determine the substituted value, an application calls <B>SQLGetConnectAttr</B>.</p> -# <P>The format of information set in the *<I>ValuePtr</I> buffer depends on the specified <I>Attribute</I>. <B>SQLSetConnectAttr</B> 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 <I>ValuePtr</I> argument of <B>SQLSetConnectAttr</B> have a length of <I>StringLength</I> bytes.</P> -# -# <P>The <I>StringLength</I> argument is ignored if the length is defined by the attribute, as is the case for all attributes introduced in ODBC 2<I>.x</I> or earlier.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=38%><I>Attribute</I></TH> -# <TH width=62%><I>ValuePtr</I> contents</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ACCESS_MODE<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>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.</TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ASYNC_ENABLE<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies whether a function called with a statement on the specified connection is executed asynchronously: -# <P>SQL_ASYNC_ENABLE_OFF = Off (the default)<BR> -# SQL_ASYNC_ENABLE_ON = On</P> -# -# <P>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.</P> -# -# <P>This attribute can be set whether <B>SQLGetInfo</B> with the SQL_ASYNC_MODE information type returns SQL_AM_CONNECTION or SQL_AM_STATEMENT.</P> -# -# <P>After a function has been called asynchronously, only the original function, <B>SQLAllocHandle</B>, <B>SQLCancel</B>, <B>SQLGetDiagField</B>, or <B>SQLGetDiagRec </B>can be called on the statement or the connection associated with <I>StatementHandle</I>, until the original function returns a code other than SQL_STILL_EXECUTING. Any other function called on <I>StatementHandle</I> or the connection associated with <I>StatementHandle</I> returns SQL_ERROR with an SQLSTATE of HY010 (Function sequence error). Functions can be called on other statements. For more information, see "<A HREF="odbcasynchronous_execution.htm">Asynchronous Execution</A>" in Chapter 9: Executing Statements.</P> -# -# <P>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.</P> -# -# <P>The following functions can be executed asynchronously:</P> -# -# <P><B>SQLBulkOperations<BR> -# SQLColAttribute</B><BR> -# <B>SQLColumnPrivileges</B><BR> -# <B>SQLColumns</B><BR> -# <B>SQLCopyDesc</B><BR> -# <B>SQLDescribeCol</B><BR> -# <B>SQLDescribeParam</B><BR> -# <B>SQLExecDirect</B><BR> -# <B>SQLExecute</B><BR> -# <B>SQLFetch</B><BR> -# <B>SQLFetchScroll</B><BR> -# <B>SQLForeignKeys</B><BR> -# <B>SQLGetData</B><BR> -# <B>SQLGetDescField</B><SUP>[1]<BR> -# </SUP><B>SQLGetDescRec</B><SUP>[1]</SUP><B><BR> -# SQLGetDiagField</B><BR> -# <B>SQLGetDiagRec<BR> -# SQLGetTypeInfo</B><BR> -# <B>SQLMoreResults</B><BR> -# <B>SQLNumParams</B><BR> -# <B>SQLNumResultCols</B><BR> -# <B>SQLParamData</B><BR> -# <B>SQLPrepare</B><BR> -# <B>SQLPrimaryKeys</B><BR> -# <B>SQLProcedureColumns</B><BR> -# <B>SQLProcedures</B><BR> -# <B>SQLPutData</B><BR> -# <B>SQLSetPos</B><BR> -# <B>SQLSpecialColumns</B><BR> -# <B>SQLStatistics</B><BR> -# <B>SQLTablePrivileges</B><BR> -# <B>SQLTables</B></P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_AUTO_IPD<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>A read-only SQLUINTEGER value that specifies whether automatic population of the IPD after a call to <B>SQLPrepare </B>is supported: -# <P>SQL_TRUE = Automatic population of the IPD after a call to <B>SQLPrepare </B>is supported by the driver.</P> -# -# <P>SQL_FALSE = Automatic population of the IPD after a call to <B>SQLPrepare </B>is not supported by the driver. Servers that do not support prepared statements will not be able to populate the IPD automatically. </P> -# -# <P>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.</P> -# -# <P>This connection attribute can be returned by <B>SQLGetConnectAttr</B> but cannot be set by <B>SQLSetConnectAttr</B>.</P> -# </TD> -# </TR> - SQL_ATTR_AUTO_IPD => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_AUTOCOMMIT<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies whether to use autocommit or manual-commit mode: -# <P>SQL_AUTOCOMMIT_OFF = The driver uses manual-commit mode, and the application must explicitly commit or roll back transactions with <B>SQLEndTran</B>.</P> -# -# <P>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.</P> -# -# <P>For more information, see "<A HREF="odbccommit_mode.htm">Commit Mode</A>" in Chapter 14: Transactions.</P> -# -# <P class="indent"><b class="le">Important </b>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 <A HREF="odbcsqlgetinfo.htm">SQLGetInfo</A> and "<A HREF="odbceffect_of_transactions_on_cursors_and_prepared_statements.htm">Effect of Transactions on Cursors and Prepared Statements</A>" in Chapter 14: Transactions.</P> -# -# <P>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.</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CONNECTION_DEAD -# <P>(ODBC 3.5)</P> -# </TD> -# <TD width=62%>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.</TD> -# </TR> - SQL_ATTR_CONNECTION_DEAD => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_CD_FALSE SQL_CD_TRUE) ], - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CONNECTION_TIMEOUT<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>If <I>ValuePtr</I> is equal to 0 (the default), there is no timeout.</P> -# </TD> -# </TR> - SQL_ATTR_CONNECTION_TIMEOUT => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => 0, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CURRENT_CATALOG<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>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 <B>USE</B> <I>database</I> statement to the data source, where <I>database</I> is the database specified in *<I>ValuePtr</I>. For a single-tier driver, the catalog might be a directory, so the driver changes its current directory to the directory specified in *<I>ValuePtr</I>.</TD> -# </TR> - SQL_ATTR_CURRENT_CATALOG => { - type => q(SQLCHAR), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_LOGIN_TIMEOUT<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>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 <I>ValuePtr</I> is 0, the timeout is disabled and a connection attempt will wait indefinitely. -# <P>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).</P> -# </TD> -# </TR> - SQL_ATTR_LOGIN_TIMEOUT => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => 0, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_METADATA_ID<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that determines how the string arguments of catalog functions are treated. -# <P>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). </P> -# -# <P>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.</P> -# -# <P>The default value is SQL_FALSE.</P> -# -# <P>The <I>TableType</I> argument of <B>SQLTables</B>, which takes a list of values, is not affected by this attribute.</P> -# -# <P>SQL_ATTR_METADATA_ID can also be set on the statement level. (It is the only connection attribute that is also a statement attribute.)</P> -# -# <P>For more information, see "<A HREF="odbcarguments_in_catalog_functions.htm">Arguments in Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# </TD> -# </TR> - SQL_ATTR_METADATA_ID => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_FALSE), - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ODBC_CURSORS<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value specifying how the Driver Manager uses the ODBC cursor library: -# <P>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 <B>SQLFetchScroll</B>, the Driver Manager uses the scrolling capabilities of the driver. Otherwise, it uses the ODBC cursor library.</P> -# -# <P>SQL_CUR_USE_ODBC = The Driver Manager uses the ODBC cursor library.</P> -# -# <P>SQL_CUR_USE_DRIVER = The Driver Manager uses the scrolling capabilities of the driver. This is the default setting.</P> -# -# <P>For more information about the ODBC cursor library, see <A HREF="odbcodbc_cursor_library.htm">Appendix F: ODBC Cursor Library</A>.</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PACKET_SIZE<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value specifying the network packet size in bytes. -# <P class="indent"><B>Note</B> Many data sources either do not support this option or only can return but not set the network packet size.</P> -# -# <P>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).</P> -# -# <P>If the application sets packet size after a connection has already been made, the driver will return SQLSTATE HY011 (Attribute cannot be set now).</P> -# </TD> -# </TR> - SQL_ATTR_PACKET_SIZE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_QUIET_MODE<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>A 32-bit window handle (<I>hwnd</I>). -# <P>If the window handle is a null pointer, the driver does not display any dialog boxes.</P> -# -# <P>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.</P> -# -# <P class="indent"><b class="le">Note </b>The SQL_ATTR_QUIET_MODE connection attribute does not apply to dialog boxes displayed by <B>SQLDriverConnect</B>.</P> -# </TD> -# </TR> - SQL_ATTR_QUIET_MODE => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_TRACE<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value telling the Driver Manager whether to perform tracing: -# <P>SQL_OPT_TRACE_OFF = Tracing off (the default)</P> -# -# <P>SQL_OPT_TRACE_ON = Tracing on</P> -# -# <P>When tracing is on, the Driver Manager writes each ODBC function call to the trace file.</P> -# -# <P class="indent"><b class="le">Note </b>When tracing is on, the Driver Manager can return SQLSTATE IM013 (Trace file error) from any function.</P> -# -# <P>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. </P> -# -# <P>An application can set the variable <B>ODBCSharedTraceFlag</B> 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.</P> -# -# <P>If the <B>Trace</B> keyword in the system information is set to 1 when an application calls <B>SQLAllocHandle</B> with a <I>HandleType</I> of SQL_HANDLE_ENV, tracing is enabled for all handles. It is enabled only for the application that called <B>SQLAllocHandle</B>.</P> -# -# <P>Calling <B>SQLSetConnectAttr</B> with an <I>Attribute</I> of SQL_ATTR_TRACE does not require that the <I>ConnectionHandle</I> argument be valid and will not return SQL_ERROR if <I>ConnectionHandle</I> is NULL. This attribute applies to all connections.</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_TRACEFILE<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>A null-terminated character string containing the name of the trace file. -# <P>The default value of the SQL_ATTR_TRACEFILE attribute is specified with the <B>TraceFile</B> keyword in the system information. For more information, see "<A HREF="odbcodbc_subkey.htm">ODBC Subkey</A>" in Chapter 19: Configuring Data Sources.</P> -# -# <P>Calling <B>SQLSetConnectAttr</B> with an <I>Attribute</I> of SQL_ATTR_ TRACEFILE does not require the <I>ConnectionHandle</I> argument to be valid and will not return SQL_ERROR if <I>ConnectionHandle</I> is invalid. This attribute applies to all connections.</P> -# </TD> -# </TR> - SQL_ATTR_TRACEFILE => { - type => q(SQLCHAR), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_TRANSLATE_LIB<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>A null-terminated character string containing the name of a library containing the functions <B>SQLDriverToDataSource</B> and <B>SQLDataSourceToDriver</B> 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 "<A HREF="odbctranslation_dlls.htm">Translation DLLs</A>" in Chapter 17: Programming Considerations, and <A HREF="odbctranslation_dll_function_reference.htm">Chapter 24: Translation DLL Function Reference</A>.</TD> -# </TR> - SQL_ATTR_TRANSLATE_LIB => { - type => q(SQLCHAR), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_TRANSLATE_OPTION<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>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 "<A HREF="odbctranslation_dlls.htm">Translation DLLs</A>" in Chapter 17: Programming Considerations.</TD> -# </TR> - SQL_ATTR_TRANSLATE_OPTION => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_TXN_ISOLATION<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>A 32-bit bitmask that sets the transaction isolation level for the current connection. An application must call <B>SQLEndTran</B> to commit or roll back all open transactions on a connection, before calling <B>SQLSetConnectAttr</B> with this option. -# <P>The valid values for <I>ValuePtr</I> can be determined by calling <B>SQLGetInfo</B> with <I>InfoType</I> equal to SQL_TXN_ISOLATION_OPTIONS.</P> -# -# <P>For a description of transaction isolation levels, see the description of the SQL_DEFAULT_TXN_ISOLATION information type in <B>SQLGetInfo</B> and "<A HREF="odbctransaction_isolation_levels.htm">Transaction Isolation Levels</A>" in Chapter 14: Transactions.</P> -# </TD> -# </TR> - SQL_ATTR_TXN_ISOLATION => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# </table></div> -# -# <P class="fineprint">[1] These functions can be called asynchronously only if the descriptor is an implementation descriptor, not an application descriptor.</p> -# <P class="label"><B>Code Example</B></P> -# -# <P>See <A HREF="odbcsqlconnect.htm">SQLConnect</A>.</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>For information about</TH> -# <TH width=52%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Allocating a handle</TD> -# <TD width=52%><A HREF="odbcsqlallochandle.htm">SQLAllocHandle</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>Returning the setting of a connection <BR> -# attribute</TD> -# <TD width=52%><A HREF="odbcsqlgetconnectattr.htm">SQLGetConnectAttr</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -}; - -# -# odbcsqlsetstmtattr.htm -# -my $attrStmt = { -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLSetStmtAttr</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlsetstmtattr"></A>SQLSetStmtAttr</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 3.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLSetStmtAttr</B> sets attributes related to a statement.</P> -# -# <P class="indent"><b class="le">Note</b> For more information about what the Driver Manager maps this function to when an ODBC 3<I>.x</I> application is working with an ODBC 2<I>.x</I> driver, see "<A HREF="odbcmapping_replacement_functions_for_backward_compatibility_of_applications.htm">Mapping Replacement Functions for Backward Compatibility of Applications</A>" in Chapter 17: Programming Considerations.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLSetStmtAttr</B>( -# SQLHSTMT <I>StatementHandle</I>, -# SQLINTEGER <I>Attribute</I>, -# SQLPOINTER <I>ValuePtr</I>, -# SQLINTEGER <I>StringLength</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>StatementHandle</I></DT> -# -# <DD>[Input]<BR> -# Statement handle.</dd> -# -# <DT><I>Attribute</I></DT> -# -# <DD>[Input]<BR> -# Option to set, listed in "Comments."</dd> -# -# <DT><I>ValuePtr</I></DT> -# -# <DD>[Input]<BR> -# Pointer to the value to be associated with <I>Attribute</I>. Depending on the value of <I>Attribute</I>, <I>ValuePtr</I> 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 <I>Attribute</I> argument is a driver-specific value, <I>ValuePtr</I> may be a signed integer.</dd> -# -# <DT><I>StringLength</I></DT> -# -# <DD>[Input]<BR> -# If <I>Attribute</I> is an ODBC-defined attribute and <I>ValuePtr</I> points to a character string or a binary buffer, this argument should be the length of *<I>ValuePtr</I>. If <I>Attribute</I> is an ODBC-defined attribute and <I>ValuePtr</I> is an integer, <I>StringLength</I> is ignored. -# -# <P>If <I>Attribute</I> is a driver-defined attribute, the application indicates the nature of the attribute to the Driver Manager by setting the <I>StringLength</I> argument. <I>StringLength</I> can have the following values: -# </dd> -# </DL> -# -# <UL type=disc> -# <LI>If <I>ValuePtr</I> is a pointer to a character string, then <I>StringLength</I> is the length of the string or SQL_NTS.</li> -# -# <LI>If <I>ValuePtr</I> is a pointer to a binary buffer, then the application places the result of the SQL_LEN_BINARY_ATTR(<I>length</I>) macro in <I>StringLength</I>. This places a negative value in <I>StringLength</I>.</li> -# -# <LI>If <I>ValuePtr</I> is a pointer to a value other than a character string or a binary string, then <I>StringLength</I> should have the value SQL_IS_POINTER. </li> -# -# <LI>If <I>ValuePtr</I> contains a fixed-length value, then <I>StringLength</I> is either SQL_IS_INTEGER or SQL_IS_UINTEGER, as appropriate.</li> -# </UL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLSetStmtAttr</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_STMT and a <I>Handle</I> of <I>StatementHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLSetStmtAttr</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01S02</TD> -# <TD width=26%>Option value changed</TD> -# <TD width=52%>The driver did not support the value specified in <I>ValuePtr</I>, or the value specified in <I>ValuePtr</I> was invalid because of implementation working conditions, so the driver substituted a similar value. (<B>SQLGetStmtAttr</B> can be called to determine the temporarily substituted value.) The substitute value is valid for the <I>StatementHandle</I> until the cursor is closed, at which point the statement attribute reverts to its previous value. The statement attributes that can be changed are: -# <P>SQL_ ATTR_CONCURRENCY<BR> -# SQL_ ATTR_CURSOR_TYPE<BR> -# SQL_ ATTR_KEYSET_SIZE<BR> -# SQL_ ATTR_MAX_LENGTH<BR> -# SQL_ ATTR_MAX_ROWS<BR> -# SQL_ ATTR_QUERY_TIMEOUT <BR> -# SQL_ATTR_ROW_ARRAY_SIZE<BR> -# SQL_ ATTR_SIMULATE_CURSOR </P> -# -# <P>(Function returns SQL_SUCCESS_WITH_INFO.)</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>The <I>Attribute</I> was SQL_ATTR_CONCURRENCY, SQL_ATTR_CURSOR_TYPE, SQL_ATTR_SIMULATE_CURSOR, or SQL_ATTR_USE_BOOKMARKS, and the cursor was open.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation <BR> -# error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY009</TD> -# <TD width=26%>Invalid use of null pointer</TD> -# <TD width=52%>The <I>Attribute</I> argument identified a statement attribute that required a string attribute, and the <I>ValuePtr </I>argument was a null pointer.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function was called for the <I>StatementHandle</I> and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY011</TD> -# <TD width=26%>Attribute cannot be set now</TD> -# <TD width=52%>The <I>Attribute</I> was SQL_ATTR_CONCURRENCY, SQL_ ATTR_CURSOR_TYPE, SQL_ ATTR_SIMULATE_CURSOR, or SQL_ ATTR_USE_BOOKMARKS, and the statement was prepared.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY017</TD> -# <TD width=26%>Invalid use of an automatically allocated descriptor handle</TD> -# <TD width=52%>(DM) The <I>Attribute</I> argument was SQL_ATTR_IMP_ROW_DESC or SQL_ATTR_IMP_PARAM_DESC. -# <P>(DM) The <I>Attribute</I> argument was SQL_ATTR_APP_ROW_DESC or SQL_ATTR_APP_PARAM_DESC, and the value in <I>ValuePtr</I> was an implicitly allocated descriptor handle other than the handle originally allocated for the ARD or APD.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY024</TD> -# <TD width=26%>Invalid attribute value</TD> -# <TD width=52%>Given the specified <I>Attribute</I> value, an invalid value was specified in <I>ValuePtr</I>. (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 <I>ValuePtr</I>.) -# <P>The <I>Attribute</I> argument was SQL_ATTR_APP_ROW_DESC or SQL_ATTR_APP_PARAM_DESC, and <I>ValuePtr</I> was an explicitly allocated descriptor handle that is not on the same connection as the <I>StatementHandle</I> argument.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=52%>(DM) <I>*ValuePtr</I> is a character string, and the <I>StringLength</I> argument was less than 0 but was not SQL_NTS.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY092</TD> -# <TD width=26%>Invalid attribute/option identifier</TD> -# <TD width=52%>(DM) The value specified for the argument <I>Attribute</I> was not valid for the version of ODBC supported by the driver. -# <P>(DM) The value specified for the argument <I>Attribute</I> was a read-only attribute.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>The value specified for the argument <I>Attribute</I> was a valid ODBC statement attribute for the version of ODBC supported by the driver but was not supported by the driver. -# <P>The <I>Attribute</I> argument was SQL_ATTR_ASYNC_ENABLE, and a call to <B>SQLGetInfo</B> with an <I>InfoType</I> of SQL_ASYNC_MODE returns SQL_AM_CONNECTION.</P> -# -# <P>The <I>Attribute</I> argument was SQL_ATTR_ENABLE_AUTO_IPD, and the value of the connection attribute SQL_ATTR_AUTO_IPD was SQL_FALSE.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver associated with the <I>StatementHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P>Statement attributes for a statement remain in effect until they are changed by another call to <B>SQLSetStmtAttr</B> or until the statement is dropped by calling <B>SQLFreeHandle</B>. Calling <B>SQLFreeStmt</B> with the SQL_CLOSE, SQL_UNBIND, or SQL_RESET_PARAMS option does not reset statement attributes.</P> -# -# <P>Some statement attributes support substitution of a similar value if the data source does not support the value specified in <I>ValuePtr</I>. In such cases, the driver returns SQL_SUCCESS_WITH_INFO and SQLSTATE 01S02 (Option value changed). For example, if <I>Attribute</I> is SQL_ATTR_CONCURRENCY and <I>ValuePtr</I> 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 <B>SQLGetStmtAttr</B>.</P> -# -# <P>The format of information set with <I>ValuePtr</I> depends on the specified <I>Attribute</I>. <B>SQLSetStmtAttr</B> 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 <B>SQLGetStmtAttr</B>. Character strings pointed to by the <I>ValuePtr</I> argument of <B>SQLSetStmtAttr</B> have a length of <I>StringLength</I>.</P> -# -# <P class="indent"><b class="le">Note</b> The ability to set statement attributes at the connection level by calling <B>SQLSetConnectAttr</B> has been deprecated in ODBC 3<I>.x</I>. ODBC 3<I>.x</I> applications should never set statement attributes at the connection level. ODBC 3<I>.x</I> 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.</P> -# -# <P class="indent">ODBC 3<I>.x</I> drivers need only support this functionality if they should work with ODBC 2<I>.x</I> applications that set ODBC 2<I>.x</I> statement options at the connection level. For more information, see "Setting Statement Options on the Connection Level" under "<A HREF="odbcsqlsetconnectoption_mapping.htm">SQLSetConnectOption Mapping</A>" in Appendix G: Driver Guidelines for Backward Compatibility.</P> -# -# <H1>Statement Attributes That Set Descriptor Fields</H1> -# -# <P>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 <B>SQLSetStmtAttr</B> rather than to <B>SQLSetDescField</B> has the advantage that a descriptor handle does not have to be obtained for the function call.</P> -# -# <P class="indent"><b class="le">Caution</b> Calling <B>SQLSetStmtAttr</B> 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 <B>SQLSetStmtAttr</B> 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 <B>SQLSetStmtAttr</B> to set the SQL_ATTR_APP_ROW_DESC or SQL_ATTR_APP_PARAM_DESC field to a different descriptor handle) before calling <B>SQLSetStmtAttr</B> again.</P> -# -# <P>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 <I>StatementHandle</I> 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 <B>SQLSetDescField</B>, 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.</P> -# -# <P>When a statement is allocated (see <A HREF="odbcsqlallochandle.htm">SQLAllocHandle</A>), four descriptor handles are automatically allocated and associated with the statement. Explicitly allocated descriptor handles can be associated with the statement by calling <B>SQLAllocHandle</B> with an <I>fHandleType</I> of SQL_HANDLE_DESC to allocate a descriptor handle and then calling <B>SQLSetStmtAttr</B> to associate the descriptor handle with the statement. </P> -# -# <P>The statement attributes in the following table correspond to descriptor header fields.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=42%>Statement attribute</TH> -# <TH width=45%>Header field</TH> -# <TH width=13%>Desc.</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_PARAM_BIND_OFFSET_PTR</TD> -# <TD width=45%>SQL_DESC_BIND_OFFSET_PTR</TD> -# <TD width=13%>APD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_PARAM_BIND_TYPE</TD> -# <TD width=45%>SQL_DESC_BIND_TYPE</TD> -# <TD width=13%>APD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_PARAM_OPERATION_PTR</TD> -# <TD width=45%>SQL_DESC_ARRAY_STATUS_PTR</TD> -# <TD width=13%>APD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_PARAM_STATUS_PTR</TD> -# <TD width=45%>SQL_DESC_ARRAY_STATUS_PTR</TD> -# <TD width=13%>IPD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_PARAMS_PROCESSED_PTR</TD> -# <TD width=45%>SQL_DESC_ROWS_PROCESSED_PTR</TD> -# <TD width=13%>IPD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_PARAMSET_SIZE</TD> -# <TD width=45%>SQL_DESC_ARRAY_SIZE</TD> -# <TD width=13%>APD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_ROW_ARRAY_SIZE</TD> -# <TD width=45%>SQL_DESC_ARRAY_SIZE</TD> -# <TD width=13%>ARD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_ROW_BIND_OFFSET_PTR</TD> -# <TD width=45%>SQL_DESC_BIND_OFFSET_PTR</TD> -# <TD width=13%>ARD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_ROW_BIND_TYPE</TD> -# <TD width=45%>SQL_DESC_BIND_TYPE</TD> -# <TD width=13%>ARD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_ROW_OPERATION_PTR</TD> -# <TD width=45%>SQL_DESC_ARRAY_STATUS_PTR</TD> -# <TD width=13%>ARD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_ROW_STATUS_PTR</TD> -# <TD width=45%>SQL_DESC_ARRAY_STATUS_PTR</TD> -# <TD width=13%>IRD</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=42%>SQL_ATTR_ROWS_FETCHED_PTR</TD> -# <TD width=45%>SQL_DESC_ROWS_PROCESSED_PTR</TD> -# <TD width=13%>IRD</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <H1>Statement Attributes</H1> -# -# <P>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 "<A HREF="odbcdriver_specific_data_types__descriptor_types__information_types.htm">Driver-Specific Data Types, Descriptor Types, Information Types, Diagnostic Types, and Attributes</A>" in Chapter 17: Programming Considerations.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=38%>Attribute</TH> -# <TH width=62%><I>ValuePtr</I> contents</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_APP_PARAM_DESC<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>The handle to the APD for subsequent calls to <B>SQLExecute</B> and <B>SQLExecDirect</B> 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. -# <P>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.</P> -# </TD> -# </TR> - SQL_ATTR_APP_PARAM_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_APP_ROW_DESC<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>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.</P> -# </TD> -# </TR> - SQL_ATTR_APP_ROW_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ASYNC_ENABLE<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies whether a function called with the specified statement is executed asynchronously: -# <P>SQL_ASYNC_ENABLE_OFF = Off (the default)<BR> -# SQL_ASYNC_ENABLE_ON = On</P> -# -# <P>Once a function has been called asynchronously, only the original function, <B>SQLCancel</B>, <B>SQLGetDiagField</B>, or <B>SQLGetDiagRec</B> can be called on the statement, and only the original function, <B>SQLAllocHandle </B>(with a <I>HandleType</I> of SQL_HANDLE_STMT), <B>SQLGetDiagField</B>, <B>SQLGetDiagRec</B>, or <B>SQLGetFunctions</B> 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 "<A HREF="odbcasynchronous_execution.htm">Asynchronous Execution</A>" in Chapter 9: Executing Statements.</P> -# -# <P>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. </P> -# -# <P>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 <B>SQLSetStmtAttr</B> to set SQL_ATTR_ASYNC_ENABLE when the SQL_ASYNC_MODE <I>InfoType</I> returns SQL_AM_CONNECTION returns SQLSTATE HYC00 (Optional feature not implemented). (See <B>SQLSetConnectAttr</B> for more information.)</P> -# -# <P>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. </P> -# -# <P>The following functions can be executed asynchronously:</P> -# -# <P><B>SQLBulkOperations<BR> -# SQLColAttribute</B><BR> -# <B>SQLColumnPrivileges</B><BR> -# <B>SQLColumns</B><BR> -# <B>SQLCopyDesc</B><BR> -# <B>SQLDescribeCol</B><BR> -# <B>SQLDescribeParam</B><BR> -# <B>SQLExecDirect</B><BR> -# <B>SQLExecute</B><BR> -# <B>SQLFetch</B><BR> -# <B>SQLFetchScroll</B><BR> -# <B>SQLForeignKeys</B><BR> -# <B>SQLGetData</B><BR> -# <B>SQLGetDescField</B><SUP>[1]</SUP><BR> -# <B>SQLGetDescRec</B><SUP>[1]</SUP><B><BR> -# SQLGetDiagField</B><BR> -# <B>SQLGetDiagRec<BR> -# SQLGetTypeInfo</B><BR> -# <B>SQLMoreResults</B><BR> -# <B>SQLNumParams</B><BR> -# <B>SQLNumResultCols</B><BR> -# <B>SQLParamData</B><BR> -# <B>SQLPrepare</B><BR> -# <B>SQLPrimaryKeys</B><BR> -# <B>SQLProcedureColumns</B><BR> -# <B>SQLProcedures</B><BR> -# <B>SQLPutData</B><BR> -# <B>SQLSetPos</B><BR> -# <B>SQLSpecialColumns</B><BR> -# <B>SQLStatistics</B><BR> -# <B>SQLTablePrivileges</B><BR> -# <B>SQLTables</B></P> -# </TD> -# </TR> - SQL_ATTR_ASYNC_ENABLE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CONCURRENCY<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies the cursor concurrency: -# <P>SQL_CONCUR_READ_ONLY = Cursor is read-only. No updates are allowed.</P> -# -# <P>SQL_CONCUR_LOCK = Cursor uses the lowest level of locking sufficient to ensure that the row can be updated.</P> -# -# <P>SQL_CONCUR_ROWVER = Cursor uses optimistic concurrency control, comparing row versions such as SQLBase ROWID or Sybase TIMESTAMP.</P> -# -# <P>SQL_CONCUR_VALUES = Cursor uses optimistic concurrency control, comparing values.</P> -# -# <P>The default value for SQL_ATTR_CONCURRENCY is SQL_CONCUR_READ_ONLY.</P> -# -# <P>This attribute cannot be specified for an open cursor. For more information, see "<A HREF="odbcconcurrency_types.htm">Concurrency Types</A>" in Chapter 14: Transactions.</P> -# -# <P>If the SQL_ATTR_CURSOR_TYPE <I>Attribute</I> 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 <B>SQLExecDirect</B> or <B>SQLPrepare</B> is called.</P> -# -# <P>If the driver supports the <B>SELECT FOR UPDATE</B> 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 <B>SQLExecDirect</B> or <B>SQLPrepare</B> is called.</P> -# -# <P>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.</P> -# -# <P>For more information about the relationship between SQL_ATTR_CONCURRENCY and the other cursor attributes, see "<A HREF="odbccursor_characteristics_and_cursor_type.htm">Cursor Characteristics and Cursor Type</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CURSOR_SCROLLABLE<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies the level of support that the application requires. Setting this attribute affects subsequent calls to <B>SQLExecDirect</B> and <B>SQLExecute</B>. -# <P>SQL_NONSCROLLABLE = Scrollable cursors are not required on the statement handle. If the application calls <B>SQLFetchScroll</B> on this handle, the only valid value of <I>FetchOrientation</I> is SQL_FETCH_NEXT. This is the default.</P> -# -# <P>SQL_SCROLLABLE = Scrollable cursors are required on the statement handle. When calling <B>SQLFetchScroll</B>, the application may specify any valid value of <I>FetchOrientation</I>, achieving cursor positioning in modes other than the sequential mode. </P> -# -# <P>For more information about scrollable cursors, see "<A HREF="odbcscrollable_cursors.htm">Scrollable Cursors</A>" in Chapter 11: Retrieving Results (Advanced). For more information about the relationship between SQL_ATTR_CURSOR_SCROLLABLE and the other cursor attributes, see "<A HREF="odbccursor_characteristics_and_cursor_type.htm">Cursor Characteristics and Cursor Type</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# </TD> -# </TR> - SQL_ATTR_CURSOR_SCROLLABLE => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_NONSCROLLABLE SQL_SCROLLABLE) ], - default => q(SQL_NONSCROLLABLE), - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CURSOR_SENSITIVITY<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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 <B>SQLExecDirect</B> and <B>SQLExecute</B>. 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. -# <P>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.</P> -# -# <P>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.</P> -# -# <P>SQL_SENSITIVE = All cursors on the statement handle make visible all changes made to a result set by another cursor. </P> -# -# <P>For more information about the relationship between SQL_ATTR_CURSOR_SENSITIVITY and the other cursor attributes, see "<A HREF="odbccursor_characteristics_and_cursor_type.htm">Cursor Characteristics and Cursor Type</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_CURSOR_TYPE<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies the cursor type: -# <P>SQL_CURSOR_FORWARD_ONLY = The cursor only scrolls forward.</P> -# -# <P>SQL_CURSOR_STATIC = The data in the result set is static.</P> -# -# <P>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.</P> -# -# <P>SQL_CURSOR_DYNAMIC = The driver saves and uses only the keys for the rows in the rowset.</P> -# -# <P>The default value is SQL_CURSOR_FORWARD_ONLY. This attribute cannot be specified after the SQL statement has been prepared.</P> -# -# <P>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. </P> -# -# <P>For more information about scrollable cursor types, see "<A HREF="odbcscrollable_cursor_types.htm">Scrollable Cursor Types</A>" in Chapter 11: Retrieving Results (Advanced). For more information about the relationship between SQL_ATTR_CURSOR_TYPE and the other cursor attributes, see "<A HREF="odbccursor_characteristics_and_cursor_type.htm">Cursor Characteristics and Cursor Type</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ENABLE_AUTO_IPD<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies whether automatic population of the IPD is performed: -# <P>SQL_TRUE = Turns on automatic population of the IPD after a call to <B>SQLPrepare</B>. SQL_FALSE = Turns off automatic population of the IPD after a call to <B>SQLPrepare</B>. (An application can still obtain IPD field information by calling <B>SQLDescribeParam</B>, if supported.) The default value of the statement attribute SQL_ATTR_ENABLE_AUTO_IPD is SQL_FALSE. For more information, see "<A HREF="odbcautomatic_population_of_the_ipd.htm">Automatic Population of the IPD</A>" in Chapter 13: Descriptors.</P> -# </TD> -# </TR> - SQL_ATTR_ENABLE_AUTO_IPD => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_FALSE), - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_FETCH_BOOKMARK_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>A pointer that points to a binary bookmark value. When <B>SQLFetchScroll</B> is called with <I>fFetchOrientation</I> 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 "<A HREF="odbcscrolling_by_bookmark.htm">Scrolling by Bookmark</A>" in Chapter 11: Retrieving Results (Advanced). -# <P>The value pointed to by this field is not used for delete by bookmark, update by bookmark, or fetch by bookmark operations in <B>SQLBulkOperations</B>, which use bookmarks cached in rowset buffers.</P> -# </TD> -# </TR> - SQL_ATTR_FETCH_BOOKMARK_PTR => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_IMP_PARAM_DESC<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>This attribute can be retrieved by a call to <B>SQLGetStmtAttr</B> but not set by a call to <B>SQLSetStmtAttr</B>.</P> -# </TD> -# </TR> - SQL_ATTR_IMP_PARAM_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_IMP_ROW_DESC<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>This attribute can be retrieved by a call to <B>SQLGetStmtAttr</B> but not set by a call to <B>SQLSetStmtAttr</B>.</P> -# </TD> -# </TR> - SQL_ATTR_IMP_ROW_DESC => { - type => q(SQLPOINTER), - ptr => undef, - value => undef, - default => undef, - mode => 'ro', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_KEYSET_SIZE<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>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 "<A HREF="odbckeyset_driven_cursors.htm">Keyset-Driven Cursors</A>" in Chapter 11: Retrieving Results (Advanced). -# <P>If the specified size exceeds the maximum keyset size, the driver substitutes that size and returns SQLSTATE 01S02 (Option value changed).</P> -# -# <P><B>SQLFetch</B> or <B>SQLFetchScroll</B> returns an error if the keyset size is greater than 0 and less than the rowset size.</P> -# </TD> -# </TR> - SQL_ATTR_KEYSET_SIZE => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_MAX_LENGTH<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies the maximum amount of data that the driver returns from a character or binary column. If <I>ValuePtr</I> is less than the length of the available data, <B>SQLFetch</B> or <B>SQLGetData</B> truncates the data and returns SQL_SUCCESS. If <I>ValuePtr</I> is 0 (the default), the driver attempts to return all available data. -# <P>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).</P> -# -# <P>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.</P> -# -# <P>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 <I>BufferLength </I>argument in <B>SQLBindCol</B> or <B>SQLGetData</B>.</P> -# </TD> -# </TR> - SQL_ATTR_MAX_LENGTH => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => 0, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_MAX_ROWS<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value corresponding to the maximum number of rows to return to the application for a <B>SELECT</B> statement. If *<I>ValuePtr</I> equals 0 (the default), the driver returns all rows. -# <P>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 <I>ValuePtr</I> rows. If the number of rows in the result set is greater than <I>ValuePtr</I>, the result set is truncated. </P> -# -# <P>SQL_ATTR_MAX_ROWS applies to all result sets on the <I>Statement</I>, including those returned by catalog functions. SQL_ATTR_MAX_ROWS establishes a maximum for the value of the cursor row count.</P> -# -# <P>A driver should not emulate SQL_ATTR_MAX_ROWS behavior for <B>SQLFetch</B> or <B>SQLFetchScroll</B> (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.</P> -# -# <P>It is driver-defined whether SQL_ATTR_MAX_ROWS applies to statements other than SELECT statements (such as catalog functions). </P> -# -# <P>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.</P> -# </TD> -# </TR> - SQL_ATTR_MAX_ROWS => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_METADATA_ID<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that determines how the string arguments of catalog functions are treated. -# <P>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). </P> -# -# <P>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.</P> -# -# <P>The default value is SQL_FALSE.</P> -# -# <P>The <I>TableType</I> argument of <B>SQLTables</B>, which takes a list of values, is not affected by this attribute.</P> -# -# <P>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.)</P> -# -# <P>For more information, see "<A HREF="odbcarguments_in_catalog_functions.htm">Arguments in Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# </TD> -# </TR> - SQL_ATTR_METADATA_ID => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_FALSE SQL_TRUE) ], - default => q(SQL_FALSE), - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_NOSCAN<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value that indicates whether the driver should scan SQL strings for escape sequences: -# <P>SQL_NOSCAN_OFF = The driver scans SQL strings for escape sequences (the default).</P> -# -# <P>SQL_NOSCAN_ON = The driver does not scan SQL strings for escape sequences. Instead, the driver sends the statement directly to the data source.</P> -# -# <P>For more information, see "<A HREF="odbcescape_sequences_in_odbc.htm">Escape Sequences in ODBC</A>" in Chapter 8: SQL Statements.</P> -# </TD> -# </TR> - SQL_ATTR_NOSCAN => { - type => q(SQLUINTEGER), - ptr => 0, - value => [ qw(SQL_NOSCAN_OFF SQL_NOSCAN_ON) ], - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAM_BIND_OFFSET_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>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.</P> -# </TD> -# </TR> - SQL_ATTR_PARAM_BIND_OFFSET_PTR => { - type => q(SQLUINTEGER), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAM_BIND_OFFSET_PTR<BR> -# (ODBC 3.0) (<I>continued</I>)</TD> -# <TD width=62%>For more information, see "<A HREF="odbcparameter_binding_offsets.htm">Parameter Binding Offsets</A>" in Chapter 9: Executing Statements. -# <P>Setting this statement attribute sets the SQL_DESC_BIND_OFFSET_PTR field in the APD header.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAM_BIND_TYPE<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that indicates the binding orientation to be used for dynamic parameters. -# <P>This field is set to SQL_PARAM_BIND_BY_COLUMN (the default) to select column-wise binding. </P> -# -# <P>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 <I>sizeof</I> operator in ANSI C, this behavior is guaranteed.</P> -# -# <P>For more information, see "<A HREF="odbcbinding_arrays_of_parameters.htm">Binding Arrays of Parameters</A>" in Chapter 9: Executing Statements.</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ BIND_TYPE field in the APD header.</P> -# </TD> -# </TR> - SQL_ATTR_PARAM_BIND_TYPE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAM_OPERATION_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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). -# <P>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.</P> -# -# <P>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 <B>SQLExecDirect</B> or <B>SQLExecute</B> is called.</P> -# -# <P>For more information, see "<A HREF="odbcusing_arrays_of_parameters.htm">Using Arrays of Parameters</A>" in Chapter 9: Executing Statements.</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the APD header.</P> -# </TD> -# </TR> - SQL_ATTR_PARAM_OPERATION_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAM_STATUS_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values containing status information for each row of parameter values after a call to <B>SQLExecute</B> or <B>SQLExecDirect</B>. This field is required only if PARAMSET_SIZE is greater than 1. -# <P>The status values can contain the following values:</P> -# -# <P>SQL_PARAM_SUCCESS: The SQL statement was successfully executed for this set of parameters.</P> -# -# <P>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.</P> -# -# <P>SQL_PARAM_ERROR: There was an error in processing this set of parameters. Additional error information is available in the diagnostics data structure.</P> -# -# <P>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.</P> -# -# <P>SQL_PARAM_DIAG_UNAVAILABLE: The driver treats arrays of parameters as a monolithic unit and so does not generate this level of error information. </P> -# -# <P>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 <B>SQLExecute</B> or <B>SQLExecDirect</B> is called. Note that setting this attribute can affect the output parameter behavior implemented by the driver.</P> -# -# <P>For more information, see "<A HREF="odbcusing_arrays_of_parameters.htm">Using Arrays of Parameters</A>" in Chapter 9: Executing Statements.</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the IPD header.</P> -# </TD> -# </TR> - SQL_ATTR_PARAM_STATUS_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAMS_PROCESSED_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>Setting this statement attribute sets the SQL_DESC_ROWS_PROCESSED_PTR field in the IPD header.</P> -# -# <P>If the call to <B>SQLExecDirect</B> or <B>SQLExecute</B> 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.</P> -# -# <P>For more information, see "<A HREF="odbcusing_arrays_of_parameters.htm">Using Arrays of Parameters</A>" in Chapter 9: Executing Statements.</P> -# </TD> -# </TR> - SQL_ATTR_PARAMS_PROCESSED_PTR => { - type => q(SQLUINTEGER), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_PARAMSET_SIZE<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>For more information, see "<A HREF="odbcusing_arrays_of_parameters.htm">Using Arrays of Parameters</A>" in Chapter 9: Executing Statements.</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ARRAY_SIZE field in the APD header.</P> -# </TD> -# </TR> - SQL_ATTR_PARAMSET_SIZE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_QUERY_TIMEOUT<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value corresponding to the number of seconds to wait for an SQL statement to execute before returning to the application. If <I>ValuePtr</I> is equal to 0 (default), there is no timeout. -# <P>If the specified timeout exceeds the maximum timeout in the data source or is smaller than the minimum timeout, <B>SQLSetStmtAttr</B> substitutes that value and returns SQLSTATE 01S02 (Option value changed).</P> -# -# <P>Note that the application need not call <B>SQLCloseCursor</B> to reuse the statement if a <B>SELECT</B> statement timed out.</P> -# -# <P>The query timeout set in this statement attribute is valid in both synchronous and asynchronous modes.</P> -# </TD> -# </TR> - SQL_ATTR_QUERY_TIMEOUT => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_RETRIEVE_DATA<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value: -# <P>SQL_RD_ON = <B>SQLFetchScroll</B> and, in ODBC 3<I>.x</I>, <B>SQLFetch</B> retrieve data after it positions the cursor to the specified location. This is the default.</P> -# -# <P>SQL_RD_OFF = <B>SQLFetchScroll</B> and, in ODBC 3<I>.x</I>, <B>SQLFetch</B> do not retrieve data after it positions the cursor.</P> -# -# <P>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 "<A HREF="odbcscrolling_and_fetching_rows.htm">Scrolling and Fetching Rows</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# -# <P>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.</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROW_ARRAY_SIZE<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies the number of rows returned by each call to <B>SQLFetch</B> or <B>SQLFetchScroll</B>. It is also the number of rows in a bookmark array used in a bulk bookmark operation in <B>SQLBulkOperations</B>. The default value is 1. -# <P>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).</P> -# -# <P>For more information, see "<A HREF="odbcrowset_size.htm">Rowset Size</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ARRAY_SIZE field in the ARD header.</P> -# </TD> -# </TR> - SQL_ATTR_ROW_ARRAY_SIZE => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROW_BIND_OFFSET_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>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. -# <P>Setting this statement attribute sets the SQL_DESC_BIND_OFFSET_PTR field in the ARD header.</P> -# </TD> -# </TR> - SQL_ATTR_ROW_BIND_OFFSET_PTR => { - type => q(SQLUINTEGER), - ptr => undef, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROW_BIND_TYPE<BR> -# (ODBC 1.0)</TD> -# <TD width=62%>An SQLUINTEGER value that sets the binding orientation to be used when <B>SQLFetch</B> or <B>SQLFetchScroll</B> 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. -# <P>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 <B>sizeof</B> operator with structures or unions in ANSI C, this behavior is guaranteed.</P> -# -# <P>Column-wise binding is the default binding orientation for <B>SQLFetch</B> and <B>SQLFetchScroll</B>.</P> -# -# <P>For more information, see "<A HREF="odbcbinding_columns_for_use_with_block_cursors.htm">Binding Columns for Use with Block Cursors</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_BIND_TYPE field in the ARD header.</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROW_NUMBER<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>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. -# <P>This attribute can be retrieved by a call to <B>SQLGetStmtAttr</B> but not set by a call to <B>SQLSetStmtAttr</B>.</P> -# </TD> -# </TR> - SQL_ATTR_ROW_NUMBER => { - type => q(SQLUINTEGER), - ptr => 0, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROW_OPERATION_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values used to ignore a row during a bulk operation using <B>SQLSetPos</B>. 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 <B>SQLBulkOperations</B>.) -# <P>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 <B>SQLSetPos</B> is called.</P> -# -# <P>For more information, see "<A HREF="odbcupdating_rows_in_the_rowset_with_sqlsetpos.htm">Updating Rows in the Rowset with SQLSetPos</A>" and "<A HREF="odbcdeleting_rows_in_the_rowset_with_sqlsetpos.htm">Deleting Rows in the Rowset with SQLSetPos</A>" in Chapter 12: Updating Data.</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the ARD.</P> -# </TD> -# </TR> - SQL_ATTR_ROW_OPERATION_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROW_STATUS_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUSMALLINT * value that points to an array of SQLUSMALLINT values containing row status values after a call to <B>SQLFetch</B> or <B>SQLFetchScroll</B>. The array has as many elements as there are rows in the rowset. -# <P>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 <B>SQLBulkOperations</B>, <B>SQLFetch</B>, <B>SQLFetchScroll</B>, or <B>SQLSetPos</B> is called.</P> -# -# <P>For more information, see "<A HREF="odbcnumber_of_rows_fetched_and_status.htm">Number of Rows Fetched and Status</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ARRAY_STATUS_PTR field in the IRD header.</P> -# -# <P>This attribute is mapped by an ODBC 2<I>.x</I> driver to the <I>rgbRowStatus</I> array in a call to <B>SQLExtendedFetch</B>.</P> -# </TD> -# </TR> - SQL_ATTR_ROW_STATUS_PTR => { - type => q(SQLUSMALLINT), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_ROWS_FETCHED_PTR<BR> -# (ODBC 3.0)</TD> -# <TD width=62%>An SQLUINTEGER * value that points to a buffer in which to return the number of rows fetched after a call to <B>SQLFetch</B> or <B>SQLFetchScroll</B>; the number of rows affected by a bulk operation performed by a call to <B>SQLSetPos</B> with an <I>Operation</I> argument of SQL_REFRESH; or the number of rows affected by a bulk operation performed by <B>SQLBulkOperations</B>. This number includes error rows. -# <P>For more information, see "<A HREF="odbcnumber_of_rows_fetched_and_status.htm">Number of Rows Fetched and Status</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# -# <P>Setting this statement attribute sets the SQL_DESC_ROWS_PROCESSED_PTR field in the IRD header. </P> -# -# <P>If the call to <B>SQLFetch</B> or <B>SQLFetchScroll</B> 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.</P> -# </TD> -# </TR> - SQL_ATTR_ROWS_FETCHED_PTR => { - type => q(SQLUINTEGER), - ptr => 1, - value => undef, - default => undef, - mode => 'rw', - order => ++$order, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_SIMULATE_CURSOR<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies whether drivers that simulate positioned update and delete statements guarantee that such statements affect only one single row. -# <P>To simulate positioned update and delete statements, most drivers construct a searched <B>UPDATE</B> or <B>DELETE</B> statement containing a <B>WHERE</B> 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.</P> -# -# <P>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.</P> -# -# <P>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, <B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLSetPos</B> returns SQLSTATE 01001 (Cursor operation conflict).</P> -# -# <P>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, <B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLSetPos</B> returns SQLSTATE 01001 (Cursor operation conflict).</P> -# -# <P>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, <B>SQLExecDirect</B> or <B>SQLPrepare</B> returns an error.</P> -# -# <P>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.</P> -# -# <P>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.</P> -# -# <P>For more information, see "<A HREF="odbcsimulating_positioned_update_and_delete_statements.htm">Simulating Positioned Update and Delete Statements</A>" in Chapter 12: Updating Data.</P> -# </TD> -# </TR> - 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, - }, -# -# <TR VALIGN="top"> -# <TD width=38%>SQL_ATTR_USE_BOOKMARKS<BR> -# (ODBC 2.0)</TD> -# <TD width=62%>An SQLUINTEGER value that specifies whether an application will use bookmarks with a cursor: -# <P>SQL_UB_OFF = Off (the default)</P> -# -# <P>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<I>.x</I>. ODBC 3<I>.x</I> applications should always use variable-length bookmarks, even when working with ODBC 2<I>.x</I> 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<I>.x</I> driver, the Driver Manager maps SQL_UB_VARIABLE to SQL_UB_FIXED.</P> -# -# <P>To use bookmarks with a cursor, the application must specify this attribute with the SQL_UB_VARIABLE value before opening the cursor.</P> -# -# <P>For more information, see "<A HREF="odbcretrieving_bookmarks.htm">Retrieving Bookmarks</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# </TD> -# </TR> - 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, - }, -# </table></div> -# -# <P class="fineprint">[1] These functions can be called asynchronously only if the descriptor is an implementation descriptor, not an application descriptor.</p> -# <P>See "<A HREF="odbccolumn_wise_binding.htm">Column-Wise Binding</A>" and "<A HREF="odbcrow_wise_binding.htm">Row-Wise Binding</A>" in Chapter 11: Retrieving Results (Advanced).</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=47%>For information about</TH> -# <TH width=53%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=47%>Canceling statement processing</TD> -# <TD width=53%><A HREF="odbcsqlcancel.htm">SQLCancel</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=47%>Returning the setting of a connection attribute</TD> -# <TD width=53%><A HREF="odbcsqlgetconnectattr.htm">SQLGetConnectAttr</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=47%>Returning the setting of a statement attribute</TD> -# <TD width=53%><A HREF="odbcsqlgetstmtattr.htm">SQLGetStmtAttr</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=47%>Setting a connection attribute</TD> -# <TD width=53%><A HREF="odbcsqlsetconnectattr.htm">SQLSetConnectAttr</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=47%>Setting a single field of the descriptor</TD> -# <TD width=53%><A HREF="odbcsqlsetdescfield.htm">SQLSetDescField</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -}; - -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<Handle$type*>(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<Handle$type*>(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/storage/ndb/src/old_files/client/odbc/docs/main.hpp b/storage/ndb/src/old_files/client/odbc/docs/main.hpp deleted file mode 100644 index ebb5b1f235a..00000000000 --- a/storage/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 <em>SQL statement</em> 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 <em>not</em> 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/storage/ndb/src/old_files/client/odbc/docs/ndbodbc.html b/storage/ndb/src/old_files/client/odbc/docs/ndbodbc.html deleted file mode 100644 index 6be624dfa1b..00000000000 --- a/storage/ndb/src/old_files/client/odbc/docs/ndbodbc.html +++ /dev/null @@ -1,659 +0,0 @@ -<HTML> -<HEAD> -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> -<TITLE>ODBC and SQL</TITLE> -</HEAD> -<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff"> - -<h2>ODBC and SQL - NDB Cluster v2.11</h2> - -<p> -NDB Cluster v2.11 includes a version of ODBC and SQL. -<p> -This document has 4 sections. -<ol> -<li>PLATFORMS -<li>ODBC -<li>SQL -<li>DIAGNOSTICS -</ol> -<p> -Features which are currently incomplete or planned for next release -are marked with <b>v2.x</b>. - -<h3>1. PLATFORMS</h3> - -<h4>1.1 Linux / Unix</h4> -<p> -We use RedHat package names to describe supporting software. -Packages starting with <b>perl-</b> are perl modules. -If your installation does not include them you can get them -from a CPAN archive ( <tt><b>ftp://ftp.funet.fi/pub/languages/perl/CPAN</b></tt> ). -<p> -Version numbers are given only as examples. -Other versions will work. -<p> -An ODBC driver manager is required, one of: -<ul> -<li>unixODBC-2.2.3 (this is more common) -<li>libiodbc-3.0.5 -</ul> -<p> -Additional packages are convenient. -Following include perl scripting interface -and an "interactive SQL" tool <b>dbish</b>: -<ul> -<li>perl-DBI-1.30 -<li>perl-DBD-ODBC-0.43 -<li>readline-4.2 -<li>perl-Term-ReadLine-Gnu-1.11 -</ul> -<p> -The NDB ODBC driver is located under NDB Cluster installation -directory and is named <tt><b>libNDB_ODBC.so</b></tt>. -It includes NDB API. -To use it create a text file -<tt><b>/etc/odbc.ini</b></tt> or <tt><b>$HOME/.odbc.ini</b></tt> -containing at least: -<p> -<tt> -<b> -[ndb] -<br> -Driver = <path-to-your-NDB-installation>/lib/libNDB_ODBC.so -</b> -</tt> -<p> -Then try the shell command <tt><b>dbish dbi:ODBC:ndb</b></tt> -in an NDB API node directory. - -<h4>1.2 Windows</h4> - -[ TODO - documentation ] - -<h3>2. ODBC</h3> - -<h4>2.1 External data types</h4> - -Usual external data types are supported and converted to and from SQL -data types. -<p> -<table width="80%" border=1> -<tr align="left"><th width="40%">type</th> <th>description</th></tr> -<tr align="left"><td>SQL_C_CHAR</td><td>character buffers</tr> -<tr align="left"><td>SQL_C_SLONG, etc</td><td>integer types</tr> -<tr align="left"><td>SQL_C_DOUBLE, etc</td><td>floating types</tr> -<tr align="left"><td>SQL_C_TYPE_TIMESTAMP</td><td>timestamp</tr> -</table> - -<h4>2.2 ODBC functions</h4> -<p> -The driver implements basic ODBC functions. -Main exceptions are: -<ul> -<li>no named cursors -<li>no scrollable cursors -<li>no bulk operations -<li>no asynchronous execution -</ul> -<p> -Following lists main ODBC 3.0 functions and -their status in the driver. -<p> -<table width="80%" border=1> -<tr align="left"><th width="40%">function</th><th>supported</th></tr> -<tr align="left"><td>SQLAllocHandle</td><td> -yes -</td></tr> -<tr align="left"><td>SQLConnect</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetInfo</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetFunctions</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetTypeInfo</td><td> -yes -</td></tr> -<tr align="left"><td>SQLSetConnectAttr</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetConnectAttr</td><td> -yes -</td></tr> -<tr align="left"><td>SQLSetEnvAttr</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetEnvAttr</td><td> -yes -</td></tr> -<tr align="left"><td>SQLSetStmtAttr</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetStmtAttr</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetDescField</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetDescRec</td><td> -yes -</td></tr> -<tr align="left"><td>SQLSetDescField</td><td> -yes -</td></tr> -<tr align="left"><td>SQLSetDescRec</td><td> -yes -</td></tr> -<tr align="left"><td>SQLPrepare</td><td> -yes -</td></tr> -<tr align="left"><td>SQLBindParameter</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetCursorName</td><td> -yes, but cursor names cannot be used in SQL -</td></tr> -<tr align="left"><td>SQLSetCursorName</td><td> -yes, but cursor names cannot be used in SQL -</td></tr> -<tr align="left"><td>SQLSetScrollOptions</td><td> -not implemented -</td></tr> -<tr align="left"><td>SQLExecute</td><td> -yes -</td></tr> -<tr align="left"><td>SQLExecDirect</td><td> -yes -</td></tr> -<tr align="left"><td>SQLNativeSql</td><td> -not implemented -</td></tr> -<tr align="left"><td>SQLDescribeParam</td><td> -not supported -</td></tr> -<tr align="left"><td>SQLNumParams</td><td> -yes -</td></tr> -<tr align="left"><td>SQLParamData</td><td> -yes -</td></tr> -<tr align="left"><td>SQLPutData</td><td> -yes -</td></tr> -<tr align="left"><td>SQLRowCount</td><td> -yes -</td></tr> -<tr align="left"><td>SQLNumResultCols</td><td> -yes -</td></tr> -<tr align="left"><td>SQLDescribeCol</td><td> -yes -</td></tr> -<tr align="left"><td>SQLColAttribute</td><td> -yes -</td></tr> -<tr align="left"><td>SQLBindCol</td><td> -yes -</td></tr> -<tr align="left"><td>SQLFetch</td><td> -yes -</td></tr> -<tr align="left"><td>SQLFetchScroll</td><td> -not implemented -</td></tr> -<tr align="left"><td>SQLGetData</td><td> -yes -</td></tr> -<tr align="left"><td>SQLSetPos</td><td> -not implemented -</td></tr> -<tr align="left"><td>SQLBulkOperations</td><td> -not implemented -</td></tr> -<tr align="left"><td>SQLMoreResults</td><td> -yes, but multiple result sets are not supported -</td></tr> -<tr align="left"><td>SQLGetDiagField</td><td> -yes -</td></tr> -<tr align="left"><td>SQLGetDiagRec</td><td> -yes -</td></tr> -<tr align="left"><td>SQLColumnPrivileges</td><td> -not applicable -</td></tr> -<tr align="left"><td>SQLColumns</td><td> -yes -</td></tr> -<tr align="left"><td>SQLForeignKeys</td><td> -not applicable -</td></tr> -<tr align="left"><td>SQLPrimaryKeys</td><td> -yes -</td></tr> -<tr align="left"><td>SQLProcedureColumns</td><td> -not applicable -</td></tr> -<tr align="left"><td>SQLProcedures</td><td> -not applicable -</td></tr> -<tr align="left"><td>SQLSpecialColumns</td><td> -yes <b>v2.x</b> -</td></tr> -<tr align="left"><td>SQLStatistics</td><td> -not applicable -</td></tr> -<tr align="left"><td>SQLTablePrivileges</td><td> -not applicable -</td></tr> -<tr align="left"><td>SQLTables</td><td> -yes -</td></tr> -<tr align="left"><td>SQLFreeStmt</td><td> -yes -</td></tr> -<tr align="left"><td>SQLCloseCursor</td><td> -yes -</td></tr> -<tr align="left"><td>SQLCancel</td><td> -yes -</td></tr> -<tr align="left"><td>SQLEndTran</td><td> -yes -</td></tr> -<tr align="left"><td>SQLDisconnect</td><td> -yes -</td></tr> -<tr align="left"><td>SQLFreeHandle</td><td> -yes -</td></tr> -</table> - -<h3>3. SQL</h3> - -<h4>3.1 Data types</h4> - -<table width="80%" border=1> -<tr align="left"><th width="40%">type</th> <th>description</th></tr> -<tr align="left"><td>CHAR(n)</td><td>fixed-width blank-padded string</tr> -<tr align="left"><td>VARCHAR(n)</td><td>variable length string</tr> -<tr align="left"><td>INT<br>INTEGER</td><td>integer 32 bits</tr> -<tr align="left"><td>BIGINT</td><td>integer 64 bits</tr> -<tr align="left"><td>DECIMAL(m,n)</td><td>exact number with precision and scale <b>v2.x</b></tr> -<tr align="left"><td>REAL</td><td>float 32 bits</tr> -<tr align="left"><td>FLOAT<br>DOUBLE PRECISION</td><td>float, at least 64 bits</tr> -<tr align="left"><td>DATE</td><td>date with precision 1 second <b>v2.x</b></tr> -<tr align="left"><td>DATETIME</td><td>date with precision 1 nanosecond (SQL_TYPE_TIMESTAMP)</tr> -</table> -<p> - -Integer types may be qualified as UNSIGNED. -<br><br> -Strings and numbers are not converted to each other automatically. -Following is an error (unlike in oracle). -<br> -<pre><tt>select 123 + '456' from tab</tt></pre> - -<h4>3.2 Expressions</h4> - -<table width="80%" border=1> -<tr align="left"><th width="40%">syntax</th> <th>description</th></tr> -<tr align="left"><td align="center"><b>NULL</b></td><td>null value</td></tr> -<tr align="left"><td align="center">12.34<b>e</b>5</td><td>integer or decimal or float constant</td></tr> -<tr align="left"><td align="center"><b>'</b>abc<b>'</b></td><td>string constant</td></tr> -<tr align="left"><td align="center"><b>+ - * / ( )</b></td><td>arithmetic operations</td></tr> -<tr align="left"><td align="center"><b>||</b></td><td>string concatenation <b>v2.x</b></td></tr> -</table> - -<br> -Integer and decimal arithmetic is done in BIGINT. -<br> -Floating arithmetic is done in DOUBLE PRECISION. -<br> -Numeric literals use largest applicable type. -<br> -String operations are done in CHAR or in VARCHAR (if any operand is VARCHAR). -<br> -String literals have type CHAR. - -<h4>3.3 Functions : non-aggregate</h4> - -<table width="80%" border=1> -<tr align="left"><th width="40%">syntax</th> <th>description</th></tr> -<tr align="left"><td align="center">SUBSTR() LEFT() RIGHT()</td><td>substring</td></tr> -<tr align="left"><td align="center">TO_NUMBER() TO_CHAR()</td><td>basic conversions <b>v2.x</b></td></tr> -<tr align="left"><td align="center">ROWNUM</td><td>row number in query</td></tr> -<tr align="left"><td align="center">SYSDATE</td><td>current date as DATETIME</td></tr> -</table> - -<h4>3.4 Functions : aggregate</h4> - -<table width="80%" border=1> -<tr align="left"><th width="40%">syntax</th> <th>description</th></tr> -<tr align="left"><td align="center">COUNT(*) COUNT(expr)</td><td>count rows or non-NULL values</td></tr> -<tr align="left"><td align="center">MIN(expr) MAX(expr)</td><td>min and max of strings and numbers</td></tr> -<tr align="left"><td align="center">SUM(expr) AVG(expr)</td><td>sum and average of numbers</td></tr> -</table> -<br> -GROUP BY and HAVING are supported. - -<h4>3.5 Predicates</h4> - -<table width="80%" border=1> -<tr align="left"><th width="40%">syntax</th> <th>description</th></tr> -<tr align="left"><td align="center">IS NULL / IS NOT NULL</td><td>test if value is null</td></tr> -<tr align="left"><td align="center"><b>< <= = != > >=</b></td><td>comparisons</td></tr> -<tr align="left"><td align="center">LIKE / NOT LIKE</td><td>string matching</td></tr> -<tr align="left"><td align="center">AND OR NOT <b>( )</b></td><td>boolean operators</td></tr> -</table> - -<h4>3.6 Tables</h4> - -An NDB table requires a primary key. -There are 2 ways to specify it. - -<p> -<h4>Case 1</h4> -<pre><tt>create table t ( - a integer not null, - b char(20) not null, - c float, - primary key(a, b) -) -</tt></pre> -<p> -<h4>Case 2</h4> -<p> -A column can be specified as AUTO_INCREMENT. -The column has following requirements. -<ul> -<li>it must be the primary key (not just part of one) -<li>its type must be one of the integer types -</ul> -<pre><tt>create table t ( - a int unsigned auto_increment primary key, - b char(20) not null, - c float -) -</tt></pre> -<p> -The values of an AUTO_INCREMENT column are unique (until wrap-around) -and form an ascending sequence. -Gaps in the sequence are possible. -<h4>Default values</h4> -Columns can be specified with DEFAULT value -which is used on insert if the column is not on the insert list. -<p> -<pre><tt>create table t ( - a int primary key, - b int default 100 -) -insert into t(a) values(1) -- inserts (1,100) -</tt></pre> -<p> -The value must evaluate to constant. -Using SYSDATE (if allowed at all) evaluates to table creation time. -<p> - -<h4>Logging / nologging</h4> - -By default tables are created in logging mode, meaning the data -is preserved across database restart. -The mode can be specified explicitly: -<p> -<tt>create table t1 (a int primary key, b int) logging</tt> -<br> -<tt>create table t1 (a int primary key, b int) nologging</tt> - -<h4>Schemas</h4> - -Schemas do not exist in current NDB Cluster. -As a convenience, a single period is allowed in table names: -<p> -<pre><tt>create table mydb.mytable (a int primary key)</tt></pre> -<p> - -<h4>Drop table</h4> - -Deletes a table, all of its indexes, and all data: -<p> -<tt>drop table t</tt> - -<h4>3.7 Indexes</h4> -Only unique non-ordered indexes exist currently. -The columns must be not nullable and are stored in same -order as underlying table columns. -<p> -<tt>create unique hash index x1 on t1(b, c) logging</tt> -<p> -Internally, a unique hash index is a table where index key is primary key. -If the index is <tt>nologging</tt>, it is rebuilt on database restart -before the database is opened. -<p> -Indexes can of course be dropped: -<p> -<tt>drop index x1</tt> - -<h4>3.8 Select</h4> - -Features: - -<ul> -<li>Expressions and predicates -<br><tt>select a + b * c from t where a < b + c and (b > c or c > 10)</tt> -<li>JOIN to any depth -<br><tt>select a.x, b.y, c.z from t1 a, t2 b, t2 c where a.x + b.y < c.z</tt> -<li>ORDER BY -<br><tt>select * from t1, t2 where a1 > 5 order by b1 + b2, c1 desc</tt> -<li>DISTINCT -<br><tt>select distinct a, b + c from t</tt> -<li>Aggregates without grouping. -<br><tt>select count(*), max(a), 1 + sum(b) + avg(c * d) from t</tt> -<li>Aggregates with grouping. -<br><tt>select a, sum(b) from t group by a having sum(c) > 0 order by a, sum(d)</tt> -</ul> - -Major omissions: -<ul> -<li>no OUTER JOIN -<li>no subqueries and no EXISTS clause -</ul> - -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 <em>nested loops</em> only. -<p> -<ul> -<li>SCAN -<br><tt>select * from t where a < b</tt> -<li>INTERPRETED SCAN (much faster) -<br><tt>select * from t1, t2 where t1.a < 10 and t2.b > t1.c</tt> -<li>PRIMARY KEY lookup -<br><tt>select * from t where pk = 5 and b > 10</tt> -<li>NESTED LOOPS -<br><tt>select * from t1, t2, t3 where t1.pk = t2.x and t2.pk = t3.y</tt> -</ul> - -<h4>3.9 Insert and write</h4> - -Both VALUES and subquery variants can be used. -<p> -<pre><tt>insert into t(a, c) values (123, 'abc') -insert into t1(a, c) select a + 10 * b, c from t2 -</tt></pre> -<p> -For convenience, the non-standard <i>MySql</i> syntax is also supported. -<p> -<pre><tt>insert into t set a = 123, c = 'abc'</tt></pre> -<p> -The non-standard operation WRITE is used exactly like INSERT. -The record is updated if it exists. -Otherwise a new record is inserted. -<p> -<pre><tt>write into t(a, c) values (123, 'abc') -</tt></pre> - -<h4>3.10 Update</h4> - -Update allows no subqueries. -Update is optimized to minimize scans and reads, -by using primary keys and existing unique hash indexes. -<p> -<ul> -<li>SCAN -<br><tt>update t set a = b + 5, c = d where c > 10</tt> -<li>PRIMARY KEY or INDEX lookup -<br><tt>update t set a = b + 5, c = d where pk = 5 and c > 10</tt> -<li>PRIMARY KEY or INDEX direct -<br><tt>update t set a = 5, c = 7 where pk = 5</tt> -</ul> - -<h4>3.11 Delete</h4> - -Delete allows no subqueries. -Delete is optimized to minimize scans and reads, -by using primary keys and existing unique hash indexes. -<p> -<ul> -<li>SCAN -<br><tt>delete from t where c > 10</tt> -<li>PRIMARY KEY or INDEX lookup -<br><tt>delete from t where pk = 5 and c > 10</tt> -<li>PRIMARY KEY or INDEX direct -<br><tt>delete from t where pk = 5</tt> -</ul> - -<h4>3.12 Virtual tables</h4> - -The driver implements some virtual tables. -They can only be queried, not modified. -<p> -<ul> -<li>DUAL -<br>A 1-row table - example: select SYSDATE from DUAL. -<li>ODBC$TYPEINFO -<br>Corresponds to SQLGetTypeInfo. -<li>ODBC$TABLES -<br>Corresponds to SQLTables but shows all NDB kernel objects. -<li>ODBC$COLUMNS -<br>Corresponds to SQLColumns. -<li>ODBC$PRIMARYKEYS -<br>Corresponds to SQLPrimaryKeys. -</ul> - -<h3>4. DIAGNOSTICS</h3> - -<h4>4.1 Diagnostic records</h4> - -The driver manager and driver return 3 main diagnostics -(see <b><tt>SQLGetDiagRec</tt></b>). -<ul> -<li>SQLSTATE (a string of 5 characters) -<li>Native error code -<li>Message text -</ul> -<p> -Message text format is -<br><br> -<b><tt>[Alzato][ODBC driver][NDB Cluster] NDB-ssccnnn <i>error text</i> (in SQLXxx)</tt></b> -<br><br> -Here <b>ssccnnnn</b> is native error code (decimal number), with following parts: -<p> -<li><b><tt>ss</tt></b> - status -<li><b><tt>cc</tt></b> - classification -<li><b><tt>nnnn</tt></b> - error code -</ul> -<p> -See NDB API guide for further information. -<p> -For non-database errors the last prefix <b><tt>[NDB Cluster]</tt></b> is omitted -and native error code is always 02015001. - -<h4>4.2 Tracing</h4> - -Following environment variables may be useful. -<ul> -<li><b><tt>NDB_ODBC_TRACE</tt></b> -<br> -Values ≥ 2 cause SQL execution plan -to be printed on standard output. -<br> -Values ≥ 3 show the ODBC API functions -called by the driver manager. -<br><br> -<li><b><tt>NDB_ODBC_DEBUG</tt></b> -<br> -Non-zero value makes the driver abort -the application on unhandled conditions. -<br> -By default the ODBC API function is aborted gracefully. -</ul> - -<h4>4.3 Thread safety</h4> -<p> -The driver has same thread-safety model as NDB API. -In NDB API each thread must use its own <b><tt>Ndb</tt></b> object. -In NDB ODBC a <b><tt>SQLConnect</tt></b> corresponds to an <b><tt>Ndb</tt></b> object. -It is required that each thread allocates its -own ODBC handles (of all types). - -<h4>4.4 Data formats</h4> -<p> -SQL types are represented as (old) NDB types as follows. -<p> -<table width="80%" border=1> -<tr align="left"><th width="20%">SQL type</th> <th>NDB type</th></tr> -<tr align="left"><td align="left">CHAR(n)</td><td>String(n), blank-padded to n</td></tr> -<tr align="left"><td align="left">VARCHAR(n)</td><td>String(n+2), zero-padded to n, length in last 2 bytes (big-endian)</td></tr> -<tr align="left"><td align="left">integers</td><td>Signed(x) or UnSigned(x), x=16,32,64, native format</td></tr> -<tr align="left"><td align="left">floats</td><td>Float(x), x=32,64, native format</td></tr> -<tr align="left"><td align="left">DATETIME</td><td>String(12) = cc yy mm dd HH MM SS \0 ff ff ff ff (big-endian)</td></tr> -</table> -<p> -Note: SQL types exist now in NDB API in <b><tt>NdbDictionary</tt></b> class. -However they are not yet understood by NDB API operations. - -<h4>4.5 NDB Cluster limitations</h4> -<p> -<ul> -<li>Isolation level is READ COMMITTED. -A scan (non-primary-key select of several rows) does not see consistent data. -<br><br> -<li>Inserting into a table from itself is likely to cause a deadlock -or a random result. -<br><tt><b>no:</b> insert into t(a, b) select a*100, b+100 from t</tt> -<br><br> -<li>Number of uncommitted rows is limited by NDB configuration -parameter <b><tt>MaxNoOfConcurrentOperations</tt></b> (typical default 4096). -To delete all rows from a large table one may need to do repeatedly: -<br><tt>delete from t where rownum < 4000</tt> -</ul> - -<h4>4.6 Known problems v2.11</h4> -<p> -Following lists specific known problems. -<ul> -<li>ORDER BY works only with expressions, -not with column aliases or positions. -<br><tt><b>no:</b> select a+b x from t order by x</tt> -<br><tt><b>no:</b> select * from t order by 1, 2, 3</tt> -<br><br> -<li>Join optimizer does not always minimize number of scans. -Changing the order of tables in the statement may help. -</ul> - -<h4>4.7 Useful links</h4> -<p> -<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/dasdkodbcoverview_whatsnew.asp/">Microsoft ODBC page</a> -<br> -<a href="http://www.unixodbc.org/">unixODBC home page</a> -<br> -<a href="http://www.iodbc.org/">iODBC home page</a> - -</BODY> -</HTML> diff --git a/storage/ndb/src/old_files/client/odbc/docs/select.fig b/storage/ndb/src/old_files/client/odbc/docs/select.fig deleted file mode 100644 index 4f51a2085b4..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/docs/systables.pl b/storage/ndb/src/old_files/client/odbc/docs/systables.pl deleted file mode 100644 index 728d966a7a4..00000000000 --- a/storage/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} = [ -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLGetTypeInfo</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlgettypeinfo"></A>SQLGetTypeInfo</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 1.0<BR> -# Standards Compliance: ISO 92</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLGetTypeInfo</B> 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.</P> -# -# <P class="indent"><b class="le">Important </b>Applications must use the type names returned in the TYPE_NAME column of the <B>SQLGetTypeInfo</B> result set in <B>ALTER TABLE</B> and <B>CREATE TABLE</B> statements. <B>SQLGetTypeInfo</B> may return more than one row with the same value in the DATA_TYPE column.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLGetTypeInfo</B>( -# SQLHSTMT <I>StatementHandle</I>, -# SQLSMALLINT <I>DataType</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>StatementHandle</I></DT> -# -# <DD>[Input]<BR> -# Statement handle for the result set.</dd> -# -# <DT><I>DataType</I></DT> -# -# <DD>[Input]<BR> -# The SQL data type. This must be one of the values in the "<A HREF="odbcsql_data_types.htm">SQL Data Types</A>" 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.</dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLGetTypeInfo</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_STMT and a <I>Handle</I> of <I>StatementHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLGetTypeInfo </B>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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01S02</TD> -# <TD width=26%>Option value changed</TD> -# <TD width=52%>A specified statement attribute was invalid because of implementation working conditions, so a similar value was temporarily substituted. (Call <B>SQLGetStmtAttr</B> to determine the temporarily substituted value.) The substitute value is valid for the <I>StatementHandle</I> 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.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>A cursor was open on the <I>StatementHandle,</I> and <B>SQLFetch</B> or <B>SQLFetchScroll</B> had been called. This error is returned by the Driver Manager if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has not returned SQL_NO_DATA, and is returned by the driver if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has returned SQL_NO_DATA. -# <P>A result set was open on the <I>StatementHandle</I>, but <B>SQLFetch</B> or <B>SQLFetchScroll</B> had not been called.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40001</TD> -# <TD width=26%>Serialization failure</TD> -# <TD width=52%>The transaction was rolled back due to a resource deadlock with another transaction.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40003</TD> -# <TD width=26%>Statement completion unknown</TD> -# <TD width=52%>The associated connection failed during the execution of this function and the state of the transaction cannot be determined.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause. </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY004</TD> -# <TD width=26%>Invalid SQL data type</TD> -# <TD width=52%>The value specified for the argument <I>DataType</I> was neither a valid ODBC SQL data type identifier nor a driver-specific data type identifier supported by the driver.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY008</TD> -# <TD width=26%>Operation canceled</TD> -# <TD width=52%>Asynchronous processing was enabled for the <I>StatementHandle</I>, then the function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I>. Then the function was called again on the <I>StatementHandle</I>. -# <P>The function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I> from a different thread in a multithread application.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function (not this one) was called for the <I>StatementHandle</I> and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>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. -# <P>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.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT00</TD> -# <TD width=26%>Timeout expired</TD> -# <TD width=52%>The query timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtAttr</B>, SQL_ATTR_QUERY_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver corresponding to the <I>StatementHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P><B>SQLGetTypeInfo</B> 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 "<A HREF="odbcddl_statements.htm">DDL Statements</A>" in Chapter 8: SQL Statements.</P> -# -# <P>If the <I>DataType</I> 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. </P> -# -# <P class="indent"><b class="le">Note </b>For more information about the general use, arguments, and returned data of ODBC catalog functions, see <A HREF="odbccatalog_functions.htm">Chapter 7: Catalog Functions</A>.</P> -# -# <P>The following columns have been renamed for ODBC 3.<I>x</I>. The column name changes do not affect backward compatibility because applications bind by column number.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>ODBC 2.0 column</TH> -# <TH width=52%>ODBC 3.<I>x</I> column</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>PRECISION</TD> -# <TD width=52%>COLUMN_SIZE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>MONEY</TD> -# <TD width=52%>FIXED_PREC_SCALE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>AUTO_INCREMENT</TD> -# <TD width=52%>AUTO_UNIQUE_VALUE</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>The following columns have been added to the results set returned by <B>SQLGetTypeInfo</B> for ODBC 3.<I>x</I>: -# -# <UL type=disc> -# <LI>SQL_DATA_TYPE</li> -# -# <LI>INTERVAL_PRECISION</li> -# -# <LI>SQL_DATETIME_SUB</li> -# -# <LI>NUM_PREC_RADIX</li> -# </UL> -# -# <P>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 "<A HREF="odbcdata_returned_by_catalog_functions.htm">Data Returned by Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# -# <P class="indent"><b class="le">Note</b> <B>SQLGetTypeInfo</B> 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 <B>SQLGetTypeInfo</B>.</P> -# -# <P class="indent">The data types returned by <B>SQLGetTypeInfo</B> 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 <B>SQLGetTypeInfo</B>. In creating the result set for a catalog function, the driver might use a data type that is not supported by the data source. </P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=33%><BR> -# Column name</TH> -# <TH width=14%>Column <BR> -# number</TH> -# <TH width=15%><BR> -# Data type</TH> -# <TH width=38%><BR> -# Comments</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=33%>TYPE_NAME<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>1</TD> -# <TD width=15%>Varchar<BR> -# not NULL</TD> -# <TD width=38%>Data source–dependent data-type name; for example, "CHAR()", "VARCHAR()", "MONEY", "LONG VARBINARY", or "CHAR ( ) FOR BIT DATA". Applications must use this name in <B>CREATE TABLE</B> and <B>ALTER TABLE</B> statements.</TD> -# </TR> - { name => "type_name", - type => "varchar", - length => 20, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>DATA_TYPE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>2</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>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 "<A HREF="odbcsql_data_types.htm">SQL Data Types</A>" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver’s documentation.</TD> -# </TR> - { name => "data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>COLUMN_SIZE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>3</TD> -# <TD width=15%>Integer</TD> -# <TD width=38%>The 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 "<A HREF="odbcinterval_data_type_length.htm">Interval Data Type Length</A>" in Appendix D: Data Types). -# <P>For more information on column size, see "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</P> -# </TD> -# </TR> - { name => "column_size", - type => "integer", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>LITERAL_PREFIX<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>4</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>Character 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.</TD> -# </TR> - { name => "literal_prefix", - type => "varchar", - length => 1, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>LITERAL_SUFFIX<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>5</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>Character 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.</TD> -# </TR> - { name => "literal_suffix", - type => "varchar", - length => 1, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>CREATE_PARAMS<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>6</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>A 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. -# <P>The driver supplies the CREATE_PARAMS text in the language of the country where it is used.</P> -# </TD> -# </TR> - { name => "create_params", - type => "varchar", - length => 20, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>NULLABLE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>7</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>Whether the data type accepts a NULL value: -# <P>SQL_NO_NULLS if the data type does not accept NULL values.</P> -# -# <P>SQL_NULLABLE if the data type accepts NULL values.</P> -# -# <P>SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values.</P> -# </TD> -# </TR> - { name => "nullable", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>CASE_SENSITIVE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>8</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>Whether a character data type is case-sensitive in collations and comparisons: -# <P>SQL_TRUE if the data type is a character data type and is case-sensitive.</P> -# -# <P>SQL_FALSE if the data type is not a character data type or is not case-sensitive.</P> -# </TD> -# </TR> - { name => "case_sensitive", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>SEARCHABLE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>9</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>How the data type is used in a <B>WHERE</B> clause: -# <P>SQL_PRED_NONE if the column cannot be used in a <B>WHERE</B> clause. (This is the same as the SQL_UNSEARCHABLE value in ODBC 2.<I>x</I>.)</P> -# -# <P>SQL_PRED_CHAR if the column can be used in a <B>WHERE</B> clause, but only with the <B>LIKE</B> predicate. (This is the same as the SQL_LIKE_ONLY value in ODBC 2.<I>x</I>.)</P> -# -# <P>SQL_PRED_BASIC if the column can be used in a <B>WHERE</B> clause with all the comparison operators except <B>LIKE</B> (comparison, quantified comparison, <B>BETWEEN</B>, <B>DISTINCT</B>, <B>IN</B>, <B>MATCH</B>, and <B>UNIQUE</B>). (This is the same as the SQL_ALL_EXCEPT_LIKE value in ODBC 2.<I>x</I>.)</P> -# -# <P>SQL_SEARCHABLE if the column can be used in a <B>WHERE</B> clause with any comparison operator.</P> -# </TD> -# </TR> - { name => "searchable", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>UNSIGNED_ATTRIBUTE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>10</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>Whether the data type is unsigned: -# <P>SQL_TRUE if the data type is unsigned.</P> -# -# <P>SQL_FALSE if the data type is signed.</P> -# -# <P>NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.</P> -# </TD> -# </TR> - { name => "unsigned_attribute", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>FIXED_PREC_SCALE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>11</TD> -# <TD width=15%>Smallint<BR> -# not NULL</TD> -# <TD width=38%>Whether the data type has predefined fixed precision and scale (which are data source–specific), such as a money data type: -# <P>SQL_TRUE if it has predefined fixed precision and scale.</P> -# -# <P>SQL_FALSE if it does not have predefined fixed precision and scale.</P> -# </TD> -# </TR> - { name => "fixed_prec_scale", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>AUTO_UNIQUE_VALUE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>12</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>Whether the data type is autoincrementing: -# <P>SQL_TRUE if the data type is autoincrementing.</P> -# -# <P>SQL_FALSE if the data type is not autoincrementing.</P> -# -# <P>NULL is returned if the attribute is not applicable to the data type or the data type is not numeric.</P> -# -# <P>An application can insert values into a column having this attribute, but typically cannot update the values in the column. </P> -# -# <P>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.</P> -# </TD> -# </TR> - { name => "auto_unique_value", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>LOCAL_TYPE_NAME<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>13</TD> -# <TD width=15%>Varchar</TD> -# <TD width=38%>Localized 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.</TD> -# </TR> - { name => "local_type_name", - type => "varchar", - length => 20, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>MINIMUM_SCALE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>14</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>The 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 "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</TD> -# </TR> - { name => "minimum_scale", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>MAXIMUM_SCALE<BR> -# (ODBC 2.0)</TD> -# <TD width=14%>15</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>The 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 "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</TD> -# </TR> - { name => "maximum_scale", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>SQL_DATA_TYPE<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>16</TD> -# <TD width=15%>Smallint NOT NULL</TD> -# <TD width=38%>The 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. -# <P>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 <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>.) </P> -# </TD> -# </TR> - { name => "sql_data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>SQL_DATETIME_SUB<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>17</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>When 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. -# <P>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 <A HREF="odbcdata_types.htm">Appendix D: Data Types</A>.)</P> -# </TD> -# </TR> - { name => "sql_datetime_sub", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>NUM_PREC_RADIX<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>18</TD> -# <TD width=15%>Integer</TD> -# <TD width=38%>If 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.</TD> -# </TR> - { name => "num_prec_radix", - type => "integer", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=33%>INTERVAL_PRECISION<BR> -# (ODBC 3.0)</TD> -# <TD width=14%>19</TD> -# <TD width=15%>Smallint</TD> -# <TD width=38%>If the data type is an interval data type, then this column contains the value of the interval leading precision. (See "<A HREF="odbcinterval_data_type_precision.htm">Interval Data Type Precision</A>" in Appendix D: Data Types.) Otherwise, this column is NULL.</TD> -# </TR> - { name => "interval_precision", - type => "smallint", - length => undef, - nullable => 1, - }, -# </table></div> -# <!--TS:--> -# <P>Attribute information can apply to data types or to specific columns in a result set. <B>SQLGetTypeInfo</B> returns information about attributes associated with data types; <B>SQLColAttribute</B> returns information about attributes associated with columns in a result set.</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>For information about</TH> -# <TH width=50%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Binding a buffer to a column in a result set</TD> -# <TD width=50%><A HREF="odbcsqlbindcol.htm">SQLBindCol</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Canceling statement processing</TD> -# <TD width=50%><A HREF="odbcsqlcancel.htm">SQLCancel</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning information about a column in a result set</TD> -# <TD width=50%><A HREF="odbcsqlcolattribute.htm">SQLColAttribute</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a block of data or scrolling through a result set</TD> -# <TD width=50%><A HREF="odbcsqlfetchscroll.htm">SQLFetchScroll</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a single row or a block of data in a forward-only direction</TD> -# <TD width=50%><A HREF="odbcsqlfetch.htm">SQLFetch</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning information about a driver or data source</TD> -# <TD width=50%><A HREF="odbcsqlgetinfo.htm">SQLGetInfo</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -]; - -# -# odbcsqltables.htm -# -$listWhat->{tables} = [ -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLTables</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqltables"></A>SQLTables</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 1.0<BR> -# Standards Compliance: X/Open</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLTables</B> 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.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLTables</B>( -# SQLHSTMT <I>StatementHandle</I>, -# SQLCHAR * <I>CatalogName</I>, -# SQLSMALLINT <I>NameLength1</I>, -# SQLCHAR * <I>SchemaName</I>, -# SQLSMALLINT <I>NameLength2</I>, -# SQLCHAR * <I>TableName</I>, -# SQLSMALLINT <I>NameLength3</I>, -# SQLCHAR * <I>TableType</I>, -# SQLSMALLINT <I>NameLength4</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>StatementHandle</I></DT> -# -# <DD>[Input]<BR> -# Statement handle for retrieved results.</dd> -# -# <DT><I>CatalogName</I></DT> -# -# <DD>[Input]<BR> -# Catalog name. The <I>CatalogName</I> 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. -# -# <P>If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>CatalogName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>CatalogName</I> is a pattern value argument; it is treated literally, and its case is significant. For more information, see "<A HREF="odbcarguments_in_catalog_functions.htm">Arguments in Catalog Functions</A>" in Chapter 7: Catalog Functions. -# </dd> -# -# <DT><I>NameLength1</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>CatalogName</I>.</dd> -# -# <DT><I>SchemaName</I></DT> -# -# <DD>[Input]<BR> -# 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. -# -# <P>If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>SchemaName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>SchemaName</I> is a pattern value argument; it is treated literally, and its case is significant. -# </dd> -# -# <DT><I>NameLength2</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>SchemaName</I>.</dd> -# -# <DT><I>TableName</I></DT> -# -# <DD>[Input]<BR> -# String search pattern for table names. -# -# <P>If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>TableName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>TableName</I> is a pattern value argument; it is treated literally, and its case is significant. -# </dd> -# -# <DT><I>NameLength3</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>TableName</I>.</dd> -# -# <DT><I>TableType</I></DT> -# -# <DD>[Input]<BR> -# List of table types to match. -# -# <P>Note that the SQL_ATTR_METADATA_ID statement attribute has no effect upon the <I>TableType</I> argument. <I>TableType</I> is a value list argument, no matter what the setting of SQL_ATTR_METADATA_ID. -# </dd> -# -# <DT><I>NameLength4</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>TableType</I>.</dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLTables</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_STMT and a <I>Handle</I> of <I>StatementHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLTables</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>A cursor was open on the <I>StatementHandle</I>, and <B>SQLFetch</B> or <B>SQLFetchScroll</B> had been called. This error is returned by the Driver Manager if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has not returned SQL_NO_DATA and is returned by the driver if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has returned SQL_NO_DATA. -# <P>A cursor was open on the <I>StatementHandle</I>, but <B>SQLFetch</B> or <B>SQLFetchScroll</B> had not been called.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40001</TD> -# <TD width=26%>Serialization failure</TD> -# <TD width=52%>The transaction was rolled back due to a resource deadlock with another transaction.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40003</TD> -# <TD width=26%>Statement completion unknown</TD> -# <TD width=52%>The associated connection failed during the execution of this function, and the state of the transaction cannot be determined.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation <BR> -# error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY008</TD> -# <TD width=26%>Operation canceled</TD> -# <TD width=52%>Asynchronous processing was enabled for the <I>StatementHandle</I>. The function was called, and before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I>. Then the function was called again on the <I>StatementHandle</I>. -# <P>The function was called, and before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I> from a different thread in a multithread application.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY009</TD> -# <TD width=26%>Invalid use of null pointer</TD> -# <TD width=52%>The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, the <I>CatalogName</I> argument was a null pointer, and the SQL_CATALOG_NAME <I>InfoType</I> returns that catalog names are supported. -# <P>(DM) The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, and the <I>SchemaName</I> or <I>TableName</I> argument was a null pointer.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function (not this one) was called for the <I>StatementHandle</I> and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=52%>(DM) The value of one of the length arguments was less than 0 but not equal to SQL_NTS. -# <P>The value of one of the name length arguments exceeded the maximum length value for the corresponding name.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>A catalog was specified, and the driver or data source does not support catalogs. -# <P>A schema was specified, and the driver or data source does not support schemas.</P> -# -# <P>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.</P> -# -# <P>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. </P> -# -# <P>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.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT00</TD> -# <TD width=26%>Timeout expired</TD> -# <TD width=52%>The query timeout period expired before the data source returned the requested result set. The timeout period is set through <B>SQLSetStmtAttr</B>, SQL_ATTR_QUERY_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver associated with the <I>StatementHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P><B>SQLTables</B> 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: -# -# <UL type=disc> -# <LI>Call <B>SQLGetInfo</B> and check the SQL_ACCESSIBLE_TABLES information type.</li> -# -# <LI>Call <B>SQLTablePrivileges</B> to check the privileges for each table.</li> -# </UL> -# -# <P>Otherwise, the application must be able to handle a situation where the user selects a table for which <B>SELECT</B> privileges are not granted.</P> -# -# <P>The <I>SchemaName</I> and <I>TableName</I> arguments accept search patterns. The <I>CatalogName</I> 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<I>.x</I> driver will require that wildcard characters in the <I>CatalogName</I> argument be escaped to be treated literally. For more information about valid search patterns, see "<A HREF="odbcpattern_value_arguments.htm">Pattern Value Arguments</A>" in Chapter 7: Catalog Functions.</P> -# -# <P class="indent"><b class="le">Note</b> For more information about the general use, arguments, and returned data of ODBC catalog functions, see <A HREF="odbccatalog_functions.htm">Chapter 7: Catalog Functions</A>.</P> -# -# <P>To support enumeration of catalogs, schemas, and table types, the following special semantics are defined for the <I>CatalogName</I>, <I>SchemaName</I>, <I>TableName</I>, and <I>TableType</I> arguments of <B>SQLTables</B>: -# -# <UL type=disc> -# <LI>If <I>CatalogName</I> is SQL_ALL_CATALOGS and <I>SchemaName</I> and <I>TableName</I> 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.)</li> -# -# <LI>If <I>SchemaName</I> is SQL_ALL_SCHEMAS and <I>CatalogName</I> and <I>TableName</I> 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.)</li> -# -# <LI>If <I>TableType</I> is SQL_ALL_TABLE_TYPES and <I>CatalogName</I>, <I>SchemaName</I>, and <I>TableName</I> 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.)</li> -# </UL> -# -# <P>If <I>TableType</I> 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, <B>SQLTables</B> does not return any results for that type.</P> -# -# <P><B>SQLTables</B> 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 "<A HREF="odbcuses_of_catalog_data.htm">Uses of Catalog Data</A>" in Chapter 7: Catalog Functions.</P> -# -# <P>To determine the actual lengths of the TABLE_CAT, TABLE_SCHEM, and TABLE_NAME columns, an application can call <B>SQLGetInfo</B> with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, and SQL_MAX_TABLE_NAME_LEN information types.</P> -# -# <P>The following columns have been renamed for ODBC 3<I>.x</I>. The column name changes do not affect backward compatibility because applications bind by column number.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>ODBC 2.0 column</TH> -# <TH width=52%>ODBC 3<I>.x</I> column</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>TABLE_QUALIFIER</TD> -# <TD width=52%>TABLE_CAT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>TABLE_OWNER</TD> -# <TD width=52%>TABLE_SCHEM</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>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 "<A HREF="odbcdata_returned_by_catalog_functions.htm">Data Returned by Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=27%><BR> -# Column name</TH> -# <TH width=15%>Column number</TH> -# <TH width=16%><BR> -# Data type</TH> -# <TH width=42%><BR> -# Comments</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_CAT<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>1</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>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.</TD> -# </TR> - { name => "table_cat", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_SCHEM<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>2</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>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.</TD> -# </TR> - { name => "table_schem", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>3</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>Table name.</TD> -# </TR> - { name => "table_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_TYPE<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>4</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>Table type name; one of the following: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM", or a data source–specific type name. -# <P>The meanings of "ALIAS" and "SYNONYM" are driver-specific.</P> -# </TD> -# </TR> - { name => "table_type", - type => "varchar", - length => 20, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>REMARKS<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>5</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>A description of the table.</TD> -# </TR> - { name => "remarks", - type => "varchar", - length => 200, - nullable => 1, - }, -# </table></div> -# <!--TS:--> -# <P class="label"><B>Code Example</B></P> -# -# <P>For a code example of a similar function, see <A HREF="odbcsqlcolumns.htm">SQLColumns</A>.</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=43%>For information about</TH> -# <TH width=57%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Binding a buffer to a column in a result set</TD> -# <TD width=57%><A HREF="odbcsqlbindcol.htm">SQLBindCol</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Canceling statement processing</TD> -# <TD width=57%><A HREF="odbcsqlcancel.htm">SQLCancel</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Returning privileges for a column or columns</TD> -# <TD width=57%><A HREF="odbcsqlcolumnprivileges.htm">SQLColumnPrivileges</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Returning the columns in a table or tables</TD> -# <TD width=57%><A HREF="odbcsqlcolumns.htm">SQLColumns</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Fetching a single row or a block of data in a forward-only direction</TD> -# <TD width=57%><A HREF="odbcsqlfetch.htm">SQLFetch</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Fetching a block of data or scrolling through a result set</TD> -# <TD width=57%><A HREF="odbcsqlfetchscroll.htm">SQLFetchScroll</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Returning table statistics and indexes</TD> -# <TD width=57%><A HREF="odbcsqlstatistics.htm">SQLStatistics</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=43%>Returning privileges for a table or tables</TD> -# <TD width=57%><A HREF="odbcsqltableprivileges.htm">SQLTablePrivileges</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -]; - -# -# odbcsqlcolumns.htm -# -$listWhat->{columns} = [ -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLColumns</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlcolumns"></A>SQLColumns</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 1.0<BR> -# Standards Compliance: X/Open</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLColumns</B> returns the list of column names in specified tables. The driver returns this information as a result set on the specified <I>StatementHandle</I>.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLColumns</B>( -# SQLHSTMT <I>StatementHandle</I>, -# SQLCHAR * <I>CatalogName</I>, -# SQLSMALLINT <I>NameLength1</I>, -# SQLCHAR * <I>SchemaName</I>, -# SQLSMALLINT <I>NameLength2</I>, -# SQLCHAR * <I>TableName</I>, -# SQLSMALLINT <I>NameLength3</I>, -# SQLCHAR * <I>ColumnName</I>, -# SQLSMALLINT <I>NameLength4</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>StatementHandle</I></DT> -# -# <DD>[Input]<BR> -# Statement handle.</dd> -# -# <DT><I>CatalogName</I></DT> -# -# <DD>[Input]<BR> -# 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. <I>CatalogName</I> cannot contain a string search pattern.</dd> -# </DL> -# -# <BLOCKQUOTE> -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>CatalogName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>CatalogName</I> is an ordinary argument; it is treated literally, and its case is significant. For more information, see "<A HREF="odbcarguments_in_catalog_functions.htm">Arguments in Catalog Functions</A>" in Chapter 7: Catalog Functions.</BLOCKQUOTE> -# -# <DL> -# <DT><I>NameLength1</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>CatalogName</I>.</dd> -# -# <DT><I>SchemaName</I></DT> -# -# <DD>[Input]<BR> -# 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.</dd> -# </DL> -# -# <BLOCKQUOTE> -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>SchemaName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>SchemaName</I> is a pattern value argument; it is treated literally, and its case is significant.</BLOCKQUOTE> -# -# <DL> -# <DT><I>NameLength2</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>SchemaName</I>.</dd> -# -# <DT><I>TableName</I></DT> -# -# <DD>[Input]<BR> -# String search pattern for table names.</dd> -# </DL> -# -# <BLOCKQUOTE> -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>TableName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>TableName</I> is a pattern value argument; it is treated literally, and its case is significant.</BLOCKQUOTE> -# -# <DL> -# <DT><I>NameLength3</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>TableName</I>.</dd> -# -# <DT><I>ColumnName</I></DT> -# -# <DD>[Input]<BR> -# String search pattern for column names. </dd> -# </DL> -# -# <BLOCKQUOTE> -# If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>ColumnName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>ColumnName</I> is a pattern value argument; it is treated literally, and its case is significant.</BLOCKQUOTE> -# -# <DL> -# <DT><I>NameLength4</I></DT> -# -# <DD>[Input]<BR> -# Length of *<I>ColumnName</I>.</dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLColumns</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_STMT and a <I>Handle</I> of <I>StatementHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLColumns</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>A cursor was open on the <I>StatementHandle</I>, and <B>SQLFetch</B> or <B>SQLFetchScroll</B> had been called. This error is returned by the Driver Manager if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has not returned SQL_NO_DATA, and is returned by the driver if <B>SQLFetch</B> or <B>SQLFetchScroll</B> has returned SQL_NO_DATA. -# <P>A cursor was open on the <I>StatementHandle</I> but <B>SQLFetch</B> or <B>SQLFetchScroll</B> had not been called.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40001</TD> -# <TD width=26%>Serialization failure</TD> -# <TD width=52%>The transaction was rolled back due to a resource deadlock with another transaction.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40003</TD> -# <TD width=26%>Statement completion unknown</TD> -# <TD width=52%>The associated connection failed during the execution of this function, and the state of the transaction cannot be determined.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY008</TD> -# <TD width=26%>Operation canceled</TD> -# <TD width=52%>Asynchronous processing was enabled for the <I>StatementHandle</I>. The function was called, and before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I>. Then the function was called again on the <I>StatementHandle</I>. -# <P>The function was called, and before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I> from a different thread in a multithread application.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY009</TD> -# <TD width=26%>Invalid use of null pointer</TD> -# <TD width=52%>The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, the <I>CatalogName</I> argument was a null pointer, and the SQL_CATALOG_NAME <I>InfoType</I> returns that catalog names are supported. -# <P>(DM) The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, and the <I>SchemaName</I>, <I>TableName</I>, or <I>ColumnName</I> argument was a null pointer.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function (not this one) was called for the <I>StatementHandle</I> and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=52%>(DM) The value of one of the name length arguments was less than 0 but not equal to SQL_NTS.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%> </TD> -# <TD width=26%> </TD> -# <TD width=52%>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 <B>SQLGetInfo</B> with the <I>InfoType</I> values. (See "Comments.")</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>A catalog name was specified, and the driver or data source does not support catalogs. -# <P>A schema name was specified, and the driver or data source does not support schemas.</P> -# -# <P>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.</P> -# -# <P>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. </P> -# -# <P>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.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT00</TD> -# <TD width=26%>Timeout expired</TD> -# <TD width=52%>The query timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtAttr</B>, SQL_ATTR_QUERY_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver associated with the <I>StatementHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P>This function typically is used before statement execution to retrieve information about columns for a table or tables from the data source's catalog. <B>SQLColumns</B> can be used to retrieve data for all types of items returned by <B>SQLTables</B>. In addition to base tables, this may include (but is not limited to) views, synonyms, system tables, and so on. By contrast, the functions <B>SQLColAttribute</B> and <B>SQLDescribeCol</B> describe the columns in a result set and the function <B>SQLNumResultCols</B> returns the number of columns in a result set. For more information, see "<A HREF="odbcuses_of_catalog_data.htm">Uses of Catalog Data</A>" in Chapter 7: Catalog Functions.</P> -# -# <P class="indent"><b class="le">Note</b> For more information about the general use, arguments, and returned data of ODBC catalog functions, see <A HREF="odbccatalog_functions.htm">Chapter 7: Catalog Functions</A>.</P> -# -# <P><B>SQLColumns</B> returns the results as a standard result set, ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and ORDINAL_POSITION. </P> -# -# <P class="indent"><b class="le">Note</b> When an application works with an ODBC 2.<I>x</I> driver, no ORDINAL_POSITION column is returned in the result set. As a result, when working with ODBC 2.<I>x</I> drivers, the order of the columns in the column list returned by <B>SQLColumns</B> 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.</P> -# -# <P class="indent"><b class="le">Note</b> <B>SQLColumns</B> 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 <B>SQLColumns</B>. </P> -# -# <P class="indent">Some columns that can be returned by <B>SQLStatistics</B> are not returned by <B>SQLColumns</B>. For example, <B>SQLColumns</B> does not return the columns in an index created over an expression or filter, such as SALARY + BENEFITS or DEPT = 0012.</P> -# -# <P>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 <B>SQLGetInfo</B> with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, SQL_MAX_TABLE_NAME_LEN, and SQL_MAX_COLUMN_NAME_LEN options.</P> -# -# <P>The following columns have been renamed for ODBC 3.<I>x</I>. The column name changes do not affect backward compatibility because applications bind by column number.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>ODBC 2.0 column</TH> -# <TH width=52%>ODBC 3.<I>x</I> column</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>TABLE_QUALIFIER</TD> -# <TD width=52%>TABLE_CAT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>TABLE_OWNER</TD> -# <TD width=52%>TABLE_SCHEM</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>PRECISION</TD> -# <TD width=52%>COLUMN_SIZE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>LENGTH</TD> -# <TD width=52%>BUFFER_LENGTH</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>SCALE</TD> -# <TD width=52%>DECIMAL_DIGITS</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>RADIX</TD> -# <TD width=52%>NUM_PREC_RADIX</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>The following columns have been added to the result set returned by <B>SQLColumns</B> for ODBC 3.<I>x</I>:</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TD width=50%> CHAR_OCTET_LENGTH </TD> -# <TD width=50%>ORDINAL_POSITION</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%> COLUMN_DEF</TD> -# <TD width=50%>SQL_DATA_TYPE</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%> IS_NULLABLE </TD> -# <TD width=50%>SQL_DATETIME_SUB</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>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 "<A HREF="odbcdata_returned_by_catalog_functions.htm">Data Returned by Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=24%><BR> -# Column name</TH> -# <TH width=17%>Column<BR> -# number</TH> -# <TH width=16%><BR> -# Data type</TH> -# <TH width=43%><BR> -# Comments</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=24%>TABLE_CAT<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>1</TD> -# <TD width=16%>Varchar</TD> -# <TD width=43%>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.</TD> -# </TR> - { name => "table_cat", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>TABLE_SCHEM<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>2</TD> -# <TD width=16%>Varchar </TD> -# <TD width=43%>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.</TD> -# </TR> - { name => "table_schem", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>TABLE_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>3</TD> -# <TD width=16%>Varchar not NULL</TD> -# <TD width=43%>Table name.</TD> -# </TR> - { name => "table_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>COLUMN_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>4</TD> -# <TD width=16%>Varchar not NULL</TD> -# <TD width=43%>Column name. The driver returns an empty string for a column that does not have a name.</TD> -# </TR> - { name => "column_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>DATA_TYPE<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>5</TD> -# <TD width=16%>Smallint not NULL</TD> -# <TD width=43%>SQL 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 "<A HREF="odbcsql_data_types.htm">SQL Data Types</A>" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver's documentation. -# <P>The data types returned for ODBC 3.<I>x</I> and ODBC 2.<I>x</I> applications may be different. For more information, see "<A HREF="odbcbackward_compatibility_and_standards_compliance.htm">Backward Compatibility and Standards Compliance</A>" in Chapter 17: Programming Considerations.</P> -# </TD> -# </TR> - { name => "data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>TYPE_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>6</TD> -# <TD width=16%>Varchar not NULL</TD> -# <TD width=43%>Data source–dependent data type name; for example, "CHAR", "VARCHAR", "MONEY", "LONG VARBINAR", or "CHAR ( ) FOR BIT DATA".</TD> -# </TR> - { name => "type_name", - type => "varchar", - length => 20, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>COLUMN_SIZE<BR> -# (ODBC 1.0) </TD> -# <TD width=17%>7</TD> -# <TD width=16%>Integer</TD> -# <TD width=43%>If 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 "<A HREF="odbcinterval_data_type_length.htm">Interval Data Type Length</A>" in Appendix D: Data Types). For more information, see "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</TD> -# </TR> - { name => "column_size", - type => "integer", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>BUFFER_LENGTH<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>8</TD> -# <TD width=16%>Integer</TD> -# <TD width=43%>The 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 "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types.</TD> -# </TR> - { name => "buffer_length", - type => "integer", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>DECIMAL_DIGITS<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>9</TD> -# <TD width=16%>Smallint</TD> -# <TD width=43%>The 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 "<A HREF="odbccolumn_size__decimal_digits__transfer_octet_length__and_display_size.htm">Column Size, Decimal Digits, Transfer Octet Length, and Display Size</A>" in Appendix D: Data Types. NULL is returned for data types where DECIMAL_DIGITS is not applicable.</TD> -# </TR> - { name => "decimal_digits", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>NUM_PREC_RADIX<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>10</TD> -# <TD width=16%>Smallint</TD> -# <TD width=43%>For 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. -# <P>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.</P> -# -# <P>NULL is returned for data types where NUM_PREC_RADIX is not applicable.</P> -# </TD> -# </TR> - { name => "num_prec_radix", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>NULLABLE<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>11</TD> -# <TD width=16%>Smallint not NULL</TD> -# <TD width=43%>SQL_NO_NULLS if the column could not include NULL values. -# <P>SQL_NULLABLE if the column accepts NULL values.</P> -# -# <P>SQL_NULLABLE_UNKNOWN if it is not known whether the column accepts NULL values.</P> -# -# <P>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.</P> -# </TD> -# </TR> - { name => "nullable", - type => "smallint", - length => 16, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>REMARKS<BR> -# (ODBC 1.0)</TD> -# <TD width=17%>12</TD> -# <TD width=16%>Varchar</TD> -# <TD width=43%>A description of the column.</TD> -# </TR> - { name => "remarks", - type => "varchar", - length => 200, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>COLUMN_DEF<BR> -# (ODBC 3.0)</TD> -# <TD width=17%>13</TD> -# <TD width=16%>Varchar</TD> -# <TD width=43%>The default value of the column. The value in this column should be interpreted as a string if it is enclosed in quotation marks. -# <P>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.</P> -# -# <P>The value of COLUMN_DEF can be used in generating a new column definition, except when it contains the value TRUNCATED.</P> -# </TD> -# </TR> - { name => "column_def", - type => "varchar", - length => 100, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>SQL_DATA_TYPE<BR> -# (ODBC 3.0)</TD> -# <TD width=17%>14</TD> -# <TD width=16%>Smallint not NULL</TD> -# <TD width=43%>SQL 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 "<A HREF="odbcsql_data_types.htm">SQL Data Types</A>" in Appendix D: Data Types. For information about driver-specific SQL data types, see the driver's documentation. -# <P>The data types returned for ODBC 3.<I>x</I> and ODBC 2.<I>x</I> applications may be different. For more information, see "<A HREF="odbcbackward_compatibility_and_standards_compliance.htm">Backward Compatibility and Standards Compliance</A>" in Chapter 17: Programming Considerations.</P> -# </TD> -# </TR> - { name => "sql_data_type", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>SQL_DATETIME_SUB<BR> -# (ODBC 3.0)</TD> -# <TD width=17%>15</TD> -# <TD width=16%>Smallint</TD> -# <TD width=43%>The 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 <A HREF="odbcsqlsetdescfield.htm">SQLSetDescField</A>.</TD> -# </TR> - { name => "sql_datetime_sub", - type => "smallint", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>CHAR_OCTET_LENGTH<BR> -# (ODBC 3.0)</TD> -# <TD width=17%>16</TD> -# <TD width=16%>Integer</TD> -# <TD width=43%>The maximum length in bytes of a character or binary data type column. For all other data types, this column returns a NULL.</TD> -# </TR> - { name => "char_octet_length", - type => "integer", - length => undef, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>ORDINAL_POSITION<BR> -# (ODBC 3.0)</TD> -# <TD width=17%>17</TD> -# <TD width=16%>Integer not NULL</TD> -# <TD width=43%>The ordinal position of the column in the table. The first column in the table is number 1.</TD> -# </TR> - { name => "ordinal_position", - type => "integer", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=24%>IS_NULLABLE<BR> -# (ODBC 3.0)</TD> -# <TD width=17%>18</TD> -# <TD width=16%>Varchar</TD> -# <TD width=43%>"NO" if the column does not include NULLs. -# <P>"YES" if the column could include NULLs.</P> -# -# <P>This column returns a zero-length string if nullability is unknown. </P> -# -# <P>ISO rules are followed to determine nullability. An ISO SQL–compliant DBMS cannot return an empty string. </P> -# -# <P>The value returned for this column is different from the value returned for the NULLABLE column. (See the description of the NULLABLE column.)</P> -# </TD> -# </TR> - { name => "is_nullable", - type => "varchar", - length => 3, - nullable => 1, - }, -# </table></div> -# <!--TS:--> -# <P class="label"><B>Code Example</B></P> -# -# <P>In the following example, an application declares buffers for the result set returned by <B>SQLColumns</B>. It calls <B>SQLColumns</B> to return a result set that describes each column in the EMPLOYEE table. It then calls <B>SQLBindCol</B> to bind the columns in the result set to the buffers. Finally, the application fetches each row of data with <B>SQLFetch</B> and processes it.</P> -# -# <PRE class="code">#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; -# } -# } -# }</PRE> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>For information about</TH> -# <TH width=50%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Binding a buffer to a column in a result set</TD> -# <TD width=50%><A HREF="odbcsqlbindcol.htm">SQLBindCol</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Canceling statement processing</TD> -# <TD width=50%><A HREF="odbcsqlcancel.htm">SQLCancel</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning privileges for a column or columns</TD> -# <TD width=50%><A HREF="odbcsqlcolumnprivileges.htm">SQLColumnPrivileges</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a block of data or scrolling through a result set</TD> -# <TD width=50%><A HREF="odbcsqlfetchscroll.htm">SQLFetchScroll</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching multiple rows of data</TD> -# <TD width=50%><A HREF="odbcsqlfetch.htm">SQLFetch</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning columns that uniquely identify a row, or columns automatically updated by a transaction</TD> -# <TD width=50%><A HREF="odbcsqlspecialcolumns.htm">SQLSpecialColumns</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning table statistics and indexes</TD> -# <TD width=50%><A HREF="odbcsqlstatistics.htm">SQLStatistics</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning a list of tables in a data source</TD> -# <TD width=50%><A HREF="odbcsqltables.htm">SQLTables</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning privileges for a table or tables</TD> -# <TD width=50%><A HREF="odbcsqltableprivileges.htm">SQLTablePrivileges</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -]; - -# -# odbcsqlprimarykeys.htm -# -$listWhat->{primarykeys} = [ -# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -# <HTML DIR="LTR"><HEAD> -# <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252"> -# <TITLE>SQLPrimaryKeys</TITLE> -# <SCRIPT SRC="/stylesheets/vs70link.js"></SCRIPT> -# <SCRIPT SRC="/stylesheets/vs70.js"></SCRIPT> -# <SCRIPT LANGUAGE="JScript" SRC="/stylesheets/odbc.js"></SCRIPT> -# </HEAD> -# <body topmargin=0 id="bodyID"> -# -# <div id="nsbanner"> -# <div id="bannertitle"> -# <TABLE CLASS="bannerparthead" CELLSPACING=0> -# <TR ID="hdr"> -# <TD CLASS="bannertitle" nowrap> -# ODBC Programmer's Reference -# </TD><TD valign=middle><a href="#Feedback"><IMG name="feedb" onclick=EMailStream(SDKFeedB) style="CURSOR: hand;" hspace=15 alt="" src="/stylesheets/mailto.gif" align=right></a></TD> -# </TR> -# </TABLE> -# </div> -# </div> -# <DIV id="nstext" valign="bottom"> -# -# <H1><A NAME="odbcsqlprimarykeys"></A>SQLPrimaryKeys</H1> -# -# <P class="label"><B>Conformance</B></P> -# -# <P>Version Introduced: ODBC 1.0<BR> -# Standards Compliance: ODBC</P> -# -# <P class="label"><B>Summary</B></P> -# -# <P><B>SQLPrimaryKeys</B> 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.</P> -# -# <P class="label"><B>Syntax</B></P> -# -# <PRE class="syntax">SQLRETURN <B>SQLPrimaryKeys</B>( -# SQLHSTMT <I>StatementHandle</I>, -# SQLCHAR * <I>CatalogName</I>, -# SQLSMALLINT <I>NameLength1</I>, -# SQLCHAR * <I>SchemaName</I>, -# SQLSMALLINT <I>NameLength2</I>, -# SQLCHAR * <I>TableName</I>, -# SQLSMALLINT <I>NameLength3</I>);</PRE> -# -# <P class="label"><B>Arguments</B> -# -# <DL> -# <DT><I>StatementHandle</I></DT> -# -# <DD>[Input]<BR> -# Statement handle.</dd> -# -# <DT><I>CatalogName</I></DT> -# -# <DD>[Input]<BR> -# 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. <I>CatalogName </I>cannot contain a string search pattern. -# -# <P>If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>CatalogName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>CatalogName</I> is an ordinary argument; it is treated literally, and its case is significant. For more information, see "<A HREF="odbcarguments_in_catalog_functions.htm">Arguments in Catalog Functions</A>" in Chapter 7: Catalog Functions. -# </dd> -# -# <DT><I>NameLength1</I></DT> -# -# <DD>[Input]<BR> -# Length in bytes of *<I>CatalogName</I>.</dd> -# -# <DT><I>SchemaName</I></DT> -# -# <DD>[Input]<BR> -# 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. <I>SchemaName </I>cannot contain a string search pattern. -# -# <P>If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>SchemaName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>SchemaName</I> is an ordinary argument; it is treated literally, and its case is not significant. -# </dd> -# -# <DT><I>NameLength2</I></DT> -# -# <DD>[Input]<BR> -# Length in bytes of *<I>SchemaName</I>.</dd> -# -# <DT><I>TableName</I></DT> -# -# <DD>[Input]<BR> -# Table name. This argument cannot be a null pointer. <I>TableName </I>cannot contain a string search pattern. -# -# <P>If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, <I>TableName</I> is treated as an identifier and its case is not significant. If it is SQL_FALSE, <I>TableName</I> is an ordinary argument; it is treated literally, and its case is not significant. -# </dd> -# -# <DT><I>NameLength3</I></DT> -# -# <DD>[Input]<BR> -# Length in bytes of *<I>TableName</I>.</dd> -# </DL> -# -# <P class="label"><B>Returns</B></P> -# -# <P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.</P> -# -# <P class="label"><B>Diagnostics</B></P> -# -# <P>When <B>SQLPrimaryKeys</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling <B>SQLGetDiagRec</B> with a <I>HandleType</I> of SQL_HANDLE_STMT and a <I>Handle</I> of <I>StatementHandle</I>. The following table lists the SQLSTATE values commonly returned by <B>SQLPrimaryKeys</B> 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.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=22%>SQLSTATE</TH> -# <TH width=26%>Error</TH> -# <TH width=52%>Description</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>01000</TD> -# <TD width=26%>General warning</TD> -# <TD width=52%>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>08S01</TD> -# <TD width=26%>Communication link failure</TD> -# <TD width=52%>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>24000</TD> -# <TD width=26%>Invalid cursor state</TD> -# <TD width=52%>(DM) A cursor was open on the <I>StatementHandle</I>, and <B>SQLFetch</B> or <B>SQLFetchScroll</B> had been called. -# <P>A cursor was open on the <I>StatementHandle</I>, but <B>SQLFetch</B> or <B>SQLFetchScroll</B> had not been called.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40001</TD> -# <TD width=26%>Serialization failure</TD> -# <TD width=52%>The transaction was rolled back due to a resource deadlock with another transaction.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>40003</TD> -# <TD width=26%>Statement completion unknown</TD> -# <TD width=52%>The associated connection failed during the execution of this function, and the state of the transaction cannot be determined.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY000</TD> -# <TD width=26%>General error</TD> -# <TD width=52%>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLGetDiagRec</B> in the <I>*MessageText</I> buffer describes the error and its cause.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY001</TD> -# <TD width=26%>Memory allocation error</TD> -# <TD width=52%>The driver was unable to allocate memory required to support execution or completion of the function.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY008</TD> -# <TD width=26%>Operation canceled</TD> -# <TD width=52%>Asynchronous processing was enabled for the <I>StatementHandle</I>. The function was called, and before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I>. Then the function was called again on the <I>StatementHandle</I>. -# <P>The function was called, and before it completed execution, <B>SQLCancel</B> was called on the <I>StatementHandle</I> from a different thread in a multithread application.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY009</TD> -# <TD width=26%>Invalid use of null pointer</TD> -# <TD width=52%>(DM) The <I>TableName</I> argument was a null pointer. -# <P>The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, the <I>CatalogName</I> argument was a null pointer, and <B>SQLGetInfo</B> with the SQL_CATALOG_NAME information type returns that catalog names are supported.</P> -# -# <P>(DM) The SQL_ATTR_METADATA_ID statement attribute was set to SQL_TRUE, and the <I>SchemaName</I> argument was a null pointer.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY010</TD> -# <TD width=26%>Function sequence error</TD> -# <TD width=52%>(DM) An asynchronously executing function (not this one) was called for the <I>StatementHandle</I> and was still executing when this function was called. -# <P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, <B>SQLBulkOperations</B>, or <B>SQLSetPos</B> was called for the <I>StatementHandle</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY013</TD> -# <TD width=26%>Memory management error</TD> -# <TD width=52%>The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HY090</TD> -# <TD width=26%>Invalid string or buffer length</TD> -# <TD width=52%>(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. -# <P>The value of one of the name length arguments exceeded the maximum length value for the corresponding name.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYC00</TD> -# <TD width=26%>Optional feature not implemented</TD> -# <TD width=52%>A catalog was specified, and the driver or data source does not support catalogs. -# <P>A schema was specified and the driver or data source does not support schemas.</P> -# -# <P>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.</P> -# -# <P>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.</P> -# </TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT00</TD> -# <TD width=26%>Timeout expired</TD> -# <TD width=52%>The timeout period expired before the data source returned the requested result set. The timeout period is set through <B>SQLSetStmtAttr</B>, SQL_ATTR_QUERY_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>HYT01</TD> -# <TD width=26%>Connection timeout expired</TD> -# <TD width=52%>The connection timeout period expired before the data source responded to the request. The connection timeout period is set through <B>SQLSetConnectAttr</B>, SQL_ATTR_CONNECTION_TIMEOUT.</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=22%>IM001</TD> -# <TD width=26%>Driver does not support this function</TD> -# <TD width=52%>(DM) The driver associated with the <I>StatementHandle</I> does not support the function.</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P class="label"><B>Comments</B></P> -# -# <P><B>SQLPrimaryKeys</B> 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 "<A HREF="odbcuses_of_catalog_data.htm">Uses of Catalog Data</A>" in Chapter 7: Catalog Functions.</P> -# -# <P>The following columns have been renamed for ODBC 3.<I>x</I>. The column name changes do not affect backward compatibility because applications bind by column number.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=48%>ODBC 2.0 column</TH> -# <TH width=52%>ODBC 3.<I>x</I> column</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>TABLE_QUALIFIER</TD> -# <TD width=52%>TABLE_CAT</TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=48%>TABLE_OWNER</TD> -# <TD width=52%>TABLE_SCHEM</TD> -# </TR> -# </table></div> -# <!--TS:--> -# <P>To determine the actual lengths of the TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and COLUMN_NAME columns, call <B>SQLGetInfo</B> with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, SQL_MAX_TABLE_NAME_LEN, and SQL_MAX_COLUMN_NAME_LEN options.</P> -# -# <P class="indent"><b class="le">Note</b> For more information about the general use, arguments, and returned data of ODBC catalog functions, see <A HREF="odbccatalog_functions.htm">Chapter 7: Catalog Functions</A>.</P> -# -# <P>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 "<A HREF="odbcdata_returned_by_catalog_functions.htm">Data Returned by Catalog Functions</A>" in Chapter 7: Catalog Functions.</P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=27%><BR> -# Column name</TH> -# <TH width=15%>Column number</TH> -# <TH width=16%><BR> -# Data type</TH> -# <TH width=42%><BR> -# Comments</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_CAT<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>1</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>Primary 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.</TD> -# </TR> - { name => "table_cat", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_SCHEM<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>2</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>Primary 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.</TD> -# </TR> - { name => "table_schem", - type => "varchar", - length => 16, - nullable => 1, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>TABLE_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>3</TD> -# <TD width=16%>Varchar<BR> -# not NULL</TD> -# <TD width=42%>Primary key table name.</TD> -# </TR> - { name => "table_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>COLUMN_NAME<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>4</TD> -# <TD width=16%>Varchar<BR> -# not NULL</TD> -# <TD width=42%>Primary key column name. The driver returns an empty string for a column that does not have a name.</TD> -# </TR> - { name => "column_name", - type => "varchar", - length => 16, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>KEY_SEQ<BR> -# (ODBC 1.0)</TD> -# <TD width=15%>5</TD> -# <TD width=16%>Smallint<BR> -# not NULL</TD> -# <TD width=42%>Column sequence number in key (starting with 1).</TD> -# </TR> - { name => "key_seq", - type => "smallint", - length => undef, - nullable => 0, - }, -# -# <TR VALIGN="top"> -# <TD width=27%>PK_NAME<BR> -# (ODBC 2.0)</TD> -# <TD width=15%>6</TD> -# <TD width=16%>Varchar</TD> -# <TD width=42%>Primary key name. NULL if not applicable to the data source.</TD> -# </TR> - { name => "pk_name", - type => "varchar", - length => 16, - nullable => 1, - }, -# </table></div> -# <!--TS:--> -# <P class="label"><B>Code Example</B></P> -# -# <P>See <A HREF="odbcsqlforeignkeys.htm">SQLForeignKeys</A>.</P> -# -# <P class="label"><B>Related Functions</B></P> -# <!--TS:--><div class="tablediv"><table> -# -# <TR VALIGN="top"> -# <TH width=50%>For information about</TH> -# <TH width=50%>See</TH> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Binding a buffer to a column in a result set</TD> -# <TD width=50%><A HREF="odbcsqlbindcol.htm">SQLBindCol</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Canceling statement processing</TD> -# <TD width=50%><A HREF="odbcsqlcancel.htm">SQLCancel</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a block of data or scrolling through a result set</TD> -# <TD width=50%><A HREF="odbcsqlfetchscroll.htm">SQLFetchScroll</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Fetching a single row or a block of data in a forward-only direction</TD> -# <TD width=50%><A HREF="odbcsqlfetch.htm">SQLFetch</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning the columns of foreign keys</TD> -# <TD width=50%><A HREF="odbcsqlforeignkeys.htm">SQLForeignKeys</A></TD> -# </TR> -# -# <TR VALIGN="top"> -# <TD width=50%>Returning table statistics and indexes</TD> -# <TD width=50%><A HREF="odbcsqlstatistics.htm">SQLStatistics</A></TD> -# </TR> -# </table></div> -# <!--TS:--><H4><A NAME="feedback"></A></H4> -# <SPAN id="SDKFeedB"></SPAN> -# </div> -# -# </BODY> -# </HTML> -]; - -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/storage/ndb/src/old_files/client/odbc/docs/type.txt b/storage/ndb/src/old_files/client/odbc/docs/type.txt deleted file mode 100644 index d7b391afc55..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/Func.data b/storage/ndb/src/old_files/client/odbc/driver/Func.data deleted file mode 100644 index c32671e1135..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/Func.pl b/storage/ndb/src/old_files/client/odbc/driver/Func.pl deleted file mode 100644 index 1064a6a6c6e..00000000000 --- a/storage/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 <<END; -usage: perl $0 <data|name|code|move> ... -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, </usr/local/include/{sql,sqlext}.h>); - next; - } - if ($file eq '-iodbc') { - unshift(@args, </usr/local/opt/iODBC/include/{sql,sqlext}.h>); - next; - } - warn "read $file\n"; - open(F, "<$file") || die "$file: $!"; - my $text = undef; - my $odbcver = undef; - while ($_ = <F>) { - 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 ($_ = <F>) { - 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 = <F>; - 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 = <F>; - close(F); - if ($x1 !~ /\bauto_$name\b/) { - warn "$name.cpp: not auto-generated\n" if $action eq 'move'; - next; - } - } - if (! open(F, "<auto/$name.cpp")) { - die "auto/$name.cpp: $!\n"; - } - $x2 = <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/storage/ndb/src/old_files/client/odbc/driver/Makefile b/storage/ndb/src/old_files/client/odbc/driver/Makefile deleted file mode 100644 index 62f82371da4..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp deleted file mode 100644 index a7ffd8c89d1..00000000000 --- a/storage/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<SQLHDBC>(pDbc); - pEnv->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCCONNECT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/storage/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp deleted file mode 100644 index a62dae61008..00000000000 --- a/storage/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<SQLHENV>(pEnv); - pRoot->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCENV); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp deleted file mode 100644 index 9daf6ead946..00000000000 --- a/storage/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<SQLHANDLE>(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/storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp deleted file mode 100644 index 61290e37b7b..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp deleted file mode 100644 index bf3f149f5de..00000000000 --- a/storage/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<SQLHSTMT>(pStmt); - pDbc->saveCtx(ctx); - ctx.logSqlExit(); - SQLRETURN ret = ctx.getCode(); - driver_exit(SQL_API_SQLALLOCSTMT); - return ret; -} -#endif // ODBCVER >= 0x0000 diff --git a/storage/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp deleted file mode 100644 index 5562334e8cc..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp deleted file mode 100644 index 2fcc17b872f..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp deleted file mode 100644 index e4ca5bbc731..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp deleted file mode 100644 index 7e629e199e5..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp deleted file mode 100644 index 7d256d66e3f..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp deleted file mode 100644 index ac4e43c6e89..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp deleted file mode 100644 index 26d88c91e3b..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp deleted file mode 100644 index 0e7e5446932..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp deleted file mode 100644 index 05a4c1d4d37..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp deleted file mode 100644 index cfbc9c2bc57..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp deleted file mode 100644 index 4e0b646ee7d..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp deleted file mode 100644 index d8f30ed47e7..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp deleted file mode 100644 index b4d4b2e4122..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp deleted file mode 100644 index 6115e7175f9..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp deleted file mode 100644 index f15ce8962f1..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp deleted file mode 100644 index beff41396fe..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp deleted file mode 100644 index 75db5604da8..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp deleted file mode 100644 index 340babd8523..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp deleted file mode 100644 index 9c52f900992..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp deleted file mode 100644 index 20b0b2203f5..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLError.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLError.cpp deleted file mode 100644 index af78c931d37..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp deleted file mode 100644 index 0ad99d29cd9..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp deleted file mode 100644 index 9c30d418f09..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp deleted file mode 100644 index e0dd078b5d0..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp deleted file mode 100644 index addba7b998c..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp deleted file mode 100644 index cfbfc813fca..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp deleted file mode 100644 index 886ac6bdaa5..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp deleted file mode 100644 index 9ac84710cce..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp deleted file mode 100644 index 7e35056feb5..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp deleted file mode 100644 index 284463cbb07..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp deleted file mode 100644 index 7af6623a37a..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp deleted file mode 100644 index 66c1f3827e1..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp deleted file mode 100644 index 514bedb12b9..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp deleted file mode 100644 index d54bdf42005..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp deleted file mode 100644 index 3b6987c515d..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp deleted file mode 100644 index 6cc390a58ed..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp deleted file mode 100644 index c7e9631b075..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp deleted file mode 100644 index 3eb34f7ebf6..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp deleted file mode 100644 index 448c5206d76..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp deleted file mode 100644 index c93870326e4..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp deleted file mode 100644 index 68416fab1a6..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp deleted file mode 100644 index 8f0a0d67cfa..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp deleted file mode 100644 index 990ab68808a..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp deleted file mode 100644 index 0b5758b1212..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp deleted file mode 100644 index e6a016cc400..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp deleted file mode 100644 index d23d653a319..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp deleted file mode 100644 index fb8a9bbf3d9..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp deleted file mode 100644 index 7b1a6a07aec..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp deleted file mode 100644 index 2e70897a9a2..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp deleted file mode 100644 index 4eb38a010f4..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp deleted file mode 100644 index 59b7dcf7fa9..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp deleted file mode 100644 index b1205fa6e3a..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp deleted file mode 100644 index 2d562ae3e19..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp deleted file mode 100644 index 2e42e428b87..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp deleted file mode 100644 index 1f3a9f89073..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp deleted file mode 100644 index a4715a836d2..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp deleted file mode 100644 index d03f954386a..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp deleted file mode 100644 index 05bfce5e9cd..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp deleted file mode 100644 index a4794316971..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp deleted file mode 100644 index 291ad817d42..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp deleted file mode 100644 index 19d34c2f46d..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp deleted file mode 100644 index 80a00514a51..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp deleted file mode 100644 index 86364eac5e8..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp deleted file mode 100644 index 03bde1076d8..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp deleted file mode 100644 index 653030f90bc..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp deleted file mode 100644 index a5e89d8568b..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp deleted file mode 100644 index 9ed6a83b563..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp deleted file mode 100644 index b403fc8408c..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp deleted file mode 100644 index 5dd92c86053..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp deleted file mode 100644 index 941fb6249a5..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp deleted file mode 100644 index 23c6ad9fc4b..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLTables.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLTables.cpp deleted file mode 100644 index b2496bfba87..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp b/storage/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp deleted file mode 100644 index da8b46b1596..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/driver/driver.cpp b/storage/ndb/src/old_files/client/odbc/driver/driver.cpp deleted file mode 100644 index f992fa70878..00000000000 --- a/storage/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 <NdbMutex.h> - -#undef NDB_ODBC_SIG_DFL -#ifdef NDB_ODBC_SIG_DFL -#include <signal.h> -#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/storage/ndb/src/old_files/client/odbc/driver/driver.hpp b/storage/ndb/src/old_files/client/odbc/driver/driver.hpp deleted file mode 100644 index 96d2e052c0d..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/OdbcData.hpp> -#include <handles/handles.hpp> - -#ifndef NDB_WIN32 -#define SQL_API -#endif - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp deleted file mode 100644 index 40d3950a592..00000000000 --- a/storage/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 <NdbScanFilter.hpp> -#include <NdbSqlUtil.hpp> -#include <codegen/Code_comp_op.hpp> - -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<const char*>(f2.sqlChar()); - n2 = t2.length(); - nopad = false; - } else if (t1.type() == SqlType::Char && t2.type() == SqlType::Varchar) { - v2 = reinterpret_cast<const char*>(f2.sqlVarchar(&n2)); - nopad = true; - } else if (t1.type() == SqlType::Varchar && t2.type() == SqlType::Char) { - v2 = reinterpret_cast<const char*>(f2.sqlChar()); - n2 = t2.length(); - nopad = true; - } else if (t1.type() == SqlType::Varchar && t2.type() == SqlType::Varchar) { - v2 = reinterpret_cast<const char*>(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<const char*>(s1), n1, reinterpret_cast<const char *>(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<const char*>(s1), n1, reinterpret_cast<const char *>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp deleted file mode 100644 index 3966c6d5db2..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <dictionary/DictSchema.hpp> -#include <codegen/Code_create_index.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp deleted file mode 100644 index d6274119371..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <dictionary/DictSchema.hpp> -#include <codegen/Code_create_table.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp deleted file mode 100644 index 10814654a58..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_delete_index.hpp> -#include <codegen/Code_query.hpp> - -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<const char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp deleted file mode 100644 index d0795286122..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_delete_lookup.hpp> -#include <codegen/Code_query.hpp> - -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<const char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp deleted file mode 100644 index a0b3b8314b8..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_delete_scan.hpp> -#include <codegen/Code_query.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp deleted file mode 100644 index 6bf451f6911..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <dictionary/DictSchema.hpp> -#include <codegen/Code_drop_index.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp deleted file mode 100644 index 40d1d42fc61..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <dictionary/DictSchema.hpp> -#include <codegen/Code_drop_table.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp deleted file mode 100644 index 636bfda7d59..00000000000 --- a/storage/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 <codegen/Code_expr_conv.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp deleted file mode 100644 index 093d15c6e2b..00000000000 --- a/storage/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 <time.h> -#include <NdbTick.h> -#include <codegen/Code_expr_func.hpp> - -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<int>(f2.sqlSmallint()); - break; - case SqlType::Integer: - num = static_cast<int>(f2.sqlInteger()); - break; - case SqlType::Bigint: - num = static_cast<int>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp deleted file mode 100644 index fc8b6df9f5b..00000000000 --- a/storage/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 <codegen/Code_expr_op.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp deleted file mode 100644 index c2612c6aaab..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_insert.hpp> -#include <codegen/Code_query.hpp> - -#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<const char*>(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<const char*>(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<const char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp deleted file mode 100644 index 7caa4656473..00000000000 --- a/storage/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 <codegen/Code_pred_op.hpp> -#include <NdbScanFilter.hpp> - -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/storage/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp deleted file mode 100644 index 919743beac2..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_query_index.hpp> -#include <codegen/Code_table.hpp> - -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<const char*>(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<char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp deleted file mode 100644 index 599e1a36461..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_query_lookup.hpp> -#include <codegen/Code_table.hpp> - -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<const char*>(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<char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp deleted file mode 100644 index 0bc878d760d..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_query_range.hpp> -#include <codegen/Code_table.hpp> - -#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<const char*>(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<char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp deleted file mode 100644 index 213dfdd616d..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <NdbScanFilter.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_query_scan.hpp> -#include <codegen/Code_table.hpp> - -#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<char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp deleted file mode 100644 index acdc120e609..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_query_sys.hpp> -#include <codegen/Code_table.hpp> - -#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/storage/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp deleted file mode 100644 index 35b6159d8ca..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_update_index.hpp> -#include <codegen/Code_query.hpp> - -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<const char*>(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<const char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp deleted file mode 100644 index 2c801372de3..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_expr.hpp> -#include <codegen/Code_update_lookup.hpp> -#include <codegen/Code_query.hpp> - -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<const char*>(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<const char*>(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/storage/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp b/storage/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp deleted file mode 100644 index a36fdd27142..00000000000 --- a/storage/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 <NdbApi.hpp> -#include <common/StmtArea.hpp> -#include <common/ResultArea.hpp> -#include <codegen/Code_update_scan.hpp> -#include <codegen/Code_query.hpp> - -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<const char*>(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/storage/ndb/src/old_files/client/odbc/executor/Executor.cpp b/storage/ndb/src/old_files/client/odbc/executor/Executor.cpp deleted file mode 100644 index adabb28a4a5..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/CodeTree.hpp> -#include <common/StmtArea.hpp> -#include <codegen/Code_root.hpp> -#include "Executor.hpp" - -void -Executor::execute(Ctx& ctx) -{ - Exec_base::Ctl ctl(0); - Exec_root* execRoot = static_cast<Exec_root*>(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<Exec_root*>(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<Exec_root*>(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/storage/ndb/src/old_files/client/odbc/executor/Executor.hpp b/storage/ndb/src/old_files/client/odbc/executor/Executor.hpp deleted file mode 100644 index 5edb9d509ac..00000000000 --- a/storage/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 <common/common.hpp> -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/storage/ndb/src/old_files/client/odbc/executor/Makefile b/storage/ndb/src/old_files/client/odbc/executor/Makefile deleted file mode 100644 index d86781e212c..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp b/storage/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp deleted file mode 100644 index 4768a8995a2..00000000000 --- a/storage/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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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<HandleDbc*>(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/storage/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp b/storage/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp deleted file mode 100644 index 3d57fddeb57..00000000000 --- a/storage/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<HandleEnv*>(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<HandleEnv*>(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<HandleEnv*>(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<HandleEnv*>(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<HandleEnv*>(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<HandleEnv*>(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/storage/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp b/storage/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp deleted file mode 100644 index d1b264835b6..00000000000 --- a/storage/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<HandleRoot*>(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<HandleRoot*>(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<HandleRoot*>(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<HandleRoot*>(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/storage/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp b/storage/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp deleted file mode 100644 index ce9a9c03fd1..00000000000 --- a/storage/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<HandleStmt*>(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<HandleStmt*>(self); - ctx_assert(pStmt != 0); - HandleDesc* apd = pStmt->getHandleDesc(ctx, Desc_usage_APD); - OdbcData value(reinterpret_cast<SQLPOINTER>(apd)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_APP_ROW_DESC_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast<HandleStmt*>(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<HandleStmt*>(self); - ctx_assert(pStmt != 0); - HandleDesc* ard = pStmt->getHandleDesc(ctx, Desc_usage_ARD); - OdbcData value(reinterpret_cast<SQLPOINTER>(ard)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_ASYNC_ENABLE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(self); - ctx_assert(pStmt != 0); - HandleDesc* ipd = pStmt->getHandleDesc(ctx, Desc_usage_IPD); - OdbcData value(reinterpret_cast<SQLPOINTER>(ipd)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_IMP_ROW_DESC_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast<HandleStmt*>(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<HandleStmt*>(self); - ctx_assert(pStmt != 0); - HandleDesc* ird = pStmt->getHandleDesc(ctx, Desc_usage_IRD); - OdbcData value(reinterpret_cast<SQLPOINTER>(ird)); - data.setValue(value); -} - -static void -callback_SQL_ATTR_KEYSET_SIZE_set(Ctx& ctx, HandleBase* self, const OdbcData& data) -{ - HandleStmt* pStmt = static_cast<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<SQLPOINTER>(value), SQL_IS_POINTER); -} - -static void -callback_SQL_ATTR_ROWS_FETCHED_PTR_default(Ctx& ctx, HandleBase* self, OdbcData& data) -{ - HandleStmt* pStmt = static_cast<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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<HandleStmt*>(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/storage/ndb/src/old_files/client/odbc/handles/DescSpec.cpp b/storage/ndb/src/old_files/client/odbc/handles/DescSpec.cpp deleted file mode 100644 index 83905cf9822..00000000000 --- a/storage/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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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<HandleDesc*>(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/storage/ndb/src/old_files/client/odbc/handles/FuncTab.cpp b/storage/ndb/src/old_files/client/odbc/handles/FuncTab.cpp deleted file mode 100644 index 6bd744d7a7f..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/handles/HandleBase.cpp b/storage/ndb/src/old_files/client/odbc/handles/HandleBase.cpp deleted file mode 100644 index 27379cdc3f8..00000000000 --- a/storage/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<SQLPOINTER>(sqlstate), 5 + 1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_NATIVE, static_cast<SQLPOINTER>(nativeError), -1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_MESSAGE_TEXT, static_cast<SQLPOINTER>(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<SQLPOINTER>(sqlstate), 5 + 1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_NATIVE, static_cast<SQLPOINTER>(nativeError), -1, 0); - sqlGetDiagField(ctx, recNumber, SQL_DIAG_MESSAGE_TEXT, static_cast<SQLPOINTER>(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<SQLINTEGER>(option), reinterpret_cast<SQLPOINTER>(value), 0); -} - -void -HandleBase::baseGetHandleOption(Ctx& ctx, AttrArea& attrArea, SQLUSMALLINT option, SQLPOINTER value) -{ - baseGetHandleAttr(ctx, attrArea, static_cast<SQLINTEGER>(option), value, SQL_NTS, 0); -} diff --git a/storage/ndb/src/old_files/client/odbc/handles/HandleBase.hpp b/storage/ndb/src/old_files/client/odbc/handles/HandleBase.hpp deleted file mode 100644 index fc35c2b559b..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/OdbcData.hpp> -#include <common/DiagArea.hpp> -#include <common/AttrArea.hpp> - -/** - * @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/storage/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp b/storage/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp deleted file mode 100644 index 2d5ded2cc21..00000000000 --- a/storage/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 <limits.h> -#include <NdbApi.hpp> -#include <common/common.hpp> -#include <common/DiagArea.hpp> -#include <common/StmtArea.hpp> -#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<SQLPOINTER>(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/storage/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp b/storage/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp deleted file mode 100644 index 130df08d02c..00000000000 --- a/storage/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 <list> -#include <common/common.hpp> -#include <common/ConnArea.hpp> -#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<HandleStmt*> ListStmt; - ListStmt m_listStmt; - typedef std::list<HandleDesc*> 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/storage/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp b/storage/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp deleted file mode 100644 index 4cff1bb8892..00000000000 --- a/storage/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 <common/OdbcData.hpp> -#include <common/DiagArea.hpp> -#include <common/DataType.hpp> -#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<SQLPOINTER>(&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<SQLPOINTER>(&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<SQLPOINTER>(&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<SQLPOINTER>(type), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_DATETIME_INTERVAL_CODE, reinterpret_cast<SQLPOINTER>(subType), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_OCTET_LENGTH, reinterpret_cast<SQLPOINTER>(length), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_PRECISION, reinterpret_cast<SQLPOINTER>(precision), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_SCALE, reinterpret_cast<SQLPOINTER>(scale), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_DATA_PTR, data, -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_OCTET_LENGTH_PTR, reinterpret_cast<SQLPOINTER>(stringLength), -1); - sqlSetDescField(ctx, recNumber, SQL_DESC_INDICATOR_PTR, reinterpret_cast<SQLPOINTER>(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<SQLPOINTER>(name), bufferLength, 0, stringLength); - sqlGetDescField(ctx, recNumber, SQL_DESC_TYPE, reinterpret_cast<SQLPOINTER>(type), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_DATETIME_INTERVAL_CODE, reinterpret_cast<SQLPOINTER>(subType), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_OCTET_LENGTH, reinterpret_cast<SQLPOINTER>(length), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_PRECISION, reinterpret_cast<SQLPOINTER>(precision), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_SCALE, reinterpret_cast<SQLPOINTER>(scale), -1, 0); - sqlGetDescField(ctx, recNumber, SQL_DESC_NULLABLE, reinterpret_cast<SQLPOINTER>(nullable), -1, 0); -} diff --git a/storage/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp b/storage/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp deleted file mode 100644 index 9419697f134..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DescArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp b/storage/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp deleted file mode 100644 index bc9d8b420a6..00000000000 --- a/storage/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 <common/DiagArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp b/storage/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp deleted file mode 100644 index 2b13b0256bc..00000000000 --- a/storage/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 <list> -#include <common/common.hpp> -#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<HandleDbc*> 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/storage/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp b/storage/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp deleted file mode 100644 index 13560d55028..00000000000 --- a/storage/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 <common/common.hpp> -#include <NdbMutex.h> -#include <common/DiagArea.hpp> -#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<HandleEnv*>(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<HandleDbc*>(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<HandleStmt*>(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<HandleDesc*>(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/storage/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp b/storage/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp deleted file mode 100644 index 08a22b3e400..00000000000 --- a/storage/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 <list> -#include <map> -#include <common/common.hpp> -#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<HandleEnv*> m_listEnv; - PoolNdb* m_poolNdb; - typedef std::map<void*, SQLSMALLINT> 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/storage/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp b/storage/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp deleted file mode 100644 index d33d33dbd5b..00000000000 --- a/storage/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 <common/OdbcData.hpp> -#include <codegen/CodeGen.hpp> -#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<char*>(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<SQLPOINTER>(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<SQLPOINTER>(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<SQLPOINTER>(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<SQLPOINTER>(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<SQLPOINTER>(columnName), bufferLength, 0, nameLength); - ird->sqlGetDescField(ctx, columnNumber, SQL_DESC_CONCISE_TYPE, static_cast<SQLPOINTER>(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<SQLPOINTER>(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<SQLPOINTER>(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/storage/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp b/storage/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp deleted file mode 100644 index 0bee138bfc6..00000000000 --- a/storage/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 <common/common.hpp> -#include <common/DescArea.hpp> -#include <common/StmtArea.hpp> -#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/storage/ndb/src/old_files/client/odbc/handles/InfoTab.cpp b/storage/ndb/src/old_files/client/odbc/handles/InfoTab.cpp deleted file mode 100644 index 1a93c4da264..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/handles/Makefile b/storage/ndb/src/old_files/client/odbc/handles/Makefile deleted file mode 100644 index d37e7d286ba..00000000000 --- a/storage/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/storage/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp b/storage/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp deleted file mode 100644 index 45d3c67ec77..00000000000 --- a/storage/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 <common/common.hpp> -#include <NdbMutex.h> -#include <NdbApi.hpp> -#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/storage/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp b/storage/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp deleted file mode 100644 index 35eac055c30..00000000000 --- a/storage/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 <common/common.hpp> -#include <list> - -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<Ndb*> m_listUsed; - std::list<Ndb*> m_listFree; - unsigned m_cntUsed; - unsigned m_cntFree; -}; - -#endif diff --git a/storage/ndb/src/old_files/client/odbc/handles/handles.hpp b/storage/ndb/src/old_files/client/odbc/handles/handles.hpp deleted file mode 100644 index a9f0fcae888..00000000000 --- a/storage/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 <common/common.hpp> -#include "HandleBase.hpp" -#include "HandleRoot.hpp" -#include "HandleEnv.hpp" -#include "HandleDbc.hpp" -#include "HandleStmt.hpp" -#include "HandleDesc.hpp" - -#endif diff --git a/storage/ndb/src/old_files/ndbbaseclient/Makefile b/storage/ndb/src/old_files/ndbbaseclient/Makefile deleted file mode 100644 index f4c49a95ffa..00000000000 --- a/storage/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/storage/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp b/storage/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp deleted file mode 100644 index e69de29bb2d..00000000000 --- a/storage/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp +++ /dev/null diff --git a/storage/ndb/src/old_files/ndbclient/Makefile b/storage/ndb/src/old_files/ndbclient/Makefile deleted file mode 100644 index 2c597eccfa1..00000000000 --- a/storage/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/storage/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp b/storage/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp deleted file mode 100644 index e69de29bb2d..00000000000 --- a/storage/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp +++ /dev/null diff --git a/storage/ndb/src/old_files/newtonapi/Makefile b/storage/ndb/src/old_files/newtonapi/Makefile deleted file mode 100644 index bed179046a5..00000000000 --- a/storage/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/storage/ndb/src/old_files/newtonapi/dba_binding.cpp b/storage/ndb/src/old_files/newtonapi/dba_binding.cpp deleted file mode 100644 index 63e48110b1d..00000000000 --- a/storage/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; i<count; i++) - if(data[i] == value) - return true; - return false; - } - - void insert(int value){ - data[count] = value; - count++; - } -}; - -/** - * createBindings - */ -static -DBA_Binding_t * -createBinding(const char* TableName, - int NbCol, - const DBA_ColumnBinding_t ColsBindings[], - Size_t StructSz, - const NdbDictionary::Table * theTable, - struct DBA__Array * keys, - struct DBA__Array * columns); - -extern "C" -DBA_Binding_t * -DBA_CreateBinding( const char* TableName, - int NbCol, - const DBA_ColumnBinding_t ColsBindings[], - Size_t StructSz ){ - - NdbDictionary::Dictionary * dict = DBA__TheNdb->getDictionary(); - 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; i<tabColumns; i++){ - const NdbDictionary::Column * col = table->getColumn(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; i<NbCol; i++){ - if(ColsBindings[i].Ptr){ - /** - * Pointer binding - */ - noOfSubBindings ++; - - DBA_Binding_t * tmp = createBinding(TableName, - ColsBindings[i].Size, - ColsBindings[i].SubBinding, - StructSz, - table, - keys, - columns); - DBA__ValidBinding(tmp); - - if(tmp == 0){ - // createBindings have already set latestError - return 0; - } - - DBA_DestroyBinding(tmp); - } else { - const NdbDictionary::Column * col = - table->getColumn(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; i<DBA__MagicLength; i++) - ret->magic[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; i<NbCol; i++){ - if(ColsBindings[i].Ptr){ - ret->subBindings[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; i<Binding->noOfSubBindings; 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; i<DBA__NoOfMappings; i++) - if(DBA__DataTypesMappings[i].newtonType == t2 && - DBA__DataTypesMappings[i].ndbType == t1) - return true; - return false; -} - -static -bool -matchSize(NdbDictionary::Column::Type t, unsigned b, Size_t s) { - switch(t){ - case NdbDictionary::Column::Int: - case NdbDictionary::Column::Unsigned: - case NdbDictionary::Column::Float: - return (4 * b) == s; - case NdbDictionary::Column::Bigint: - case NdbDictionary::Column::Bigunsigned: - case NdbDictionary::Column::Double: - return (8 * b) == s; - case NdbDictionary::Column::Decimal: - case NdbDictionary::Column::Char: - case NdbDictionary::Column::Binary: - return (1 * b) == s; - case NdbDictionary::Column::Varchar: - case NdbDictionary::Column::Varbinary: - case NdbDictionary::Column::Datetime: - case NdbDictionary::Column::Timespec: - case NdbDictionary::Column::Blob: - case NdbDictionary::Column::Tinyint: - case NdbDictionary::Column::Tinyunsigned: - case NdbDictionary::Column::Smallint: - case NdbDictionary::Column::Smallunsigned: - case NdbDictionary::Column::Mediumint: - case NdbDictionary::Column::Mediumunsigned: - case NdbDictionary::Column::Undefined: - return false; - } - return false; -} - -bool -DBA__ValidBinding(const DBA_Binding_t * bindings){ - if(bindings == 0){ - DBA_DEBUG("Null pointer passed to validBinding"); - return false; - } - - for(int i = 0; i<DBA__MagicLength; i++) - if(bindings->magic[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; i<n; i++) - if(!DBA__ValidBinding(pBindings[i])) - return false; - return true; -} - -/** - * Note: currently only checksum "static" part of struct - */ -static -int -computeChecksum(const DBA_Binding_t * bindings){ - int sum = 0; - int pos = 0; - const char * ptr = ((const char *)bindings)+DBA__MagicLength+sizeof(int); - const int sz = sizeof(DBA_Binding_t) - DBA__MagicLength - sizeof(int) - 4; - - for(int i = 0; i<sz; i++){ - sum += ((int)ptr[i]) << pos; - pos += 8; - if(pos == 32) - pos = 0; - } - - return sum; -} - -int -DBA__GetStructSize(const DBA_Binding_t * bind){ - if(!DBA__ValidBinding(bind)) - return 0; - return bind->structSz; -} diff --git a/storage/ndb/src/old_files/newtonapi/dba_bulkread.cpp b/storage/ndb/src/old_files/newtonapi/dba_bulkread.cpp deleted file mode 100644 index 1f75037046b..00000000000 --- a/storage/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; i<OpPerTrans && RowsAcknowledged < RowsSubmitted; i++){ - require(op != 0); - if(op->getNdbError().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; i<OpPerTrans && RowsSubmitted < TotalRows; i++){ - - const DBA_Binding_t * binding = pBindings[tmp.binding]; - void * data = pData[tmp.datarow].DataPtr; - - NdbOperation * op = con->getNdbOperation(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/storage/ndb/src/old_files/newtonapi/dba_config.cpp b/storage/ndb/src/old_files/newtonapi/dba_config.cpp deleted file mode 100644 index d84386a9438..00000000000 --- a/storage/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; i<Params; i++) - if(Parameters[i].ParamId == id) - return &Parameters[i]; - return 0; -} - - -extern "C" -DBA_Error_t -DBA_SetParameter(int ParameterId, int Value){ - if(Value == -1){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Node id is not modifyable"); - return DBA_APPLICATION_ERROR; - } - - DBA__Config * p = getParam(ParameterId); - - if(p == 0){ - DBA__SetLatestError(DBA_APPLICATION_ERROR, 0, "Invalid parameter id: %d", - ParameterId); - return DBA_APPLICATION_ERROR; - } - - if(Value < p->min){ - 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/storage/ndb/src/old_files/newtonapi/dba_dac.cpp b/storage/ndb/src/old_files/newtonapi/dba_dac.cpp deleted file mode 100644 index fcb4e676e46..00000000000 --- a/storage/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 <NdbSleep.h> - -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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbBindings; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbBindings; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbBindings; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbBindings; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbRows; i++){ - NdbOperation * op = con->getNdbOperation(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; i<NbBindings; i++){ - NdbOperation * op = con->getNdbOperation(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; i<pBindings->noOfKeys; i++){ - if(op->equal(pBindings->keyIds[i], - (const char*)pData+pBindings->keyOffsets[i]) == -1){ - return false; - } - } - - for(int i = 0; i<pBindings->noOfColumns; i++){ - if(op->getValue(pBindings->columnIds[i], - (char*)pData+pBindings->columnOffsets[i]) == 0){ - return false; - } - } - - for(int i = 0; i<pBindings->noOfSubBindings; 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; i<pBindings->noOfKeys; i++){ - if(op->equal(pBindings->keyIds[i], - (const char*)pData+pBindings->keyOffsets[i]) == -1){ - return false; - } - } - - for(int i = 0; i<pBindings->noOfColumns; i++){ - if(op->setValue(pBindings->columnIds[i], - (char*)pData+pBindings->columnOffsets[i]) == -1){ - return false; - } - } - - for(int i = 0; i<pBindings->noOfSubBindings; 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; i<pBindings->noOfKeys; i++) - if(op->equal(pBindings->keyIds[i], - (const char*)pData+pBindings->keyOffsets[i]) == -1){ - return false; - } - - for(int i = 0; i<pBindings->noOfSubBindings; 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/storage/ndb/src/old_files/newtonapi/dba_error.cpp b/storage/ndb/src/old_files/newtonapi/dba_error.cpp deleted file mode 100644 index f05446522b0..00000000000 --- a/storage/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 <ndb_global.h> - -#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<ErrMsgs; i++) - if(errMap[i].Error == e) - return errMap[i].Msg; - return "Invalid error code"; -} - diff --git a/storage/ndb/src/old_files/newtonapi/dba_init.cpp b/storage/ndb/src/old_files/newtonapi/dba_init.cpp deleted file mode 100644 index aa5fef1171c..00000000000 --- a/storage/ndb/src/old_files/newtonapi/dba_init.cpp +++ /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 */ - - -#include "dba_internal.hpp" -#include "dba_process.hpp" -#include <NdbOut.hpp> - - -#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/storage/ndb/src/old_files/newtonapi/dba_internal.hpp b/storage/ndb/src/old_files/newtonapi/dba_internal.hpp deleted file mode 100644 index 84ae7ba222b..00000000000 --- a/storage/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 <ndb_global.h> - -extern "C" { -#include "dba.h" -} - -#include <NdbApi.hpp> -#include <NdbMutex.h> -#include <NdbOut.hpp> - -#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/storage/ndb/src/old_files/newtonapi/dba_process.cpp b/storage/ndb/src/old_files/newtonapi/dba_process.cpp deleted file mode 100644 index ddb6e62f180..00000000000 --- a/storage/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/storage/ndb/src/old_files/newtonapi/dba_process.hpp b/storage/ndb/src/old_files/newtonapi/dba_process.hpp deleted file mode 100644 index ef24fbd9142..00000000000 --- a/storage/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 <NdbThread.h> -#include <NdbMutex.h> -#include <NdbSleep.h> - -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/storage/ndb/src/old_files/newtonapi/dba_schema.cpp b/storage/ndb/src/old_files/newtonapi/dba_schema.cpp deleted file mode 100644 index 1bf21f1fe80..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/ExtSender.cpp b/storage/ndb/src/old_files/rep/ExtSender.cpp deleted file mode 100644 index cf31001a85f..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/ExtSender.hpp b/storage/ndb/src/old_files/rep/ExtSender.hpp deleted file mode 100644 index 0bdabd68f37..00000000000 --- a/storage/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 <NdbSleep.h> -#include <TransporterFacade.hpp> -#include <NdbApiSignal.hpp> -#include <rep/rep_version.hpp> - -/** - * @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/storage/ndb/src/old_files/rep/Makefile b/storage/ndb/src/old_files/rep/Makefile deleted file mode 100644 index 9688a68ec74..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/NodeConnectInfo.hpp b/storage/ndb/src/old_files/rep/NodeConnectInfo.hpp deleted file mode 100644 index 403f92a5999..00000000000 --- a/storage/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 <ndb_types.h> - -struct NodeConnectInfo { - NodeConnectInfo(Uint16 n, bool c): nodeId(n), connected(c) {}; - Uint32 nodeId; - bool connected; -}; - - -#endif diff --git a/storage/ndb/src/old_files/rep/README b/storage/ndb/src/old_files/rep/README deleted file mode 100644 index 7be5e230eb3..00000000000 --- a/storage/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 <global checkpoint id - gci> -A global checkpoint is a point in time when all database server -are synchronized. - -NODE -A database server with information. - -NODE GROUP <node group id> -A set of database servers, all storing the same information. - -SUBSCRIPTION <subscription id>. -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 <subscription id, gci> -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 <subscription id, gci, node group id> -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 <subscription id> -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/storage/ndb/src/old_files/rep/RepApiInterpreter.cpp b/storage/ndb/src/old_files/rep/RepApiInterpreter.cpp deleted file mode 100644 index 6e6f150713a..00000000000 --- a/storage/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 <signaldata/GrepImpl.hpp> - -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/storage/ndb/src/old_files/rep/RepApiInterpreter.hpp b/storage/ndb/src/old_files/rep/RepApiInterpreter.hpp deleted file mode 100644 index 78f190156b3..00000000000 --- a/storage/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 <editline/editline.h> - -#include <rep/RepComponents.hpp> -#include <rep/state/RepState.hpp> -#include <rep/RepApiService.hpp> -#include <signaldata/GrepImpl.hpp> -#include <Properties.hpp> - -/** - * @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/storage/ndb/src/old_files/rep/RepApiService.cpp b/storage/ndb/src/old_files/rep/RepApiService.cpp deleted file mode 100644 index d07f7a59375..00000000000 --- a/storage/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 <Parser.hpp> -#include <NdbOut.hpp> -#include <Properties.hpp> -#include <socket_io.h> -#include "RepApiService.hpp" -#include "RepApiInterpreter.hpp" -#include "repapi/repapi.h" -#include <NdbMutex.h> -#include <OutputStream.hpp> - -/** - 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<RepApiSession>::Cmd, \ - ParserRow<RepApiSession>::String, \ - ParserRow<RepApiSession>::Optional, \ - ParserRow<RepApiSession>::IgnoreMinMax, \ - 0, 0, \ - fun, \ - desc } - -#define REP_ARG(name, type, opt, desc) \ - { name, \ - 0, \ - ParserRow<RepApiSession>::Arg, \ - ParserRow<RepApiSession>::type, \ - ParserRow<RepApiSession>::opt, \ - ParserRow<RepApiSession>::IgnoreMinMax, \ - 0, 0, \ - 0, \ - desc } - -#define REP_ARG2(name, type, opt, min, max, desc) \ - { name, \ - 0, \ - ParserRow<RepApiSession>::Arg, \ - ParserRow<RepApiSession>::type, \ - ParserRow<RepApiSession>::opt, \ - ParserRow<RepApiSession>::IgnoreMinMax, \ - min, max, \ - 0, \ - desc } - -#define REP_END() \ - { 0, \ - 0, \ - ParserRow<RepApiSession>::Arg, \ - ParserRow<RepApiSession>::Int, \ - ParserRow<RepApiSession>::Optional, \ - ParserRow<RepApiSession>::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0 } - -#define REP_CMD_ALIAS(name, realName, fun) \ - { name, \ - realName, \ - ParserRow<RepApiSession>::CmdAlias, \ - ParserRow<RepApiSession>::Int, \ - ParserRow<RepApiSession>::Optional, \ - ParserRow<RepApiSession>::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0 } - -#define REP_ARG_ALIAS(name, realName, fun) \ - { name, \ - realName, \ - ParserRow<RepApiSession>::ArgAlias, \ - ParserRow<RepApiSession>::Int, \ - ParserRow<RepApiSession>::Optional, \ - ParserRow<RepApiSession>::IgnoreMinMax, \ - 0, 0, \ - 0, \ - 0 } - - -const -ParserRow<RepApiSession> 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<RepApiSession>(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<RepApiSession>(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<ctx.m_aliasUsed.size(); i++) - ndbout_c("Used alias: %s -> %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/storage/ndb/src/old_files/rep/RepApiService.hpp b/storage/ndb/src/old_files/rep/RepApiService.hpp deleted file mode 100644 index e1137e53258..00000000000 --- a/storage/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 <Parser.hpp> -#include <InputStream.hpp> -#include <SocketServer.hpp> - -class RepApiInterpreter; - -class RepApiSession : public SocketServer::Session { - typedef Parser<RepApiSession> 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/storage/ndb/src/old_files/rep/RepCommandInterpreter.cpp b/storage/ndb/src/old_files/rep/RepCommandInterpreter.cpp deleted file mode 100644 index a0daf9529ab..00000000000 --- a/storage/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 <epoch no> Stop replication after epoch number <epoch no> |\n" -"| STOP IMMEDIATELY Stop replication after applying the current epoch |\n" -"| ADD TABLE <db>/<schema>/<tablename> |\n" -"| Note: <db>/<schema>/<tablename> is case sensitive! |\n" -"| Use 'STATUS' to see added tables. |\n" -"| REMOVE TABLE <db>/<schema>/<tablename> |\n" -"| Note: <db>/<schema>/<tablename> is case sensitive! |\n" -"| ENABLE <protocol> Starts protocol |\n" -"| DISABLE <protocol> Stops protocol |\n" -"| DEBUG Toggle logging of replication messages on console |\n" -"| |\n" -"| <protocol> ::= REQUESTOR | TRANSFER | APPLY | DELETE |\n" -"+-------------------------------------------------------------------------+\n" -; - -/** - * @todo -"| <protocol> ::= SUBID | SUBSCRIPTION |\n" -"| <protocol> ::= METALOG | METASCAN | DATALOG | DATASCAN |\n" -"| <system> ::= PRIMARY | STANDBY | TWOWAY |\n" -"| CONNECT <system> Connects to NDB Cluster and other replication server |\n" -"| DELETE Removes all epochs stored in replication servers |\n" -"| DROP <tableid> Drops table in standby system identified by table id |\n" -"| <epoch> ::= 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 <db>/<schema>/<table> - 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 <epoch no>', " - "where\n<epoch no> 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/storage/ndb/src/old_files/rep/RepCommandInterpreter.hpp b/storage/ndb/src/old_files/rep/RepCommandInterpreter.hpp deleted file mode 100644 index 398a7c0318c..00000000000 --- a/storage/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 <editline/editline.h> - -#include <rep/RepComponents.hpp> -#include <rep/state/RepState.hpp> - -/** - * @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/storage/ndb/src/old_files/rep/RepComponents.cpp b/storage/ndb/src/old_files/rep/RepComponents.cpp deleted file mode 100644 index 04b2e0e5fa5..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/RepComponents.hpp b/storage/ndb/src/old_files/rep/RepComponents.hpp deleted file mode 100644 index ff0f29e2128..00000000000 --- a/storage/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 <rep/adapters/ExtNDB.hpp> -#include <rep/adapters/AppNDB.hpp> -#include <rep/transfer/TransPS.hpp> -#include <rep/transfer/TransSS.hpp> -#include <rep/Requestor.hpp> -#include <rep/state/RepState.hpp> - -#include <rep/rep_version.hpp> - -/** - * 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/storage/ndb/src/old_files/rep/RepMain.cpp b/storage/ndb/src/old_files/rep/RepMain.cpp deleted file mode 100644 index d9f057be9a1..00000000000 --- a/storage/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 <ndb_global.h> - -#include <NdbApiSignal.hpp> -#include <getarg.h> - -#include <rep/RepComponents.hpp> - -#include "rep_version.hpp" -#include <rep/RepCommandInterpreter.hpp> -#include <rep/RepApiInterpreter.hpp> - - -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/storage/ndb/src/old_files/rep/Requestor.cpp b/storage/ndb/src/old_files/rep/Requestor.cpp deleted file mode 100644 index 3c93a6394a4..00000000000 --- a/storage/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 <NdbApiSignal.hpp> - -#include <signaldata/RepImpl.hpp> -#include <signaldata/GrepImpl.hpp> -#include <signaldata/DictTabInfo.hpp> -#include <signaldata/GetTabInfo.hpp> -#include <signaldata/SumaImpl.hpp> - -#include <AttributeHeader.hpp> -#include <rep/rep_version.hpp> - -#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; i<thisObj->m_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/storage/ndb/src/old_files/rep/Requestor.hpp b/storage/ndb/src/old_files/rep/Requestor.hpp deleted file mode 100644 index 735d2094bde..00000000000 --- a/storage/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 <ndb_global.h> - -#include <TransporterDefinitions.hpp> -#include <TransporterFacade.hpp> -#include <ClusterMgr.hpp> -#include <API.hpp> -#include <Vector.hpp> -#include <GrepError.hpp> - -#include <rep/storage/GCIContainer.hpp> - -/** - * @todo Remove this dependency - */ -#include <rep/adapters/AppNDB.hpp> - -#include <rep/SignalQueue.hpp> -#include <rep/ExtSender.hpp> - - -/** - * @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/storage/ndb/src/old_files/rep/RequestorSubscriptions.cpp b/storage/ndb/src/old_files/rep/RequestorSubscriptions.cpp deleted file mode 100644 index 75b41fae037..00000000000 --- a/storage/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 <signaldata/GrepImpl.hpp> -#include <signaldata/SumaImpl.hpp> - -#include <rep/rep_version.hpp> - -/***************************************************************************** - * 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/storage/ndb/src/old_files/rep/SignalQueue.cpp b/storage/ndb/src/old_files/rep/SignalQueue.cpp deleted file mode 100644 index 9b356a14b7d..00000000000 --- a/storage/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 <string.h> - -#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/storage/ndb/src/old_files/rep/SignalQueue.hpp b/storage/ndb/src/old_files/rep/SignalQueue.hpp deleted file mode 100644 index 697bca85893..00000000000 --- a/storage/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 <NdbApiSignal.hpp> -#include <NdbMutex.h> -#include <NdbCondition.h> -#include <Vector.hpp> - -/* 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<class T> bool waitFor(Vector<T> &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<class T> bool -SignalQueue::waitFor(Vector<T> &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/storage/ndb/src/old_files/rep/TODO b/storage/ndb/src/old_files/rep/TODO deleted file mode 100644 index a2462fae6cd..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/adapters/AppNDB.cpp b/storage/ndb/src/old_files/rep/adapters/AppNDB.cpp deleted file mode 100644 index 05f6d52807f..00000000000 --- a/storage/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 <ConfigRetriever.hpp> -#include <AttributeHeader.hpp> -#include <NdbOperation.hpp> -#include <NdbDictionaryImpl.hpp> - -#include <signaldata/RepImpl.hpp> -#include <TransporterFacade.hpp> -#include <trigger_definitions.h> -#include <rep/storage/GCIPage.hpp> -#include <rep/storage/GCIBuffer.hpp> -#include <rep/rep_version.hpp> - -/***************************************************************************** - * 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; i<table->getNoOfColumns(); 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/storage/ndb/src/old_files/rep/adapters/AppNDB.hpp b/storage/ndb/src/old_files/rep/adapters/AppNDB.hpp deleted file mode 100644 index 9563a1e41ab..00000000000 --- a/storage/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 <NdbMain.h> -#include <NdbOut.hpp> -#include <NdbSleep.h> -#include <NdbTick.h> - -#include <NdbThread.h> -#include <Vector.hpp> - -#include "TableInfoPs.hpp" -#include <rep/storage/GCIContainer.hpp> -#include <rep/storage/GCIBuffer.hpp> - -#include <rep/state/RepState.hpp> - -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<GCIBuffer*> m_gciBufferList; -}; - -#endif diff --git a/storage/ndb/src/old_files/rep/adapters/ExtAPI.cpp b/storage/ndb/src/old_files/rep/adapters/ExtAPI.cpp deleted file mode 100644 index 0dcd1e85465..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/adapters/ExtAPI.hpp b/storage/ndb/src/old_files/rep/adapters/ExtAPI.hpp deleted file mode 100644 index f10b6c7d682..00000000000 --- a/storage/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 <signaldata/RepImpl.hpp> -#include <signaldata/GrepImpl.hpp> -#include <signaldata/SumaImpl.hpp> - -#include <rep/ExtSender.hpp> - -/** - * 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/storage/ndb/src/old_files/rep/adapters/ExtNDB.cpp b/storage/ndb/src/old_files/rep/adapters/ExtNDB.cpp deleted file mode 100644 index 6642b750b57..00000000000 --- a/storage/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 <NdbSleep.h> - -#include <NdbApiSignal.hpp> - -#include <signaldata/DictTabInfo.hpp> -#include <signaldata/GetTabInfo.hpp> -#include <signaldata/SumaImpl.hpp> -#include <AttributeHeader.hpp> -#include <rep/rep_version.hpp> -#include <ndb_limits.h> - -/***************************************************************************** - * 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; i<noOfConnections; i++) { - Uint32 nodeId1, nodeId2; - config->get("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; i<MAX_NDB_NODES; i++) { - if (m_transporterFacade->getIsDbNode(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<SigMatch> 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/storage/ndb/src/old_files/rep/adapters/ExtNDB.hpp b/storage/ndb/src/old_files/rep/adapters/ExtNDB.hpp deleted file mode 100644 index 228c980fd06..00000000000 --- a/storage/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 <ndb_global.h> - -#include <TransporterDefinitions.hpp> -#include <TransporterFacade.hpp> -#include <ClusterMgr.hpp> -#include <API.hpp> -#include <Vector.hpp> - -#include <signaldata/RepImpl.hpp> -#include <signaldata/GrepImpl.hpp> - -#include <rep/SignalQueue.hpp> -#include <rep/ExtSender.hpp> - -#include <rep/storage/GCIContainerPS.hpp> -#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/storage/ndb/src/old_files/rep/adapters/Makefile b/storage/ndb/src/old_files/rep/adapters/Makefile deleted file mode 100644 index bdd711510c3..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/adapters/TableInfoPs.hpp b/storage/ndb/src/old_files/rep/adapters/TableInfoPs.hpp deleted file mode 100644 index 3fa25979255..00000000000 --- a/storage/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 <Vector.hpp> -#include <ndb_types.h> -#include <string.h> -#include <NdbMem.h> - -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<struct TableInfo*> 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(i<tableInfo.size()) { - table=tableInfo[i]; - if(table->tableId == tableId) - return table; - i++; - } - return 0; -} - -inline -TableInfo * -TableInfoPs::lookup(const Uint32 tableId, Uint32 * pos ) const{ - TableInfo * table; - Uint32 i=0; - while(i<tableInfo.size()) { - table=tableInfo[i]; - if(table->tableId == 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/storage/ndb/src/old_files/rep/dbug_hack.cpp b/storage/ndb/src/old_files/rep/dbug_hack.cpp deleted file mode 100644 index 74e5f080777..00000000000 --- a/storage/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 <ndb_global.h> - -#include <OutputStream.hpp> -#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/storage/ndb/src/old_files/rep/rep_version.hpp b/storage/ndb/src/old_files/rep/rep_version.hpp deleted file mode 100644 index 3830f9c351c..00000000000 --- a/storage/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 <ndb_version.h> - -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/storage/ndb/src/old_files/rep/repapi/Makefile b/storage/ndb/src/old_files/rep/repapi/Makefile deleted file mode 100644 index fdd153f1060..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/repapi/repapi.cpp b/storage/ndb/src/old_files/rep/repapi/repapi.cpp deleted file mode 100644 index d34ab098c9c..00000000000 --- a/storage/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 <ndb_global.h> -#include <NdbTCP.h> -#include "repapi.h" -//#include "mgmapi_debug.h" -#include <socket_io.h> - -#include <NdbOut.hpp> -#include <SocketServer.hpp> -#include <Parser.hpp> -#include <OutputStream.hpp> -#include <InputStream.hpp> - -#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<ParserDummy2> Parser_t; - - -#define REP_CMD(name, fun, desc) \ - { name, \ - 0, \ - ParserRow<ParserDummy2>::Cmd, \ - ParserRow<ParserDummy2>::String, \ - ParserRow<ParserDummy2>::Optional, \ - ParserRow<ParserDummy2>::IgnoreMinMax, \ - 0, 0, \ - fun, \ - desc, 0 } - -#define REP_ARG(name, type, opt, desc) \ - { name, \ - 0, \ - ParserRow<ParserDummy2>::Arg, \ - ParserRow<ParserDummy2>::type, \ - ParserRow<ParserDummy2>::opt, \ - ParserRow<ParserDummy2>::IgnoreMinMax, \ - 0, 0, \ - 0, \ - desc, 0 } - -#define REP_END() \ - { 0, \ - 0, \ - ParserRow<ParserDummy2>::Arg, \ - ParserRow<ParserDummy2>::Int, \ - ParserRow<ParserDummy2>::Optional, \ - ParserRow<ParserDummy2>::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<ParserDummy2> *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="<<ctx.m_currentToken << endl; - } -#ifdef REPAPI_LOG - else { - /** - * Print reply to log file - */ - p->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<ParserDummy2> 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<ParserDummy2> 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; i<REPAPI_MAX_NODE_GROUPS; i++) { - state->first[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<ParserDummy2> 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/storage/ndb/src/old_files/rep/repapi/repapi.h b/storage/ndb/src/old_files/rep/repapi/repapi.h deleted file mode 100644 index 170e493cd86..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/Channel.cpp b/storage/ndb/src/old_files/rep/state/Channel.cpp deleted file mode 100644 index a7f7b90d3fe..00000000000 --- a/storage/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; i<MAX_NO_OF_NODE_GROUPS; i++) { - for (Uint32 j=0; j<NO_OF_POSITIONS; j++) { - state[i][j].set(1,0); - } - } - m_noOfNodeGroups = 0; - m_requestorEnabled = true; - m_transferEnabled = true; - m_applyEnabled = true; - m_deleteEnabled = true; - m_autoStartEnabled = false; - m_stopEpochId = intervalMax; - setSubKey(0); - setSubId(0); - m_stateSub = NO_SUBSCRIPTION_EXISTS; - m_stateRep = CONSISTENT; - m_metaScanEpochs = emptyInterval; - m_dataScanEpochs = emptyInterval; -} - -bool -Channel::requestTransfer(Uint32 nodeGrp, Interval * i) -{ - invariant(); - Interval tmp1, tmp2; - - // i = PS - SSReq - SS - App - intervalLeftMinus(state[nodeGrp][PS], state[nodeGrp][SSReq], &tmp1); - intervalLeftMinus(tmp1, state[nodeGrp][SS], &tmp2); - intervalLeftMinus(tmp2, state[nodeGrp][App], i); - - i->onlyLeft(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; i<m_noOfNodeGroups; i++) { - if (!state[nodeGrp][SS].inInterval(tmp2.first())) - return false; - } - - invariant(); - add(AppReq, nodeGrp, tmp2); - invariant(); - *epoch = tmp2.first(); - return true; -} - -bool -Channel::requestDelete(Uint32 nodeGrp, Interval * i) -{ - invariant(); - Interval tmp1; - - // i = (App cut PS) - DelReq - intervalCut(state[nodeGrp][App], state[nodeGrp][PS], &tmp1); - intervalLeftMinus(tmp1, state[nodeGrp][DelReq], i); - - if (i->isEmpty()) 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; i<m_noOfNodeGroups; i++) { - if (state[i][App].isEmpty()) { - *interval = emptyInterval; - return; - } - - if (interval->first() < 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<m_noOfNodeGroups; i++) { - if (!state[i][AppReq].isEmpty()) { - RLOG(("Stop disallowed. AppReq is non-empty")); - return false; - } - } - - /** - * If stop immediately, then it is ok to stop now - */ - if (m_stopEpochId == 0) { - RLOG(("Stop allowed. AppReq empty and immediate stop requested")); - return true; - } - - /** - * If stop on a certain epoch, then - * check that stopEpochId is equal to the last applied epoch - */ - Interval interval; - getFullyAppliedEpochs(&interval); - if (m_stopEpochId > 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<m_noOfNodeGroups; i++) { - n = (state[i][App].last() > 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; i<m_noOfNodeGroups; i++) { - if (n < state[i][App].last()) return GrepError::ILLEGAL_STOP_EPOCH_ID; - if (n < state[i][AppReq].last()) return GrepError::ILLEGAL_STOP_EPOCH_ID; - } - - m_stopEpochId = n; - return GrepError::NO_ERROR; -}; - -bool -Channel::shouldStop() -{ - /** - * If (m_stopEpochId == App) then channel should stop - */ - for (Uint32 i=0; i<m_noOfNodeGroups; i++) { - if(m_stopEpochId != state[i][App].last()) return false; - } - return true; -} - -/***************************************************************************** - * SELECTIVE TABLE INTERFACE - *****************************************************************************/ - -GrepError::Code -Channel::addTable(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 <db>/<schema>/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; i<m_selectedTables.size(); i++) { - if(strcmp(tableName, m_selectedTables[i]->tableName)==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 <db>/<schema>/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; i<m_selectedTables.size(); i++) { - if(strcmp(tableName, m_selectedTables[i]->tableName)==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; i<m_selectedTables.size(); i++) - ndbout_c("| %-69s |", m_selectedTables[i]->tableName); - } -} - -Vector<struct table *> * -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<m_noOfNodeGroups; i++) { - print(i); - } -} - -void -Channel::print(Position pos, Uint32 nodeGrp) -{ - print(pos); - if (state[nodeGrp][pos].first() == 1 && state[nodeGrp][pos].last() == 0) { - ndbout << " EMPTY"; - } else { - ndbout << " [" << state[nodeGrp][pos].first() << "-" - << state[nodeGrp][pos].last() << "]"; - } -} - -static const char* -channelline = -"+-------------------------------------------------------------------------+\n" -; - -void -Channel::getEpochState(Position p, - Uint32 nodeGrp, - Uint32 * first, - Uint32 * last) { - if(state[nodeGrp][p].isEmpty()) { - *first = 1; - *last = 0; - return; - } - *first = state[nodeGrp][p].first(); - *last = state[nodeGrp][p].last(); -} - - -void -Channel::print(Uint32 nodeGrp) -{ - ndbout << channelline; - ndbout_c("| | Meta scan |" - " Data scan |"); - ndbout.print("| "); - if (m_metaScanEpochs.isEmpty()) { - ndbout.print("| "); - } else { - ndbout.print("| %10u-%-10u ", - m_metaScanEpochs.first(), m_metaScanEpochs.last()); - } - if (m_dataScanEpochs.isEmpty()) { - ndbout_c("| |"); - } else { - ndbout_c("| %10u-%-10u |", - m_dataScanEpochs.first(), m_dataScanEpochs.last()); - } - - /* --- */ - - ndbout << channelline; - ndbout_c("| Source Rep Server | Being Transfered |" - " Destination Rep Server |"); - if (state[nodeGrp][PS].isEmpty()) { - ndbout.print("| "); - } else { - ndbout.print("| %10u-%-10u ", - state[nodeGrp][PS].first(), state[nodeGrp][PS].last()); - } - if (state[nodeGrp][SSReq].isEmpty()) { - ndbout.print("| "); - } else { - ndbout.print("| %10u-%-10u ", - state[nodeGrp][SSReq].first(), state[nodeGrp][SSReq].last()); - } - if (state[nodeGrp][SS].isEmpty()) { - ndbout_c("| |"); - } else { - ndbout_c("| %10u-%-10u |", - state[nodeGrp][SS].first(), state[nodeGrp][SS].last()); - } - - /* --- */ - - ndbout << channelline; - ndbout_c("| Being Applied | Applied |" - " Being Deleted |"); - if (state[nodeGrp][AppReq].isEmpty()) { - ndbout.print("| "); - } else { - ndbout.print("| %10u-%-10u ", state[nodeGrp][AppReq].first(), - state[nodeGrp][AppReq].last()); - } - if (state[nodeGrp][App].isEmpty()) { - ndbout.print("| "); - } else { - ndbout.print("| %10u-%-10u ", - state[nodeGrp][App].first(), state[nodeGrp][App].last()); - } - if (state[nodeGrp][DelReq].isEmpty()) { - ndbout_c("| |"); - } else { - ndbout_c("| %10u-%-10u |", - state[nodeGrp][DelReq].first(), state[nodeGrp][DelReq].last()); - } -} - -/***************************************************************************** - * Private Methods - *****************************************************************************/ - -void -Channel::invariant() -{ - for (Uint32 j=0; j<MAX_NO_OF_NODE_GROUPS; j++) - { - if (!intervalDisjoint(state[j][SSReq], state[j][SS])) - REPABORT("Invariant 1 violated"); - if (!intervalDisjoint(state[j][AppReq], state[j][App])) - REPABORT("Invariant 2 violated"); - } -} diff --git a/storage/ndb/src/old_files/rep/state/Channel.hpp b/storage/ndb/src/old_files/rep/state/Channel.hpp deleted file mode 100644 index cdf4eecca63..00000000000 --- a/storage/ndb/src/old_files/rep/state/Channel.hpp +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 CHANNEL_HPP -#define CHANNEL_HPP - -#include "Interval.hpp" -#include <rep/rep_version.hpp> -#include <Vector.hpp> -#include <ndb_limits.h> -#include <GrepError.hpp> - - -/** - * 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<struct table *> * 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<struct table *> 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/storage/ndb/src/old_files/rep/state/Interval.cpp b/storage/ndb/src/old_files/rep/state/Interval.cpp deleted file mode 100644 index 8266f19c58d..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/Interval.hpp b/storage/ndb/src/old_files/rep/state/Interval.hpp deleted file mode 100644 index 935adaf26b1..00000000000 --- a/storage/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 <NdbOut.hpp> -#include <ndb_types.h> - -/** - * @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/storage/ndb/src/old_files/rep/state/Makefile b/storage/ndb/src/old_files/rep/state/Makefile deleted file mode 100644 index 3eed69a97dd..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/RepState.cpp b/storage/ndb/src/old_files/rep/state/RepState.cpp deleted file mode 100644 index d8a50961a3c..00000000000 --- a/storage/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 <signaldata/SumaImpl.hpp> -#include <NdbApiSignal.hpp> -#include <Properties.hpp> -//#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.getNoOfNodeGroups(); nodeGrp++) { - DBUG_REQUESTOR_PRINT("RepState: Transfer calc for node grp"); - Interval i; - if (m_channel.requestTransfer(nodeGrp, &i)) { - m_funcRequestTransfer(m_extSender, signal, nodeGrp, i.first(), i.last()); - } - } -} - -void -RepState::requestApply(NdbApiSignal * signal) -{ - DBUG_REQUESTOR_PRINT("RepState: Apply calculations started"); - for(Uint32 nodeGrp=0; nodeGrp<m_channel.getNoOfNodeGroups(); nodeGrp++) { - DBUG_REQUESTOR_PRINT("RepState: Apply calc for node grp"); - Uint32 gci; - if (m_channel.requestApply(nodeGrp, &gci)) { - Uint32 force = (m_channel.getState() == Channel::LOG) ? 0 : 1; - m_funcRequestApply(m_applier, signal, nodeGrp, gci, gci, force); - } - } -} - -void -RepState::requestDelete(NdbApiSignal * signal) -{ - DBUG_REQUESTOR_PRINT("RepState: Delete calculations started"); - for(Uint32 nodeGrp=0; nodeGrp<m_channel.getNoOfNodeGroups(); nodeGrp++) { - DBUG_REQUESTOR_PRINT("RepState: Delete calc for node grp"); - Interval i; - if (m_channel.requestDelete(nodeGrp, &i)){ - m_funcRequestDeleteSS(m_gciContainer, signal, nodeGrp, - i.first(), i.last()); - m_funcRequestDeletePS(m_extSender, signal, nodeGrp, i.first(), i.last()); - } - } -} - -void -RepState::requestEpochInfo(NdbApiSignal * signal) -{ - DBUG_REQUESTOR_PRINT("RepState: Epoch Info calculations"); - for(Uint32 nodeGrp=0; nodeGrp<m_channel.getNoOfNodeGroups(); nodeGrp++) { - m_funcRequestEpochInfo(m_extSender, signal, nodeGrp); - } -} - -/**************************************************************************** - * Public - ****************************************************************************/ - -GrepError::Code -RepState::add(Channel::Position s, Uint32 nodeGrp, const Interval i) -{ - m_channel.add(s, nodeGrp, i); - - if(s == Channel::PS) - { - m_connected = CONNECTED; - m_connected_counter = 0; - } - - Interval fullEpochs; - m_channel.getFullyAppliedEpochs(&fullEpochs); - if(s == Channel::App && - m_channel.getState() == Channel::DATASCAN_COMPLETED && - fullEpochs.last() >= 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/storage/ndb/src/old_files/rep/state/RepState.hpp b/storage/ndb/src/old_files/rep/state/RepState.hpp deleted file mode 100644 index 06bbca19f7e..00000000000 --- a/storage/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 <GrepError.hpp> -#include <signaldata/GrepImpl.hpp> -#include <rep/repapi/repapi.h> -#include <rep/ExtSender.hpp> -#include <rep/adapters/AppNDB.hpp> -#include <Properties.hpp> - -#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 <struct table *> * 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/storage/ndb/src/old_files/rep/state/RepStateEvent.cpp b/storage/ndb/src/old_files/rep/state/RepStateEvent.cpp deleted file mode 100644 index 9be304c8bfa..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/RepStateRequests.cpp b/storage/ndb/src/old_files/rep/state/RepStateRequests.cpp deleted file mode 100644 index 02677e141f6..00000000000 --- a/storage/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 <NdbApiSignal.hpp> -#include <SimpleProperties.hpp> -#include <UtilBuffer.hpp> - -#include <signaldata/GrepImpl.hpp> -#include <signaldata/RepImpl.hpp> -#include <signaldata/SumaImpl.hpp> - -#include <rep/rep_version.hpp> -#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<struct table *> * 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/storage/ndb/src/old_files/rep/state/testInterval/Makefile b/storage/ndb/src/old_files/rep/state/testInterval/Makefile deleted file mode 100644 index fbb0b48c280..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/testInterval/testInterval.cpp b/storage/ndb/src/old_files/rep/state/testInterval/testInterval.cpp deleted file mode 100644 index 463e4adffb7..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/testRepState/Makefile b/storage/ndb/src/old_files/rep/state/testRepState/Makefile deleted file mode 100644 index 33c6076eff3..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp b/storage/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp deleted file mode 100644 index 8989f7098b8..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp b/storage/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp deleted file mode 100644 index 726b289114d..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/storage/GCIBuffer.cpp b/storage/ndb/src/old_files/rep/storage/GCIBuffer.cpp deleted file mode 100644 index 013600b30a5..00000000000 --- a/storage/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 <ndb_global.h> -#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; i<m_pageList.size(); i++) { - delete m_pageList[i]; - m_pageList[i] = 0; - } - m_pageList.clear(); - // m_pageList = 0; -} - -/***************************************************************************** - * Inserts - *****************************************************************************/ - -void -GCIBuffer::insertLogRecord(Uint32 tableId, Uint32 operation, - 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->insertLogRecord(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_iterator<m_gciBuffer->m_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/storage/ndb/src/old_files/rep/storage/GCIBuffer.hpp b/storage/ndb/src/old_files/rep/storage/GCIBuffer.hpp deleted file mode 100644 index 8a8473d1d49..00000000000 --- a/storage/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 <Vector.hpp> -#include <TransporterDefinitions.hpp> - -#include <signaldata/RepImpl.hpp> - -/** - * @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; ///< <m_gci, id> names GCIBuffer - bool m_complete; ///< GCI complete; buffer contains - ///< everything - Vector <GCIPage *> m_pageList; ///< Storage for data/log record pages. - Uint32 m_receivedBytes; ///< Received bytes in this buffer -}; - -#endif diff --git a/storage/ndb/src/old_files/rep/storage/GCIContainer.cpp b/storage/ndb/src/old_files/rep/storage/GCIContainer.cpp deleted file mode 100644 index c161db0769b..00000000000 --- a/storage/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 <NdbOut.hpp> -#include <NdbMem.h> -#include <new> - -#include <rep/rep_version.hpp> - -//#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/storage/ndb/src/old_files/rep/storage/GCIContainer.hpp b/storage/ndb/src/old_files/rep/storage/GCIContainer.hpp deleted file mode 100644 index 48cbc66bfbd..00000000000 --- a/storage/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 <Vector.hpp> - -#include "LogRecord.hpp" -#include "GCIBuffer.hpp" - -#undef swap -#include <list> -#include <iterator> - -/** - * @class GCIContainer - * @brief Responsible for storing LogRecord:s in GCIBuffer:s - * - * Each GCIBuffer stored in the GCIContainer is named by a pair <GCI, id>. - * (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 <GCIBuffer *> 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/storage/ndb/src/old_files/rep/storage/GCIContainerPS.cpp b/storage/ndb/src/old_files/rep/storage/GCIContainerPS.cpp deleted file mode 100644 index 5adb53f965c..00000000000 --- a/storage/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 <NdbOut.hpp> -#include <NdbMem.h> -#include <new> - -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; i<m_nodeGroupInfo->getNoOfNodeGroups(); 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/storage/ndb/src/old_files/rep/storage/GCIContainerPS.hpp b/storage/ndb/src/old_files/rep/storage/GCIContainerPS.hpp deleted file mode 100644 index 7f5aaac4840..00000000000 --- a/storage/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 <Vector.hpp> -#include <TransporterDefinitions.hpp> - -#include "NodeGroupInfo.hpp" -#include <rep/storage/GCIContainer.hpp> - -#include <list> -#include <iterator> - -/** - * @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/storage/ndb/src/old_files/rep/storage/GCIPage.cpp b/storage/ndb/src/old_files/rep/storage/GCIPage.cpp deleted file mode 100644 index 05ecde2fee1..00000000000 --- a/storage/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 <new> - -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/storage/ndb/src/old_files/rep/storage/GCIPage.hpp b/storage/ndb/src/old_files/rep/storage/GCIPage.hpp deleted file mode 100644 index 50c5ab0cfba..00000000000 --- a/storage/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 <TransporterDefinitions.hpp> - -#include <rep/rep_version.hpp> - -/** - * @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/storage/ndb/src/old_files/rep/storage/LogRecord.hpp b/storage/ndb/src/old_files/rep/storage/LogRecord.hpp deleted file mode 100644 index a0bf3d52372..00000000000 --- a/storage/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 <ndb_global.h> -#include <portlib/NdbMem.h> - -/** - * @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/storage/ndb/src/old_files/rep/storage/Makefile b/storage/ndb/src/old_files/rep/storage/Makefile deleted file mode 100644 index 89b3af455e8..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp b/storage/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp deleted file mode 100644 index 403f92a5999..00000000000 --- a/storage/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 <ndb_types.h> - -struct NodeConnectInfo { - NodeConnectInfo(Uint16 n, bool c): nodeId(n), connected(c) {}; - Uint32 nodeId; - bool connected; -}; - - -#endif diff --git a/storage/ndb/src/old_files/rep/storage/NodeGroup.cpp b/storage/ndb/src/old_files/rep/storage/NodeGroup.cpp deleted file mode 100644 index 33451efb104..00000000000 --- a/storage/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 <NdbOut.hpp> - -//#define NODE_GROUP_DEBUG - -NodeGroup::NodeGroup(Uint32 nodeGrp) { - m_nodeGrp = nodeGrp; - m_primaryNode = 0; -} - -NodeGroup::~NodeGroup() { - for(Uint32 i=0; i<m_nodeConnectList.size(); i++) { - delete m_nodeConnectList[i]; - m_nodeConnectList.erase(i); - } -} - -void -NodeGroup::addNode(Uint32 nodeId, bool connected) { -#ifdef NODE_GROUP_DEBUG - ndbout_c("NodeGroup: addNode(nodeId=%d, connected=%d), nodegrp=%d", - nodeId, connected, m_nodeGrp); -#endif - - /** - * If node already in node group, then do nothing except - * setting the connect statusflag for the node (in case it - * has changed). - */ - for(Uint32 i=0; i < m_nodeConnectList.size(); i++) - if(m_nodeConnectList[i]->nodeId == 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; i<m_nodeConnectList.size(); i++){ - if(m_nodeConnectList[i]->connected) - return m_nodeConnectList[i]->nodeId; - } - return 0; -} - -Uint32 -NodeGroup::getNodeGrp() { - return m_nodeGrp; -} - -Vector <NodeConnectInfo *> * -NodeGroup::getNodeConnectList(){ - return &m_nodeConnectList; -} - -void -NodeGroup::setNodeConnectStatus(Uint32 nodeId, bool connected) { - for(Uint32 i=0; i<m_nodeConnectList.size(); i++){ - if(m_nodeConnectList[i]->nodeId==nodeId) { - m_nodeConnectList[i]->connected=connected; - break; - } - } -} - -bool -NodeGroup::isConnected(Uint32 nodeId) { - for(Uint32 i=0; i<m_nodeConnectList.size(); i++){ - if(m_nodeConnectList[i]->nodeId == nodeId) { - return m_nodeConnectList[i]->connected; - } - } - REPABORT1("Check for non-existing node to be connected", nodeId); -} - - -bool -NodeGroup::fullyConnected() { - for(Uint32 i=0; i<m_nodeConnectList.size(); i++){ - if(!(m_nodeConnectList[i]->connected)) - return false; - } - return true; -} - -bool -NodeGroup::connectedNodeGrp() { - for(Uint32 i=0; i<m_nodeConnectList.size(); i++){ - if(m_nodeConnectList[i]->connected) { - return true; - } - } - return false; -} - - -bool -NodeGroup::exists(Uint32 nodeId) { - for(Uint32 i=0;i<m_nodeConnectList.size();i++) { - if(m_nodeConnectList[i]->nodeId==nodeId) - return true; - } - return false; -} diff --git a/storage/ndb/src/old_files/rep/storage/NodeGroup.hpp b/storage/ndb/src/old_files/rep/storage/NodeGroup.hpp deleted file mode 100644 index 1f515e02a23..00000000000 --- a/storage/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 <Vector.hpp> -#include <ndb_types.h> - -#include <rep/rep_version.hpp> - -/** - * @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 <NodeConnectInfo *> * getNodeConnectList(); - -private: - /** - * Sort list (bubble sort) - */ - void sort(); - Uint32 m_primaryNode; - Uint32 m_nodeGrp; - Vector<NodeConnectInfo *> m_nodeConnectList; -}; - -#endif diff --git a/storage/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp b/storage/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp deleted file mode 100644 index 8c250268997..00000000000 --- a/storage/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; i<m_nodeGroupList.size(); i++) { - delete m_nodeGroupList[i]; - } - m_nodeGroupList.clear(); -} - - -void -NodeGroupInfo::setPrimaryNode(Uint32 nodeGrp, Uint32 nodeId) { - 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)) { - m_nodeGroupList[pos]->setPrimaryNode(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; i<m_nodeGroupList.size(); i++) { - if(m_nodeGroupList[i]->exists(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; i<m_nodeGroupList.size(); i++) { - if(!(m_nodeGroupList[i]->fullyConnected())) - 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; i<m_nodeGroupList.size(); i++) { - if(m_nodeGroupList[i]->getNodeGrp()==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_iterator<m_nodeList->size()) - return (*m_nodeList)[m_iterator]; - else - return 0; -} - diff --git a/storage/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp b/storage/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp deleted file mode 100644 index 3d0499d4425..00000000000 --- a/storage/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 <Vector.hpp> -#include <NdbTick.h> -#include <NdbMain.h> -#include <NdbOut.hpp> -//#include <NdbSleep.h> - -#include "NodeGroup.hpp" -#include <rep/rep_version.hpp> - -/** - * @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<NodeConnectInfo *> * m_nodeList; - }; - friend class NodeGroupInfo::iterator; - -private: - bool existsNodeGroup(Uint32 nodeGrp, Uint32 * pos); - - Vector<NodeGroup *> m_nodeGroupList; -}; - -#endif diff --git a/storage/ndb/src/old_files/rep/transfer/Makefile b/storage/ndb/src/old_files/rep/transfer/Makefile deleted file mode 100644 index 0d8851e287a..00000000000 --- a/storage/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/storage/ndb/src/old_files/rep/transfer/TransPS.cpp b/storage/ndb/src/old_files/rep/transfer/TransPS.cpp deleted file mode 100644 index 11fb0203cbc..00000000000 --- a/storage/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 <NdbSleep.h> - -#include <NdbApiSignal.hpp> -#include <AttributeHeader.hpp> - -#include <signaldata/DictTabInfo.hpp> -#include <signaldata/GetTabInfo.hpp> -#include <signaldata/SumaImpl.hpp> -#include <GrepError.hpp> -#include <SimpleProperties.hpp> - -#include "TransPS.hpp" -#include <rep/storage/NodeGroupInfo.hpp> - -/***************************************************************************** - * 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<SigMatch> 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/storage/ndb/src/old_files/rep/transfer/TransPS.hpp b/storage/ndb/src/old_files/rep/transfer/TransPS.hpp deleted file mode 100644 index 0464b9e47c0..00000000000 --- a/storage/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 <NdbTick.h> -#include <NdbMain.h> -#include <NdbOut.hpp> -#include <NdbSleep.h> - -#include <TransporterDefinitions.hpp> -#include <TransporterFacade.hpp> -#include <ClusterMgr.hpp> - -#include <rep/storage/GCIContainerPS.hpp> - -#include <signaldata/RepImpl.hpp> - -#include <rep/SignalQueue.hpp> -#include <rep/ExtSender.hpp> - -#include <rep/rep_version.hpp> - -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/storage/ndb/src/old_files/rep/transfer/TransSS.cpp b/storage/ndb/src/old_files/rep/transfer/TransSS.cpp deleted file mode 100644 index 376c6375bc4..00000000000 --- a/storage/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 <NdbApiSignal.hpp> -#include <AttributeHeader.hpp> - -#include <signaldata/RepImpl.hpp> -#include <signaldata/DictTabInfo.hpp> -#include <signaldata/GetTabInfo.hpp> -#include <signaldata/SumaImpl.hpp> -#include <signaldata/GrepImpl.hpp> - -#include <SimpleProperties.hpp> -#include <rep/rep_version.hpp> - -#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<SigMatch> 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/storage/ndb/src/old_files/rep/transfer/TransSS.hpp b/storage/ndb/src/old_files/rep/transfer/TransSS.hpp deleted file mode 100644 index 3340038c8d1..00000000000 --- a/storage/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 <NdbTick.h> -#include <NdbMain.h> -#include <NdbOut.hpp> -#include <NdbSleep.h> - -#include <TransporterDefinitions.hpp> -#include <TransporterFacade.hpp> -#include <ClusterMgr.hpp> -#include <API.hpp> - -#include <rep/storage/GCIContainer.hpp> - -#include <rep/SignalQueue.hpp> -#include <rep/ExtSender.hpp> - -#include <rep/state/RepState.hpp> - -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/storage/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp b/storage/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp deleted file mode 100644 index 582ba8040a6..00000000000 --- a/storage/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 <signaldata/SumaImpl.hpp> -#include <GrepError.hpp> - -/***************************************************************************** - * 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/storage/ndb/test/ndbapi/old_dirs/acid/Makefile b/storage/ndb/test/ndbapi/old_dirs/acid/Makefile deleted file mode 100644 index 33dc49fcdea..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/acid2/Makefile b/storage/ndb/test/ndbapi/old_dirs/acid2/Makefile deleted file mode 100644 index 69c9d409b9e..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp b/storage/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp deleted file mode 100644 index 2bd4eab6b70..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.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 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/storage/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp b/storage/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp deleted file mode 100644 index 4a5b8cc8111..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp +++ /dev/null @@ -1,466 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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/storage/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile b/storage/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile deleted file mode 100755 index 802c5e5a2bd..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile b/storage/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile deleted file mode 100644 index 22c05b138b7..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile b/storage/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile deleted file mode 100644 index 58309807682..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/create_tab/Makefile b/storage/ndb/test/ndbapi/old_dirs/create_tab/Makefile deleted file mode 100644 index c2ea0b52b15..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile b/storage/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile deleted file mode 100644 index 96db0781417..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile b/storage/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile deleted file mode 100644 index 2c77c8e21df..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am b/storage/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am deleted file mode 100644 index d4de4b92b60..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl b/storage/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl deleted file mode 100755 index b16f6d5897d..00000000000 --- a/storage/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 <<END; -$progname -- plot ndb operation counts in X11 window -usage: $progname [options] ---help print this summary and exit ---debug print lots of debug information ---port N port number to listen on, default $defaultport ---total N total time interval shown, default $defaulttotal seconds ---sample N sample interval, default $defaultsample seconds ---range N range (max ops per second), default $defaultrange ---nopct show no percentages in graph titles ---z "..." add X11/gnuplot options, for example: - --z "-bg grey80 -geometry 500x300" --z "-persist" -END - exit(0); -} - -# get options -use vars qw( - $helpflag $debug $serverport $totaltime $sampletime $range $nopct - @zopts -); -$helpflag = 0; -$debug = 0; -$serverport = $defaultport; -$totaltime = $defaulttotal; -$sampletime = $defaultsample; -$range = $defaultrange; -$nopct = 0; -@zopts = (); -GetOptions( - 'help' => \$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 <<END; -clear -set title "ops/sec [ $currops ]" -set xrange [@{[ -($totaltime-1) ]}:0] -set yrange [0:$range] -plot \\ - '$datafile' \\ - using 1:3 \\ - title "insert$currpct->{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/storage/ndb/test/ndbapi/old_dirs/flexHammer/Makefile b/storage/ndb/test/ndbapi/old_dirs/flexHammer/Makefile deleted file mode 100644 index c8e436fb7f5..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexHammer/README b/storage/ndb/test/ndbapi/old_dirs/flexHammer/README deleted file mode 100644 index 556582aab96..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexScan/Makefile b/storage/ndb/test/ndbapi/old_dirs/flexScan/Makefile deleted file mode 100644 index 78f9d481063..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexScan/README b/storage/ndb/test/ndbapi/old_dirs/flexScan/README deleted file mode 100644 index cddbdea5336..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexTT/Makefile b/storage/ndb/test/ndbapi/old_dirs/flexTT/Makefile deleted file mode 100644 index a63bd803d95..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile b/storage/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile deleted file mode 100644 index e9995dbd16f..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile b/storage/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile deleted file mode 100644 index d2608526cae..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/indexTest/Makefile b/storage/ndb/test/ndbapi/old_dirs/indexTest/Makefile deleted file mode 100644 index d842e487ee5..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/indexTest2/Makefile b/storage/ndb/test/ndbapi/old_dirs/indexTest2/Makefile deleted file mode 100644 index ad78fd51986..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile b/storage/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile deleted file mode 100644 index 074adbf674a..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile deleted file mode 100644 index af472b1589f..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile deleted file mode 100644 index 744d6171139..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile deleted file mode 100644 index c1f84a3ef70..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h deleted file mode 100644 index 2256498e151..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h +++ /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 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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h deleted file mode 100644 index 3db85e7342e..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h +++ /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 TESTDATA_H -#define TESTDATA_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ -#include <NdbTick.h> -#include <NdbThread.h> -#include <NDBT_Stats.hpp> -#include <random.h> -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h deleted file mode 100644 index 94bd1e80ab3..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h +++ /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 */ - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile deleted file mode 100644 index c0b532a8359..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h deleted file mode 100644 index 22b7f564490..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h +++ /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 */ - -#ifndef MACROS_H -#define MACROS_H - -#include <ndb_global.h> -#include <NdbOut.hpp> - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp deleted file mode 100644 index 9e6c5e55e73..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.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 NDB_ERROR_H -#define NDB_ERROR_H - -#include <ndb_global.h> -#include <NdbOut.hpp> -#include "userInterface.h" -#include <NdbError.hpp> - -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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty deleted file mode 100644 index e69de29bb2d..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty +++ /dev/null diff --git a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp deleted file mode 100644 index af08bc2eecd..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp +++ /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 */ - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h deleted file mode 100644 index 2f4aeb30975..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h +++ /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 TESTDEFINITIONS_H -#define TESTDEFINITIONS_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include <ndb_types.h> - -/***************************************************************/ -/* 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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty deleted file mode 100644 index e69de29bb2d..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty +++ /dev/null diff --git a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile deleted file mode 100644 index 240b5957573..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh deleted file mode 100755 index 1ce3969f9fb..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh deleted file mode 100755 index a5de71395c4..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh deleted file mode 100755 index 92c853cdd86..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh deleted file mode 100755 index da8e9d9bf42..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile deleted file mode 100644 index ae7fac9c49b..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/README b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/README deleted file mode 100644 index e81c8ba0051..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile deleted file mode 100644 index 143d9ba655e..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c deleted file mode 100644 index 7484c7647f5..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c +++ /dev/null @@ -1,543 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.h> -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h deleted file mode 100644 index 824688b6cf9..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h +++ /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 */ - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c deleted file mode 100644 index 4a31db0b4e9..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c +++ /dev/null @@ -1,323 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.h> - -#include <NdbHost.h> -#include <NdbSleep.h> -#include <NdbThread.h> -#include <NdbMain.h> - -#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 <name>] [-proc <num>] [-transactions <num>] [-time <num>]\n" - " -db <name> Specifies the database name\n" - " default = '%s'\n" - " -proc <num> Specifies that <num> is the number of\n" - " concurrent processes. The default is 1.\n" - " -transactions <num> Specifies that <num> transactions will be\n" - " performed. The default is to do a specific time interval\n" - " -time <num> Specifies that the test will run for <num> sec.\n" - " The default is 10 sec\n" - " -warm <num> Specifies the warm-up/cooldown period of <num> 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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h deleted file mode 100644 index 863c230502b..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h +++ /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 TESTDATA_H -#define TESTDATA_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include "testDefinitions.h" -#include <random.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 { - 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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h deleted file mode 100644 index b70ded87756..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h +++ /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 */ - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux deleted file mode 100644 index a933669cfe7..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc deleted file mode 100644 index 57ab8bf982f..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile deleted file mode 100644 index 2107c948843..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c deleted file mode 100644 index 42fbb52f3b2..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.h> - -#include "userInterface.h" - -#include "dbPopulate.h" -#include <NdbOut.hpp> -#include <random.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 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<RETRIES; j++){ - for(k = 0; k<OP_PER_TRANS && i+k < count; k++){ - getRandomSubscriberData(i+k, number, name); - userDbInsertSubscriber(uh, number, getNextRandom(&seq), name); - } - res = userDbCommit(uh); - if(res == 0) - break; - if(res != 1){ - ndbout_c("Terminating"); - exit(0); - } - } - if(j == RETRIES){ - ndbout_c("Terminating"); - exit(0); - } - } -} - -static void populateGroups(UserHandle *uh, int count) -{ - int i; - int j; - int len; - RandomSequence seq; - Permission allow[NO_OF_GROUPS]; - ServerBit serverBit; - GroupName groupName; - char tmp[80]; - int commitCount = 0; - - if( initSequence(&seq, permissionsDefinition) != 0 ) { - ndbout_c("could not set the sequence of random permissions"); - exit(0); - } - - for(i = 0; i < NO_OF_GROUPS; i++) - allow[i] = 0; - - for(i = 0; i < NO_OF_SERVERS; i++) { - serverBit = 1 << i; - - for(j = 0; j < NO_OF_GROUPS; j++ ) { - if( getNextRandom(&seq) ) - allow[j] |= serverBit; - } - } - - for(i = 0; i < NO_OF_GROUPS; i++) { - sprintf(tmp, "-Group %d-", i); - - len = strlen(tmp); - - for(j = 0; j < GROUP_NAME_LENGTH; j++) { - groupName[j] = tmp[j % len]; - } - /* groupName[j] = 0; not null-terminated */ - - userDbInsertGroup(uh, - i, - groupName, - allow[i], - allow[i], - allow[i]); - commitCount ++; - if((commitCount % OP_PER_TRANS) == 0) - userDbCommit(uh); - } - if((commitCount % OP_PER_TRANS) != 0) - userDbCommit(uh); -} - -/*************************************************************** -**************************************************************** -* 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 dbPopulate(UserHandle *uh) -{ - populate("servers", NO_OF_SERVERS, populateServers, uh); - populate("subscribers", NO_OF_SUBSCRIBERS, populateSubscribers, uh); - populate("groups", NO_OF_GROUPS, populateGroups, uh); -} diff --git a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h deleted file mode 100644 index 1916720e141..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h +++ /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 DBPOPULATE_H -#define DBPOPULATE_H - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#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 dbPopulate(UserHandle *uh); - -#ifdef __cplusplus -} -#endif - -/*************************************************************** -* E X T E R N A L D A T A * -***************************************************************/ - - - -#endif /* DBPOPULATE_H */ - diff --git a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c deleted file mode 100644 index 838ac8a7196..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c +++ /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 */ - -#include <ndb_global.h> - -#include "userInterface.h" -#include "dbPopulate.h" -#include <NdbMain.h> -#include <NdbOut.hpp> -#include <random.h> - -#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<argc; i++){ - if(strcmp(argv[i], "-l") == 0){ - useTableLogging = 1; - } else if(strcmp(argv[i], "-i") == 0){ - useIndexTables = 1; - } else { - usage(argv[0]); - return 0; - } - } - - ndbout_c("Using %s tables and %s key storage", - useTableLogging ? "logging" : "temporary", - useIndexTables ? "index" : "normal"); - - myRandom48Init(0x3e6f); - - uh = userDbConnect(1, 0); - dbPopulate(uh); - userDbDisconnect(uh); - return(0); -} diff --git a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile deleted file mode 100644 index 9bf229ac84c..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -ARCHIVE_TARGET := lmc_User - -SOURCES := userInterface.C - -CCFLAGS_LOC = -I../include -I../../include - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c deleted file mode 100644 index dd100507016..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c +++ /dev/null @@ -1,648 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.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 * -***************************************************************/ - - -/*************************************************************** -* 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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h deleted file mode 100644 index 363f247b93f..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h +++ /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 */ - -#ifndef MACROS_H -#define MACROS_H - -#include <ndb_global.h> -#include <NdbOut.hpp> - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp deleted file mode 100644 index b3aaeac822e..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp +++ /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 */ - -#ifndef NDB_ERROR_H -#define NDB_ERROR_H - -#include <NdbOut.hpp> - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile deleted file mode 100644 index 9b1247d44af..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h deleted file mode 100644 index 1de468d4dad..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h +++ /dev/null @@ -1,190 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c deleted file mode 100644 index bacf1861dde..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c +++ /dev/null @@ -1,453 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.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 * -***************************************************************/ - -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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c deleted file mode 100644 index a2f4787bb0c..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c +++ /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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include <ndb_global.h> -#include <time.h> - -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h deleted file mode 100644 index 6da76fc2bff..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h +++ /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 */ - -#ifndef USERHANDLE_H -#define USERHANDLE_H - -/***************************************************************/ -/* I N C L U D E D F I L E S */ -/***************************************************************/ - -#include <NdbApi.hpp> -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp deleted file mode 100644 index fe3c17acbf5..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp +++ /dev/null @@ -1,739 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.h> -#ifndef NDB_WIN32 -#include <sys/time.h> -#endif - -#include "ndb_error.hpp" -#include "userHandle.h" -#include "userInterface.h" -#include <NdbThread.h> -#include <NdbTick.h> -#include <NdbMutex.h> -#include <NdbSleep.h> -#include "ndb_schema.hpp" -#include <NDBT.hpp> -#include <NdbSchemaCon.hpp> - -/*************************************************************** -* 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 <unistd.h> -#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/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c b/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c deleted file mode 100644 index a2f4787bb0c..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c +++ /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 */ - -/*************************************************************** -* I N C L U D E D F I L E S * -***************************************************************/ - -#include <ndb_global.h> -#include <time.h> - -#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/storage/ndb/test/ndbapi/old_dirs/restarter/Makefile b/storage/ndb/test/ndbapi/old_dirs/restarter/Makefile deleted file mode 100644 index 041fbfd82ba..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/restarter2/Makefile b/storage/ndb/test/ndbapi/old_dirs/restarter2/Makefile deleted file mode 100644 index ba33a2e21dc..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/restarts/Makefile b/storage/ndb/test/ndbapi/old_dirs/restarts/Makefile deleted file mode 100644 index 9f14b81fae5..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/ronja/Makefile b/storage/ndb/test/ndbapi/old_dirs/ronja/Makefile deleted file mode 100644 index a11a27c5fd7..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile b/storage/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile deleted file mode 100644 index f0521c3ba77..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile b/storage/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile deleted file mode 100644 index dd66dd813d1..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/telco/Makefile b/storage/ndb/test/ndbapi/old_dirs/telco/Makefile deleted file mode 100644 index 8f82c714119..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/telco/readme b/storage/ndb/test/ndbapi/old_dirs/telco/readme deleted file mode 100644 index 627b4256eef..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testBackup/Makefile b/storage/ndb/test/ndbapi/old_dirs/testBackup/Makefile deleted file mode 100644 index abf47dcfb2d..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testBasic/Makefile b/storage/ndb/test/ndbapi/old_dirs/testBasic/Makefile deleted file mode 100644 index 755b19939cb..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testBlobs/Makefile b/storage/ndb/test/ndbapi/old_dirs/testBlobs/Makefile deleted file mode 100644 index cc5bb629c17..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile b/storage/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile deleted file mode 100644 index 181fbc829d4..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testDict/Makefile b/storage/ndb/test/ndbapi/old_dirs/testDict/Makefile deleted file mode 100644 index 75d493c3424..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testGrep/Makefile b/storage/ndb/test/ndbapi/old_dirs/testGrep/Makefile deleted file mode 100644 index 6bad3d56a00..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile b/storage/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile deleted file mode 100644 index 256e3c98f36..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testIndex/Makefile b/storage/ndb/test/ndbapi/old_dirs/testIndex/Makefile deleted file mode 100644 index e5cd4542c9c..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile b/storage/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile deleted file mode 100644 index e84287a1b16..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testMgm/Makefile b/storage/ndb/test/ndbapi/old_dirs/testMgm/Makefile deleted file mode 100644 index be50d3dae7e..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile b/storage/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile deleted file mode 100644 index 3bb3cba427e..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile b/storage/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile deleted file mode 100644 index 8c13ab3beb4..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile b/storage/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile deleted file mode 100644 index 1bbbcf1d17e..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt b/storage/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt deleted file mode 100644 index 641e9ddb4bf..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testOperations/Makefile b/storage/ndb/test/ndbapi/old_dirs/testOperations/Makefile deleted file mode 100644 index 25546ade639..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile b/storage/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile deleted file mode 100644 index d8899a37895..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile b/storage/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile deleted file mode 100644 index 24f449b747d..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testScan/Makefile b/storage/ndb/test/ndbapi/old_dirs/testScan/Makefile deleted file mode 100644 index fe48f5bc926..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile b/storage/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile deleted file mode 100644 index c7d96494148..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile b/storage/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile deleted file mode 100644 index 7a306eb313d..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testTimeout/Makefile b/storage/ndb/test/ndbapi/old_dirs/testTimeout/Makefile deleted file mode 100644 index 01a9df9887f..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/testTransactions/Makefile b/storage/ndb/test/ndbapi/old_dirs/testTransactions/Makefile deleted file mode 100644 index 0279a526923..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/test_event/Makefile b/storage/ndb/test/ndbapi/old_dirs/test_event/Makefile deleted file mode 100644 index 6299fa47845..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/vw_test/Makefile b/storage/ndb/test/ndbapi/old_dirs/vw_test/Makefile deleted file mode 100644 index 144873dcc69..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/vw_test/bcd.h b/storage/ndb/test/ndbapi/old_dirs/vw_test/bcd.h deleted file mode 100644 index d0aaffbd8b7..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/vw_test/bcd.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public 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 <ndb_global.h> - -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/storage/ndb/test/ndbapi/old_dirs/vw_test/script/client_start b/storage/ndb/test/ndbapi/old_dirs/vw_test/script/client_start deleted file mode 100644 index 2965be6fbb5..00000000000 --- a/storage/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/storage/ndb/test/ndbapi/old_dirs/vw_test/utv.h b/storage/ndb/test/ndbapi/old_dirs/vw_test/utv.h deleted file mode 100644 index 6f378e5595b..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/vw_test/utv.h +++ /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 <semaphore.h> -#include <thread.h> -#include <limits.h> - -#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/storage/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h b/storage/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h deleted file mode 100644 index 3c5444d733b..00000000000 --- a/storage/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h +++ /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 */ - -/********************************************************/ -/* 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/storage/ndb/test/tools/old_dirs/hugoCalculator/Makefile b/storage/ndb/test/tools/old_dirs/hugoCalculator/Makefile deleted file mode 100644 index a29deeaacd3..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoCalculator/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoCalculator - -# Source files of non-templated classes (.C files) -SOURCES = hugoCalculator.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/test/tools/old_dirs/hugoFill/Makefile b/storage/ndb/test/tools/old_dirs/hugoFill/Makefile deleted file mode 100644 index 3da745810b6..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoFill/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoFill - -# Source files of non-templated classes (.C files) -SOURCES = hugoFill.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/test/tools/old_dirs/hugoLoad/Makefile b/storage/ndb/test/tools/old_dirs/hugoLoad/Makefile deleted file mode 100644 index 7c5756d0d41..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoLoad/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoLoad - -# Source files of non-templated classes (.C files) -SOURCES = hugoLoad.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/test/tools/old_dirs/hugoLockRecords/Makefile b/storage/ndb/test/tools/old_dirs/hugoLockRecords/Makefile deleted file mode 100644 index 3235750cbf8..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoLockRecords/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoLockRecords - -SOURCES := hugoLockRecords.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/hugoPkDelete/Makefile b/storage/ndb/test/tools/old_dirs/hugoPkDelete/Makefile deleted file mode 100644 index e6d53611c54..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoPkDelete/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoPkDelete - -SOURCES := hugoPkDel.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/hugoPkRead/Makefile b/storage/ndb/test/tools/old_dirs/hugoPkRead/Makefile deleted file mode 100644 index 03580dc0d18..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoPkRead/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoPkRead - -SOURCES := hugoPkRead.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile b/storage/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile deleted file mode 100644 index 158a79a5666..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoPkReadRecord - -# Source files of non-templated classes (.C files) -SOURCES = hugoPkReadRecord.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile b/storage/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile deleted file mode 100644 index 48795b62206..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoPkUpdate - -SOURCES := hugoPkUpd.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/hugoScanRead/Makefile b/storage/ndb/test/tools/old_dirs/hugoScanRead/Makefile deleted file mode 100644 index b88377c299e..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoScanRead/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoScanRead - -SOURCES := hugoScanRead.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile b/storage/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile deleted file mode 100644 index ec0e07bfd84..00000000000 --- a/storage/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := hugoScanUpdate - -SOURCES := hugoScanUpd.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/restart/Makefile b/storage/ndb/test/tools/old_dirs/restart/Makefile deleted file mode 100644 index 05d9e98c5bc..00000000000 --- a/storage/ndb/test/tools/old_dirs/restart/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := restart - -# Source files of non-templated classes (.C files) -SOURCES = restart.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/test/tools/old_dirs/transproxy/Makefile b/storage/ndb/test/tools/old_dirs/transproxy/Makefile deleted file mode 100644 index d6a76ed2e3d..00000000000 --- a/storage/ndb/test/tools/old_dirs/transproxy/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -include .defs.mk - -TYPE = - -BIN_TARGET = transproxy - -SOURCES = transproxy.cpp - -CCFLAGS_LOC +=\ - -I$(NDB_TOP)/include/kernel \ - -I$(NDB_TOP)/include/mgmcommon \ - -I$(NDB_TOP)/src/common/mgmcommon \ - -I$(NDB_TOP)/src/mgmsrv - -LIBS_LOC +=\ - -L$(NDB_TOP)/lib - -LIBS_SPEC +=\ - $(NDB_TOP)/src/mgmsrv/InitConfigFileParser.o \ - $(NDB_TOP)/src/mgmsrv/Config.o \ - $(NDB_TOP)/src/mgmsrv/Container.o \ - $(NDB_TOP)/src/mgmsrv/Str.o \ - $(NDB_TOP)/src/mgmsrv/convertStrToInt.o \ - -lNDB_API \ - -leventlogger \ - -llogger \ - -lportlib - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/verify_index/Makefile b/storage/ndb/test/tools/old_dirs/verify_index/Makefile deleted file mode 100644 index f6b31e4dc8e..00000000000 --- a/storage/ndb/test/tools/old_dirs/verify_index/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := verify_index - -SOURCES := verify_index.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/test/tools/old_dirs/waiter/waiter.cpp b/storage/ndb/test/tools/old_dirs/waiter/waiter.cpp deleted file mode 100644 index d57daff3aea..00000000000 --- a/storage/ndb/test/tools/old_dirs/waiter/waiter.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 "mgmapi.h" -#include <string.h> -#include <NdbMain.h> -#include <NdbOut.hpp> -#include <NdbSleep.h> -#include <getarg.h> - - -#include <NdbRestarter.hpp> -#include <NDBT.hpp> - -int main(int argc, const char** argv){ - - const char* _hostName = NULL; - int _help = 0; - - struct getargs args[] = { - { "usage", '?', arg_flag, &_help, "Print help", "" } - }; - int num_args = sizeof(args) / sizeof(args[0]); - int optind = 0; - char desc[] = - "hostname:port\n"\ - "This program will connect to the mgmsrv of a NDB cluster.\n"\ - "It will then wait for all nodes to be started\n"; - - if(getarg(args, num_args, argc, argv, &optind) || _help) { - arg_printusage(args, num_args, argv[0], desc); - return NDBT_ProgramExit(NDBT_WRONGARGS); - } - _hostName = argv[optind]; - - NdbRestarter restarter(_hostName); - - if (restarter.waitClusterStarted() != 0) - return NDBT_ProgramExit(NDBT_FAILED); - - return NDBT_ProgramExit(NDBT_OK); -} diff --git a/storage/ndb/tools/old_dirs/copy_tab/Makefile b/storage/ndb/tools/old_dirs/copy_tab/Makefile deleted file mode 100644 index 4ad33a26652..00000000000 --- a/storage/ndb/tools/old_dirs/copy_tab/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := copy_tab - -SOURCES := copy_tab.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/cpcc/Makefile b/storage/ndb/tools/old_dirs/cpcc/Makefile deleted file mode 100644 index 78f8c61e464..00000000000 --- a/storage/ndb/tools/old_dirs/cpcc/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include .defs.mk - -TYPE = util - -BIN_TARGET = ndb_cpcc - -SOURCES = cpcc.cpp -OBJECTS_LOC = $(call fixpath,$(NDB_TOP)/src/mgmclient/CpcClient.o) - -CFLAGS_cpcc.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmclient) - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/create_index/Makefile b/storage/ndb/tools/old_dirs/create_index/Makefile deleted file mode 100644 index 38f2df970c4..00000000000 --- a/storage/ndb/tools/old_dirs/create_index/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := create_index - -# Source files of non-templated classes (.C files) -SOURCES = create_index.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/tools/old_dirs/delete_all/Makefile b/storage/ndb/tools/old_dirs/delete_all/Makefile deleted file mode 100644 index 1cae240eb8f..00000000000 --- a/storage/ndb/tools/old_dirs/delete_all/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := delete_all - -SOURCES := delete_all.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/desc/Makefile b/storage/ndb/tools/old_dirs/desc/Makefile deleted file mode 100644 index 614984cfd35..00000000000 --- a/storage/ndb/tools/old_dirs/desc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := desc - -SOURCES := desc.C - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/drop_index/Makefile b/storage/ndb/tools/old_dirs/drop_index/Makefile deleted file mode 100644 index 969bee51064..00000000000 --- a/storage/ndb/tools/old_dirs/drop_index/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := drop_index - -# Source files of non-templated classes (.C files) -SOURCES = drop_index.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/tools/old_dirs/drop_tab/Makefile b/storage/ndb/tools/old_dirs/drop_tab/Makefile deleted file mode 100644 index d7b21fe982c..00000000000 --- a/storage/ndb/tools/old_dirs/drop_tab/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := drop_tab - -# Source files of non-templated classes (.C files) -SOURCES = drop_tab.cpp - -include $(NDB_TOP)/Epilogue.mk - diff --git a/storage/ndb/tools/old_dirs/list_tables/Makefile b/storage/ndb/tools/old_dirs/list_tables/Makefile deleted file mode 100644 index b60f161ee68..00000000000 --- a/storage/ndb/tools/old_dirs/list_tables/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE = ndbapitest - -BIN_TARGET = list_tables - -SOURCES = listTables.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/ndbnet/Makefile.PL b/storage/ndb/tools/old_dirs/ndbnet/Makefile.PL deleted file mode 100644 index 4b27a17de15..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/Makefile.PL +++ /dev/null @@ -1,158 +0,0 @@ -# -*- perl -*- - -use strict; -use Config; -use ExtUtils::MakeMaker qw(WriteMakefile); -use Test::Harness; - -require 5.005; - -my $base; -if ($base ||= $ENV{NDB_BASE}) { - warn "Using NDB_BASE=$base\n"; -} -$base or die "FATAL: need env.variable NDB_BASE\n"; - -my $top; -if ($top ||= $ENV{NDB_TOP}) { - warn "Using NDB_TOP=$top\n"; -} -$top or die "FATAL: need env.variable NDB_TOP\n"; - -my @scripts = qw(ndbnet.pl ndbnetd.pl); - -for my $f (@scripts) { - my $p = $f; - $p =~ s/\.pl$//; - unlink("$p.sh"); - open(G, ">$p.sh") or die "$p.sh: $!"; - if ($Config{osname} ne 'MSWin32') { - print G <<END; -#! /bin/sh - -# installed in \$NDB_BASE -# selects which $p to run (normally from latest release) -# created in source directory by "make install-base" - -NDB_BASE=$base -export NDB_BASE - -PATH=\$NDB_BASE/bin:\$PATH -export PATH - -LD_LIBRARY_PATH=\$NDB_BASE/lib:\$LD_LIBRARY_PATH -export LD_LIBRARY_PATH - -PERL5LIB=\$NDB_BASE/lib/perl5:\$PERL5LIB -export PERL5LIB - -NDB_TOP=$top -export NDB_TOP - -PATH=\$NDB_TOP/bin:\$PATH -export PATH - -LD_LIBRARY_PATH=\$NDB_TOP/lib:\$LD_LIBRARY_PATH -export LD_LIBRARY_PATH - -PERL5LIB=\$NDB_TOP/lib/perl5:\$PERL5LIB -export PERL5LIB - -exec perl \$NDB_TOP/lib/perl5/$p.pl "\$@" -END - } else { - print G <<END; -rem installed in \$NDB_BASE -rem selects which $p to run (normally from latest release) -rem created in source directory by "make install-base" - -set NDB_BASE=$base -set PATH=%NDB_BASE%\\bin;%PATH% -set PERL5LIB=%NDB_BASE%\\lib\\perl5;%PERL5LIB% -set NDB_TOP=$top -set PATH=%NDB_TOP%\\bin;%PATH% -set PERL5LIB=%NDB_TOP%\\lib\\perl5;%PERL5LIB% -perl %NDB_TOP%\\lib\\perl5\\$p.pl %1 %2 %3 %4 %5 %6 %7 %8 %9 -END - } - close G; -} - -unshift(@INC, 'lib'); -$main::onlymodules = 1; -require lib::NDB::Util; -require lib::NDB::Net; -require lib::NDB::Run; - -my @modules = ( - q(NDB::Util), - @NDB::Util::modules, - q(NDB::Net), - @NDB::Net::modules, - q(NDB::Run), - @NDB::Run::modules, -); - -my @modulepaths = map { s!::!/!g; s!$!.pm!; $_ } @modules; - -my %pm = (); -for my $pl (@scripts) { - $pm{"$pl"} = "\$(INST_LIBDIR)/$pl"; -} -for my $pm (@modulepaths) { - $pm{"lib/$pm"} = "\$(INST_LIBDIR)/$pm"; -} - -WriteMakefile( - NAME=> 'NDB', - PM=> \%pm, - EXE_FILES=> [ qw(ndbrun) ], -# install - PREFIX=> $top, - LIB=> "$top/lib/perl5", -); - -sub MY::postamble { - my $mk = ""; - $mk .= "\n" . <<END; -# NDB make targets -libs: all install -bins: -links: -depend: -clean_dep: -#clean: -cleanall: -tidy: -#distclean: -check: - perl -Ilib -cw -e "use NDB::Util" - perl -Ilib -cw -e "use NDB::Net" - perl -Ilib -cw -e "use NDB::Run" - perl -Ilib -cw ndbnetd.pl - perl -Ilib -cw ndbnet.pl -END - if ($Config{osname} ne 'MSWin32') { - $mk .= "\n" . <<END; -# install startup scripts to \$NDB_BASE -install-base: - test "\$\$NDB_BASE" - mkdir -p \$\$NDB_BASE/bin - rm -f \$\$NDB_BASE/bin/ndbnet - cp -p ndbnet.sh \$\$NDB_BASE/bin/ndbnet - chmod +x \$\$NDB_BASE/bin/ndbnet - rm -f \$\$NDB_BASE/bin/ndbnetd - cp -p ndbnetd.sh \$\$NDB_BASE/bin/ndbnetd - chmod +x \$\$NDB_BASE/bin/ndbnetd -END - } else { - $mk .= "\n" . <<END; -install-base: - copy ndbnet.sh $base\\bin\\ndbnet.bat - copy ndbnetd.sh $base\\bin\\ndbnetd.bat -END - } - return $mk; -} - -1; diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net.pm deleted file mode 100644 index 3b7b16bb3cf..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net.pm +++ /dev/null @@ -1,42 +0,0 @@ -package NDB::Net; - -use strict; -use Carp; -require Exporter; - -use NDB::Util; - -use vars qw(@ISA @EXPORT @EXPORT_OK); -@ISA = qw(Exporter); - -use vars qw(@modules); -@modules = qw( - NDB::Net::Base - NDB::Net::Client - NDB::Net::Command - NDB::Net::Config - NDB::Net::Database - NDB::Net::Env - NDB::Net::Node - NDB::Net::NodeApi - NDB::Net::NodeDb - NDB::Net::NodeMgmt - NDB::Net::Server - NDB::Net::ServerINET - NDB::Net::ServerUNIX -); - -return 1 if $main::onlymodules; - -for my $module (@modules) { - eval "require $module"; - $@ and confess "$module $@"; -} - -for my $module (@modules) { - eval "$module->initmodule"; - $@ and confess "$module $@"; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Base.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Base.pm deleted file mode 100644 index 900446138e8..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Base.pm +++ /dev/null @@ -1,12 +0,0 @@ -package NDB::Net::Base; - -use strict; -use Carp; - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Client.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Client.pm deleted file mode 100644 index d34a18d63af..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Client.pm +++ /dev/null @@ -1,252 +0,0 @@ -package NDB::Net::Client; - -use strict; -use Carp; -use POSIX(); -use Socket; - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -my %clientcache = (); -my $clientid = 0; - -NDB::Net::Client->attributes( - id => sub { /^\d+$/ }, - addtime => sub { /^\d+$/ }, - state => sub { /^(new|input|cmd)$/ }, - socket => sub { ref && $_->isa('NDB::Util::Socket') }, - serversocket => sub { ref && $_->isa('NDB::Util::Socket') }, - serverlock => sub { ref && $_->isa('NDB::Util::Lock') }, - event => sub { ref && $_->isa('NDB::Util::Event') }, - context => sub { defined }, - cmd => sub { ref && $_->isa('NDB::Net::Command') }, -); - -sub desc { - my $client = shift; - my $id = $client->getid; - my $fileno = fileno($client->getsocket->getfh); - return "client $id fd=$fileno"; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $client = $class->SUPER::new(%attr); - $client->setid(++$clientid) - or $log->push, return undef; - $client->setaddtime(time) - or $log->push, return undef; - $client->setstate(q(new)) - or $log->push, return undef; - $client->setsocket($attr{socket}) - or $log->push, return undef; - $client->setserversocket($attr{serversocket}) - or $log->push, return undef; - $client->setserverlock($attr{serverlock}) - or $log->push, return undef; - $client->setevent($attr{event}) - or $log->push, return undef; - $client->setcontext($attr{context}) - or $log->push, return undef; - $log->put("add")->push($client)->info; - $clientcache{$client->getid} = $client; - return $client; -} - -sub listall { - my $class = shift; - my $list = []; - for my $id (sort { $a <=> $b } keys %clientcache) { - my $client = $clientcache{$id}; - push(@$list, $client); - } - return $list; -} - -sub exists { - my $client = shift; - return exists($clientcache{$client->getid}); -} - -sub delete { - my $client = shift; - $log->put("delete")->push($client)->info; - $client->getevent->clear($client->getsocket, 'r'); - $client->getsocket->close; - delete $clientcache{$client->getid} or confess 'oops'; -} - -sub deleteother { - my $thisclient = shift; - for my $id (sort { $a <=> $b } keys %clientcache) { - my $client = $clientcache{$id}; - if ($client ne $thisclient) { - $client->delete; - } - } -} - -sub deleteall { - my $class = shift; - for my $id (sort { $a <=> $b } keys %clientcache) { - my $client = $clientcache{$id}; - $client->delete; - } -} - -# processing - -sub processnew { - my $client = shift; - @_ == 0 or confess 0+@_; - $log->put("process new")->push($client)->debug; - $client->getevent->set($client->getsocket, 'r'); - $log->attachuser(io => $client->getsocket); - $client->setstate(q(input)) - or $log->push, return undef; - return 1; -} - -sub processinput { - my $client = shift; - @_ == 0 or confess 0+@_; - $log->put("process input")->push($client)->debug; - my $line = $client->getsocket->readline; - if (! defined($line)) { - $log->push; - return undef; - } - if (length($line) == 0) { - if ($client->getsocket->getreadend) { - $log->put("no command")->push($client); - return undef; - } - $log->put("wait for input")->push($client)->debug; - return 1; - } - $log->put("got line: $line")->push($client)->info; - $client->getevent->clear($client->getsocket, 'r'); - my $cmd = NDB::Net::Command->new(line => $line) - or $log->push, return undef; - $log->put("command received")->push($cmd)->push($client)->debug; - $client->setcmd($cmd) - or $log->push, return undef; - $client->setstate(q(cmd)) - or $log->push, return undef; - return 1; -} - -sub processcmd { - my $client = shift; - @_ == 0 or confess 0+@_; - $log->put("process cmd")->push($client)->debug; - my $cmd = $client->getcmd; - my $context = $client->getcontext; - my $name_fg = "cmd_" . $cmd->getname . "_fg"; - my $name_bg = "cmd_" . $cmd->getname . "_bg"; - my $fg = $context->can($name_fg); - my $bg = $context->can($name_bg); - unless ($fg || $bg) { - $log->put("%s: unimplemented", $cmd->getname); - return undef; - } - my $ret; - if ($fg) { - $log->put($name_fg)->push($cmd)->push($client)->info; - if (! ref($context)) { - $ret = &$fg($cmd); - } - else { - $ret = &$fg($context, $cmd); - } - defined($ret) - or $log->push, return undef; - if (! $bg) { - $log->push($name_fg)->putvalue($ret)->user; - return 1; - } - } - if ($bg) { - $log->put($name_bg)->push($cmd)->push($client)->info; - my $pid = fork; - if (! defined($pid)) { - $log->put("fork failed: $!"); - return undef; - } - if ($pid == 0) { - $client->getserversocket->close; - $client->getserverlock->close; - $client->deleteother; - if (! ref($context)) { - $ret = &$bg($cmd); - } - else { - $ret = &$bg($context, $cmd); - } - if (! $ret) { - $log->push($client)->error; - $log->push($name_bg)->putvalue(undef)->user; - exit(1); - } - $log->push($name_bg)->putvalue($ret)->user; - exit(0); - } - } - return 1; -} - -sub process { - my $client = shift; - @_ == 0 or confess 0+@_; - try: { - if ($client->getstate eq q(new)) { - $client->processnew - or $log->push, last try; - } - if ($client->getstate eq q(input)) { - $client->processinput - or $log->push, last try; - } - if ($client->getstate eq q(cmd)) { - $client->processcmd - or $log->push, last try; - $log->detachuser; - $client->delete; - return 1; - } - return 1; - } - $log->push($client)->error; - $log->putvalue(undef)->user; - $log->detachuser; - $client->delete; - return undef; -} - -sub processall { - my $class = shift; - @_ == 0 or confess 0+@_; - my $list = $class->listall; - for my $client (@$list) { - $client->process; - } - while ((my $pid = waitpid(-1, &POSIX::WNOHANG)) > 0) { - $log->put("harvested pid=$pid")->info; - } -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Command.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Command.pm deleted file mode 100644 index 30145d09fa9..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Command.pm +++ /dev/null @@ -1,641 +0,0 @@ -package NDB::Net::Command; - -use strict; -use Carp; -use Getopt::Long; -use Text::ParseWords (); -use Text::Tabs (); - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -my($cmdtab, $aliastab); - -NDB::Net::Command->attributes( - name => sub { /^\s*\w+\b/ }, - argv => sub { ref eq 'ARRAY' }, - optspec => sub { ref eq 'ARRAY' }, - argspec => sub { /^\d+$/ || ref eq 'CODE' }, - short => sub { defined && ! ref }, - help => sub { defined && ! ref }, - opts => sub { ref eq 'HASH' }, - args => sub { ref eq 'ARRAY' }, -); - -sub desc { - my $cmd = shift; - return "command " . $cmd->getname("?"); -}; - -sub processname { - my $cmd = shift; - @_ == 0 or confess 0+@_; - my $cmdargv = $cmd->getargv; - my $name = shift(@$cmdargv); - my %seen = (); - while ((my $entry) = grep($name eq $_->{name}, @$aliastab)) { - $seen{$name}++ && last; - unshift(@$cmdargv, split(' ', $entry->{value})); - $name = shift(@$cmdargv); - } - if ((my $entry) = grep($_->{name} eq $name, @$cmdtab)) { - $cmd->setname($entry->{name}) - or $log->push, return undef; - $cmd->setoptspec($entry->{optspec}) - or $log->push, return undef; - $cmd->setargspec($entry->{argspec}) - or $log->push, return undef; - } - else { - $log->put("$name: undefined")->push($cmd); - return undef; - } - return 1; -} - -sub getopttype { - my $cmd = shift; - my($key) = @_; - if (grep(/^$key$/, @{$cmd->getoptspec})) { - return 1; - } - if (grep(/^$key=/, @{$cmd->getoptspec})) { - return 2; - } - return undef; -} - -sub processargv { - my $cmd = shift; - @_ == 0 or confess 0+@_; - my $cmdargv = $cmd->getargv; - my @newargv = (); - while (@$cmdargv) { - my $v = shift(@$cmdargv); - if (! defined($v)) { - next; - } - if (ref($v) eq 'ARRAY') { - unshift(@$cmdargv, @$v); # push back - next; - } - if (ref($v) eq 'HASH') { - for my $k (sort keys %$v) { - if ($cmd->getopttype($k) == 1) { - push(@newargv, "--$k"); - next; - } - if ($cmd->getopttype($k) == 2) { - push(@newargv, "--$k", $v->{$k}); - next; - } - $log->put("$k: undefined option")->push($cmd); - return undef; - } - next; - } - if (ref($v)) { - confess 'oops'; - } - push(@newargv, $v); - } - push(@$cmdargv, @newargv); - return 1; -} - -sub processopts { - my $cmd = shift; - @_ == 0 or confess 0+@_; - my $cmdargv = $cmd->getargv; - local(@ARGV) = @$cmdargv; - try: { - local $SIG{__WARN__} = sub { - my $errstr = "@_"; - while (chomp($errstr)) {} - $log->put($errstr)->push($cmd); - }; - $cmd->setopts({}) - or $log->push, return undef; - Getopt::Long::Configure(qw( - default no_getopt_compat no_ignore_case - )); - GetOptions($cmd->getopts, @{$cmd->getoptspec}) - or return undef; - } - $cmd->setargs([ @ARGV ]) - or $log->push, return undef; - return 1; -} - -sub processargs { - my $cmd = shift; - @_ == 0 or confess 0+@_; - my $cmdargs = $cmd->getargs; - if ($cmd->getargspec =~ /^\d+$/) { - if (@$cmdargs != $cmd->getargspec) { - $log->put("invalid arg count %d != %d", - scalar(@$cmdargs), $cmd->getargspec)->push($cmd); - return undef; - } - } - if (ref($cmd->getargspec) eq 'CODE') { - local $_ = scalar(@$cmdargs); - if (! &{$cmd->getargspec}()) { - $log->put("invalid arg count %d", - scalar(@$cmdargs))->push($cmd); - return undef; - } - } - return 1; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my %attr = @_; - my $cmd = $class->SUPER::new(%attr); - my $cmdargv = []; - $cmd->setargv($cmdargv) - or $log->push, return undef; - my $line = $attr{line}; - my $argv = $attr{argv}; - defined($line) != defined($argv) # exactly one - or confess 'oops'; - if (defined($line)) { - ! ref($line) or confess 'oops'; - push(@$cmdargv, Text::ParseWords::shellwords($line)); - } - if (defined($argv)) { - ref($argv) eq 'ARRAY' or confess 'oops'; - push(@$cmdargv, @$argv); - } - if (! @$cmdargv) { - $log->put("empty command"); - return undef; - } - $cmd->processname - or $log->push, return undef; - $cmd->processargv - or $log->push, return undef; - $cmd->processopts - or $log->push, return undef; - $cmd->processargs - or $log->push, return undef; - return $cmd; -} - -sub getline { - my $cmd = shift; - @_ == 0 or confess 0+@_; - my @text = ($cmd->getname); - for my $k (sort keys %{$cmd->getopts}) { - if ($cmd->getopttype($k) == 1) { - push(@text, "--$k"); - next; - } - if ($cmd->getopttype($k) == 2) { - push(@text, "--$k", quotemeta($cmd->getopts->{$k})); - next; - } - confess 'oops'; - } - for my $s (@{$cmd->getargs}) { - push(@text, quotemeta($s)); - } - return "@text"; -} - -sub setopt { - my $cmd = shift; - my($key, $value) = @_; - if ($cmd->getopttype($key) == 1) { - @_ == 1 or confess 0+@_; - $cmd->getopts->{$key} = 1; - } - elsif ($cmd->getopttype($key) == 2) { - @_ == 2 or confess 0+@_; - $cmd->getopts->{$key} = $value; - } - else { - confess 'oops'; - } -} - -sub getopt { - my $cmd = shift; - @_ == 1 or confess 0+@_; - my($key) = @_; - $cmd->getopttype($key) or confess 'oops'; - return $cmd->getopts->{$key}; -} - -sub setarg { - my $cmd = shift; - @_ == 2 or confess 0+@_; - my($idx, $value) = @_; - $cmd->getargs->[$idx] = $value; -} - -sub getarg { - my $cmd = shift; - @_ == 1 or confess 0+@_; - my($idx) = @_; - return $cmd->getargs->[$idx]; -} - -sub getarglist { - my $cmd = shift; - @_ == 1 or confess 0+@_; - my($idx) = @_; - my @args = @{$cmd->getargs}; - @args = @args[$idx..$#args]; - return \@args; -} - -sub helptext { - my $cmd = shift; - @_ <= 1 or confess 0+@_; - my $name = $cmd->getargs->[0]; - my $text = ""; - my $indent = " "x4; - if (defined($name)) { - for my $entry (@$aliastab) { - if ($entry->{name} eq $name) { - $text .= "alias $name=\"$entry->{value}\"\n"; - ($name) = split(' ', $entry->{value}); - last; - } - } - } - else { - $text .= "COMMANDS\n"; - } - for my $entry (@$cmdtab) { - if (defined($name)) { - if ($entry->{name} eq $name) { - $text .= uc($name) . "\n"; - for my $t (split(/\n/, $entry->{help})) { - $text .= $indent; - $text .= Text::Tabs::expand($t) . "\n"; - } - last; - } - } - else { - $text .= $indent; - $text .= sprintf("%-16s%s\n", $entry->{name}, $entry->{short}); - } - } - if (! $text) { - $log->put("$name: undefined"); - return undef; - } - return $text; -} - -sub aliastext { - my $cmd = shift; - @_ == 0 or confess 0+@_; - my $text = ""; - my $indent = " "x4; - $text .= "ALIASES\n"; - for my $entry (@$aliastab) { - $text .= $indent; - $text .= sprintf("%-16s%s\n", $entry->{name}, $entry->{value}); - } - return $text; -} - -# commands -# name command name (unique) -# optspec option spec in Getopt::Long style -# argspec arg count (number or sub) -# short one line summary -# help long help text -# opts options HASH (after parse) -# args arguments ARRAY (after parse) - -$cmdtab = [ - { - name => "help", - optspec => [ qw() ], - argspec => sub { $_[0] <= 1 }, - short => "print help (try: h h)", - help => <<END, -help [name] -name command name or alias - -Print help summary or longer help text for one command. - -General: - -Options can be placed anywhere on command line and can be abbreviated. -Example: "start db11 -i" instead of "start --init_rm db11". - -Several commands have internal option --local which makes current server -do the work, instead of passing it to other servers. This option should -not be used explicitly, except for testing. -END - }, - { - name => "alias", - optspec => [ qw() ], - argspec => 0, - short => "list aliases", - help => <<END, -alias - -List built-in aliases. New ones cannot be defined (yet). -END - }, - { - name => "quit", - optspec => [ qw() ], - argspec => 0, - short => "exit ndbnet", - help => <<END, -quit - -Exit ndbnet client. -END - }, - { - name => "server", - optspec => [ qw(all direct pass parallel script=s local) ], - argspec => sub { $_ >= 1 }, - short => "net server commands", - help => <<END, -server action id... [options] -action start restart stop ping -id net server id from net config ---all do all servers listed in net config ---direct do not use a server ---pass pass current ndb environment to remote command ---parallel run in parallel when possible ---script path remote script instead of "ndbnetd" ---local for internal use by servers - -Each host needs one net server (ndbnetd). It should be started -from latest ndb installation, for example at system boot time. -A "server ping" is used to check that all servers are up (option ---all is added if no server ids are given). - -Other actions are mainly for testing. A "server start" tries to -start servers via "ssh". This does not work if "ssh" is not allowed -or if the remote command does not get right environment. - -Option --direct makes this ndbnet client do the work. It is assumed -for "server start" and it requires that a local net config exists. -Option --pass is useful in a homogeneous (NFS) environment. - -There are aliases "startserver" for "server start", etc. -END - }, - { - name => "start", - optspec => [ qw(init_rm nostart stop kill config old home=s clean proxy=s) ], - argspec => 1, - short => "start database", - help => <<END, -start dbname [options] -dbname database name ---init_rm destroy existing database files on each node ---nostart for DB nodes only do "ndb -n" ---stop do "stop dbname" first ---kill do "kill dbname" first ---config create run config but start no processes ---old use existing config files ---home dir override home (product dir) from config ---clean passed to startnode ---proxy list generate proxy ports (read the source) - -Start a database as follows: - -- start mgmt servers on all mgmt nodes -- start ndb processes on all db nodes -- send "all start" to first mgmt server (redundant) -- start processes on all api nodes (if runtype!="manual") - -Older database versions (v1.0) are started similarly except that there -are no management servers. - -The --proxy option is used for testing network problems. -END - }, - { - name => "startnode", - optspec => [ qw(init_rm nostart config old run=s home=s local clean proxy=s) ], - argspec => 2, - short => "start database node", - help => <<END, -startnode dbname nodeid [options] -dbname database name -nodeid node number ---init_rm destroy existing database files (if db node) ---nostart if DB node only do "ndb -n" ---config create run config but start no processes ---old use existing config files ---run cmd run this shell command, default from config file ---home dir override home (product dir) from config ---local node must be local to this ndbnet server ---clean remove old node dir first ---proxy list processed by mgmt nodes, see "start" command - -Start the process on one database node. The node can be of any type -(mgmt/db/api). If already running, does nothing. - -The --run option specifies a simple shell command (not pipeline etc). -Defaults: - -- mgmt node => mgmtsrvr -p port -l Ndb.cfg -i config.txt -c config.bin - where port comes from ndbnet.xml -- db node => ndb -- api node => based on ndbnet config, default empty - -The node server exits when the command exits (unless runtype is set to -auto). Command exit status is not available. - -Used internally by db "start" command. -END - }, - { - name => "stop", - optspec => [ qw() ], - argspec => 1, - short => "stop database", - help => <<END, -stop dbname [options] -dbname database name - -Stop a database as follows (see also "stopnode" command): - -- send SIGTERM to api processes, wait for them to exit -- send "all stop" command to first mgmt server -- wait for db processes to exit -- send "quit" to mgmt servers, wait for them to exit -END - }, - { - name => "stopnode", - optspec => [ qw(local) ], - argspec => 2, - short => "stop process on one node", - help => <<END, -stopnode dbname nodeid [options] -dbname database name -nodeid node number ---local node must be local to this server - -Stop process on one database node. Action depends on node type: - -- api node: send SIGTERM to the process, wait for it to exit -- db node: no action, wait for the ndb process to exit -- mgmt node: send "quit" command to mgmt server, wait for it to exit - -Used internally by db "stop" command. -END - }, - { - name => "kill", - optspec => [ qw() ], - argspec => 1, - short => "kill processes on all nodes", - help => <<END, -kill dbname [options] -dbname database name - -Send SIGKILL to processes on all nodes and wait for them to exit. -END - }, - { - name => "killnode", - optspec => [ qw(local) ], - argspec => 2, - short => "kill process on one node", - help => <<END, -killnode dbname nodeid [options] -dbname database name -nodeid node number ---local node must be local to this server - -Send SIGKILL to the process on the node and wait for it to exit. - -Used internally by db "kill" command. -END - }, - { - name => "statnode", - optspec => [ qw(local) ], - argspec => 2, - short => "get node run status (internal)", - help => <<END, -statnode dbname nodeid [options] -dbname database name -nodeid node number ---local node must be local to this server - -Get node run status (up/down) as a process. Used internally -and may not produce any output in ndbnet command. -END - }, - { - name => "list", - optspec => [ qw(quick short) ], - argspec => sub { 1 }, - short => "list databases", - help => <<END, -list [dbname] [options] -dbname database name, default is to list all ---quick only output config, do not query status ---short do list nodes - -List databases and nodes. Internally returns a data structure -of process and mgmt server status values for each node. Externally -(in ndbnet command) this is formatted as a listing. -END - }, - { - name => "writenode", - optspec => [ qw(wait=i local) ], - argspec => 3, - short => "write line of text to the process on a node", - help => <<END, -writenode dbname nodeid "some text" -dbname database name -nodeid node number -"some text" arbitrary text (quote if spaces) ---wait n wait n seconds for any response ---local node must be local to this server - -Write the text and a newline to the standard input of the process -running on the node. If wait > 0 is specified, prints whatever -the process wrote to stdout/stderr during that time. - -Used internally by "start" and other commands. -END - }, -]; - -# aliases -# name alias -# value expansion - -$aliastab = [ - { - name => "h", - value => "help", - }, - { - name => "q", - value => "quit", - }, - { - name => "EOF", - value => "quit", - }, - { - name => "startserver", - value => "server start", - }, - { - name => "ss", - value => "server start", - }, - { - name => "restartserver", - value => "server restart", - }, - { - name => "rss", - value => "server restart", - }, - { - name => "stopserver", - value => "server stop", - }, - { - name => "pingserver", - value => "server ping", - }, - { - name => "ps", - value => "server ping", - }, - { - name => "l", - value => "list", - }, -]; - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Config.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Config.pm deleted file mode 100644 index 4c5db3cd3f5..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Config.pm +++ /dev/null @@ -1,235 +0,0 @@ -package NDB::Net::Config; - -use strict; -use Carp; -use Symbol; -use Socket; -use Errno; -use XML::Parser; - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::Config->attributes( - file => sub { /^\S+$/ }, - loadtime => sub { /^\d+$/ }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $netcfg = $class->SUPER::new(%attr); - $netcfg->setfile($attr{file}) - or $log->put, return undef; - return $netcfg; -} - -sub desc { - my $netcfg = shift; - return $netcfg->getfile; -} - -use vars qw(@context); - -sub handle_start { - my($parser, $tag, %attr) = @_; - my $p = $context[-1]; - my $q = {}; - $p->{$tag} ||= []; - push(@{$p->{$tag}}, $q); - for my $k (keys %attr) { - $q->{$k} = $attr{$k}; - } - push(@context, $q); - return 1; -} - -sub handle_end { - my($parser, $tag, %attr) = @_; - pop(@context); - return 1; -} - -sub load { - my $netcfg = shift; - my $file = $netcfg->getfile; - my @s; - while (1) { - if (@s = stat($file)) { - last; - } - $log->put("$file: stat failed: $!"); - if (! $!{ESTALE}) { - return undef; - } - $log->put("(retry)")->info; - sleep 1; - } - if ($s[9] <= $netcfg->getloadtime(0)) { - return 1; - } - my $fh = gensym(); - if (! open($fh, "<$file")) { - $log->put("$file: open for read failed: $!"); - return undef; - } - my $text = ""; - my $line; - while (defined($line = <$fh>)) { - $text .= $line; - } - close($fh); - my $parser = XML::Parser->new( - ParseParamEnt => 1, - Handlers => { - Start => \&handle_start, - End => \&handle_end, - }, - ); - delete $netcfg->{config}; - local @context = ($netcfg); - $parser->parse($text); - $netcfg->{text} = $text; - $netcfg->{config} = $netcfg->{config}[0]; - $netcfg->setloadtime(time) - or $log->push, return undef; - NDB::Net::Server->deleteall; - NDB::Net::Database->deleteall; - NDB::Net::Node->deleteall; - return 1; -} - -sub getservers { - my $netcfg = shift; - @_ == 0 or confess 0+@_; - my $servers = []; - my $slist = $netcfg->{config}{server} || []; - for my $s (@$slist) { - my $server; - $server = NDB::Net::ServerINET->get($s->{id}); - if (! $server) { - $server = NDB::Net::ServerINET->new(%$s); - if (! $server) { - $log->push($netcfg)->warn; - next; - } - } - push(@$servers, $server); - } - return $servers; -} - -sub getdatabases { - my $netcfg = shift; - @_ == 0 or confess 0+@_; - my $databases = []; - my $dlist = $netcfg->{config}{database} || []; - for my $d (@$dlist) { - if ($d->{isproto} eq "y") { - next; - } - if ($d->{name} !~ /^\w(\w|-)*$/) { - $log->put("$d->{name}: invalid db name")->push($netcfg)->warn; - next; - } - my $db = $netcfg->getdatabase($d->{name}); - if (! $db) { - $log->push->warn; - next; - } - push(@$databases, $db); - } - return $databases; -} - -sub getdatabase { - my $netcfg = shift; - @_ == 1 or confess 0+@_; - my($name) = @_; - $netcfg->getservers or return undef; # cache them - my $default = $netcfg->{config}{default}[0] || {}; - my $db; - my $dlist = $netcfg->{config}{database} || []; - my $nlist; - for my $d (@$dlist) { - ($d->{name} ne $name) && next; - if ($d->{isproto} eq "y") { - next; - } - my %attr = (%$default, %$d); - $db = NDB::Net::Database->new(%attr); - if (! $db) { - $log->push($netcfg); - return undef; - } - if ($d->{proto}) { - if ($d->{isproto} eq "y") { - $log->put("$name: prototypes cannot be recursive"); - return undef; - } - for my $d2 (@$dlist) { - ($d2->{name} ne $d->{proto}) && next; - if ($d2->{isproto} ne "y") { - $log->put("$name: $d2->{name} is not a prototype"); - return undef; - } - if (! $d->{node}) { - $d->{node} = $d2->{node}; - } - last; - } - } - $nlist = $d->{node} || []; - last; - } - if (! $db) { - $log->put("$name: no such db")->push($netcfg); - return undef; - } - if (! @$nlist) { - $log->put("$name: empty node list")->push($netcfg); - return undef; - } - for my $n (@$nlist) { - my $node; - try: { - my $server = NDB::Net::Server->get($n->{server}) - or last try; - my %attr = (%$n, db => $db, server => $server); - my $type = $attr{type}; - if ($type eq 'db') { - $node = NDB::Net::NodeDb->new(%attr) - or last try; - } - if ($type eq 'mgmt') { - $node = NDB::Net::NodeMgmt->new(%attr) - or last try; - } - if ($type eq 'api') { - $node = NDB::Net::NodeApi->new(%attr) - or last try; - } - $log->put("bad node type '$type'"); - } - if (! $node) { - $log->push($netcfg); - $db->delete; - return undef; - } - } - return $db; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Database.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Database.pm deleted file mode 100644 index 7ea15be0650..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Database.pm +++ /dev/null @@ -1,321 +0,0 @@ -package NDB::Net::Database; - -use strict; -use Carp; -use Symbol; - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -my %dbcache = (); - -NDB::Net::Database->attributes( - name => sub { s/^\s+|\s+$//g; /^\S+$/ && ! m!/! }, - comment => sub { defined }, - version => sub { /^\d+(\.\d+)*$/ }, - base => sub { $^O eq 'MSWin32' || m!^/\S+$! }, - home => sub { $^O eq 'MSWin32' || m!^/\S+$! }, - nodeport => sub { $_ > 0 }, -); - -sub desc { - my $db = shift; - return $db->getname; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $db = $class->SUPER::new(%attr); - $db->setname($attr{name}) - or $log->push, return undef; - if ($dbcache{$db->getname}) { - $log->put("duplicate db")->push($db); - return undef; - } - $db->setcomment($attr{comment}); - $db->setversion($attr{version}) - or $log->push, return undef; - if (defined($attr{base})) { - $db->setbase($attr{base}) - or $log->push, return undef; - } - if (defined($attr{home})) { - if ($^O ne 'MSWin32' && $attr{home} !~ m!^/! && $db->hasbase) { - $attr{home} = $db->getbase . "/$attr{home}"; - } - $db->sethome($attr{home}) - or $log->push, return undef; - } - if (defined($attr{nodeport})) { - $db->setnodeport($attr{nodeport}) - or $log->push, return undef; - } - if ($^O eq 'MSWin32' && ! $db->hasnodeport) { - $log->put("nodeport required on windows")->push($db), return undef; - } - $db->{nodehash} = {}; - $dbcache{$db->getname} = $db; - return $db; -} - -sub delete { - my $db = shift; - my $nodelist = $db->getnodelist('all'); - for my $node (@$nodelist) { - $node->delete; - } - delete $dbcache{$db->getname}; -} - -sub deleteall { - my $class = shift; - for my $name (sort keys %dbcache) { - my $db = $dbcache{$name}; - $db->delete; - } -} - -# assume numerical dot separated version numbers like 1.1.2 -sub cmpversion { - my $db = shift; - my $version = shift; - my @x = split(/\./, $db->getversion); - my @y = split(/\./, $version); - while (@x || @y) { - return -1 if $x[0] < $y[0]; - return +1 if $x[0] > $y[0]; - shift(@x); - shift(@y); - } - return 0; -} - -# nodes - -sub addnode { - my $db = shift; - @_ == 1 or confess 0+@_; - my($node) = @_; - unless (ref($node) && $node->isa('NDB::Net::Node')) { - confess 'oops'; - } - my $id = $node->getid; - if ($db->{nodehash}{$id}) { - $log->put("$id: duplicate node id")->push($db); - return undef; - } - $db->{nodehash}{$id} = $node; - return 1; -} - -sub getnode { - my $db = shift; - @_ == 1 or confess 0+@_; - my($id) = @_; - $id += 0; - my $node = $db->{nodehash}{$id}; - if (! $node) { - $log->put("$id: no such node id")->push($db); - return undef; - } - return $node; -} - -sub getnodelist { - my $db = shift; - @_ == 1 or confess 0+@_; - my($type) = @_; - $type =~ /^(all|mgmt|db|api)$/ or confess 'oops'; - my @nodes = (); - for my $id (sort { $a <=> $b } keys %{$db->{nodehash}}) { - my $node = $db->{nodehash}{$id}; - if ($type eq 'all' or $type eq $node->gettype) { - push(@nodes, $node); - } - } - return \@nodes; -} - -# start /stop - -sub start { - my $db = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - if ($opts->{stop} || $opts->{kill}) { - my $method = $opts->{stop} ? "stop" : "kill"; - my %opts = (); - $db->$method(\%opts) - or $log->push, return undef; - } - $log->put("start")->push($db)->info; - my $nodesmgmt = $db->getnodelist('mgmt'); - my $nodesdb = $db->getnodelist('db'); - my $nodesapi = $db->getnodelist('api'); - my $ret; - try: { - my %startopts = (); - for my $k (qw(local init_rm nostart config old home clean proxy)) { - $startopts{$k} = $opts->{$k} if defined($opts->{$k}); - } - my %writeopts = (); - for my $k (qw(local)) { - $writeopts{$k} = $opts->{$k} if defined($opts->{$k}); - } - if ($db->cmpversion("1.0") > 0) { - for my $node (@$nodesmgmt) { - $node->start(\%startopts) or last try; - } - for my $node (@$nodesdb) { - $node->start(\%startopts) or last try; - } - if (! $opts->{config}) { - for my $node (@$nodesmgmt) { # probably redundant - $node->write(\%writeopts, "all start") or last try; - last; - } - } - } - else { - for my $node (@$nodesdb) { - $node->start(\%startopts) or last try; - } - if (! $opts->{config}) { - for my $node (@$nodesdb) { # probably redundant - $node->write(\%writeopts, "start") or last try; - } - } - } - for my $node (@$nodesapi) { - my %apiopts = %startopts; - if ($node->getruntype eq 'manual') { - $apiopts{config} = 1; - } - $node->start(\%apiopts) or last try; - } - $ret = 1; - } - if (! $ret) { - $log->push("start failed")->push($db); - return undef; - } - my $msg = ! $opts->{config} ? "start done" : "config created"; - $log->put($msg)->push($db)->user; - return 1; -} - -sub stop { - my $db = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("stop")->push($db)->info; - my $nodesmgmt = $db->getnodelist('mgmt'); - my $nodesdb = $db->getnodelist('db'); - my $nodesapi = $db->getnodelist('api'); - my $ret; - try: { - for my $node (@$nodesapi) { - $node->stop($opts) or last try; - } - if ($db->cmpversion("1.0") > 0) { - for my $node (@$nodesmgmt) { - $node->write($opts, "all stop") or last try; - last; - } - for my $node (@$nodesdb) { - $node->stop($opts) or last try; - } - for my $node (@$nodesmgmt) { - $node->stop($opts) or last try; - } - } - else { - for my $node (@$nodesdb) { - $node->write($opts, "stop") or last try; - } - for my $node (@$nodesdb) { - $node->stop($opts) or last try; - } - } - $ret = 1; - } - if (! $ret) { - $log->push("stop failed")->push($db); - return undef; - } - $log->put("stop done")->push($db)->user; - return 1; -} - -sub kill { - my $db = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("kill")->push($db)->info; - my $nodesmgmt = $db->getnodelist('mgmt'); - my $nodesdb = $db->getnodelist('db'); - my $nodesapi = $db->getnodelist('api'); - my $ret = 1; - try: { - for my $node (@$nodesapi) { - $node->kill($opts) || ($ret = undef); - } - for my $node (@$nodesdb) { - $node->kill($opts) || ($ret = undef); - } - for my $node (@$nodesmgmt) { - $node->kill($opts) || ($ret = undef); - } - } - if (! $ret) { - $log->push("kill failed")->push($db); - return undef; - } - $log->put("kill done")->push($db)->user; - return 1; -} - -sub list { - my $db = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - my $dbsts = {}; - $dbsts->{comment} = $db->getcomment(""); - $dbsts->{home} = $db->gethome; - $log->put("status")->push($db)->info; - my $mgmsts; - for my $node (@{$db->getnodelist('mgmt')}) { - $mgmsts = $node->get_status or - $log->push->error; - last; - } - $mgmsts ||= {}; - for my $node (@{$db->getnodelist('all')}) { - my $id = $node->getid; - my $nodests = $dbsts->{node}{$id} ||= {}; - my $stat = $node->stat($opts) or - $log->push->error; - $nodests->{id} = $id; - $nodests->{type} = $node->gettype; - $nodests->{comment} = $node->getcomment(""); - $nodests->{host} = $node->getserver->gethost; - $nodests->{run} = $stat || "error"; - $nodests->{status} = $mgmsts->{node}{$id}; - } - return $dbsts; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Env.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Env.pm deleted file mode 100644 index d79e72f2bb3..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Env.pm +++ /dev/null @@ -1,94 +0,0 @@ -package NDB::Net::Env; - -use strict; -use File::Spec; -use Carp; - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# environment variables -# -# NDB_TOP source dir or installation dir -# NDB_BASE base dir not tied to any release or database -# NDB_NETCFG ndbnet config file, default $NDB_BASE/etc/ndbnet.xml -# -# ndbnet explicitly unsets NDB_TOP and NDB_HOME because they are -# specific to each database or database node - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::Env->attributes( - base => sub { /^\S+$/ }, - netcfg => sub { /^\S+$/ }, - hostname => sub { /^\S+$/ }, -); - -my $instance; - -sub desc { - my $netenv = shift; - return "net environment";; -} - -sub instance { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - if ($instance) { - return $instance; - } - for my $var (qw(NDB_TOP NDB_HOME)) { - my $top = delete $ENV{$var}; - if (defined($top)) { - if ($^O ne 'MSWin32') { - $ENV{PATH} =~ s!(^|:)$top/bin($|:)!$1$2!g; - $ENV{LD_LIBRARY_PATH} =~ s!(^|:)$top/lib($|:)!$1$2!g; - $ENV{PERL5LIB} =~ s!(^|:)$top/lib/perl5($|:)!$1$2!g; - } - } - } - my $netenv = $class->SUPER::new(%attr); - for my $base ($attr{base}, $ENV{NDB_BASE}) { - if (defined($base)) { - $netenv->setbase($base) - or $log->push, return undef; - } - } - for my $netcfg ($attr{netcfg}, $ENV{NDB_NETCFG}) { - if (defined($netcfg)) { - $netenv->setnetcfg($netcfg) - or $log->push, return undef; - } - } - if ($netenv->hasbase && ! $netenv->hasnetcfg) { - $netenv->setnetcfg(File::Spec->catfile($netenv->getbase, "etc", "ndbnet.xml")) - or $log->push, return undef; - } - my $uname; - if ($^O ne 'MSWin32') { - chomp($uname = `uname -n`); - } else { - chomp($uname = `hostname`); - } - my($hostname) = gethostbyname($uname); - if (! defined($hostname)) { - $uname =~ s!\..*$!!; - ($hostname) = gethostbyname($uname); - } - $netenv->sethostname($hostname) - or $log->push, return undef; - $instance = $netenv; - return $instance; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Node.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Node.pm deleted file mode 100644 index f41bf51168d..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Node.pm +++ /dev/null @@ -1,747 +0,0 @@ -package NDB::Net::Node; - -use strict; -use Carp; -use Symbol; -use Socket; -use IPC::Open3; -use POSIX(); -use Errno; -use File::Spec; - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -my %nodecache = (); - -NDB::Net::Node->attributes( - db => sub { ref && $_->isa('NDB::Net::Database') }, - comment => sub { defined }, - id => sub { s/^\s+|\s+$//g; s/^0+(\d+)$/$1/; /^\d+$/ && $_ > 0 }, - type => sub { s/^\s+|\s+$//g; /^(mgmt|db|api)$/ }, - server => sub { ref && $_->isa('NDB::Net::Server') }, - base => sub { File::Spec->file_name_is_absolute($_) }, - home => sub { File::Spec->file_name_is_absolute($_) }, - state => sub { /^(new|run|stop)$/ }, - run => sub { defined }, - runenv => sub { defined }, - runtype => sub { m!(auto|once|manual)$! }, - lockpid => sub { $_ != 0 }, - iow => sub { ref && $_->isa('NDB::Util::IO') }, - ior => sub { ref && $_->isa('NDB::Util::IO') }, - pid => sub { $_ > 1 }, - event => sub { ref && $_->isa('NDB::Util::Event') }, -); - -sub desc { - my $node = shift; - my $dbname = $node->getdb->getname; - my $id = $node->getid; - my $type = $node->gettype; - return "$dbname.$id-$type"; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $node = $class->SUPER::new(%attr); - $node->setdb($attr{db}) - or $log->push, return undef; - $node->setid($attr{id}) - or $log->push, return undef; - if ($nodecache{$node->getdb->getname,$node->getid}) { - $log->put("duplicate node")->push($node); - return undef; - } - $node->setcomment($attr{comment}); - $node->settype($attr{type}) - or $log->push, return undef; - if ($node->getdb->cmpversion("1.0") <= 0 && $node->gettype eq 'mgmt') { - $log->put("no mgmt nodes in db version <= 1.0")->push($node); - return undef; - } - $node->setserver($attr{server}) - or $log->push, return undef; - for my $base ($attr{base}, $node->getdb->getbase(undef)) { - if (defined($base)) { - $node->setbase($base) - or $log->push, return undef; - } - } - for my $home ($attr{home}, $node->getdb->gethome(undef)) { - if (defined($home)) { - if ($^O ne 'MSWin32' && $home !~ m!^/! && $node->hasbase) { - $home = $node->getbase . "/$home"; - } - $node->sethome($home) - or $log->push, return undef; - } - } - if (! $node->hashome) { - $log->put("home not defined")->push($node); - return undef; - } - $node->setstate('new') - or $log->push, return undef; - if (defined($attr{run})) { - $node->setrun($attr{run}) - or $log->push, return undef; - } - if (defined($attr{runenv})) { - $node->setrunenv($attr{runenv}) - or $log->push, return undef; - } - if (defined($attr{runtype})) { - $node->setruntype($attr{runtype}) - or $log->push, return undef; - } - if (! $node->hasruntype) { - my $runtype = "manual"; - $runtype = "once" - if $node->gettype =~ /^(mgmt|db)$/ || $node->hasrun; - $node->setruntype($runtype) - or $log->push, return undef; - } - if (! $node->getdb->addnode($node)) { - $log->push; - return undef; - } - $nodecache{$node->getdb->getname,$node->getid} = $node; - return $node; -} - -sub delete { - my $node = shift; - delete $nodecache{$node->getdb->getname,$node->getid} or - confess 'oops'; -} - -sub deleteall { - my $class = shift; - for my $k (sort keys %nodecache) { - my $node = $nodecache{$k}; - $node->delete; - } -} - -# node startup - -sub getconfdir { - my $node = shift; - @_ == 0 or confess 0+@_; - my $netenv = NDB::Net::Env->instance; - my $name = File::Spec->catfile($netenv->getbase, "etc"); - my $dir = NDB::Util::Dir->new(path => $name); - return $dir; -} - -sub getdbdir { - my $node = shift; - @_ == 0 or confess 0+@_; - my $netenv = NDB::Net::Env->instance; - my $name = File::Spec->catfile($netenv->getbase, "db", $node->getdb->getname); - my $dir = NDB::Util::Dir->new(path => $name); - return $dir; -} - -sub getnodedir { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("%s-%s", $node->getid, $node->gettype); - my $dir = $node->getdbdir->getdir($name); - return $dir; -} - -sub getrundir { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("run"); - my $dir = $node->getdbdir->getdir($name); - return $dir; -} - -sub getlogdir { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("log"); - my $dir = $node->getdbdir->getdir($name); - return $dir; -} - -sub getlock { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("%s-%s.pid", $node->getid, $node->gettype); - my $lock = $node->getrundir->getfile($name)->getlock; - return $lock; -} - -sub getsocketfile { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("%s-%s.socket", $node->getid, $node->gettype); - my $file = $node->getrundir->getfile($name); - return $file; -} - -sub getlogfile { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("%s-%s.log", $node->getid, $node->gettype); - my $file = $node->getlogdir->getfile($name); - return $file; -} - -sub getshellfile { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("run.sh"); - my $file = $node->getnodedir->getfile($name); - return $file; -} - -sub getlocalcfg { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = "Ndb.cfg"; - my $file = $node->getnodedir->getfile($name); - return $file; -} - -sub writelocalcfg { - my $node = shift; - @_ == 0 or confess 0+@_; - my $db = $node->getdb; - my $file = $node->getlocalcfg; - $file->mkdir or $log->push, return undef; - if ($db->cmpversion("1.0") <= 0) { - my $section = ""; - my $edit = sub { - chomp; - if (/^\s*\[\s*(\S+)\s*\]/) { - $section = uc($1); - } - if ($section eq 'OWN_HOST') { - if (/^\s*ThisHostId\b/i) { - $_ = "ThisHostId " . $node->getid; - } - } - if ($section eq 'CM') { - if (/^\s*ThisNodeId\b/i) { - $_ = "ThisNodeId " . $node->getid; - } - } - if (0 and $section eq 'PROCESS_ID') { - if (/^\s*Host(\d+)\s+(\S+)(.*)/) { - my $id2 = $1; - my $host2 = $2; - my $rest2 = $3; - my $node2 = $db->getnode($id2) - or $log->push, return undef; - $_ = "Host$id2 "; - $_ .= $node2->getserver->getcanon; - $_ .= " $rest2"; - } - } - $_ .= "\n"; - return 1; - }; - $node->getinifile->copyedit($file, $edit) - or $log->push, return undef; - } - else { - my @text = (); - push(@text, sprintf("OwnProcessId %s", $node->getid)); - my $nodesmgmt = $db->getnodelist('mgmt'); - for my $mnode (@$nodesmgmt) { - my $host = $mnode->getserver->getcanon; - my $port = $mnode->getport; - push(@text, "$host $port"); - } - $file->putlines(\@text) or $log->push, return undef; - } - return 1; -} - -sub getinifile { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("%s.ini", $node->getdb->getname); - my $file = $node->getconfdir->getfile($name); - return $file; -} - -sub getbincfg { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = sprintf("config.bin"); - my $file = $node->getnodedir->getfile($name); - return $file; -} - -sub getenvdefs { - my $node = shift; - @_ == 1 or confess 0+@_; - my $opts = shift; - my $home = $opts->{home} || $node->gethome; - my $netenv = NDB::Net::Env->instance; - if (! File::Spec->file_name_is_absolute($home)) { - $netenv->hasbase - or $log->put("no base and home=$home not absolute"), return undef; - $home = File::Spec->catfile($netenv->getbase, $home); - } - (-d $home) - or $log->put("$home: no such directory"), return undef; - my $defs; - if ($^O ne 'MSWin32') { - $defs = <<END; -# @{[ $node->desc ]} @{[ $node->getcomment("") ]} -# @{[ $node->getserver->desc ]} @{[ $node->getserver->getcanon ]} -# -debugger=\$1 -# -NDB_TOP=$home -export NDB_TOP -PATH=\$NDB_TOP/bin:\$PATH -export PATH -LD_LIBRARY_PATH=\$NDB_TOP/lib:\$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -PERL5LIB=\$NDB_TOP/lib/perl5:\$PERL5LIB -export PERL5LIB -NDB_NODEID=@{[ $node->getid ]} -export NDB_NODEID -NDB_NODETYPE=@{[ $node->gettype ]} -export NDB_NODETYPE -ulimit -Sc unlimited -END - if ($node->hasrunenv) { - $defs .= <<END; -# -cd @{[ $node->getnodedir->getpath ]} || exit 1 -@{[ $node->getrunenv ]} -END - } - $defs .= <<END; -# -unset NDB_HOME # current NdbConfig.c would look here -# -END - } else { - $defs = <<END; -rem @{[ $node->desc ]} @{[ $node->getcomment("") ]} -rem @{[ $node->getserver->desc ]} @{[ $node->getserver->getcanon ]} -rem -set NDB_TOP=$home -set PATH=%NDB_TOP%\\bin;%PATH% -set PERL5LIB=%NDB_TOP%\\lib\\perl5;%PERL5LIB% -set NDB_NODEID=@{[ $node->getid ]} -set NDB_NODETYPE=@{[ $node->gettype ]} -END - if ($node->hasrunenv) { - $defs .= <<END; -rem -@{[ $node->getrunenv ]} -END - } - $defs .= <<END; -rem -rem current NdbConfig.c would look here -set NDB_HOME= -rem -END - } - chomp($defs); - return $defs; -} - -sub startlocal { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("start local")->push($node)->info; - my $lock = $node->getlock; - $lock->mkdir or $log->push, return undef; - anon: { - my $ret = $lock->test; - defined($ret) or $log->push, return undef; - if ($ret) { - $log->put("already running under serverpid=%s", - $lock->getpid)->push($node)->user; - return 1; - } - $lock->set or $log->push, return undef; - } - if ($opts->{clean}) { - $node->getnodedir->rmdir(1); - $node->getlogfile->unlink; - } - if (! $opts->{old}) { - $node->writelocalcfg or $log->push, return undef; - $node->handleprepare($opts) or $log->push, return undef; - } - anon: { - $lock->close; - if ($opts->{config}) { - return 1; - } - my $file = $node->getlogfile; - $file->mkdir or $log->push, return undef; - my $pid = fork(); - defined($pid) or $log->put("fork failed: $!"), return undef; - if ($pid) { - exit(0); - } - $lock->set or $log->push->fatal; - $node->setlockpid($$) or $log->push->fatal; - if ($^O ne 'MSWin32') { - POSIX::setsid() or $log->put("setsid failed: $!")->fatal; - } - $log->setfile($file->getpath) or $log->push->fatal; - } - my $socket; - anon: { - my $file = $node->getsocketfile; - $file->mkdir or $log->push($node)->fatal; - unlink($file->getpath); - if ($^O ne 'MSWin32') { - $socket = NDB::Util::SocketUNIX->new - or $log->push($node)->fatal; - } else { - $socket = NDB::Util::SocketINET->new - or $log->push($node)->fatal; - } - $socket->setopt(SOL_SOCKET, SO_REUSEADDR, 1) - or $log->push($node)->fatal; - if ($^O ne 'MSWin32') { - $socket->bind($file->getpath) - or $log->push($node)->fatal; - } else { - $socket->bind($node->getdb->getnodeport + $node->getid) - or $log->push($node)->fatal; - } - $socket->listen - or $log->push($node)->fatal; - } - START: { - my $w = gensym(); - my $r = gensym(); - my @arg = ('/bin/sh', $node->getshellfile->getpath); - my $pid = open3($w, $r, undef, @arg); - $node->setiow(NDB::Util::IO->new(fh => $w)) - or $log->push->fatal; - $node->setior(NDB::Util::IO->new(fh => $r)) - or $log->push->fatal; - $node->setpid($pid) - or $log->push->fatal; - } - $node->setstate('run') - or $log->push($node)->fatal; - $log->put("started host=%s pid=%s", - $node->getserver->gethost, $node->getpid)->push($node)->user; - $log->push("started")->push($node)->putvalue(1)->user; - $log->detachuser; - NDB::Net::Client->deleteall; - my $event = NDB::Util::Event->new; - $event->set($socket, 'r'); - $event->set($node->getior, 'r'); - loop: { - try: { - my $n = $event->poll(10); - if (! defined($n)) { - $log->push->error; - sleep 1; - last try; - } - if (! $n) { - $log->push->debug; - last try; - } - if ($node->hasior && $event->test($node->getior, 'r')) { - my $data = $node->getior->read; - if (! defined($data)) { - $log->push->fatal; - } - if (length($data) > 0) { - $node->handleoutput($opts, $data); - } - if ($node->getior->getreadend) { - $log->put("input closed")->warn; - $event->clear($node->getior, 'r'); - $node->getior->close; - $node->delior; - $node->handleeof($opts); - last loop; - } - } - if (! $event->test($socket, 'r')) { - last try; - } - my $csocket = $socket->accept(10); - if (! defined($csocket)) { - $log->push->error; - last try; - } - if (! $csocket) { - $log->push->warn; - last try; - } - my $client = NDB::Net::Client->new( - socket => $csocket, - serversocket => $socket, - serverlock => $lock, - event => $event, - context => $node, - ); - $client or $log->push->fatal; - } - NDB::Net::Client->processall; - redo loop; - } - if ($node->getruntype eq "auto") { - if ($node->getstate eq "run") { - $log->put("restart in 5 seconds...")->info; - sleep 5; - goto START; - } - $log->put("stopping, skip restart")->info; - } - $lock->close; - $node->getsocketfile->unlink; - while (wait() != -1) {} - $log->put("exit")->push->info; - exit(0); -} - -# handlers can be overridden in subclass - -sub handleprepare { confess 'oops'; } - -sub handleoutput { - my $node = shift; - @_ == 2 or confess 0+@_; - my($opts, $data) = @_; - $data =~ s/\015//g; - $data = $node->{savedata} . $data; - while ((my $i = index($data, "\n")) >= 0) { - my $line = substr($data, 0, $i); - $data = substr($data, $i+1); - $log->put($line)->info; - if ($opts->{user} && $line !~ /^\s*$/) { - $log->put($line)->user; - } - } - $node->{savedata} = $data; - if (1 && length $node->{savedata}) { # XXX partial line - my $line = $node->{savedata}; - $log->put($line)->info; - if ($opts->{user} && $line !~ /^\s*$/) { - $log->put($line)->user; - } - $node->{savedata} = ""; - } -} - -sub handleeof { -} - -# command subs can be overridden by subclass - -sub waitforexit { - my $node = shift; - my $lock = $node->getlock; - my $lockpid = $node->getlockpid; - my $n1 = 0; - my $n2 = 10; - while (1) { - my $ret = $lock->test; - defined($ret) or $log->push, return undef; - if (! $ret) { - $log->put("exit done")->push($node)->user; - last; - } - if ($lockpid != $lock->getpid) { - $log->put("restarted: lock pid changed %s->%s", - $lockpid, $lock->getpid)->push($node); - return undef; - } - if (++$n1 >= $n2) { - $n2 *= 2; - $log->put("wait for exit")->push($node)->user; - } - select(undef, undef, undef, 0.1); - } - return 1; -} - -sub cmd_stopnode_bg { - my($node, $cmd) = @_; - return $node->waitforexit; -} - -sub cmd_killnode_fg { - my($node, $cmd) = @_; - my $pid = $node->getpid; - $log->put("kill -9 $pid")->push($node)->user; - kill(9, $pid); - $node->setstate('stop') - or $log->push($node), return undef; - return 1; -} - -sub cmd_killnode_bg { - my($node, $cmd) = @_; - return $node->waitforexit; -} - -sub cmd_statnode_bg { - my($node, $cmd) = @_; - return "up"; -} - -sub cmd_writenode_fg { - my($node, $cmd) = @_; - my $text = $cmd->getarg(2); - while(chomp($text)) {}; - $log->put("write: $text")->push($node)->user; - $node->getiow->write("$text\n"); - my $output = ""; - if ((my $num = $cmd->getopt("wait")) > 0) { - my $lim = time + $num; - $node->getior->settimeout(1); - loop: { - my $data = $node->getior->read; - if (length($data) > 0) { - $node->handleoutput({user => 1}, $data); - $output .= $data; - } - redo loop if time < $lim; - } - $node->getior->settimeout(0); - } - return { output => $output }; -} - -# commands - -sub doremote { - my $node = shift; - my($cmdname, $opts, @args) = @_; - my $server = $node->getserver; - $log->put("$cmdname remote")->push($server)->push($node)->info; - my $argv = [ - $cmdname, q(--local), - $opts, $node->getdb->getname, $node->getid, @args ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $server->request($cmd) - or $log->push, return undef; - return $ret; -} - -sub dolocal { - my $node = shift; - my($cmdname, $opts, @args) = @_; - $log->put("$cmdname local")->push($node)->info; - if (! $node->getserver->islocal) { - $log->put("not local")->push($node->getserver)->push($node); - return undef; - } - if ($cmdname eq "startnode") { - return $node->startlocal($opts); - } - my $lock = $node->getlock; - anon: { - my $ret = $lock->test; - defined($ret) or $log->push, return undef; - if (! $ret) { - if ($cmdname eq "statnode") { - return "down"; - } - $log->put("not running")->push($node)->user; - return $cmdname eq "writenode" ? undef : 1; - } - } - my $server; - anon: { - my $path = $node->getsocketfile->getpath; - if (! -e $path) { - $log->put("$path: no socket")->push($node); - return undef; - } - if ($^O ne 'MSWin32') { - $server = NDB::Net::ServerUNIX->new(id => 0, path => $path) - or $log->push, return undef; - } else { - $server = NDB::Net::ServerINET->new(id => 0, host => $node->getserver->getcanon, port => $node->getdb->getnodeport + $node->getid) - or $log->push, return undef; - } - } - my $argv = [ - $cmdname, - $opts, $node->getdb->getname, $node->getid, @args ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $server->request($cmd) - or $log->push, return undef; - $log->put("$cmdname done")->push($node)->info; - return $ret; -} - -sub start { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("start")->push($node)->info; - my $do = $opts->{local} ? "dolocal" : "doremote"; - return $node->$do("startnode", $opts); -} - -sub stop { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("stop")->push($node)->info; - my $do = $opts->{local} ? "dolocal" : "doremote"; - return $node->$do("stopnode", $opts); -} - -sub kill { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("kill")->push($node)->info; - my $do = $opts->{local} ? "dolocal" : "doremote"; - return $node->$do("killnode", $opts); -} - -sub stat { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - $log->put("stat")->push($node)->info; - my $do = $opts->{local} ? "dolocal" : "doremote"; - return $node->$do("statnode", $opts); -} - -sub write { - my $node = shift; - @_ == 2 or confess 0+@_; - my($opts, $text) = @_; - $log->put("write: $text")->push($node)->info; - my $do = $opts->{local} ? "dolocal" : "doremote"; - return $node->$do("writenode", $opts, $text); -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeApi.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeApi.pm deleted file mode 100644 index 08f5f85577d..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeApi.pm +++ /dev/null @@ -1,84 +0,0 @@ -package NDB::Net::NodeApi; - -use strict; -use Carp; -use Symbol; - -require NDB::Net::Node; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Node); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::NodeApi->attributes(); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $node = $class->SUPER::new(%attr, type => 'api') - or $log->push, return undef; - return 1; -} - -# run methods - -sub handleprepare { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - my $netenv = NDB::Net::Env->instance; - my $envdefs = $node->getenvdefs($opts); - defined($envdefs) or return undef; - my $nodedir = $node->getnodedir; - my $shellfile = $node->getshellfile; - my $run; - if ($node->hasrun) { - $run = $node->getrun; - } - if (defined($opts->{run})) { - $run = $opts->{run}; - } - if (defined($run)) { - $log->put("run: $run")->push($node)->user; - } - if ($^O ne 'MSWin32') { - $shellfile->puttext(<<END) or $log->push, return undef; -$envdefs -cd @{[ $nodedir->getpath ]} || exit 1 -set -x -exec \$DEBUGGER $run -END - } else { - $shellfile->puttext(<<END) or $log->push, return undef; -$envdefs -cd @{[ $nodedir->getpath ]} -call $run -END - } - return 1; -} - -sub cmd_stopnode_fg { - my($node, $cmd) = @_; - my $pid = $node->getpid; - unless ($pid > 1) { - $log->put("bad pid=$pid")->push($node); - return undef; - } - $log->put("kill -15 $pid")->push($node)->user; - kill(15, $pid); - $node->setstate('stop') - or log->push($node), return undef; - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeDb.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeDb.pm deleted file mode 100644 index 88a35ba4f8d..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeDb.pm +++ /dev/null @@ -1,116 +0,0 @@ -package NDB::Net::NodeDb; - -use strict; -use Carp; -use Symbol; - -require NDB::Net::Node; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Node); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::NodeDb->attributes( - fsdir => sub { s/^\s+|\s+$//g; /^\S+$/ }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $node = $class->SUPER::new(%attr, type => 'db') - or $log->push, return undef; - $node->setfsdir($attr{fsdir}) - or $log->push, return undef; - return 1; -} - -# run methods - -sub handleprepare { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - my $netenv = NDB::Net::Env->instance; - my $envdefs = $node->getenvdefs($opts); - defined($envdefs) or return undef; - my $nodedir = $node->getnodedir; - my $shellfile = $node->getshellfile; - my $fsdir = NDB::Util::Dir->new( - path => sprintf("%s/%s/%s-%s.fs", - $node->getfsdir, $node->getdb->getname, $node->getid, $node->gettype)); - $fsdir->mkdir or $log->push, return undef; - my $init_rm; - my $run; - if ($^O ne 'MSWin32') { - $init_rm = "# no -i"; - if ($opts->{init_rm}) { - $init_rm = 'rm -f $NDB_FILESYSTEM/*/DBDIH/P0.sysfile'; - } - $run = "\$NDB_TOP/bin/ndb"; - } else { - $init_rm = "rem no -i"; - if ($opts->{init_rm}) { - $init_rm = - 'del/f %NDB_FILESYSTEM%\D1\DBDIH\P0.sysfile' . "\n" . - 'del/f %NDB_FILESYSTEM%\D2\DBDIH\P0.sysfile'; - } - $run = "ndb"; - } - if ($node->getdb->cmpversion("1.0") <= 0) { - $run .= " -s"; - } - if ($opts->{nostart}) { - $run .= " -n"; - } - if ($node->hasrun) { - $run = $node->getrun; - } - if (defined($opts->{run})) { - $run = $opts->{run}; - } - $log->put("run: $run")->push($node)->user; - if ($^O ne 'MSWin32') { - $shellfile->puttext(<<END) or $log->push, return undef; -$envdefs -NDB_FILESYSTEM=@{[ $fsdir->getpath ]} -export NDB_FILESYSTEM -# v1.0 compat -UAS_FILESYSTEM=\$NDB_FILESYSTEM -export UAS_FILESYSTEM -mkdir -p \$NDB_FILESYSTEM -$init_rm -cd @{[ $nodedir->getpath ]} || exit 1 -exec \$debugger $run -END - } else { - $shellfile->puttext(<<END) or $log->push, return undef; -$envdefs -set NDB_FILESYSTEM=@{[ $fsdir->getpath ]} -rem v1.0 compat -set UAS_FILESYSTEM=%NDB_FILESYSTEM% -mkdir %NDB_FILESYSTEM% -$init_rm -cd @{[ $nodedir->getpath ]} -call $run -END - } - return 1; -} - -sub cmd_stopnode_fg { - my($node, $cmd) = @_; - $node->setstate('stop') - or log->push($node), return undef; - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeMgmt.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeMgmt.pm deleted file mode 100644 index 1056e3df623..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeMgmt.pm +++ /dev/null @@ -1,318 +0,0 @@ -package NDB::Net::NodeMgmt; - -use strict; -use Carp; -use Symbol; - -require NDB::Net::Node; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Node); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::NodeMgmt->attributes( - port => sub { s/^\s+|\s+$//g; /^\d+$/ }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $node = $class->SUPER::new(%attr, type => 'mgmt') - or $log->push, return undef; - $node->setport($attr{port}) - or $log->push, return undef; - return 1; -} - -# socket parser methods - -sub socketcommand { - my $node = shift; - my $socket; - $socket = NDB::Util::SocketINET->new or - $log->push($node), return undef; - $socket->settimeout(10); - $socket->connect($node->getserver->getcanon, $node->getport) or - $log->push($node), return undef; - $socket->write("GET STATUS\r\nBYE\r\n") or - $log->push($node), return undef; - my $out = ""; - my $data; - while ($data = $socket->read) { - $out .= $data; - } - $socket->close; - $out =~ s/\015//g; - return $out; -} - -sub get_status { - my $node = shift; - my $out = $node->socketcommand or - $log->push, return undef; - my @out = split(/\n/, $out); - $out[0] =~ /^get\s+status\s+(\d+)/i or - $log->put("bad line 0: $out[0]"), return undef; - my $cnt = $1; - my $ret = {}; - for (my $i = 1; $i <= $cnt; $i++) { - $out[$i] =~ /^$i\s+(.*)/ or - $log->put("bad line $i: $out[$i]"), return undef; - my $text = $1; - $text =~ s/^\s+|\s+$//g; - if ($text =~ /^ndb\s+(no_contact)\s+(\d+)$/i) { - $text = lc "$1"; - } elsif ($text =~ /^ndb\s+(starting)\s+(\d+)$/i) { - $text = lc "$1/$2"; - } elsif ($text =~ /^ndb\s+(started)\s+(\d+)$/i) { - $text = lc "$1"; - } elsif ($text =~ /^ndb\s+(shutting_down)\s+(\d+)$/i) { - $text = lc "$1"; - } elsif ($text =~ /^ndb\s+(restarting)\s+(\d+)$/i) { - $text = lc "$1"; - } elsif ($text =~ /^ndb\s+(unknown)\s+(\d+)$/i) { - $text = lc "$1"; - } - $ret->{node}{$i} = $text; - } - return $ret; -} - -# run methods - -sub getautoinifile { - my $node = shift; - @_ == 0 or confess 0+@_; - my $name = "config.txt"; - my $file = $node->getnodedir->getfile($name); - return $file; -} - -sub writeautoinifile { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - my $db = $node->getdb; - my $nodelist = $db->getnodelist('all'); - my $computers = {}; - for my $n (@$nodelist) { - $computers->{$n->getserver->getid} ||= { - id => $n->getserver->getid, - hostname => $n->getserver->getcanon, - }; - } - my $section = ""; # e.g. PROCESSES - my $auto; - my $edit = sub { - chomp; - s/^\s+|\s+$//g; - if (/^(\w+)$/) { - $section = uc($1); - } - elsif (/^\@loop$/i) { - $_ = "#$_"; - if ($auto) { - $log->put("nested \@loop"); - return undef; - } - $auto = {}; - } - elsif (/^\@base\s+(\S+)\s*$/) { - my $arg = $1; - $_ = "#$_"; - if (! $auto) { - $log->put("unexpected \@base"); - return undef; - } - if ($arg !~ /^\d+$/) { - $log->put("non-numerical \@base"); - return undef; - } - $auto->{base} = $arg; - } - elsif (/^\@end$/i) { - $_ = "#$_"; - if (! $auto) { - $log->put("unmatched \@end"); - return undef; - } - if ($section eq 'COMPUTERS') { - for my $id (sort { $a <=> $b } keys %$computers) { - my $computer = $computers->{$id}; - $_ .= "\n"; - $_ .= "\nId: " . $computer->{id}; - $_ .= "\nHostName: " . $computer->{hostname}; - if ($auto->{list}) { - $_ .= "\n#defaults"; - for my $s (@{$auto->{list}}) { - $_ .= "\n$s"; - } - } - } - } - elsif ($section eq 'PROCESSES') { - for my $n (@$nodelist) { - if ($auto->{type} && $n->gettype ne lc($auto->{type})) { - next; - } - $_ .= "\n"; - $_ .= "\nType: " . uc($n->gettype); - $_ .= "\nId: " . $n->getid; - $_ .= "\nExecuteOnComputer: " . $n->getserver->getid; - if ($auto->{list}) { - $_ .= "\n#defaults"; - for my $s (@{$auto->{list}}) { - $_ .= "\n$s"; - } - } - } - } - elsif ($section eq 'CONNECTIONS') { - if (! $auto->{type}) { - $log->put("cannot generate CONNECTIONS without type"); - return undef; - } - if (! defined($auto->{base})) { - $log->put("need \@base for CONNECTIONS"); - return undef; - } - my $key = $auto->{base}; - for (my $i1 = 0; $i1 <= $#$nodelist; $i1++) { - for (my $i2 = $i1+1; $i2 <= $#$nodelist; $i2++) { - my $n1 = $nodelist->[$i1]; - my $n2 = $nodelist->[$i2]; - if ($n1->gettype ne 'db' && $n2->gettype ne 'db') { - next; - } - $_ .= "\n"; - $_ .= "\nType: $auto->{type}"; - $_ .= "\nProcessId1: " . $n1->getid; - $_ .= "\nProcessId2: " . $n2->getid; - $key++; - if ($auto->{type} eq 'TCP') { - $_ .= "\nPortNumber: $key"; - if (my $list = $opts->{proxy}) { - my $id1 = $n1->getid; - my $id2 = $n2->getid; - if ($list =~ /\b$id1\b.*-.*\b$id2\b/) { - $key++; - $_ .= "\nProxy: $key"; - } elsif ($list =~ /\b$id2\b.*-.*\b$id1\b/) { - $key++; - $_ .= "\nProxy: $key"; - } - } - } - elsif ($auto->{type} eq 'SHM') { - $_ .= "\nShmKey: $key"; - } - else { - $log->put("cannot handle CONNECTIONS type $auto->{type}"); - return undef; - } - if ($auto->{list}) { - $_ .= "\n#defaults"; - for my $s (@{$auto->{list}}) { - $_ .= "\n$s"; - } - } - } - } - } - else { - $log->put("found \@end in unknown section '$section'"); - return undef; - } - undef $auto; - } - elsif (/^$/) { - } - elsif ($auto) { - if (/^Type:\s*(\w+)$/i) { - $auto->{type} = uc($1); - } - else { - $auto->{list} ||= []; - push(@{$auto->{list}}, $_); - } - $_ = ""; - return 1; # no output - } - $_ .= "\n"; - return 1; - }; - $node->getautoinifile->mkdir - or $log->push, return undef; - $node->getinifile->copyedit($node->getautoinifile, $edit) - or $log->push, return undef; - return 1; -} - -sub handleprepare { - my $node = shift; - @_ == 1 or confess 0+@_; - my($opts) = @_; - my $envdefs = $node->getenvdefs($opts); - defined($envdefs) or return undef; - my $nodedir = $node->getnodedir; - my $shellfile = $node->getshellfile; - my $port = $node->getport; - my $lpath = $node->getlocalcfg->getbasename; - $node->writeautoinifile($opts) - or $log->push, return undef; - my $ipath = $node->getautoinifile->getbasename; - $node->getbincfg->mkdir or $log->push, return undef; - my $cpath = $node->getbincfg->getbasename; - my $run; - if ($^O ne 'MSWin32') { - $run = "\$NDB_TOP/bin/mgmtsrvr"; - } else { - $run = "mgmtsrvr"; - } - my $statport = $port + 1; - $run .= " -l $lpath -c $ipath"; - if ($node->hasrun) { - $run = $node->getrun; - } - if (defined($opts->{run})) { - $run = $opts->{run}; - } - $log->put("run: $run")->push($node)->user; - if ($^O ne 'MSWin32') { - $shellfile->puttext(<<END) or $log->push, return undef; -$envdefs -cd @{[ $nodedir->getpath ]} || exit 1 -set -x -exec \$DEBUGGER $run -END - } else { - $shellfile->puttext(<<END) or $log->push, return undef; -$envdefs -cd @{[ $nodedir->getpath ]} -call $run -END - } - return 1; -} - -sub cmd_stopnode_fg { - my $node = shift; - @_ == 1 or confess 0+@_; - my($cmd) = @_; - $log->put("write: quit")->push($node)->user; - $node->getiow->write("quit\n"); - $node->setstate('stop') - or log->push($node), return undef; - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Server.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Server.pm deleted file mode 100644 index 5d2118f0ffe..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Server.pm +++ /dev/null @@ -1,149 +0,0 @@ -package NDB::Net::Server; - -use strict; -use Carp; -use Socket; - -require NDB::Net::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -my %servercache = (); - -NDB::Net::Server->attributes( - id => sub { s/^\s+|\s+$//g; m/^\S+$/ && ! m!/! }, - domain => sub { $_ == PF_UNIX || $_ == PF_INET }, -); - -sub desc { - my $server = shift; - my $id = $server->getid; - return "server $id"; -} - -sub add { - my $server = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - if ($servercache{$server->getid}) { - $log->put("duplicate server")->push($server); - return undef; - } - $servercache{$server->getid} = $server; - return 1; -} - -sub get { - my $class = shift; - @_ == 1 or confess 0+@_; - my($id) = @_; - $id =~ s/^\s+|\s+$//g; - my $server = $servercache{$id}; - if (! $server) { - $log->put("$id: undefined server"); - return undef; - } - $log->put("found")->push($server)->debug; - return $server; -} - -sub delete { - my $server = shift; - delete $servercache{$server->getid}; -} - -sub deleteall { - my $class = shift; - for my $id (sort keys %servercache) { - my $server = $servercache{$id}; - $server->delete; - } -} - -# local server is this server process - -my $localserver; - -sub setlocal { - my $server = shift; - @_ == 0 or confess 0+@_; - $localserver = $server; -} - -sub islocal { - my $server = shift; - @_ == 0 or confess 0+@_; - return $localserver eq $server; -} - -# client side - -sub testconnect { - my $server = shift; - @_ == 0 or confess 0+@_; - my $socket = $server->connect or - $log->push($server), return undef; - $socket->close; - return 1; -} - -sub request { - my $server = shift; - @_ == 1 or confess 0+@_; - my($cmd) = @_; - unless (ref($cmd) && $cmd->isa('NDB::Net::Command')) { - confess 'oops'; - } - my $socket = $server->connect - or $log->push($server), return undef; - anon: { - my $line = $cmd->getline; - my $n = $socket->write("$line\n"); - defined($n) && $n == length("$line\n") - or $log->push($server), return undef; - shutdown($socket->{fh}, 1); - } - my $value; - try: { - my $last; - loop: { - my $line = $socket->readline; - defined($line) - or $log->push($server), last try; - if ($socket->getreadend) { - last loop; - } - while (chomp($line)) {} - $log->put($line)->user - unless $log->hasvalue($line); - $last = $line; - redo loop; - } - if (! $log->hasvalue($last)) { - $log->put("missing return value in \"$last\"")->push($server); - last try; - } - $value = $log->getvalue($last); - defined($value) - or $log->push, last try; - $value = $value->[0]; - if (! defined($value)) { - $log->put("failed")->push($cmd); - last try; - } - } - $socket->close; - return $value; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerINET.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerINET.pm deleted file mode 100644 index a065c186855..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerINET.pm +++ /dev/null @@ -1,116 +0,0 @@ -package NDB::Net::ServerINET; - -use strict; -use Carp; -use Socket; - -require NDB::Net::Server; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Server); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::ServerINET->attributes( - host => sub { s/^\s+|\s+$//g; /^\S+$/ }, - port => sub { s/^\s+|\s+$//g; /^\d+$/ }, - canon => sub { s/^\s+|\s+$//g; /^\S+$/ }, - aliases => sub { ref($_) eq 'ARRAY' }, -); - - -sub desc { - my $server = shift; - my $id = $server->getid; - my $host = $server->gethost; - return "server $id at $host"; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $server = $class->SUPER::new(%attr); - $server->setid($attr{id}) - or $log->push, return undef; - $server->setdomain(PF_INET) - or $log->push, return undef; - $server->sethost($attr{host}) - or $log->push, return undef; - $server->setport($attr{port}) - or $log->push, return undef; - my($canon, $aliases) = gethostbyname($server->gethost); - if (! defined($canon)) { - $log->put("%s: unknown host", $server->gethost); - return undef; - } - $server->setcanon($canon) - or $log->push, return undef; - $server->setaliases([ split(' ', $aliases) ]) - or $log->push, return undef; - $server->add or - $log->push, return undef; - $log->put("added")->push($server)->debug; - return $server; -} - -# find matching servers - -sub match { - my $class = shift; - @_ == 3 or confess 0+@_; - my($host, $port, $servers) = @_; - if (! defined($port) && $host =~ /:/) { - ($host, $port) = split(/:/, $host, 2); - } - $host =~ s/^\s+|\s+$//g; - my($canon) = gethostbyname($host); - unless (defined($canon)) { - $log->put("$host: unknown host"); - return undef; - } - my $hostport = $host; - if (defined($port)) { - $port =~ s/^\s+|\s+$//g; - $port =~ /\d+$/ - or $log->put("$port: non-numeric port"), return undef; - $hostport .= ":$port"; - } - my @server = (); - for my $s (@$servers) { - ($s->getdomain == PF_INET) || next; - ($s->getcanon eq $canon) || next; - ($port && $s->getport != $port) && next; - push(@server, $s); - } - if (! @server) { - $log->put("$hostport: no server found"); - } - if (@server > 1) { - $log->put("$hostport: multiple servers at ports ", - join(' ', map($_->getport, @server))); - } - return \@server; -} - -# client side - -sub connect { - my $server = shift; - @_ == 0 or confess 0+@_; - my $socket; - $socket = NDB::Util::SocketINET->new or - $log->push, return undef; - $socket->connect($server->gethost, $server->getport) or - $log->push, return undef; - return $socket; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerUNIX.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerUNIX.pm deleted file mode 100644 index b3fa245d5ee..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerUNIX.pm +++ /dev/null @@ -1,54 +0,0 @@ -package NDB::Net::ServerUNIX; - -use strict; -use Carp; -use Socket; - -require NDB::Net::Server; - -use vars qw(@ISA); -@ISA = qw(NDB::Net::Server); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Net::ServerUNIX->attributes( - path => sub { s/^\s+|\s+$//g; /^\S+$/ }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $server = $class->SUPER::new(%attr); - $server->setid($attr{id}) - or $log->push, return undef; - $server->setdomain(PF_UNIX) - or $log->push, return undef; - $server->setpath($attr{path}) - or $log->push, return undef; - $server->add or - $log->push, return undef; - return $server; -} - -# client side - -sub connect { - my $server = shift; - @_ == 0 or confess 0+@_; - my $socket; - $socket = NDB::Util::SocketUNIX->new or - $log->push, return undef; - $socket->connect($server->getpath) or - $log->push, return undef; - return $socket; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run.pm deleted file mode 100644 index a8cabde544c..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run.pm +++ /dev/null @@ -1,40 +0,0 @@ -package NDB::Run; - -use strict; -use Carp; -require Exporter; - -use NDB::Net; - -use vars qw(@ISA @EXPORT @EXPORT_OK); -@ISA = qw(Exporter); - -use vars qw(@modules); -@modules = qw( - NDB::Run::Base - NDB::Run::Database - NDB::Run::Env - NDB::Run::Node -); - -return 1 if $main::onlymodules; - -for my $module (@modules) { - eval "require $module"; - $@ and confess "$module $@"; -} - -for my $module (@modules) { - eval "$module->initmodule"; - $@ and confess "$module $@"; -} - -# methods - -sub getenv { - my $class = shift; - return NDB::Run::Env->new(@_); -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Base.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Base.pm deleted file mode 100644 index 4769f2c4441..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Base.pm +++ /dev/null @@ -1,12 +0,0 @@ -package NDB::Run::Base; - -use strict; -use Carp; - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Database.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Database.pm deleted file mode 100644 index 9a12ddb20b3..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Database.pm +++ /dev/null @@ -1,89 +0,0 @@ -package NDB::Run::Database; - -use strict; -use Carp; - -require NDB::Run::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Run::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Run::Database->attributes( - name => sub { s/^\s+|\s+$//g; /^\S+$/ && ! m!/! }, - env => sub { ref && $_->isa('NDB::Run::Env') }, -); - -sub desc { - my $db = shift; - return $db->getname; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $db = $class->SUPER::new(%attr); - $db->setname($attr{name}) - or $log->push, return undef; - $db->setenv($attr{env}) - or $log->push, return undef; - return $db; -} - -sub getnode { - my $db = shift; - @_ == 1 or croak q(usage: $node = $db->getnode($id)); - my($id) = @_; - my $node = NDB::Run::Node->new(db => $db, id => $id) - or $log->push, return undef; - return $node; -} - -# commands - -sub start { - my $db = shift; - my $opts = shift; - my $argv = [ 'start', $db->getname, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $db->getenv->docmd($cmd); - defined($ret) - or $log->push, return undef; - return $ret; -} - -sub stop { - my $db = shift; - my $opts = shift; - my $argv = [ 'stop', $db->getname, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $db->getenv->docmd($cmd); - defined($ret) - or $log->push, return undef; - return $ret; -} - -sub kill { - my $db = shift; - my $opts = shift; - my $argv = [ 'kill', $db->getname, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $db->getenv->docmd($cmd); - defined($ret) - or $log->push, return undef; - return $ret; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Env.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Env.pm deleted file mode 100644 index e851a82636b..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Env.pm +++ /dev/null @@ -1,84 +0,0 @@ -package NDB::Run::Env; - -use strict; -use Carp; - -require NDB::Run::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Run::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Run::Env->attributes( - server => sub { ref && $_->isa('NDB::Net::Server') }, -); - -sub desc { - "env"; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $env = $class->SUPER::new(%attr); - return $env; -} - -sub getdb { - my $env = shift; - @_ == 1 or croak q(usage: $db = $env->getdb($name)); - my($name) = @_; - my $db = NDB::Run::Database->new(env => $env, name => $name) - or $log->push, return undef; - return $db; -} - -# commands - -sub init { - my $env = shift; - my $netenv = NDB::Net::Env->instance; - my $netcfg = NDB::Net::Config->new(file => $netenv->getnetcfg) - or $log->push, return undef; - $netcfg->load - or $log->push, return undef; - my $servers = $netcfg->getservers - or $log->push, return undef; - my $server; - for my $s (@$servers) { - if (! $s->testconnect) { - $log->push->warn; - next; - } - $server = $s; - last; - } - if (! $server) { - $log->put("no available server")->push($netcfg); - return undef; - } - $env->setserver($server) - or $log->push, return undef; - $log->put("selected")->push($server)->info; - return 1; -} - -sub docmd { - my $env = shift; - my $cmd = shift; - my $ret = $env->getserver->request($cmd); - defined($ret) - or $log->push, return undef; - return $ret; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Node.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Node.pm deleted file mode 100644 index e657021b229..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Node.pm +++ /dev/null @@ -1,114 +0,0 @@ -package NDB::Run::Node; - -use strict; -use Carp; - -require NDB::Run::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Run::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Run::Node->attributes( - env => sub { ref && $_->isa('NDB::Run::Env') }, - db => sub { ref && $_->isa('NDB::Run::Database') }, - dbname => sub { s/^\s+|\s+$//g; /^\S+$/ && ! m!/! }, - id => sub { s/^\s+|\s+$//g; s/^0+(\d+)$/$1/; /^\d+$/ && $_ > 0 }, - type => sub { s/^\s+|\s+$//g; /^(mgmt|db|api)$/ }, -); - -sub desc { - my $node = shift; - my $dbname = $node->getdb->getname; - my $id = $node->getid; - my $type = "?"; # $node->gettype; - return "$dbname.$id-$type"; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $node = $class->SUPER::new(%attr); - $node->setdb($attr{db}) - or $log->push, return undef; - $node->setenv($node->getdb->getenv) - or $log->push, return undef; - $node->setdbname($node->getdb->getname) - or $log->push, return undef; - $node->setid($attr{id}) - or $log->push, return undef; -# $node->settype($attr{type}) -# or $log->push, return undef; - return $node; -} - -# commands - -sub start { - my $node = shift; - my $opts = shift; - my $argv = [ 'startnode', $node->getdb->getname, $node->getid, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $node->getenv->docmd($cmd) - or $log->push, return undef; - return $ret; -} - -sub stop { - my $node = shift; - my $opts = shift; - my $argv = [ 'stopnode', $node->getdb->getname, $node->getid, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $node->getenv->docmd($cmd) - or $log->push, return undef; - return $ret; -} - -sub kill { - my $node = shift; - my $opts = shift; - my $argv = [ 'killnode', $node->getdb->getname, $node->getid, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $node->getenv->docmd($cmd) - or $log->push, return undef; - return $ret; -} - -sub stat { - my $node = shift; - my $opts = shift; - my $argv = [ 'statnode', $node->getdb->getname, $node->getid, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $node->getenv->docmd($cmd) - or $log->push, return undef; - return $ret; -} - -sub write { - my $node = shift; - my $text = shift; - my $opts = shift; - my $argv = [ 'writenode', $node->getdb->getname, $node->getid, $text, $opts ]; - my $cmd = NDB::Net::Command->new(argv => $argv) - or $log->push, return undef; - my $ret = $node->getenv->docmd($cmd) - or $log->push, return undef; - ref($ret) eq 'HASH' && defined($ret->{output}) - or confess 'oops'; - return $ret; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util.pm deleted file mode 100644 index d5db35cbf13..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util.pm +++ /dev/null @@ -1,37 +0,0 @@ -package NDB::Util; - -use strict; -use Carp; -require Exporter; - -use vars qw(@ISA @EXPORT @EXPORT_OK); -@ISA = qw(Exporter); - -use vars qw(@modules); -@modules = qw( - NDB::Util::Base - NDB::Util::Dir - NDB::Util::Event - NDB::Util::File - NDB::Util::IO - NDB::Util::Lock - NDB::Util::Log - NDB::Util::Socket - NDB::Util::SocketINET - NDB::Util::SocketUNIX -); - -return 1 if $main::onlymodules; - -for my $module (@modules) { - eval "require $module"; - $@ and confess "$module $@"; -} - -for my $module (@modules) { - eval "$module->initmodule"; - $@ and confess "$module $@"; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Base.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Base.pm deleted file mode 100644 index 20df78a3b9b..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Base.pm +++ /dev/null @@ -1,113 +0,0 @@ -package NDB::Util::Base; - -use strict; -use Carp; - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -sub new { - my $class = shift; - my $this = bless {}, $class; - return $this; -} - -sub getlog { - my $this = shift; - return NDB::Util::Log->instance; -} - -# clone an object -# extra attributes override or delete (if value is undef) -sub clone { - my $this = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $that = bless {}, ref($this); - for my $attr (sort keys %$this) { - if (! exists($attr{$attr})) { - my $get = "get$attr"; - $attr{$attr} = $this->$get(); - } - } - for my $attr (sort keys %attr) { - if (defined($attr{$attr})) { - my $set = "set$attr"; - $that->$set($attr{$attr}); - } - } - return $that; -} - -# methods for member variables: -# - set returns 1 on success and undef on undefined or invalid value -# - get aborts unless value exists or a default (maybe undef) is given -# - has tests existence of value -# - del deletes the value and returns it (maybe undef) - -sub attributes { - @_ % 2 == 1 or confess 0+@_; - my $class = shift; - my @attr = @_; - while (@attr) { - my $attr = shift @attr; - my $filter = shift @attr; - $attr =~ /^\w+$/ or confess $attr; - ref($filter) eq 'CODE' or confess $attr; - my $set = sub { - @_ == 2 or confess "set$attr: arg count: @_"; - my $this = shift; - my $value = shift; - if (! defined($value)) { - $log->put("set$attr: undefined value")->push($this); - return undef; - } - local $_ = $value; - if (! &$filter($this)) { - $log->put("set$attr: invalid value: $value")->push($this); - return undef; - } - $value = $_; - if (! defined($value)) { - confess "set$attr: changed to undef"; - } - $this->{$attr} = $value; - return 1; - }; - my $get = sub { - @_ == 1 || @_ == 2 or confess "get$attr: arg count: @_"; - my $this = shift; - my $value = $this->{$attr}; - if (! defined($value)) { - @_ == 0 and confess "get$attr: no value"; - $value = shift; - } - return $value; - }; - my $has = sub { - @_ == 1 or confess "has$attr: arg count: @_"; - my $this = shift; - my $value = $this->{$attr}; - return defined($value); - }; - my $del = sub { - @_ == 1 or confess "del$attr: arg count: @_"; - my $this = shift; - my $value = delete $this->{$attr}; - return $value; - }; - no strict 'refs'; - *{"${class}::set$attr"} = $set; - *{"${class}::get$attr"} = $get; - *{"${class}::has$attr"} = $has; - *{"${class}::del$attr"} = $del; - } -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Dir.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Dir.pm deleted file mode 100644 index 90609b971c7..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Dir.pm +++ /dev/null @@ -1,170 +0,0 @@ -package NDB::Util::Dir; - -use strict; -use Carp; -use Symbol; -use Errno; -use File::Basename; - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::Dir->attributes( - path => sub { length > 0 }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $dir = $class->SUPER::new(%attr); - $dir->setpath($attr{path}) - or $log->push, return undef; - return $dir; -} - -sub desc { - my $dir = shift; - return $dir->getpath; -} - -sub getparent { - my $dir = shift; - @_ == 0 or confess 0+@_; - my $ppath = dirname($dir->getpath); - my $pdir = NDB::Util::Dir->new(path => $ppath); - return $pdir; -} - -sub getdir { - my $dir = shift; - @_ == 1 or confess 0+@_; - my($name) = @_; - my $dirpath = $dir->getpath; - my $path = $dirpath eq '.' ? $name : File::Spec->catfile($dirpath, $name); - my $entry = NDB::Util::Dir->new(path => $path); - return $entry; -} - -sub getfile { - my $dir = shift; - @_ == 1 or confess 0+@_; - my($name) = @_; - my $dirpath = $dir->getpath; - my $path = $dirpath eq '.' ? $name : File::Spec->catfile($dirpath, $name); - my $entry = NDB::Util::File->new(path => $path); - return $entry; -} - -# list - -sub listdirs { - my $dir = shift; - @_ == 0 or confess 0+@_; - my @list = (); - my $dirpath = $dir->getpath; - my $dh = gensym(); - if (! opendir($dh, $dirpath)) { - $log->put("opendir failed: $!")->push($dir); - return undef; - } - while (defined(my $name = readdir($dh))) { - if ($name eq '.' || $name eq '..') { - next; - } - my $path = $dirpath eq '.' ? $name : "$dirpath/$name"; - if (! -l $path && -d $path) { - my $dir2 = NDB::Util::Dir->new(path => $path) - or $log->push, return undef; - push(@list, $dir2); - } - } - close($dh); - return \@list; -} - -sub listfiles { - my $dir = shift; - @_ == 0 or confess 0+@_; - my @list = (); - my $dirpath = $dir->getpath; - my $dh = gensym(); - if (! opendir($dh, $dirpath)) { - $log->put("opendir failed: $!")->push($dir); - return undef; - } - while (defined(my $name = readdir($dh))) { - if ($name eq '.' || $name eq '..') { - next; - } - my $path = $dirpath eq '.' ? $name : "$dirpath/$name"; - if (! -d $path && -e $path) { - my $file2 = NDB::Util::File->new(path => $path) - or $log->push, return undef; - push(@list, $file2); - } - } - close($dh); - return \@list; -} - -# create / remove - -sub mkdir { - my $dir = shift; - @_ == 0 or confess 0+@_; - if (! -d $dir->getpath) { - my $pdir = $dir->getparent; - if (length($pdir->getpath) >= length($dir->getpath)) { - $log->put("mkdir looping")->push($dir); - return undef; - } - $pdir->mkdir or return undef; - if (! mkdir($dir->getpath, 0777)) { - my $errstr = "$!"; - if (-d $dir->getpath) { - return 1; - } - $log->put("mkdir failed: $errstr")->push($dir); - return undef; - } - } - return 1; -} - -sub rmdir { - my $dir = shift; - my $keep = shift; # keep top level - $log->put("remove")->push($dir)->info; - my $list; - $list = $dir->listdirs or $log->push, return undef; - for my $d (@$list) { - $d->rmdir or $log->push, return undef; - } - $list = $dir->listfiles or $log->push, return undef; - for my $f (@$list) { - $f->unlink or $log->push, return undef; - } - if (! $keep && ! rmdir($dir->getpath)) { - my $errstr = "$!"; - if (! -e $dir->getpath) { - return 1; - } - $log->put("rmdir failed: $errstr")->push($dir); - return undef; - } - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Event.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Event.pm deleted file mode 100644 index a3ad32cd7fb..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Event.pm +++ /dev/null @@ -1,103 +0,0 @@ -package NDB::Util::Event; - -use strict; -use Carp; -use Errno; - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::Event->attributes(); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $event = $class->SUPER::new(%attr); - return $event; -} - -# set and test bits - -sub check { - my $event = shift; - my($file, $type) = @_; - my $fileno; - if (ref($file) eq 'GLOB') { - $fileno = fileno($file); - } - elsif (ref($file)) { - $file->can("getfh") or confess 'oops'; - $fileno = fileno($file->getfh); - } - else { - $fileno = $file; - } - defined($fileno) or confess 'oops'; - $fileno =~ s/^\s+|\s+$//g; - $fileno =~ /^\d+$/ or confess 'oops'; - $type =~ /^[rwe]$/ or confess 'oops'; - return ($fileno, $type); -} - -sub set { - my $event = shift; - @_ == 2 or confess 0+@_; - my($fileno, $type) = $event->check(@_); - vec($event->{"i_$type"}, $fileno, 1) = 1; -} - -sub clear { - my $event = shift; - @_ == 2 or confess 0+@_; - my($fileno, $type) = $event->check(@_); - vec($event->{"i_$type"}, $fileno, 1) = 0; -} - -sub test { - my $event = shift; - @_ == 2 or confess 0+@_; - my($fileno, $type) = $event->check(@_); - return vec($event->{"o_$type"}, $fileno, 1); -} - -# poll - -sub poll { - my $event = shift; - @_ <= 1 or confess 'oops'; - my $timeout = shift; - if (defined($timeout)) { - $timeout =~ /^\d+$/ or confess 'oops'; - } - $event->{o_r} = $event->{i_r}; - $event->{o_w} = $event->{i_w}; - $event->{o_e} = $event->{i_e}; - my $n; - $n = select($event->{o_r}, $event->{o_w}, $event->{o_e}, $timeout); - if ($n < 0 || ! defined($n)) { - if ($! == Errno::EINTR) { - $log->put("select interrupted"); - return 0; - } - $log->put("select failed: $!"); - return undef; - } - if (! $n) { - $log->put("select timed out"); - } - return $n; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/File.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/File.pm deleted file mode 100644 index 4b3cb38191c..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/File.pm +++ /dev/null @@ -1,163 +0,0 @@ -package NDB::Util::File; - -use strict; -use Carp; -use Symbol; -use Errno; -use File::Basename; - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::File->attributes( - path => sub { length > 0 }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $file = $class->SUPER::new(%attr); - $file->setpath($attr{path}) - or $log->push, return undef; - return $file; -} - -sub desc { - my $file = shift; - return $file->getpath; -} - -sub getdir { - my $file = shift; - @_ == 0 or confess 0+@_; - my $dirpath = dirname($file->getpath); - my $dir = NDB::Util::Dir->new(path => $dirpath); - return $dir; -} - -sub getlock { - my $file = shift; - @_ == 0 or confess 0+@_; - my $lock = NDB::Util::Lock->new(path => $file->getpath); - return $lock; -} - -sub getbasename { - my $file = shift; - @_ == 0 or confess 0+@_; - return basename($file->getpath); -} - -# make dir, unlink - -sub mkdir { - my $file = shift; - @_ == 0 or confess 0+@_; - return $file->getdir->mkdir; -} - -sub unlink { - my $file = shift; - @_ == 0 or confess 0+@_; - $log->put("remove")->push($file)->debug; - if (-e $file->getpath) { - if (! unlink($file->getpath)) { - my $errstr = "$!"; - if (! -e $file->getpath) { - return 1; - } - $log->put("unlink failed: $errstr")->push($file); - return undef; - } - } - return 1; -} - -# read /write - -sub open { - my $file = shift; - @_ == 1 or confess 0+@_; - my($mode) = @_; - my $fh = gensym(); - if (! open($fh, $mode.$file->getpath)) { - $log->put("open$mode failed")->push($file); - return undef; - } - my $io = NDB::Util::IO->new; - $io->setfh($fh) - or $log->push, return undef; - return $io; -} - -sub puttext { - my $file = shift; - @_ == 1 or confess 0+@_; - my($text) = @_; - ref($text) and confess 'oops'; - $file->mkdir - or $log->push, return undef; - $file->unlink - or $log->push, return undef; - my $io = $file->open(">") - or $log->push, return undef; - if (! $io->write($text)) { - $log->push($file); - $io->close; - return undef; - } - if (! $io->close) { - $log->push($file); - return undef; - } - return 1; -} - -sub putlines { - my $file = shift; - @_ == 1 or confess 0+@_; - my($lines) = @_; - ref($lines) eq 'ARRAY' or confess 'oops'; - my $text = join("\n", @$lines) . "\n"; - $file->puttext($text) or $log->push, return undef; - return 1; -} - -sub copyedit { - my $file1 = shift; - @_ == 2 or confess 0+@_; - my($file2, $edit) = @_; - my $io1 = $file1->open("<") - or $log->push, return undef; - my $io2 = $file2->open(">") - or $log->push, return undef; - local $_; - my $fh1 = $io1->getfh; - my $fh2 = $io2->getfh; - my $line = 0; - while (defined($_ = <$fh1>)) { - $line++; - if (! &$edit()) { - $log->push("line $line")->push($file1); - return undef; - } - print $fh2 $_; - } - $io1->close; - $io2->close; - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/IO.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/IO.pm deleted file mode 100644 index 34f4d0a150d..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/IO.pm +++ /dev/null @@ -1,213 +0,0 @@ -package NDB::Util::IO; - -use strict; -use Carp; - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::IO->attributes( - readbuf => sub { defined }, - readend => sub { defined }, - writebuf => sub { defined }, - writeend => sub { defined }, - iosize => sub { $_ > 0 }, - timeout => sub { /^\d+$/ }, - fh => sub { ref($_) eq 'GLOB' && defined(fileno($_)) }, -); - -sub desc { - my $io = shift; - my $fileno = $io->hasfh ? fileno($io->getfh) : -1; - return "fd=$fileno"; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $io = $class->SUPER::new(%attr); - $io->setreadbuf("") - or $log->push, return undef; - $io->setreadend(0) - or $log->push, return undef; - $io->setwritebuf("") - or $log->push, return undef; - $io->setwriteend(0) - or $log->push, return undef; - $io->setiosize(1024) - or $log->push, return undef; - $io->settimeout(0) - or $log->push, return undef; - if (defined($attr{fh})) { - $io->setfh($attr{fh}) - or $log->push, return undef; - } - return $io; -} - -# input / output - -sub read { - my $io = shift; - @_ == 0 or confess 0+@_; - if ($io->getreadend) { - return ""; - } - my $size = $io->getiosize; - my $timeout = $io->hastimeout ? $io->gettimeout : 0; - my $fh = $io->getfh; - my $n; - my $data; - eval { - if ($^O ne 'MSWin32' && $timeout > 0) { - local $SIG{ALRM} = sub { die("timed out\n") }; - alarm($timeout); - $n = sysread($fh, $data, $size); - alarm(0); - } - else { - $n = sysread($fh, $data, $size); - } - }; - if ($@) { - $log->put("read error: $@")->push($io); - return undef; - } - if (! defined($n)) { - $log->put("read failed: $!")->push($io); - return undef; - } - if ($n == 0) { - $io->setreadend(1) - or $log->push, return undef; - $log->put("read EOF")->push($io)->debug; - return ""; - } - (my $show = $data) =~ s!\n!\\n!g; - $log->put("read: $show")->push($io)->debug; - return $data; -} - -sub readbuf { - my $io = shift; - @_ == 0 or confess 0+@_; - my $data = $io->read; - defined($data) or - $log->push, return undef; - if (length($data) == 0) { - return 0; - } - $io->setreadbuf($io->getreadbuf . $data) - or $log->push, return undef; - return 1; -} - -sub readupto { - my $io = shift; - @_ == 1 or confess 0+@_; - my($code) = @_; - ref($code) eq 'CODE' or confess 'oops'; - my $k = &$code($io->getreadbuf); - if (! defined($k)) { - $log->push($io); - return undef; - } - if ($k == 0) { - my $n = $io->readbuf; - defined($n) or - $log->push, return undef; - if ($n == 0) { - if ($io->getreadbuf eq "") { - return ""; - } - $log->put("incomplete input: %s", $io->getreadbuf)->push($io); - return undef; - } - $k = &$code($io->getreadbuf); - if (! defined($k)) { - $log->push($io); - return undef; - } - if ($k == 0) { - return ""; - } - } - my $head = substr($io->getreadbuf, 0, $k); - my $tail = substr($io->getreadbuf, $k); - $io->setreadbuf($tail) - or $log->push, return undef; - return $head; -} - -sub readline { - my $io = shift; - @_ == 0 or confess 0+@_; - my $code = sub { - my $i = index($_[0], "\n"); - return $i < 0 ? 0 : $i + 1; - }; - return $io->readupto($code); -} - -sub write { - my $io = shift; - @_ == 1 or confess 0+@_; - my($data) = @_; - my $timeout = $io->hastimeout ? $io->gettimeout : 0; - my $fh = $io->getfh; - (my $show = $data) =~ s!\n!\\n!g; - $log->put("write: $show")->push($io)->debug; - my $n; - my $size = length($data); - eval { - local $SIG{PIPE} = sub { die("broken pipe\n") }; - if ($^O ne 'MSWin32' && $timeout > 0) { - local $SIG{ALRM} = sub { die("timed out\n") }; - alarm($timeout); - $n = syswrite($fh, $data, $size); - alarm(0); - } - else { - $n = syswrite($fh, $data, $size); - } - }; - if ($@) { - $log->put("write error: $@")->push($io); - return undef; - } - if (! defined($n)) { - $log->put("write failed: $!")->push($io); - return undef; - } - if ($n > $size) { - $log->put("impossible write: $n > $size")->push($io); - return undef; - } - if ($n != $size) { # need not be error - $log->put("short write: $n < $size")->push($io); - } - return $n; -} - -sub close { - my $io = shift; - @_ == 0 or confess 0+@_; - if (! close($io->delfh)) { - $log->put("close failed: $!")->push($io); - return undef; - } - return 1; -} - -1; diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Lock.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Lock.pm deleted file mode 100644 index b515e633059..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Lock.pm +++ /dev/null @@ -1,136 +0,0 @@ -package NDB::Util::Lock; - -use strict; -use Carp; -use Symbol; -use Fcntl qw(:flock); -use Errno; -use File::Basename; - -require NDB::Util::File; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::File); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::Lock->attributes( - pid => sub { $_ != 0 }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $lock = $class->SUPER::new(%attr); - return $lock; -} - -sub desc { - my $lock = shift; - return $lock->getpath; -} - -# test / set - -sub test { - my $lock = shift; - @_ == 0 or confess 0+@_; - my $fh = gensym(); - if (! open($fh, "+<$lock->{path}")) { - if ($! != Errno::ENOENT) { - $log->put("$lock->{path}: open failed: $!"); - return undef; - } - return 0; # file does not exist - } - if (flock($fh, LOCK_EX|LOCK_NB)) { - close($fh); - return 0; # file was not locked - } - if ($^O eq 'MSWin32') { - close($fh); - if (! open($fh, "<$lock->{path}x")) { - $log->put("$lock->{path}x: open failed: $!"); - return undef; - } - } - my $pid = <$fh>; - close($fh); - ($pid) = split(' ', $pid); - if ($pid+0 == 0) { - $log->put("$lock->{path}: locked but pid='$pid' is zero"); - return undef; - } - $lock->{pid} = $pid; - return 1; # file was locked -} - -sub set { - my $lock = shift; - @_ == 0 or confess 0+@_; - my $fh = gensym(); - if (! open($fh, "+<$lock->{path}")) { - if ($! != Errno::ENOENT) { - $log->put("$lock->{path}: open failed: $!"); - return undef; - } - close($fh); - if (! open($fh, ">$lock->{path}")) { - $log->put("$lock->{path}: create failed: $!"); - return undef; - } - } - if (! flock($fh, LOCK_EX|LOCK_NB)) { - $log->put("$lock->{path}: flock failed: $!"); - close($fh); - return 0; # file was probably locked - } - my $line = "$$\n"; - if ($^O eq 'MSWin32') { - my $gh = gensym(); - if (! open($gh, ">$lock->{path}x")) { - $log->put("$lock->{path}x: open for write failed: $!"); - close($fh); - return undef; - } - if (! syswrite($gh, $line)) { - close($fh); - close($gh); - $log->put("$lock->{path}x: write failed: $!"); - return undef; - } - close($gh); - } else { - if (! truncate($fh, 0)) { - close($fh); - $log->put("$lock->{path}: truncate failed: $!"); - return undef; - } - if (! syswrite($fh, $line)) { - close($fh); - $log->put("$lock->{path}: write failed: $!"); - return undef; - } - } - $lock->{fh} = $fh; - return 1; # file is now locked by us -} - -sub close { - my $lock = shift; - @_ == 0 or confess 0+@_; - my $fh = delete $lock->{fh}; - if ($fh) { - close($fh); - } -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Log.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Log.pm deleted file mode 100644 index 44b39df84e6..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Log.pm +++ /dev/null @@ -1,367 +0,0 @@ -package NDB::Util::Log; - -use strict; -use Carp; -use Symbol; -use Data::Dumper (); - -require NDB::Util::Base; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Base); - -# constructors - -my $instance = undef; -my %attached = (); - -my %priolevel = qw(user 0 fatal 1 error 2 warn 3 notice 4 info 5 debug 6); -my %partlist = qw(time 1 pid 2 prio 3 text 4 line 5); - -NDB::Util::Log->attributes( - prio => sub { defined($priolevel{$_}) }, - parts => sub { ref eq 'HASH' }, - stack => sub { ref eq 'ARRAY' }, - io => sub { ref && $_->isa('NDB::Util::IO') }, - active => sub { defined }, - censor => sub { ref eq 'ARRAY' }, -); - -sub setpart { - my $log = shift; - @_ % 2 == 0 or confess 0+@_; - while (@_) { - my $part = shift; - my $onoff = shift; - $partlist{$part} or confess 'oops'; - $log->getparts->{$part} = $onoff; - } -} - -sub getpart { - my $log = shift; - @_ == 1 or confess 0+@_; - my($part) = @_; - $partlist{$part} or confess 'oops'; - return $log->getparts->{$part}; -} - -sub instance { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - if (! $instance) { - $instance = $class->SUPER::new(%attr); - $instance->setprio(q(info)); - $instance->setparts({ text => 1 }); - $instance->setstack([]); - $instance->setcensor([]); - my $io = NDB::Util::IO->new(fh => \*STDERR, %attr) - or confess 'oops'; - $instance->setio($io); - } - return $instance; -} - -# attached logs are written in parallel to main log -# user log is a special server-to-client log - -sub attach { - my $log = shift; - @_ % 2 == 1 or confess 0+@_; - my($key, %attr) = @_; - $attached{$key} and confess 'oops'; - my $alog = $attached{$key} = $log->clone(%attr); - return $alog; -} - -sub detach { - my $log = shift; - @_ == 1 or confess 0+@_; - my($key) = @_; - $attached{$key} or return undef; - my $alog = delete $attached{$key}; - return $alog; -} - -sub attachuser { - my $log = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - %attr = ( - prio => q(user), - parts => { text => 1 }, - censor => [ qw(NDB::Net::Client NDB::Util::IO) ], - %attr); - my $alog = $log->attach(q(user), %attr); - return $alog; -} - -sub detachuser { - my $log = shift; - @_ == 0 or confess 0+@_; - my $alog = $log->detach(q(user)); - return $alog; -} - -# input / output - -sub setfile { - my $log = shift; - @_ == 1 or confess 0+@_; - my $file = shift; - if (! open(STDOUT, ">>$file")) { - $log->put("$file: open for append failed: $!"); - return undef; - } - select(STDOUT); - $| = 1; - open(STDERR, ">&STDOUT"); - select(STDERR); - $| = 1; - return 1; -} - -sub close { - my $log = shift; - $log->getio->close; -} - -sub closeall { - my $class = shift; - for my $key (sort keys %attached) { - my $log = $attached{$key}; - $log->close; - } - $instance->close; -} - -# private - -sub entry { - my $log = shift; - my($clear, $file, $line, @args) = @_; - $file =~ s!^.*\bNDB/!!; - $file =~ s!^.*/bin/([^/]+)$!$1!; - my $text = undef; - if (@args) { - $text = shift(@args); - if (! ref($text)) { - if (@args) { - $text = sprintf($text, @args); - } - while (chomp($text)) {} - } - } - if ($clear) { - $#{$log->getstack} = -1; - } - push(@{$log->getstack}, { - line => "$file($line)", - text => $text, - }); -} - -sub matchlevel { - my $log = shift; - my $msgprio = shift; - my $logprio = $log->getprio; - my $msglevel = $priolevel{$msgprio}; - my $loglevel = $priolevel{$logprio}; - defined($msglevel) && defined($loglevel) - or confess 'oops'; - if ($msglevel == 0 && $loglevel == 0) { - return $msgprio eq $logprio; - } - if ($msglevel == 0 && $loglevel != 0) { - return $loglevel >= $priolevel{q(info)}; - } - if ($msglevel != 0 && $loglevel == 0) { - return $msglevel <= $priolevel{q(notice)}; - } - if ($msglevel != 0 && $loglevel != 0) { - return $msglevel <= $loglevel; - } - confess 'oops'; -} - -sub print { - my $log = shift; - @_ == 2 or confess 0+@_; - my($prio, $tmpstack) = @_; - if ($log->hasactive) { # avoid recursion - return; - } - if (! $log->matchlevel($prio)) { - return; - } - $log->setactive(1); - my @text = (); - if ($log->getpart(q(time))) { - my @t = localtime(time); - push(@text, sprintf("%02d-%02d/%02d:%02d:%02d", - 1+$t[4], $t[3], $t[2], $t[1], $t[0])); - } - if ($log->getpart(q(pid))) { - push(@text, "[$$]"); - } - if ($log->getpart(q(prio)) && - (0 == $priolevel{$prio} || $priolevel{$prio} <= $priolevel{notice})) - { - push(@text, "[$prio]"); - } - if ($log->getpart(q(text))) { - my @stack = @$tmpstack; - while (@stack) { - my $s = pop(@stack); - my $text = $s->{text}; - if (ref($text)) { - if (grep($text->isa($_), @{$log->getcensor})) { - next; - } - $text = $text->desc; - } - push(@text, $text) if length($text) > 0; - } - } - if ($log->getpart(q(line)) && - (0 < $priolevel{$prio} && $priolevel{$prio} <= $priolevel{warn})) - { - push(@text, "at"); - my @stack = @$tmpstack; - while (@stack) { - my $s = shift(@stack); - defined($s->{line}) or confess 'oops'; - if ($text[-1] ne $s->{line}) { - push(@text, $s->{line}); - } - } - } - $log->getio->write("@text\n"); - $log->delactive; -} - -sub printall { - my $log = shift; - @_ == 1 or confess 0+@_; - my($prio) = @_; - my $logstack = $log->getstack; - if (! @$logstack) { - $log->put("[missing log message]"); - } - my @tmpstack = (); - while (@$logstack) { - push(@tmpstack, shift(@$logstack)); - } - for my $key (sort keys %attached) { - my $alog = $attached{$key}; - $alog->print($prio, \@tmpstack); - } - $instance->print($prio, \@tmpstack); -} - -# public - -sub push { - my $log = shift; - my(@args) = @_; - my($pkg, $file, $line) = caller; - $log->entry(0, $file, $line, @args); - return $log; -} - -sub put { - my $log = shift; - my(@args) = @_; - my($pkg, $file, $line) = caller; - $log->entry(1, $file, $line, @args); - return $log; -} - -sub fatal { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(fatal)); - exit(1); -} - -sub error { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(error)); - return $log; -} - -sub warn { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(warn)); - return $log; -} - -sub notice { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(notice)); - return $log; -} - -sub info { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(info)); - return $log; -} - -sub debug { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(debug)); - return $log; -} - -sub user { - my $log = shift; - @_ == 0 or confess 0+@_; - $log->printall(q(user)); - return $log; -} - -# return values from server to client - -sub putvalue { - my $log = shift; - @_ == 1 or confess 0+@_; - my($value) = @_; - my $d = Data::Dumper->new([$value], [qw($value)]); - $d->Indent(0); - $d->Useqq(1); - my $dump = $d->Dump; - $dump =~ /^\s*\$value\s*=\s*(.*);\s*$/ or confess $dump; - $log->push("[value $1]"); -} - -sub hasvalue { - my $log = shift; - @_ == 1 or confess 0+@_; - my($line) = @_; - return $line =~ /\[value\s+(.*)\]/; -} - -sub getvalue { - my $log = shift; - @_ == 1 or confess 0+@_; - my($line) = @_; - $line =~ /\[value\s+(.*)\]/ or confess $line; - my $expr = $1; - my($value); - eval "\$value = $expr"; - if ($@) { - $log->put("$line: eval error: $@"); - return undef; - } - return [$value]; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Socket.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Socket.pm deleted file mode 100644 index 00e8b6eca51..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Socket.pm +++ /dev/null @@ -1,158 +0,0 @@ -package NDB::Util::Socket; - -use strict; -use Carp; -use Symbol; -use Socket; -use Errno; - -require NDB::Util::IO; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::IO); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::Socket->attributes( - domain => sub { $_ == PF_INET || $_ == PF_UNIX }, - type => sub { $_ == SOCK_STREAM }, - proto => sub { /^(0|tcp)$/ }, -); - -sub desc { - my $socket = shift; - return $socket->SUPER::desc; -} - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $socket = $class->SUPER::new(%attr); - $socket->setdomain($attr{domain}) - or $log->push, return undef; - $socket->settype($attr{type}) - or $log->push, return undef; - $socket->setproto($attr{proto}) - or $log->push, return undef; - my $nproto; - if ($socket->getproto =~ /^\d+/) { - $nproto = $socket->getproto; - } - else { - $nproto = getprotobyname($socket->getproto); - unless (defined($nproto)) { - $log->put("%s: getprotobyname failed", $socket->getproto); - return undef; - } - } - my $fh = gensym(); - if (! socket($fh, $socket->getdomain, $socket->gettype, $nproto)) { - $log->put("create socket failed: $!"); - return undef; - } - $socket->setfh($fh) - or $log->push, return undef; - return $socket; -} - -sub setopt { - my $socket = shift; - @_ >= 2 or confess 'oops'; - my $level = shift; - my $optname = shift; - my $optval = @_ ? pack("l*", @_) : undef; - my $fh = $socket->getfh; - if (! setsockopt($fh, $level, $optname, $optval)) { - $log->put("setsockopt failed: $!")->push($socket); - return undef; - } - return 1; -} - -sub connect { - my $socket = shift; - @_ == 1 or confess 0+@_; - my($paddr) = @_; - my $fh = $socket->getfh; - if (! connect($fh, $paddr)) { - $log->put("connect failed: $!")->push($socket); - return undef; - } - $log->put("connect done")->push($socket)->debug; - return 1; -} - -sub bind { - my $socket = shift; - @_ == 1 or confess 0+@_; - my($paddr) = @_; - my $fh = $socket->getfh; - if (! bind($fh, $paddr)) { - $log->put("bind failed: $!")->push($socket); - return undef; - } - return 1; -} - -sub listen { - my $socket = shift; - @_ == 0 or confess 0+@_; - my $fh = $socket->getfh; - if (! listen($fh, SOMAXCONN)) { - $log->put("listen failed: $!")->push($socket); - return undef; - } - return 1; -} - -sub accept { - my $socket = shift; - @_ == 1 or confess 0+@_; - my($timeout) = @_; - $timeout =~ /^\d+$/ or confess 'oops'; - my $fh = $socket->getfh; - my $gh = gensym(); - my $paddr; - eval { - if ($^O ne 'MSWin32' && $timeout > 0) { - local $SIG{ALRM} = sub { die("timed out\n") }; - alarm($timeout); - $paddr = accept($gh, $fh); - alarm(0); - } - else { - $paddr = accept($gh, $fh); - } - }; - if ($@) { - $log->put("accept failed: $@")->push($socket); - return undef; - } - if (! $paddr) { - my $errno = 0+$!; - if ($errno == Errno::EINTR) { - $log->put("accept interrupted")->push($socket); - return 0; - } - $log->put("accept failed: $!")->push($socket); - return undef; - } - my $csocket = $socket->clone(fh => $gh); - $csocket->acceptaddr($paddr); - return $csocket; -} - -sub DESTROY { - my $socket = shift; - $socket->close; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketINET.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketINET.pm deleted file mode 100644 index faaa568a08e..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketINET.pm +++ /dev/null @@ -1,86 +0,0 @@ -package NDB::Util::SocketINET; - -use strict; -use Carp; -use Symbol; -use Socket; -use Errno; - -require NDB::Util::Socket; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Socket); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::SocketINET->attributes( - host => sub { /^\S+$/ }, - port => sub { /^\d+$/ }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $socket = $class->SUPER::new(%attr, - domain => PF_INET, type => SOCK_STREAM, proto => 'tcp') - or $log->push, return undef; - return $socket; -} - -sub connect { - my $socket = shift; - @_ == 2 or confess 0+@_; - my($host, $port) = @_; - $port =~ /^\d+$/ or confess 'oops'; - my $iaddr = inet_aton($host); - if (! $iaddr) { - $log->put("host $host not found")->push($socket); - return undef; - } - my $paddr = pack_sockaddr_in($port, $iaddr); - $socket->SUPER::connect($paddr) - or $log->push, return undef; - $socket->sethost($host) - or $log->push, return undef; - $socket->setport($port) - or $log->push, return undef; - return 1; -} - -sub bind { - my $socket = shift; - @_ == 1 or confess 0+@_; - my($port) = @_; - $port =~ /^\d+$/ or confess 'oops'; - my $paddr = pack_sockaddr_in($port, INADDR_ANY); - $socket->SUPER::bind($paddr) - or $log->push, return undef; - $socket->setport($port) - or $log->push, return undef; - return 1; -} - -sub acceptaddr { - my $csocket = shift; - @_ == 1 or confess 0+@_; - my($paddr) = @_; - my($port, $iaddr) = unpack_sockaddr_in($paddr); - my $host = gethostbyaddr($iaddr, AF_INET); - $csocket->sethost($host) - or $log->push, return undef; - $csocket->setport($port) - or $log->push, return undef; - $log->put("accept: host=%s port=%d", - $csocket->gethost, $csocket->getport)->push($csocket)->debug; - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketUNIX.pm b/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketUNIX.pm deleted file mode 100644 index 9c6b3115f6a..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketUNIX.pm +++ /dev/null @@ -1,76 +0,0 @@ -package NDB::Util::SocketUNIX; - -use strict; -use Carp; -use Symbol; -use Socket; -use Errno; - -require NDB::Util::Socket; - -use vars qw(@ISA); -@ISA = qw(NDB::Util::Socket); - -# constructors - -my $log; - -sub initmodule { - $log = NDB::Util::Log->instance; -} - -NDB::Util::SocketUNIX->attributes( - path => sub { /^\S+$/ }, -); - -sub new { - my $class = shift; - @_ % 2 == 0 or confess 0+@_; - my(%attr) = @_; - my $socket = $class->SUPER::new(%attr, - domain => PF_UNIX, type => SOCK_STREAM, proto => 0) - or $log->push, return undef; - return $socket; -} - -sub connect { - my $socket = shift; - @_ == 1 or confess 0+@_; - my($path) = @_; - $path =~ /^\S+$/ or confess 'oops'; - my $paddr = pack_sockaddr_un($path); - $socket->SUPER::connect($paddr) - or $log->push, return undef; - $socket->setpath($path) - or $log->push, return undef; - return 1; -} - -sub bind { - my $socket = shift; - @_ == 1 or confess 0+@_; - my($path) = @_; - $path =~ /^\S+$/ or confess 'oops'; - my $paddr = pack_sockaddr_un($path); - $socket->SUPER::bind($paddr) - or $log->push, return undef; - $socket->setpath($path) - or $log->push, return undef; - return 1; -} - -sub acceptaddr { - my $csocket = shift; - @_ == 1 or confess 0+@_; - my($paddr) = @_; - return 1; # crash - my $path = unpack_sockaddr_un($paddr); - $csocket->setpath($path) - or $log->push, return undef; - $log->put("%s accept: path=%s", - $csocket->getpath)->push($csocket)->debug; - return 1; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/ndbnet.pl b/storage/ndb/tools/old_dirs/ndbnet/ndbnet.pl deleted file mode 100644 index 5f6648da46d..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/ndbnet.pl +++ /dev/null @@ -1,339 +0,0 @@ -#! /usr/local/bin/perl - -use strict; -use POSIX(); -use Socket; -use Getopt::Long; -use File::Basename; -use Term::ReadLine; - -use NDB::Net; - -select(STDOUT); -$| = 1; - -# get options and environment - -my $log = NDB::Util::Log->instance; -$log->setpart(); - -sub printhelp { - print <<END; -ndbnet -- ndbnet client -usage: ndbnet [options] [command...] ---help print this text and exit ---base dir ndb installation, default \$NDB_BASE ---netcfg file net config, default \$NDB_BASE/etc/ndbnet.xml ---server id ndbnetd server id, or host:port if no config ---noterm no prompting and no input editing ---log prio debug/info/notice/warn/error/fatal, default info -command... command (by default becomes interactive) -END - exit(0); -} - -my $progopts = {}; -my @progargv; - -anon: { - local $SIG{__WARN__} = sub { - my $errstr = "@_"; - while (chomp($errstr)) {} - $log->put("$errstr (try --help)")->fatal; - }; - Getopt::Long::Configure(qw( - default no_getopt_compat no_ignore_case require_order - )); - GetOptions($progopts, qw( - help base=s netcfg=s server=s noterm log=s - )); -} - -$progopts->{help} && printhelp(); -if (defined(my $prio = $progopts->{log})) { - $log->setprio($prio); -} -@progargv = @ARGV; - -my $netenv = NDB::Net::Env->instance( - base => $progopts->{base}, - netcfg => $progopts->{netcfg}, -); -$netenv or $log->fatal; - -# get servers from command line or from net config - -my @servers = (); -my $netcfg; -if ($netenv->hasnetcfg) { - $netcfg = NDB::Net::Config->new(file => $netenv->getnetcfg); -} - -if (defined(my $id = $progopts->{server})) { - if ($id !~ /:/) { - $netcfg or $log->put("need net config to find server $id")->fatal; - $netcfg->load or $log->push->fatal; - $netcfg->getservers or $log->push->fatal; - my $s = NDB::Net::Server->get($id) or $log->fatal; - push(@servers, $s); - } else { - my($host, $port) = split(/:/, $id, 2); - my $s = NDB::Net::ServerINET->new(id => "?", host => $host, port => $port) - or $log->fatal; - push(@servers, $s); - } -} else { - $netcfg or $log->put("need net config to find servers")->fatal; - $netcfg->load or $log->push->fatal; - my $list = $netcfg->getservers or $log->fatal; - @servers= @$list; - @servers or $log->put("no servers")->push($netcfg)->fatal; -} - -# server commands - -my $server; -sub doserver { - my($cmd) = @_; - my $ret; - my $found; - for my $s (@servers) { - if (! $s->testconnect) { - $log->warn; - next; - } - $found = 1; - if ($server ne $s) { - $server = $s; - $log->put("selected")->push($server)->debug; - } - $ret = $server->request($cmd); - last; - } - if (! $found) { - $log->put("no available server"); - return undef; - } - my %seen = (); - @servers = grep(! $seen{$_}++, $server, @servers); - defined($ret) or $log->push, return undef; - return $ret; -} - -# local commands - -sub cmd_help { - my($cmd) = @_; - my $text = $cmd->helptext; - defined($text) or return undef; - while(chomp($text)) {} - print $text, "\n"; - return 1; -} - -sub cmd_alias { - my($cmd) = @_; - my $text = $cmd->aliastext; - while(chomp($text)) {} - print $text, "\n"; -} - -sub cmd_quit { - my($cmd) = @_; - $log->put("bye-bye")->info; - exit(0); -} - -sub cmd_server { - my($cmd) = @_; - my $action = $cmd->getarg(0); - if ($action !~ /^(start|restart|stop|ping)$/) { - $log->put("$action: undefined action"); - return undef; - } - if ($action eq 'start') { - $cmd->setopt('direct') - or $log->push, return undef; - } - if ($action eq 'ping' && ! @{$cmd->getarglist(1)}) { - $cmd->setopt('all') - or $log->push, return undef; - } - if (! $cmd->getopt('direct')) { - return doserver($cmd); - } - $netcfg->load - or return undef; - my $servers = $netcfg->getservers - or return undef; - my $list; - if ($cmd->getopt('all')) { - $list = $servers; - } - else { - $list = []; - for my $id (@{$cmd->getarglist(1)}) { - if (my $s = NDB::Net::ServerINET->get($id)) { - push(@$list, $s); - next; - } - if (my $s = NDB::Net::ServerINET->match($id, undef, $servers)) { - if (@$s) { - push(@$list, @$s); - next; - } - } - $log->push; - return undef; - } - } - if (! @$list) { - $log->put("no servers specified, use --all for all")->info; - return 1; - } - for my $s (@$list) { - if ($action eq 'ping') { - if ($s->testconnect) { - $log->put("is alive")->push($s); - } - $log->info; - next; - } - if ($action eq 'start') { - if ($s->testconnect) { - $log->put("already running")->push($s)->info; - next; - } - } - my $script = $cmd->getopt('script') || "ndbnetd"; - my @cmd = ($script); - if ($action eq 'restart') { - push(@cmd, "--restart"); - } - if ($action eq 'stop') { - push(@cmd, "--stop"); - } - if ($cmd->getopt('pass')) { - my $base = $netenv->getbase; - $cmd[0] = "$base/bin/$cmd[0]"; - } - if ($cmd->getopt('parallel')) { - my $pid = fork; - defined($pid) or - $log->push("fork failed: $!"), return undef; - $pid > 0 && next; - } - $log->put("$action via ssh")->push($s->getcanon)->push($s)->info; - $log->put("run: @cmd")->push($s)->debug; - system 'ssh', '-n', $s->getcanon, "@cmd"; - if ($cmd->getopt('parallel')) { - exit(0); - } - } - if ($cmd->getopt('parallel')) { - while ((my $pid = waitpid(-1, &POSIX::WNOHANG)) > 0) { - ; - } - } - return 1; -} - -sub cmd_list { - my($cmd) = @_; - my $ret = doserver($cmd) or - $log->push, return undef; - my @out = (); - my @o = qw(NAME NODES PROCESS STATUS COMMENT); - push(@out, [ @o ]); - for my $name (sort keys %$ret) { - $#o = -1; - $o[0] = $name; - my $dbsts = $ret->{$name}; - my @tmp = sort { $a->{id} <=> $b->{id} } values %{$dbsts->{node}}; - my @nodesmgmt = grep($_->{type} eq 'mgmt', @tmp); - my @nodesdb = grep($_->{type} eq 'db', @tmp); - my @nodesapi = grep($_->{type} eq 'api', @tmp); - my @nodes = (@nodesmgmt, @nodesdb, @nodesapi); - $o[1] = sprintf("%d/%d/%d", 0+@nodesmgmt, 0+@nodesdb, 0+@nodesapi); - $o[2] = "-"; - $o[3] = "-"; - $o[4] = $dbsts->{comment}; - $o[4] .= " - " if length $o[4]; - $o[4] .= basename($dbsts->{home}); - push(@out, [ @o ]); - for my $nodests (@nodes) { - $#o = -1; - $o[0] = $nodests->{id} . "-" . $nodests->{type}; - $o[1] = $nodests->{host}; - $o[1] =~ s/\..*//; - $o[2] = $nodests->{run}; - $o[3] = $nodests->{status} || "-"; - $o[4] = $nodests->{comment} || "-"; - push(@out, [ @o ]); - } - } - my @len = ( 8, 8, 8, 8 ); - for my $o (@out) { - for my $i (0..$#len) { - $len[$i] = length($o->[$i]) if $len[$i] < length($o->[$i]); - } - } - for my $o (@out) { - my @t = (); - for my $i (0..$#{$out[0]}) { - my $f = $len[$i] ? "%-$len[$i].$len[$i]s" : "%s"; - push(@t, sprintf($f, $o->[$i])); - } - print "@t\n"; - } - return 1; -} - -# main program - -sub docmd { - my(@args) = @_; - my $cmd = NDB::Net::Command->new(@args) - or return undef; - my $name = $cmd->getname; - my $doit; - { - no strict 'refs'; - $doit = *{"cmd_$name"}; - } - if (! defined(&$doit)) { - $doit = \&doserver; - } - my $ret = &$doit($cmd); - defined($ret) or $log->push, return undef; - return $ret; -} - -if (@progargv) { - docmd(argv => \@progargv) or $log->push->fatal; - exit(0); -} - -my $term; -if ((-t STDIN) && (-t STDOUT) && ! $progopts->{noterm}) { - $term = Term::ReadLine->new("ndbnet"); - $term->ornaments(0); -} - -print "type 'h' for help\n" if $term; -while (1) { - my($line); - while (! $line) { - $line = $term ? $term->readline("> ") : <STDIN>; - if (! defined($line)) { - print("\n") if $term; - $line = 'EOF'; - } - } - my $ret = docmd(line => $line); - $ret or $log->error; - ($line eq 'EOF') && last; -} - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/ndbnetd.pl b/storage/ndb/tools/old_dirs/ndbnet/ndbnetd.pl deleted file mode 100644 index 95fa5322abc..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/ndbnetd.pl +++ /dev/null @@ -1,400 +0,0 @@ -#! /usr/local/bin/perl - -use strict; -use POSIX(); -use Socket; -use Getopt::Long; -use File::Basename; -use File::Spec; - -use NDB::Net; - -# save argv for restart via client -my @origargv = @ARGV; - -# get options and environment - -my $log = NDB::Util::Log->instance; - -sub printhelp { - print <<END; -ndbnetd -- ndbnet daemon -usage: ndbnetd [options] ---help print this text and exit ---base dir ndb installation, default \$NDB_BASE ---netcfg file net config, default \$NDB_BASE/etc/ndbnet.xml ---port num port number (if more than 1 server on this host) ---stop kill any existing server ---restart kill any existing server and start a new one ---fg run in foreground (test option) ---log prio debug/info/notice/warn/error/fatal, default info -END - exit(0); -} - -my $progopts = {}; -anon: { - local $SIG{__WARN__} = sub { - my $errstr = "@_"; - while (chomp($errstr)) {} - $log->put("$errstr (try --help)")->fatal; - }; - Getopt::Long::Configure(qw( - default no_getopt_compat no_ignore_case no_require_order - )); - GetOptions($progopts, qw( - help base=s netcfg=s port=i stop restart fg log=s - )); -} -$progopts->{help} && printhelp(); -if (defined(my $prio = $progopts->{log})) { - $log->setprio($prio); -} -@ARGV and $log->put("extra args on command line")->fatal; - -my $netenv = NDB::Net::Env->instance( - base => $progopts->{base}, - netcfg => $progopts->{netcfg}, -); -$netenv or $log->fatal; -$netenv->hasbase or $log->put("need NDB_BASE")->fatal; - -# load net config and find our entry - -my $netcfg = NDB::Net::Config->new(file => $netenv->getnetcfg) - or $log->push->fatal; -my $server; - -sub loadnetcfg { - $netcfg->load or $log->push->fatal; - my $servers = $netcfg->getservers or $log->fatal; - my $host = $netenv->gethostname; - my $port = $progopts->{port} || 0; - my $list = NDB::Net::ServerINET->match($host, $port, $servers) - or $log->push->fatal; - @$list == 1 - or $log->push->fatal; - $server = $list->[0]; - $server->setlocal; -} -loadnetcfg(); -$log->put("this server")->push($server)->debug; - -# check if server already running - -my $lock; -anon: { - my $dir = NDB::Util::Dir->new(path => File::Spec->catfile($netenv->getbase, "run")); - $dir->mkdir or $log->fatal; - my $name = sprintf("ndbnet%s.pid", $server->getid); - $lock = $dir->getfile($name)->getlock; - my $ret; - $ret = $lock->test; - defined($ret) or $log->fatal; - if ($ret) { - if ($progopts->{stop} || $progopts->{restart}) { - $log->put("stopping server %s pid=%s", $netenv->gethostname, $lock->getpid)->info; - if ($^O ne 'MSWin32') { - kill -15, $lock->getpid; - } else { - kill 15, $lock->getpid; - } - while (1) { - sleep 1; - $ret = $lock->test; - defined($ret) or $log->fatal; - if ($ret) { - if (! kill(0, $lock->getpid) && $! == Errno::ESRCH) { - $log->put("locked but gone (linux bug?)")->info; - $lock->unlink; - $ret = 0; - } - } - if (! $ret) { - if ($progopts->{stop}) { - $log->put("stopped")->info; - exit(0); - } - $log->put("restarting server %s", $netenv->gethostname)->info; - last; - } - } - } - else { - $log->put("already running pid=%s", $lock->getpid)->fatal; - } - } - else { - if ($progopts->{stop}) { - $log->put("not running")->info; - exit(0); - } - } - $lock->set or $log->fatal; -} - -# become daemon, re-obtain the lock, direct log to file - -anon: { - $log->setpart(time => 1, pid => 1, prio => 1, line => 1); - $progopts->{fg} && last anon; - $lock->close; - my $dir = NDB::Util::Dir->new(path => $netenv->getbase . "/log"); - $dir->mkdir or $log->fatal; - my $pid = fork(); - defined($pid) or $log->put("fork failed: $!")->fatal; - if ($pid) { - exit(0); - } - $lock->set or $log->fatal; - if ($^O ne 'MSWin32') { - POSIX::setsid() or $log->put("setsid failed: $!")->fatal; - } - open(STDIN, "</dev/null"); - my $name = sprintf("ndbnet%s.log", $server->getid); - $log->setfile($dir->getfile($name)->getpath) or $log->fatal; -} -$log->put("ndbnetd started pid=$$ port=%s", $server->getport)->info; - -# create server socket and event - -my $socket = NDB::Util::SocketINET->new or $log->fatal; -my $event = NDB::Util::Event->new; - -# commands - -sub cmd_server_fg { - my($cmd) = @_; - my $action = $cmd->getarg(0); - if (! $cmd->getopt('local')) { - return 1; - } - if ($action eq 'restart') { - my $prog = $netenv->getbase . "/bin/ndbnetd"; - my @argv = @origargv; - if (! grep(/^--restart$/, @argv)) { - push(@argv, "--restart"); - } - unshift(@argv, basename($prog)); - $lock->close; - $socket->close; - $log->put("restart: @argv")->push($server)->user; - $log->put("server restart")->putvalue(1)->user; - exec $prog @argv; - die "restart failed: $!"; - } - if ($action eq 'stop') { - $log->put("stop by request")->push($server)->user; - $log->put("server stop")->putvalue(1)->user; - exit(0); - } - if ($action eq 'ping') { - return 1; - } - $log->put("$action: unimplemented"); - return undef; -} - -sub cmd_server_bg { - my($cmd) = @_; - loadnetcfg() or return undef; - my $action = $cmd->getarg(0); - if (! $cmd->getopt('local')) { - $cmd->setopt('local') - or $log->push, return undef; - my $servers = $netcfg->getservers or $log->fatal; - my $list; - if ($cmd->getopt('all')) { - $list = $servers; - } - else { - $list = []; - for my $id (@{$cmd->getarglist(1)}) { - if (my $s = NDB::Net::ServerINET->get($id)) { - push(@$list, $s); - next; - } - if (my $s = NDB::Net::ServerINET->match($id, undef, $servers)) { - if (@$s) { - push(@$list, @$s); - next; - } - } - $log->push; - return undef; - } - } - my $fail = 0; - for my $s (@$list) { - if (! $s->request($cmd)) { - $log->push->user; - $fail++; - } - } - if ($fail) { - $log->put("failed %d/%d", $fail, scalar(@$list)); - return undef; - } - return 1; - } - if ($action eq 'restart') { - return 1; - } - if ($action eq 'stop') { - return 1; - } - if ($action eq 'ping') { - $log->put("is alive")->push($server)->user; - return 1; - } - $log->put("$action: unimplemented"); - return undef; -} - -sub cmd_start_bg { - my($cmd) = @_; - loadnetcfg() or return undef; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - $db->start($cmd->getopts) or return undef; - return 1; -} - -sub cmd_startnode_bg { - my($cmd) = @_; - loadnetcfg() or return undef; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - my $node = $db->getnode($cmd->getarg(1)) or return undef; - $node->start($cmd->getopts) or return undef; - return 1; -} - -sub cmd_stop_bg { - my($cmd) = @_; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - $db->stop($cmd->getopts) or return undef; - return 1; -} - -sub cmd_stopnode_bg { - my($cmd) = @_; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - my $node = $db->getnode($cmd->getarg(1)) or return undef; - $node->stop($cmd->getopts) or return undef; - return 1; -} - -sub cmd_kill_bg { - my($cmd) = @_; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - $db->kill($cmd->getopts) or return undef; - return 1; -} - -sub cmd_killnode_bg { - my($cmd) = @_; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - my $node = $db->getnode($cmd->getarg(1)) or return undef; - $node->kill($cmd->getopts) or return undef; - return 1; -} - -sub cmd_statnode_bg { - my($cmd) = @_; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - my $node = $db->getnode($cmd->getarg(1)) or return undef; - my $ret = $node->stat($cmd->getopts) or return undef; - return $ret; -} - -sub cmd_list_bg { - my($cmd) = @_; - loadnetcfg() or return undef; - my $dblist; - if ($cmd->getarg(0)) { - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - $dblist = [ $db ]; - } else { - $dblist = $netcfg->getdatabases or return undef; - } - my $ret = {}; - for my $db (@$dblist) { - my $status = $db->list($cmd->getopts) || "error"; - $ret->{$db->getname} = $status; - } - return $ret; -} - -sub cmd_writenode_bg { - my($cmd) = @_; - my $db = $netcfg->getdatabase($cmd->getarg(0)) or return undef; - my $node = $db->getnode($cmd->getarg(1)) or return undef; - my $ret = $node->write($cmd->getopts, $cmd->getarg(2)) or return undef; - return $ret; -} - -# main program - -sub checkchild { - while ((my $pid = waitpid(-1, &POSIX::WNOHANG)) > 0) { - $log->put("harvested pid=$pid")->info; - } -} - -my $gotterm = 0; -$SIG{INT} = sub { $gotterm = 1 }; -$SIG{TERM} = sub { $gotterm = 1 }; - -$socket->setopt(SOL_SOCKET, SO_REUSEADDR, 1) or $log->fatal; -$socket->bind($server->getport) or $log->fatal; -$socket->listen or $log->fatal; -$event->set($socket, 'r'); - -loop: { - try: { - my $n = $event->poll(10); - if ($gotterm) { - $log->put("terminate on signal")->info; - last try; - } - if (! defined($n)) { - $log->error; - sleep 1; - last try; - } - if (! $n) { - $log->debug; - last try; - } - if (! $event->test($socket, 'r')) { - last try; - } - my $csocket = $socket->accept(10); - if (! defined($csocket)) { - $log->error; - last try; - } - if (! $csocket) { - $log->warn; - last try; - } - my $client = NDB::Net::Client->new( - socket => $csocket, - serversocket => $socket, - serverlock => $lock, - event => $event, - context => 'main', - ); - $client or $log->fatal; - } - loadnetcfg() or $log->fatal; - NDB::Net::Client->processall; - if ($gotterm) { - last loop; - } - redo loop; -} - -$log->put("ndbnetd done")->info; - -1; -# vim:set sw=4: diff --git a/storage/ndb/tools/old_dirs/ndbnet/ndbrun b/storage/ndb/tools/old_dirs/ndbnet/ndbrun deleted file mode 100644 index 99121276d99..00000000000 --- a/storage/ndb/tools/old_dirs/ndbnet/ndbrun +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh - -# just for autotest for now - -case $# in -1) script=$1 ;; -*) echo "usage: $0 script"; exit 1 ;; -esac - -case $NDB_TOP in -/*) ;; -*) echo "$0: NDB_TOP not defined" >&2; exit 1 ;; -esac - -case $script in -/*) ;; -*) for d in $NDB_TOP $NDB_TOP/test $NDB_TOP/test/ndbnet; do - if [ -f $d/$script ]; then - script=$d/$script - break - fi - done ;; -esac - -if [ ! -f $script ]; then - echo "$0: $script: script not found" >&2; exit 1 -fi - -PERL5LIB=$NDB_TOP/lib/perl5:$PERL5LIB; export PERL5LIB - -perl -cw $script || exit 1 -perl $script -exit $? diff --git a/storage/ndb/tools/old_dirs/ndbsql/Makefile b/storage/ndb/tools/old_dirs/ndbsql/Makefile deleted file mode 100644 index 81ca87b0414..00000000000 --- a/storage/ndb/tools/old_dirs/ndbsql/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -include .defs.mk - -TYPE := util - -BIN_TARGET := ndbsql - -# -# If BIN_TARGET_LIBS include NDB_ODBC then the ODBC lib is -# linked into the program and the user does not need to -# set up any ODBC stuff to make it work. -# -# If you want to use this program together with some -# other DBMS (e.g. MySQL or Oracle), then comment the line below. -# -BIN_TARGET_LIBS = NDB_ODBC - -#BIN_TARGET_ARCHIVES := mgmapi NDB_API - -ifneq ($(USE_EDITLINE), N) -BIN_TARGET_ARCHIVES += editline -#DIRS := mkconfig -endif - -BIN_FLAGS += $(TERMCAP_LIB) - -#ifneq ($(USE_TERMCAP), N) -#LDFLAGS_LOC = -ltermcap -#endif - - -# Source files of non-templated classes (.cpp files) -SOURCES = \ - ndbsql.cpp - -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/src/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/src/common/mgmcommon) - - -include $(NDB_TOP)/Epilogue.mk - -_bins_mkconfig : $(NDB_TOP)/bin/$(BIN_TARGET) - diff --git a/storage/ndb/tools/old_dirs/select_all/Makefile b/storage/ndb/tools/old_dirs/select_all/Makefile deleted file mode 100644 index e14e411b3a5..00000000000 --- a/storage/ndb/tools/old_dirs/select_all/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := select_all - -SOURCES := select_all.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/select_count/Makefile b/storage/ndb/tools/old_dirs/select_count/Makefile deleted file mode 100644 index 35a53c6b046..00000000000 --- a/storage/ndb/tools/old_dirs/select_count/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include .defs.mk - -TYPE := ndbapitest - -BIN_TARGET := select_count - -SOURCES := select_count.cpp - -include $(NDB_TOP)/Epilogue.mk diff --git a/storage/ndb/tools/old_dirs/src/counterviewer/CounterViewer.java b/storage/ndb/tools/old_dirs/src/counterviewer/CounterViewer.java deleted file mode 100644 index 317c1c75e28..00000000000 --- a/storage/ndb/tools/old_dirs/src/counterviewer/CounterViewer.java +++ /dev/null @@ -1,725 +0,0 @@ - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import java.io.*; -import java.net.*; -import javax.swing.*; - -class Node extends Observable { - public final static int UNDEFINED = -1; - public final static int NDB_NODE = 0; - public final static int MGM_NODE = 1; - public final static int API_NODE = 2; - - public int getNodeType() { return m_nodeType;} - public static int getNodeType(String str) { - if(str.equals("NDB")) - return NDB_NODE; - if(str.equals("API")) - return API_NODE; - if(str.equals("MGM")) - return MGM_NODE; - return UNDEFINED; - } - - protected int m_nodeType; -} - -class NdbNode extends Node { - public NdbNode(){ - m_nodeType = NDB_NODE; - } - - public Counters getCounters() { return counters; } - - public void setCounters(Counters _c) { - - if(_c == null){ - counters = null; - setChanged(); - notifyObservers(); - return; - } - - int old_tps = 0; - int old_ops = 0; - int old_aps = 0; - int diff = 5; - if(counters != null){ - old_tps = counters.tps; - old_ops = counters.ops; - old_aps = counters.aps; - diff = 5; //_c.epochsecs - counters.epochsecs; - } - - switch(_c.type){ - case Counters.TRANSACTIONS: - _c.tps = (_c.transactions -_c.aborts)/ diff; - _c.aps = _c.aborts / diff; - _c.ops = old_ops; - break; - case Counters.OPERATIONS: - _c.tps = old_tps; - _c.aps = old_aps; - _c.ops = _c.operations / diff; - break; - } - - counters = _c; - setChanged(); - notifyObservers(); - } - - public int getNodeState(){ - return nodeState; - } - - public static int getNodeState(String state){ - if(state.equals("NOT_STARTED") || - state.equals("NO_CONTACT")) - return 0; - return 1; - } - - public void setState(int nodeState){ - this.nodeState = nodeState; - if(nodeState == 0) - counters = null; - } - - private int nodeState; - private Counters counters; -} - -class MgmNode extends Node { public MgmNode(){ m_nodeType = MGM_NODE; } } -class ApiNode extends Node { public ApiNode(){ m_nodeType = API_NODE; } } - -class Counters { - - public static final int TRANSACTIONS = 0; - public static final int OPERATIONS = 1; - - public Counters(){ - transactions = operations = -1; - } - - public int type; - public int transactions; - public int operations; - public int aborts; - public int tps; - public int ops; - public int aps; - public int epochsecs; - - public String toString(){ - return "[Counters"+ - " transactions="+transactions+ - " operations="+operations+ - " tps="+tps+ - " ops="+ops+ - " ]"; - } -} - -class NdbCluster extends Observable { - - NdbCluster(int node_types[], int num_nodes, int maxNodeId){ - - nodes = new Node[maxNodeId+1]; - maxCounters = new Counters(); - - for(int i = 0; i<maxNodeId; i++) - nodes[i] = null; - - for(int i = 1; i<num_nodes; i++) - switch(node_types[i]){ - case Node.NDB_NODE: - nodes[i] = new NdbNode(); - break; - case Node.API_NODE: - nodes[i] = new ApiNode(); - break; - case Node.MGM_NODE: - nodes[i] = new MgmNode(); - default: - } - } - - public int getNoOfNdbNodes(){ - if(nodes == null) - return 0; - int retVal = 0; - for(int i = 1; i<nodes.length; i++) - if(getNodeType(i) == Node.NDB_NODE) - retVal++; - return retVal; - } - - public int getNodeType(int nodeId){ - if(nodes == null || nodeId > nodes.length || nodes[nodeId] == null) - return Node.UNDEFINED; - return nodes[nodeId].getNodeType(); - } - - public Counters getCounters(int nodeId){ - if(nodes == null || nodeId > nodes.length || nodes[nodeId] == null || - nodes[nodeId].getNodeType() != Node.NDB_NODE) - return null; - return ((NdbNode)nodes[nodeId]).getCounters(); - } - - public void setCounters(int nodeId, Counters _c){ - if(nodes == null || nodeId > nodes.length || nodes[nodeId] == null) - return; - ((NdbNode)nodes[nodeId]).setCounters(_c); - - int maxSum = 0; - for(int i = 1; i<nodes.length; i++){ - Counters c = getCounters(i); - if(c != null){ - int sum = c.tps + c.ops + c.aps; - if(sum > maxSum){ - maxCounters = c; - maxSum = sum; - } - } - } - setChanged(); - notifyObservers(); - } - - public void setState(int nodeId, int nodeType, int nodeState){ - if(nodes == null || nodeId > nodes.length || nodes[nodeId] == null || - nodes[nodeId].getNodeType() != nodeType) - return; - - if(nodeType != Node.NDB_NODE) - return; - - ((NdbNode)nodes[nodeId]).setState(nodeState); - } - - public void setNoConnection(){ - for(int i = 1; i<nodes.length; i++){ - Counters c = getCounters(i); - if(c != null){ - setCounters(i, null); - } - } - } - - public Counters getMaxCounters(){ - return maxCounters; - } - - private Node nodes[]; - private Counters maxCounters; -} - -class CountersPanel extends JPanel implements Observer -{ - public CountersPanel(Dimension dim, NdbCluster _cluster, int maxInRow) - { - cluster = _cluster; - cluster.addObserver(this); - maxRow = maxInRow; - reSize(dim); - } - - private void showCounters(Graphics g, int node, int x, int y, boolean p) - { - Counters counters = cluster.getCounters(node); - - if (counters == null || p){ - // Mark processor as not available - g.setColor(Color.black); - g.fillRect(x, y, width, height); - } else { - int red = (counters.aps * height) / scale; - int green = (counters.tps * height) / scale; - int yellow = (counters.ops * height) / scale; - - System.out.println("tps="+counters.tps+" ops="+counters.ops+" scale="+scale+" green="+green+" yellow="+yellow); - - g.setColor(Color.white); - g.fillRect(x, y, width, height); - if (yellow + green + red <= height){ // Max 100% load - int yellow_scaled = yellow; - int green_scaled = green; - int red_scaled = red; - if (red_scaled > 0){ - g.setColor(Color.red); - g.fillRect(x, - height + y - red_scaled, - width, - red_scaled); - } - if (green_scaled > 0){ - g.setColor(Color.green); - g.fillRect(x, - height + y - red_scaled - green_scaled, - width, - green_scaled); - } - if (yellow_scaled > 0){ - g.setColor(Color.yellow); - g.fillRect(x, - height + y - red_scaled - green_scaled - yellow_scaled, - width, - yellow_scaled); - } - } - // Draw box - g.setColor(Color.black); - g.drawRect(x, y, width, height); - - float f = ((float)height)/((float)(lines+1)); - - for(int i = 0; i<lines; i++){ - int ytmp = (int)(y+height-(i+1)*f); - g.drawLine(x, ytmp, x+width, ytmp); - } - } - } - - public void paintComponent(Graphics g) - { - super.paintComponent(g); - - Counters maxCounters = cluster.getMaxCounters(); - final int sum = maxCounters.tps+maxCounters.ops+maxCounters.aps; - boolean skipDraw = false; - if(sum == 0){ - skipDraw = true; - } else { - lines = (sum / 1000) + 1; - scale = (lines+1) * 1000; - } - - int nodeId = 0; - int nodeNo = 0; - final int noOfNdbNodes = cluster.getNoOfNdbNodes(); - for(int row = 0; row <= noOfNdbNodes / maxRow; row++) { - int end = Math.min(noOfNdbNodes, (row + 1) * maxRow); - for (int pos = 0; (nodeNo < noOfNdbNodes) && (pos < maxRow); pos++){ - while(cluster.getNodeType(nodeId) != Node.NDB_NODE) - nodeId++; - showCounters(g, - nodeId, - xindent + (xgap + width) * pos, - yindent + row * (height + ygap), - skipDraw); - nodeNo++; - nodeId++; - } - } - } - - public void setWidth(int maxInRow) - { - maxRow = maxInRow; - } - - public void reSize(Dimension dim) - { - final int noOfNdbNodes = cluster.getNoOfNdbNodes(); - - // System.out.println(dim); - int noRows = (int) Math.ceil((double) noOfNdbNodes / (double) maxRow); - xgap = (noOfNdbNodes > 1) ? Math.max(2, dim.width / 50) : 0; - ygap = (noOfNdbNodes > 1) ? Math.max(2, dim.height / 20) : 0; - xindent = 10; - yindent = 10; - int heightOfScroll = 20; - Insets insets = getInsets(); - width = (dim.width - (insets.left + insets.right) - 2*xindent + xgap)/maxRow - xgap; - height = (dim.height - (insets.top + insets.bottom) - 2*yindent + ygap - heightOfScroll)/noRows - ygap; - } - - - public void update(Observable o, Object arg){ - repaint(); - } - - private int width, height, maxRow, xgap, ygap, xindent, yindent; - private int scale; - private int lines; - private NdbCluster cluster; -} - -class CountersFrame extends JFrame - implements ComponentListener, AdjustmentListener -{ - - public CountersFrame(NdbCluster cluster) - { - setTitle("CountersViewer"); - - final int noOfNdbNodes = cluster.getNoOfNdbNodes(); - - processorWidth = Math.min(noOfNdbNodes, 10); - setSize(Math.max(50, processorWidth*20), - Math.max(100, 200*noOfNdbNodes/processorWidth)); - JPanel p = new JPanel(); - addComponentListener(this); - p.addComponentListener(this); - getContentPane().add(p, "Center"); - myPanel = new CountersPanel(getContentPane().getSize(), - cluster, - processorWidth); - getContentPane().add(myPanel, "Center"); - JPanel labelAndScroll = new JPanel(); - labelAndScroll.setLayout(new GridLayout (1, 2)); - myWidthLabel = new JLabel("Width: " + processorWidth); - labelAndScroll.add(myWidthLabel); - myWidthScroll = new JScrollBar(Adjustable.HORIZONTAL, - Math.min(noOfNdbNodes, 10), 0, 1, - noOfNdbNodes); - myWidthScroll.addAdjustmentListener(this); - labelAndScroll.add(myWidthScroll); - if (noOfNdbNodes > 1) - getContentPane().add(labelAndScroll, "South"); - } - - public void componentHidden(ComponentEvent e) { - } - - public void componentMoved(ComponentEvent e) { - } - - public void componentResized(ComponentEvent e) { - myPanel.reSize(getContentPane().getSize()); - repaint(); - } - - public void componentShown(ComponentEvent e) { - } - - public void adjustmentValueChanged(AdjustmentEvent evt) - { - myPanel.setWidth(myWidthScroll.getValue()); - myPanel.reSize(getContentPane().getSize()); - myWidthLabel.setText("Width: " + myWidthScroll.getValue()); - repaint(); - } - - private JScrollBar myWidthScroll; - private JLabel myWidthLabel; - private CountersPanel myPanel; - private int processorWidth = 10; -} - -class CountersConnection { - - public CountersConnection(String host, int port){ - this.host = host; - this.port = port; - } - - public boolean connect(){ - if(br == null){ - try { - InetAddress target = InetAddress.getByName(host); - sock = new Socket(target, port); - - br = new BufferedReader(new InputStreamReader - (sock.getInputStream())); - } catch (Exception e){ - System.out.println("connect: " + e); - } - } - - if (br == null) - return false; - return true; - } - - public void disconnect(){ - try { - sock.close(); - } catch (Exception e){ - System.out.println("disconnect: " + e); - } - sock = null; - br = null; - } - - public boolean readCounters(NdbCluster cluster) { - if(!connect()){ - cluster.setNoConnection(); - return false; - } - String str = null; - - try { - str = br.readLine(); - } catch (Exception e){ - System.out.println("readLine: " + e); - } - if(str == null){ - disconnect(); - return false; - } - StringTokenizer st = new StringTokenizer(str, " "); - - int nodeId = 0; - Counters c = new Counters(); - - while(st.hasMoreTokens()){ - String tmp = st.nextToken(); - int ind = 0; - if(tmp.startsWith("nodeid=")){ - nodeId = Integer.valueOf(tmp.substring(7)).intValue(); - } else if(tmp.startsWith("trans=")){ - c.transactions = Integer.valueOf(tmp.substring(6)).intValue(); - c.type = Counters.TRANSACTIONS; - } else if(tmp.startsWith("abort=")){ - c.aborts = Integer.valueOf(tmp.substring(6)).intValue(); - c.type = Counters.TRANSACTIONS; - } else if(tmp.startsWith("epochsecs=")){ - c.epochsecs = Integer.valueOf(tmp.substring(11)).intValue(); - } else if(tmp.startsWith("operations=")){ - c.operations = Integer.valueOf(tmp.substring(11)).intValue(); - c.type = Counters.OPERATIONS; - } - } - - if(nodeId != 0) - cluster.setCounters(nodeId, c); - - return true; - } - - private Socket sock; - private BufferedReader br; - private String host; - private int port; -} - -class MgmConnection { - - public MgmConnection(String host, int port){ - this.host = host; - this.port = port; - } - - public NdbCluster getClusterInfo(){ - NdbCluster cluster = null; - if(!connect()) - return cluster; - - out.println("get info cluster"); - String str = null; - try { - str = br.readLine(); - if(str.startsWith("GET INFO 0")){ - StringTokenizer st = new StringTokenizer - (str.substring(11)); - int nodes[] = new int[255]; - - int type = Node.UNDEFINED; - int num_nodes = 0; - int maxNodeId = 0; - while(st.hasMoreTokens()){ - String tmp = st.nextToken(); - final int t = Node.getNodeType(tmp); - if(t != Node.UNDEFINED) - type = t; - - int nodeId = 0; - try { - nodeId = Integer.parseInt(tmp); - } catch (Exception e) {} - if(nodeId != 0){ - num_nodes ++; - nodes[nodeId] = type; - if(nodeId > maxNodeId) - maxNodeId = nodeId; - } - } - cluster = new NdbCluster(nodes, num_nodes, - maxNodeId); - } - - } catch(Exception e){ - System.out.println("readLine: "+e); - } - return cluster; - } - - public boolean connect(){ - if(br == null || out == null){ - try { - InetAddress target = InetAddress.getByName(host); - sock = new Socket(target, port); - - br = new BufferedReader(new InputStreamReader - (sock.getInputStream())); - out = new PrintWriter(sock.getOutputStream(), true); - } catch (Exception e){ - System.out.println("connect: " + e); - } - } - - if (br == null || out == null) - return false; - return true; - } - - public void disconnect(){ - try { - sock.close(); - } catch (Exception e){ - System.out.println("disconnect: " + e); - } - sock = null; - br = null; - out = null; - } - - public boolean readStatus(NdbCluster cluster){ - - if(!connect()){ - cluster.setNoConnection(); - return false; - } - - String str = null; - try { - out.println("get status"); - str = br.readLine(); - } catch (Exception e){ - System.out.println("readLine: " + e); - } - if(str == null){ - disconnect(); - return false; - } - - if(!str.startsWith("GET STATUS")){ - disconnect(); - return false; - } - - int nodes = 0; - try { - nodes = Integer.parseInt(str.substring(11)); - } catch(Exception e){ - System.out.println("parseInt "+e); - } - if(nodes == 0){ - disconnect(); - return false; - } - - try { - for(; nodes > 0 ; nodes --){ - str = br.readLine(); - StringTokenizer st = new StringTokenizer(str); - - String s_nodeId = st.nextToken(); - final int nodeId = Integer.parseInt(s_nodeId); - - String s_type = st.nextToken(); - String s_state = st.nextToken(); - String s_phase = st.nextToken(); - int type = Node.getNodeType(s_type); - int state = NdbNode.getNodeState(s_state); - - cluster.setState(nodeId, type, state); - } - } catch (Exception e){ - disconnect(); - return false; - } - - return true; - } - - public int getStatisticsPort(){ - if(!connect()) - return -1; - - String str = null; - try { - out.println("stat port"); - str = br.readLine(); - } catch (Exception e){ - System.out.println("readLine: " + e); - } - if(str == null){ - disconnect(); - return -1; - } - - if(!str.startsWith("STAT PORT 0")){ - disconnect(); - return -1; - } - - try { - return Integer.parseInt(str.substring(12)); - } catch (Exception e){ - System.out.println("parseInt "+e); - } - return -1; - } - - private Socket sock; - private BufferedReader br; - private PrintWriter out; - private String host; - private int port; -} - -class CounterViewer { - - public static void usage(){ - System.out.println("java CounterViewer <mgm host> <mgm port>"); - } - - public static void main(String args[]){ - try { - String host = args[0]; - int port = Integer.parseInt(args[1]); - new CounterViewer(host, port).run(); - return; - } catch (Exception e){ - } - usage(); - } - - MgmConnection mgmConnection; - CountersConnection countersConnection; - - NdbCluster cluster; - boolean ok; - - CounterViewer(String host, int port){ - ok = false; - - mgmConnection = new MgmConnection(host, port); - int statPort = mgmConnection.getStatisticsPort(); - if(statPort < 0) - return; - - countersConnection = new CountersConnection(host, statPort); - cluster = mgmConnection.getClusterInfo(); - - CountersFrame f = new CountersFrame(cluster); - f.setSize (300, 200); - f.show(); - - ok = true; - } - - void run(){ - while(ok){ - mgmConnection.readStatus(cluster); - countersConnection.readCounters(cluster); - } - } -} - |